Building on Mac with --enable-tls
Wed Mar 18 23:53:10 GMT 2020
Jonathan Wakely <firstname.lastname@example.org> wrote:
> On Wed, 18 Mar 2020 at 19:15, Tom N <email@example.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: *** [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
>> but then I get synchronization problems in my code which uses
>> std::unique_lock<std::mutex> (namely it seems the synchronization isn't
> 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
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).
More information about the Gcc-help