Building on Mac with --enable-tls

Iain Sandoe idsandoe@googlemail.com
Wed Mar 18 23:53:10 GMT 2020


Jonathan Wakely <jwakely.gcc@gmail.com> wrote:

> On Wed, 18 Mar 2020 at 19:15, Tom N <nospam@codesniffer.com> wrote:
>> I'm trying to build GCC from source on Mac (darwin) and keep getting  
>> this error when --enable-tls is specified:
>>
>>
>> /var/folders/cq/wx4ff_gd0xncqh9qnbzmt2w40000gp/T//ccS0vBm1.s:9:2: error:  
>> unsupported symbol modifier
>> in relocation
>> leaq __ZN3GTM12_gtm_thr_tlsE@tlsgd(%rip), %rdi
>> ^
>> make[5]: *** [alloc_cpp.lo] Error 1
>>
>>
>> If I either omit --enable-tls or specify --disable-tls the build succeeds,
>
> I would expect the default to be correct for the target i.e.
> --disable-tls. If enabling it worked correctly, it would be the
> default.
>
>> but then I get synchronization problems in my code which uses  
>> std::unique_lock<std::mutex>  (namely it seems the synchronization isn't  
>> performed).
>
> That makes no sense, neither std::mutex nor std::unique_lock uses TLS.

Darwin uses emulatedTLS on all versions (powerpc, i686, x86_64) the correct  
default (to use emulatedTLS) is selected without requiring any additional  
configure options.  Selecting --enable-tls will undoubtedly produce an  
invalid configuration.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52268  is an enhancement PR to  
add native TLS for 10.7+ (but that would still not work on earlier  
versions, of course).

thanks
Iain




More information about the Gcc-help mailing list