https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81142
--- Comment #14 from Harald Welte <laforge at gnumonks dot org> --- Hi Tomas, thanks a lot for your suggested workaround. Indeed -mtls-dialect=gnu2 seems to be working also in our case. -fPIE as suggested earlier is not an option as the __thread variables are used in a shared library (libosmocore from http://git.osmocom.org/libosmocore/ in our case). Originally the reproducer also built a separate .so file, but it turned out this is not needed, i.e. even when stattically linking a -fPIC built .o file into the executable the problem can be seen very clearly.