https://sourceware.org/bugzilla/show_bug.cgi?id=27624
Bug ID: 27624 Summary: OpenRisc BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377 Product: binutils Version: 2.36.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: giulio.benetti at micronovasrl dot com Target Milestone: --- this bug still shows up with binutils 2.36.1 like: /home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377 /home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377 /home/giuliobenetti/git/upstream/or1k-binutils-2.36.1/host/lib/gcc/or1k-buildroot-linux-uclibc/9.3.0/../../../../or1k-buildroot-linux-uclibc/bin/ld: BFD (GNU Binutils) 2.36.1 assertion fail elf32-or1k.c:2377 collect2: error: ld returned 1 exit status To reproduce it: # git clone git://git.busybox.net/buildroot # wget https://git.busybox.net/buildroot-test/tree/utils/br-reproduce-build - modify BASE_GIT=... with your buildroot path in br-reproduce-build then: # chmod a+x br-reproduce-build # ./br-reproduce-build 6c87be004adf03955c832be72c0c59749f311f71 And I still can't find a workaround. By mistake I've confused this bug with bug 21464: https://sourceware.org/bugzilla/show_bug.cgi?id=21464 And this bug is fixed by Stafford Horne suggestion: ''' diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 38406eda3d6..f1cfed230a1 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -2566,11 +2566,10 @@ or1k_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (h->type == STT_FUNC || h->needs_plt) { - if (! bfd_link_pic (info) - && !h->def_dynamic - && !h->ref_dynamic - && h->root.type != bfd_link_hash_undefweak - && h->root.type != bfd_link_hash_undefined) + if (h->plt.refcount <= 0 + || (SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak))) { /* This case can occur if we saw a PLT reloc in an input file, but the symbol was never referred to by a dynamic -- ''' -- You are receiving this mail because: You are on the CC list for the bug.