bug-gnu-utils
[Top][All Lists]
Advanced

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

question about ordering .rela sections on Itanium


From: Lowney, Geoff
Subject: question about ordering .rela sections on Itanium
Date: Wed, 5 Jun 2002 16:16:00 -0700

                                                6/5/02

I am using GNU ld 2.12.1 on an IA64/Linux system.  To support a binary
optimizer, I am making some changes to the linker script to use the
linkonce feature to combine the relocations corresponding to the
unwind sections.  Depending on where I place the statement in the the
linker script, the relocations may be placed such that they are
ignored by the program loader.  Is this expected behavior?

I have a simple test program linked against some C++ shared libraries
(using the Intel compiler, not g++).  The default linker script does
not mention .rela.IA_64.unwind_info.  If I add the following
definition for .rela.IA_64.unwind_info, and place it as follows, the
program will run correctly.

       ...
       .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
       .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
       .rel.plt        : { *(.rel.plt) }
       .rela.plt       : { *(.rela.plt) }
==>    .rela.IA_64.unwind_info   : { *(.rela.IA_64.unwind_info*
.rela.gnu.linkonce.ia64unwi.*) }
       .rela.IA_64.pltoff   : { *(.rela.IA_64.pltoff) }
       .init           :
       {               
       ...

If I place the statement after .rela.IA_64.pltoff, the relocations in 
.rela.IA_64.unwind_info are not applied by the program loader.  The values
in the image remain all zeros, and the program dumps core.

       ...
       .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
       .rel.plt        : { *(.rel.plt) }
       .rela.plt       : { *(.rela.plt) }
       .rela.IA_64.pltoff   : { *(.rela.IA_64.pltoff) }
==>    .rela.IA_64.unwind_info   : { *(.rela.IA_64.unwind_info*
.rela.gnu.linkonce.ia64unwi.*) }
       .init           :
       {
       ...

The major difference between the images is the order of the .rela
sections.  If I link with the default linker script, I get the
following order.  (Question: what determines the placement of
.rela.IA_64.unwind_info if it is not mentioned in the script?)

  [ 8] .rela.got         RELA             4000000000000e60  00000e60
       00000000000000d8  0000000000000018   A       4    1c     8
  [ 9] .rela.IA_64.unwin RELA             4000000000000f38  00000f38
       0000000000000078  0000000000000018   A       4    15     8
  [10] .rela.sdata       RELA             4000000000000fb0  00000fb0
       0000000000000090  0000000000000018   A       4    1e     8
  [11] .rela.IA_64.pltof RELA             4000000000001040  00001040
       00000000000001f8  0000000000000018   A       4    1d     8



With the first linker script described above, I get:

  [ 8] .rela.got         RELA             4000000000000e60  00000e60
       00000000000000d8  0000000000000018   A       4    1c     8
  [ 9] .rela.sdata       RELA             4000000000000f38  00000f38
       0000000000000090  0000000000000018   A       4    1e     8
  [10] .rela.IA_64.unwin RELA             4000000000000fc8  00000fc8
       0000000000000078  0000000000000018   A       4    15     8
  [11] .rela.IA_64.pltof RELA             4000000000001040  00001040
       00000000000001f8  0000000000000018   A       4    1d     8



And with the second linker script, I get:

  [ 8] .rela.got         RELA             4000000000000e60  00000e60
       00000000000000d8  0000000000000018   A       4    1c     8
  [ 9] .rela.sdata       RELA             4000000000000f38  00000f38
       0000000000000090  0000000000000018   A       4    1e     8
  [10] .rela.IA_64.pltof RELA             4000000000000fc8  00000fc8
       00000000000001f8  0000000000000018   A       4    1d     8
  [11] .rela.IA_64.unwin RELA             40000000000011c0  000011c0
       0000000000000078  0000000000000018   A       4    15     8

This last image fails.  My guess is that it is because
.rela.IA_64.unwind_info follow .rela.IA_64.pltoff.  Does this make
sense?










reply via email to

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