This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77285] [5/6/7 Regression] extern thread_local linkage
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Aug 2016 10:22:24 +0000
- Subject: [Bug c++/77285] [5/6/7 Regression] extern thread_local linkage
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-77285-4@http.gcc.gnu.org/bugzilla/>
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