[RFA:] elflink.h: Don't set linker-script symbols to STT_OBJECT (BSF_OBJECT).

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Mon Mar 18 22:21:00 GMT 2002


Symbols assigned in linker scripts are default set to "object"
type (bfd BSF_OBJECT, ELF STT_OBJECT) rather than stick to
untyped (ELF STT_NOTYPE) as would have happened with a symbol
from an input file.  I can't see a reason to do that.  It breaks
disassembly when one of those symbols has the same value and
collates before the "real" symbol (collation being the fallback
for the disassembler for chosing the symbol).  It will then only
dump hex, not disassembly.  I see nothing wrong with what the
disassembler does; it's the linker that shouldn't assume types
for symbols defined in linker scripts, where no type was
specified.  (There might be a separate issue about the lack of a
feature to set symbol types in linker scripts...)

The following causes no regressions for i686-pc-linux-gnu
(native), cris-axis-linux-gnu (cross) and sh64-*-elf (cross).

There are "failures" in the mmix-knuth-mmixware (cross) results,
exactly matching the changed symbol type for symbols from the
linker script.  I'll tweak those of course.

bfd:
	* elflink.h (NAME(bfd_elf,record_link_assignment)): Don't set
	STT_NOTYPE symbols to STT_OBJECT.

Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.151
diff -c -p -r1.151 elflink.h
*** elflink.h	2002/03/14 19:06:16	1.151
--- elflink.h	2002/03/19 05:23:18
*************** NAME(bfd_elf,record_link_assignment) (ou
*** 2795,2804 ****
  
    h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
  
-   /* When possible, keep the original type of the symbol.  */
-   if (h->type == STT_NOTYPE)
-     h->type = STT_OBJECT;
- 
    if (((h->elf_link_hash_flags & (ELF_LINK_HASH_DEF_DYNAMIC
  				  | ELF_LINK_HASH_REF_DYNAMIC)) != 0
         || info->shared)
--- 2795,2800 ----

brgds, H-P



More information about the Binutils mailing list