This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

st_shndx for ELF DSOs


When creating an ELF DSO, ld uses SHN_ABS quite often for linker created
___start_FOO, ___stop_FOO etc).
But this unfortunately means information loss, because any post-ld utility
is not able to differentiate between real *ABS* section symbols and section
symbols which are relative to base VMA.
Looking at other linkers, e.g. on Solaris all those symbols get a st_shndx
of the section they point into (the question is what to do with symbols
which don't point into any particular section).
For the bfd generated symbols SHN_ABS usually overwrites the actual
output section (code like:
  /* Mark some specially defined symbols as absolute.  */
  if (strcmp (h->root.root.string, "_DYNAMIC") == 0
      || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
      || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
    sym->st_shndx = SHN_ABS;
) in arch elf processing - any reason why is this done? - but these could be
handled specially. The bigger problem is the rest of the ABS symbols which
are not actually absolute and are either defined in the linker script or
e.g. in elf32.em (such as ___start_* and ___stop_*) - here symbols defined
outside of output section statements get absolute_section.
Any ideas what could be done for this?
Something like marking the initial . = assignment in the linker script with
RELOCATABLE(. = 0x...... + SIZE_OF_HEADERS) and then any symbol which would
get assigned a RELOCATABLE address (e.g. depend on `.' if `.' depends on
something RELOCATABLE) would be put into this special section and not
absolute_section (that section would be actually equal to absolute_section
unless doing DSO final link). This special section would resolve into
closest output section's st_shndx.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]