This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77285] [5/6/7 Regression] extern thread_local linkage


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77285

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Without the header:

cat > a.cpp <<EOF
#include <string>
thread_local std::string gFeelingLucky;
EOF

cat > main.cpp <<EOF
#include <string>
extern thread_local std::string gFeelingLucky;

int main() {
 return gFeelingLucky.length();
}
EOF

g++11 main.cpp a.cpp -o main
/tmp/ccpboHS6.o: In function `TLS wrapper function for gFeelingLucky':
main.cpp:(.text._ZTW13gFeelingLucky[_ZTW13gFeelingLucky]+0x5): undefined
reference to `TLS init function for gFeelingLucky'
collect2: error: ld returned 1 exit status

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]