Subject: reference to ___tls_get_addr
To: None <tech-toolchain@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-toolchain
Date: 04/25/2007 19:57:41
Hi,
I'm trying to compile code that use threads; and link fails with an
undefined reference to ___tls_get_addr:
gcc -O2 -I/usr/pkg/include/python2.4 -I/usr/include -I/usr/pkg/include -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -Werror -Wp,-MD,.xenstored.d -I../../tools/libxc -I. -L/usr/pkg/lib/python2.4/config -Wl,-R/usr/pkg/lib/python2.4/config -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L../../tools/libxc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_netbsd.o -lxenctrl -o xenstored
../../tools/libxc/libxenctrl.so: undefined reference to `___tls_get_addr'
I'm almost sure that it's gcc which generates this reference, I didn't find
it in any source. It comes from a file built like that:
gcc -I/usr/pkg/include/python2.4 -I/usr/include -I/usr/pkg/include -DPIC -O2 -I/usr/pkg/include/python2.4 -I/usr/include -I/usr/pkg/include -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -Werror -Wmissing-prototypes -fno-strict-aliasing -I. -Wp,-MD,.build.d -m32 -march=i686 -DNDEBUG -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -Werror -Wmissing-prototypes -fno-strict-aliasing -I. -Wp,-MD,.xc_private.opic.d -fPIC -c -o xc_private.opic xc_private.c
But I suspect this is because there is:
static __thread xc_error last_error = { XC_ERROR_NONE, ""};
static __thread char errbuf[32];
in xc_private.c
is there a way to fix/workaroud this ? This is NetBSD 4.0_BETA2
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
NetBSD: 26 ans d'experience feront toujours la difference
--