This is the mail archive of the binutils@sourceware.cygnus.com 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]

Re: How to stop --gc-sections nukeing all sections?


   Date: Mon, 17 Apr 2000 16:43:18 -0700
   From: Richard Henderson <rth@cygnus.com>

   On Fri, Apr 07, 2000 at 09:06:03AM -0700, Ian Lance Taylor wrote:
   >    The kernel uses a nasty ha^H^H^H^H^H^H^H^Hneat trick to trap bad user
   >    space accesses. This relies on incrementally building up two tables
   >    containing references to instructions which attempt user space accesses,
   >    in sections named .fixup and __ex_table sections. These tables must be
   >    ordered in the same order as the code they refer to ...
   > 
   > Geeze, can't we do this in a way which doesn't rely on undocumented
   > linker features?

   Preserving link order of sections is hardly undocumented.
   Lots of things rely on that, and have since the beginning of time.

But the GNU linker doesn't preserve link order of sections.

Bear in mind that we are only talking about sections which do not
appear in the linker script.

When using ELF, if a .data.foo section (with usual .data attributes)
precedes a .text.bar section (with usual .text attributes), and
neither .data.foo nor .text.bar are mentioned in the linker script,
the linker will not preserve the order of those sections.  It will put
the .text.bar section before the .data.foo section in the output file.

Ian

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