https://sourceware.org/bugzilla/show_bug.cgi?id=21464
--- Comment #6 from Stafford Horne <shorne at gmail dot com> --- On Wed, Mar 17, 2021 at 09:31:59PM +0000, giulio.benetti at micronovasrl dot com wrote: > https://sourceware.org/bugzilla/show_bug.cgi?id=21464 > > --- Comment #5 from Giulio Benetti <giulio.benetti at micronovasrl dot com> > --- > Hi Nick, > > 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. > > Do you have any idea to fix this? Hello, Sorry I missed the first mail. At first look I don't know how to fix this. I will have a look, I spent some time last year fixing many bugs with the or1k linker code pointed out by glibc testing. Those fixes are all upstream now. I didn't see this one before. I will look at it. For my reference: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=bfd/elf32-or1k.c;h=65938e51378d2c68b60769ba7d6f5443f18bea5d;hb=HEAD#l2377 2347 static bfd_boolean 2348 or1k_elf_finish_dynamic_symbol (bfd *output_bfd, 2349 struct bfd_link_info *info, 2350 struct elf_link_hash_entry *h, 2351 Elf_Internal_Sym *sym) 2352 { 2353 struct elf_or1k_link_hash_table *htab; 2354 bfd_byte *loc; 2355 2356 htab = or1k_elf_hash_table (info); 2357 if (htab == NULL) 2358 return FALSE; 2359 2360 if (h->plt.offset != (bfd_vma) -1) 2361 { 2362 unsigned int plt0, plt1, plt2; 2363 asection *splt; 2364 asection *sgot; 2365 asection *srela; 2366 bfd_vma plt_base_addr; 2367 bfd_vma plt_addr; 2368 bfd_vma plt_index; 2369 bfd_vma plt_reloc; 2370 bfd_vma got_base_addr; 2371 bfd_vma got_offset; 2372 bfd_vma got_addr; 2373 Elf_Internal_Rela rela; 2374 2375 /* This symbol has an entry in the procedure linkage table. Set 2376 it up. */ 2377 BFD_ASSERT (h->dynindx != -1); My Docs: http://stffrdhrn.github.io/software/toolchain/openrisc/2020/07/21/relocs_tls_impl.html#phase-4---finishing-up-finish_dynamic_symbol--finish_dynamic_sections Notes: https://gist.github.com/stffrdhrn/d59e1d082430a48643b301c13f6f4d24 bfd/elflink.c bfd_elf_gc_common_final_link - bfd_elf_gc_common_finalize_got_offsets - local_got.offsets setup bfd_elf_final_link() - elf_link_input_bfd - or1k_elf_relocate_section - BFD API, P3 main worker writes to sections - travers(elf_link_output_extsym) - called 2 times - or1k_elf_finish_dynamic_symbol - BFD API, P4 for a symbol write to .plt, .got + .got.rela - or1k_elf_finish_dynamic_sections - BFD API, P4 add final things to .plt, etc -Stafford -- You are receiving this mail because: You are on the CC list for the bug.