[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/21233] Internal error, /usr/bin/ld: BFD (GNU Binutils for

From: address@hidden
Subject: [Bug binutils/21233] Internal error, /usr/bin/ld: BFD (GNU Binutils for Debian) 2.28 assertion fail ../../bfd/elfxx-mips.c:3861
Date: Tue, 21 Mar 2017 12:11:42 +0000


--- Comment #9 from Maciej W. Rozycki <address@hidden> ---
Created attachment 9925
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9925&action=edit
WIP bug fix

This is indeed another incorrectly handled scenario that would have
qualified under PR ld/20828.

Here we have a symbol which has been forced local, however it has
retained its GGA_NORMAL GOT assignment.  Consequently it is considered
external by the MIPS backend and assigned to the global part of both
GOT and the dynamic symbol table.  However the generic ELF linker has
already included it in the local symbol count and as a result a
mismatch happens in the MIPS backend between the number of symbols
expected and actually assigned to the non-GOT-mapped and GOT-mapped
parts of the dynamic symbol table, which is caught by the:

BFD_ASSERT (hsd.max_non_got_dynindx <= hsd.min_got_dynindx)

assertion, saving the linker's skin as with this assertion removed
a broken binary (with the offending symbol missing due to a wrong
dynamic symbol index assignment) would be produced:

Symbol table '.dynsym' contains 10 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
     2: 00000001200104f0     0 NOTYPE  GLOBAL DEFAULT    7 _fdata
     3: 0000000000000001     0 SECTION GLOBAL DEFAULT  ABS _DYNAMIC_LINKING
     4: 00000001200004db     0 NOTYPE  GLOBAL DEFAULT    6 _ftext
     5: 00000001200104f0     0 OBJECT  GLOBAL DEFAULT    7 __RLD_MAP
     6: 0000000120010518     0 NOTYPE  GLOBAL DEFAULT    8 __bss_start
     7: 0000000120010518     0 NOTYPE  GLOBAL DEFAULT    8 _edata
     8: 0000000120010518     0 NOTYPE  GLOBAL DEFAULT    8 _end
     9: 0000000120010518     0 NOTYPE  GLOBAL DEFAULT    8 _fbss

-- notice the bad entry at 1, where `alpha' should be if considered

Here is another similarity though to what has already been covered in
PR ld/20828 in that I think with `alpha' chosen with `-u' (or, for that
matter `--require-defined') or the equivalent EXTERN linker script
command the symbol shouldn't have been garbage-collected in the first
place, as this defeats the purpose of these constructs.  So I believe
that by these contstructs' definition symbols thus created have to be
retained and therefore remain external.

That has led me to the patch proposed, which obviously fixes James's
reduced test case.  Unfortunately I am unable to reproduce the libgomp's
configuration failure and trying to build ghc is out of question too,
so I do not know if they are cases of `-u'/`--require-defined'/EXTERN
or maybe there is yet another way for forced local GGA_NORMAL symbols to
make it through linking.

So, Gianfranco and Alastair, would you please try the patch proposed
and see if it fixes the issue for you?  If so, then I'll proceed with
creating suitable linker test suite cases and following the usual
procedure to apply the fix to binutils sources, or at least trunk where
it also triggers.

For 2.28, like with PR ld/20828, I may instead choose to limit the
solution to the MIPS backend, and only use a workaround where forced
local symbols are made GGA_NONE, which I'm leaning towards doing anyway.

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]