This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
".symver" and "-flto" interaction resulting in link failure with undefined references
- From: John Mesmon <jmesmon at gmail dot com>
- To: binutils at sourceware dot org
- Date: Fri, 16 Mar 2012 02:37:20 -0500
- Subject: ".symver" and "-flto" interaction resulting in link failure with undefined references
First off: not sure if this belongs here or on gcc's list, so I've
sent it here first.
I've been trying to build numactl
(http://oss.sgi.com/projects/libnuma/,
ftp://oss.sgi.com/www/projects/libnuma/download/numactl-2.0.8-rc4.tar.gz)
with CFLAGS="-flto". This results in undefined references to symbols
on link (output follows):
cc -flto numactl.o util.o shm.o bitops.o libnuma.so -o numactl
/tmp/cckkT9OH.ltrans0.ltrans.o: In function `main':
cckkT9OH.ltrans0.o:(.text+0x11c): undefined reference to
`numa_get_run_node_mask'
cckkT9OH.ltrans0.o:(.text+0x130): undefined reference to
`numa_get_interleave_mask'
cckkT9OH.ltrans0.o:(.text+0x139): undefined reference to `numa_get_membind'
cckkT9OH.ltrans0.o:(.text+0x5cc): undefined reference to `numa_node_to_cpus'
cckkT9OH.ltrans0.o:(.text+0x90e): undefined reference to
`numa_interleave_memory'
cckkT9OH.ltrans0.o:(.text+0x91c): undefined reference to
`numa_set_interleave_mask'
cckkT9OH.ltrans0.o:(.text+0x9a5): undefined reference to `numa_run_on_node_mask'
cckkT9OH.ltrans0.o:(.text+0xa2e): undefined reference to
`numa_sched_setaffinity'
cckkT9OH.ltrans0.o:(.text+0xad1): undefined reference to
`numa_tonodemask_memory'
cckkT9OH.ltrans0.o:(.text+0xadf): undefined reference to `numa_set_membind'
/tmp/cckkT9OH.ltrans0.ltrans.o: In function `show_physcpubind.2081':
cckkT9OH.ltrans0.o:(.text+0x1c55): undefined reference to
`numa_sched_getaffinity'
collect2: ld returned 1 exit status
make: *** [numactl] Error 1
Looking at (for example) the definition of numa_set_membind:
__asm__(".symver numa_set_membind_v1,numa_set_membind@libnuma_1.1");
...
__asm__(".symver numa_set_membind_v2,numa_set_membind@@libnuma_1.2");
The others are similarly defined via symvers. Additionally note
libnuma.so is passed on the link command line directly (not via
'-lnuma').
Any ideas? (Thanks)
--
Cody Schafer