https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111322
Bug ID: 111322
Summary: non-canonical reference to canonical protected
function `__pthread_key_create'
Product: gcc
Version: 13.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcc
Assignee: unassigned at gcc dot gnu.org
Reporter: judge.packham at gmail dot com
Target Milestone: ---
Created attachment 55849
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55849&action=edit
Exclude UCLIBC from GLIBC thread check
With binutils-2.40, uClibc-ng-1.0.43 and gcc-13.2.0 the following link error is
seen for some C++ code (ISL in this case).
ld.bfd: isl_test_cpp17.o: non-canonical reference to canonical protected
function `__pthread_key_create' in
x86_64-multilib-linux-uclibc/sysroot/lib64/libc.so.1
ld.bfd: failed to set dynamic section sizes: bad value
The problem appears to be that GCC uses the presence of __pthread_key_create()
to detect the use of pthreads with GNU libc but because uclibc-ng also defines
__GLIBC__ it ends up using the same symbol which for uclibc-ng is marked
protected. It looks as though the intended symbol should be pthread_cancel() as
for other libcs.
The attached patch is my attempt to resolve the issue.