Cleanly setting C compiler options when building RTS

Alp Mestanogullari alp at well-typed.com
Thu Jul 11 09:55:00 UTC 2019


That's indeed one Hadrian solution. An alternative one (requires 
'master' from yesterday) is:

$ hadrian/build.sh --flavour=... "stage1.rts.cc.c.opts += 
-fsanitize=address -fsanitize=undefined"

Note that I'm not quite sure who between GHC and the C compiler gets 
invoked to build the RTS. If it's GHC, then you'll need to replace 
'builder Cc' in Matthew's solution with 'builder (Ghc CompileCWithGhc)', 
or with the key-value style approach:

$ hadrian/build.sh --flavour=... "stage1.rts.ghc.c.opts += 
-fsanitize=address -fsanitize=undefined"

You can find more about how both of those settings mechanisms work here: 
https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/doc/user-settings.md

... once GitLab works again. :-)

Until then: 
https://github.com/ghc/ghc/blob/master/hadrian/doc/user-settings.md

On 11/07/2019 11:49, Matthew Pickering wrote:
> Hi Siddharth,
>
> The correct way is to create a custom flavour with something like the
> following in.
>
> grts = quickFlavour { name = "grts", args = args quickFlavour <>
> (builder Cc ? package rts ? arg "-g3" <> arg "-O0") }
>
> Cheers,
>
> Matt
>
> On Thu, Jul 11, 2019 at 10:20 AM Siddharth Bhat <siddu.druid at gmail.com> wrote:
>> Hello all,
>>
>> I was interested in building the GHC RTS with GCC's AddressSanitizer and Ubsan enabled.
>>
>> What I want to do very specifically is to pass "-fsanitize=address -fsanitize=undefined" when compiling the RTS.
>>
>> What's the "correct" way to set this up in the build system? Is there a configure flag? Do I need to change the Shake script?
>> Thanks,
>> ~Siddharth
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

-- 
Alp Mestanogullari, Haskell Consultant
Well-Typed LLP, https://www.well-typed.com/

Registered in England and Wales, OC335890
118 Wymering Mansions, Wymering Road, London, W9 2NF, England



More information about the ghc-devs mailing list