bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/349] New: ld -r silently renames sections


From: jbeulich at novell dot com
Subject: [Bug ld/349] New: ld -r silently renames sections
Date: 27 Aug 2004 14:07:06 -0000

Encountering two input sections with different allocation flags but identical
names, ld renames the second one encountered by attaching a .<number> suffix.
While the ELF spec isn't really explicit about this, it would have been my
understanding that an ELF section is uniquely identified by {name,type,flags}
rather than just by its name. At the very least I'd expect ld to be able to
optionally issue a warning to the user that this happened (especially when -r is
in effect), because (for instance) linker scripts subsequently used to deal with
the resulting output may deal only with the un-renamed sections unless the
programmer(s) learn(s) that it needs to deal with more.

The problematic code is ld/emultempl/elf32.em, function
gld${EMULATION_NAME}_place_orphan calling bfd_get_unique_section_name.

And a response to this I got on the mailing list from Ian Lance Taylor:

Oh yeah.  I think this code may be buggy.  It was intended to handle
the case in which an input section was orphaned even though the output
section exists.  That can happen if, for example, the output section
is created by the linker for whatever reason.

However, the way the code is written, if two orphaned input sections
have the same name, the second one will get a unique output section
name.  Really they should both go into the same output section (if the
flags are compatible).  That is, the test should not be unconditional
on whether an output section exists with the same name.  Perhaps we
should test SEC_LINKER_CREATED, if that is used consistently.

You are correct that in the case of incompatible flags, or
SEC_LINKER_CREATED, the linker should arguably create a new section
with the same name and the appropriate flags.  This is where we may
run into trouble with the way that linker scripts base everything
purely on the section name.  On the other hand, it may work fine, as
place_orphan sets up the appropriate links directly.

-- 
           Summary: ld -r silently renames sections
           Product: binutils
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: jbeulich at novell dot com
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://sources.redhat.com/bugzilla/show_bug.cgi?id=349

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

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