Created attachment 8749 [details] test case this is still seen with the fix (as checked in) for PR ld/19171. ld --eh-frame-hdr -m elf_i386 --hash-style=gnu --as-needed -shared -z relro -o fwupdate.so --warn-common --no-undefined --fatal-warnings -Bsymbolic --build-id=sha1 crt0-efi-ia32.o fwupdate.o libefi.a libgnuefi.a libgcc.a -T elf_ia32_efi.lds ld: BFD (GNU Binutils for Ubuntu) 2.25.51.20151022 assertion fail ../../bfd/elf32-i386.c:5245 ld: BFD (GNU Binutils for Ubuntu) 2.25.51.20151022 assertion fail ../../bfd/elf32-i386.c:5245
code taken from https://github.com/rhinstaller/fwupdate
[hjl@gnu-6 pr19175]$ cat 19175.s .globl _start .type _start, @function _start: movl _text@GOT(%ecx), %eax .size _start, .-_start [hjl@gnu-6 pr19175]$ cat 19175.t EXTERN(_start) ENTRY(_start) SECTIONS { .text : { _text = .; *(.text*) } } [hjl@gnu-6 pr19175]$ gcc -c 19175.s -m32 [hjl@gnu-6 pr19175]$ ./tst/ld -T 19175.t -Bsymbolic -shared 19175.o -melf_i386 ./tst/ld: BFD (GNU Binutils) 2.25.51.20151026 assertion fail /export/gnu/import/git/sources/binutils-gdb/bfd/elf32-i386.c:5245 [hjl@gnu-6 pr19175]$
Fixed.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7b7e7f1da28585cfa49cbced50dbbd75a143cd20 commit 7b7e7f1da28585cfa49cbced50dbbd75a143cd20 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Oct 26 16:32:34 2015 -0700 Check symbol defined by assignment in linker script Symbol symbol defined by an assignment in a linker script has type bfd_link_hash_new. elf_i386_convert_load and elf_x86_64_convert_load should check bfd_link_hash_new to see if a symbol is defined by a linker script. bfd/ PR ld/19175 * elf32-i386.c (elf_i386_convert_load): Check bfd_link_hash_new instead of calling bfd_link_get_defined_symbol. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. Skip relocation overflow for bfd_link_hash_new. * linker.c (bfd_link_get_defined_symbol): Removed. * bfd-in2.h: Regenerated. ld/testsuite/ PR ld/19175 * ld-i386/i386.exp: Run pr19175. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr19175.d: New file. * ld-i386/pr19175.s: Likewise. * ld-i386/pr19175.t: Likewise. * ld-x86-64/pr19175.d: Likewise. * ld-x86-64/pr19175.s: Likewise. * ld-x86-64/pr19175.t: Likewise.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=321df0656c7557004a232b4ac3d8c354a59de364 commit 321df0656c7557004a232b4ac3d8c354a59de364 Author: Alan Modra <amodra@gmail.com> Date: Tue Oct 27 12:01:55 2015 +1030 Evaluate __start_* and __stop_* symbol PROVIDE expressions early Makes these symbols defined before bfd_elf_size_dynamic_sections, to avoid horrible hacks elsewhere. The exp_fold_tree undefweak change is necessary to define undefweak symbols early too. The comment was wrong. PROVIDE in fact defines undefweak symbols, via bfd_elf_record_link_assignment. PR ld/19175 * ldlang.c (lang_insert_orphan): Evaluate __start_* and __stop_* symbol PROVIDE expressions. * ldexp.c (exp_fold_tree_1 <etree_provide>): Define undefweak references.