Created attachment 8739 [details] test case seen with trunk 20151022 on i686-linux-gnu $ sh -x link.sh + ld -L. --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu --as-needed -shared -z relro -o liblttng-ust.so.0.0.0 crti.o crtbeginS.o --whole-archive libustsnprintf.a liblttng-ust-comm.a liblttng-ust-runtime.a liblttng-ust-support.a --no-whole-archive -ldl liblttng-ust-tracepoint.so -lrt -lurcu-bp -lurcu-cds -lpthread -Bsymbolic-functions -z relro -soname liblttng-ust.so.0 -lssp_nonshared -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtendS.o crtn.o liblttng-ust-support.a(libringbuffer_la-shm.o): In function `_shm_object_table_alloc_shm': /home/packages/tmp/x/ust-2.6.3/libringbuffer/shm.c:150: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp' ld: BFD (GNU Binutils for Ubuntu) 2.25.51.20151022 assertion fail ../../bfd/elf32-i386.c:5245
Please provide prepossessed lttng-ust-baddr.c in liblttng-ust-runtime.a.
(In reply to H.J. Lu from comment #1) > Please provide prepossessed lttng-ust-baddr.c in liblttng-ust-runtime.a. Never mind. I know what went wrong.
[hjl@gnu-tools-1 pr19161]$ cat x.c extern int a; extern int __start_my_section __attribute__((weak,visibility("hidden"))); int dump1() { int* ap = &__start_my_section; return ap[0]; } [hjl@gnu-tools-1 pr19161]$ cat y.c extern int a[]; extern int __start_my_section __attribute__((weak,visibility("hidden"))); int dump2() { int* ap = &__start_my_section; return ap[0]; } [hjl@gnu-tools-1 pr19161]$ cat z.c int __attribute__((section("my_section"))) a[2] = {0x1234, 0x5678}; extern int __start_my_section __attribute__((weak,visibility("hidden"))); int dump3() { int* ap = &__start_my_section; return ap[0]; } [hjl@gnu-tools-1 pr19161]$ gcc -fPIC -O2 -c x.c y.c z.c -m32 [hjl@gnu-tools-1 pr19161]$ ld -m elf_i386 x.o y.o z.o -shared ld: BFD (Linux/GNU Binutils) 2.25.51.0.4.20151022 assertion fail /net/gnu-6/export/linux/src/binutils/binutils/bfd/elf32-i386.c:5281 [hjl@gnu-tools-1 pr19161]$
Created attachment 8740 [details] A patch Please try this.
this patch allows the package to build.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a6af384b19c63bab4a1803c09592c5b5bd8674c2 commit a6af384b19c63bab4a1803c09592c5b5bd8674c2 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Oct 26 06:10:23 2015 -0700 Properly convert address load of __start_XXX/__stop_XXX Since __start_XXX and __stop_XXX symbols aren't defined when address load is being converted, we need to check if there is an XXX output section to get their section and value. This patch adds a new function, bfd_link_get_defined_symbol, to search for the XXX output section to check if __start_XXX and __stop_XXX symbols are defined. bfd/ PR ld/19171 * elf32-i386.c (elf_i386_convert_load): Call bfd_link_get_defined_symbol to check if a symbol is defined. * elf64-x86-64.c (elf_x86_64_convert_load): Call bfd_link_get_defined_symbol to get defined symbol section and value. * linker.c (bfd_link_get_defined_symbol): New function. * bfd-in2.h: Regenerated. ld/testsuite/ PR ld/19171 * ld-i386/lea1.s: Add tests for address load of __start_XXX and __stop_XXX. * ld-i386/mov1.s: Likewise. * ld-x86-64/lea1.s: Likewise. * ld-x86-64/mov1.s: Likewise. * ld-i386/lea1a.d: Updated. * ld-i386/lea1b.d: Likewise. * ld-i386/lea1c.d: Likewise. * ld-i386/mov1a.d: Likewise. * ld-i386/mov1b.d: Likewise. * ld-x86-64/lea1a.d: Likewise. * ld-x86-64/lea1b.d: Likewise. * ld-x86-64/lea1c.d: Likewise. * ld-x86-64/lea1d.d: Likewise. * ld-x86-64/lea1e.d: Likewise. * ld-x86-64/lea1f.d: Likewise. * ld-x86-64/mov1a.d: Likewise. * ld-x86-64/mov1b.d: Likewise. * ld-x86-64/mov1c.d: Likewise. * ld-x86-64/mov1d.d: Likewise.
Fixed.