[PATCH] D154397: [Driver] Default to -ftls-model=initial-exec on SerenityOS

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 13:35:04 PDT 2023


MaskRay added a comment.

I don't think this belongs to the upstream, either. Note: musl's TLS implementation is very clean and  may be a good reference.

https://maskray.me/blog/2021-02-14-all-about-thread-local-storage

> glibc ld.so reserves some space in static TLS blocks and allows dlopen on such a shared object if its TLS size is small. There could be an obscure reason for using such an attribute: general dynamic and local dynamic TLS models are not async-signal-safe in glibc. However, other libc implementations may not reserve additional TLS space for dlopen'ed initial-exec shared objects, e.g. musl will error.

glibc's model makes it very error-prone, even if dlopen TLS is supported to some extent.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154397/new/

https://reviews.llvm.org/D154397



More information about the cfe-commits mailing list