We currently place the eh_frame_hdr section in the data segment near the
eh_frame section. However, non-relinked binaries have a GNU_EH_FRAME
segment which only contains this section. Fix this by putting the
.eh_frame_hdr section in both the data (or text, as appopriate) segment
and the eh_frame_hdr segment. The eh_frame_hdr segment, unfortunately,
is not easily definable, so we have to use a constant (found by Adam) to
add it to each linker script (the constant is defined in
/usr/include/elf.h).

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>

diff --git a/ldscripts/elf32ppclinux.xB b/ldscripts/elf32ppclinux.xB
index c3c925f..c980bf9 100644
--- a/ldscripts/elf32ppclinux.xB
+++ b/ldscripts/elf32ppclinux.xB
@@ -15,6 +15,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -92,7 +93,7 @@ SECTIONS
     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
   } :text
   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } :text
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :text
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
 /*  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :text */
 /*  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table 
.gcc_except_table.*) } :text */
   /* Adjust the address for the data segment.  We want to adjust up to
diff --git a/ldscripts/elf32ppclinux.xBDT b/ldscripts/elf32ppclinux.xBDT
index 109d556..6c07a88 100644
--- a/ldscripts/elf32ppclinux.xBDT
+++ b/ldscripts/elf32ppclinux.xBDT
@@ -14,6 +14,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -91,7 +92,7 @@ SECTIONS
     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
   } :htext
   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } :htext
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :htext
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :htext :eh_frame_hdr
 /*  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :htext */
 /*  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table 
.gcc_except_table.*) } :htext */
 
diff --git a/ldscripts/elf64ppc.xB b/ldscripts/elf64ppc.xB
index c630ca9..f2df559 100644
--- a/ldscripts/elf64ppc.xB
+++ b/ldscripts/elf64ppc.xB
@@ -14,6 +14,7 @@ PHDRS
   htlb PT_LOAD FLAGS (0x00100007);
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -90,7 +91,7 @@ SECTIONS
     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
   }
   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
-  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :data :eh_frame_hdr
 /*  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }*/
 /*  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table 
.gcc_except_table.*) }*/
   /* Adjust the address for the data segment.  We want to adjust up to
diff --git a/ldscripts/elf64ppc.xBDT b/ldscripts/elf64ppc.xBDT
index 548b707..e894de7 100644
--- a/ldscripts/elf64ppc.xBDT
+++ b/ldscripts/elf64ppc.xBDT
@@ -13,6 +13,7 @@ PHDRS
   hdata PT_LOAD FLAGS (0x00100007);
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -89,7 +90,7 @@ SECTIONS
     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
   } :htext
   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } :htext
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :htext
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :htext :eh_frame_hdr
 /*  .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :htext */
 /*  .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table 
.gcc_except_table.*) } :htext */
 
diff --git a/ldscripts/elf_i386.xB b/ldscripts/elf_i386.xB
index 3ac9af6..ffa508a 100644
--- a/ldscripts/elf_i386.xB
+++ b/ldscripts/elf_i386.xB
@@ -17,6 +17,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -78,7 +79,7 @@ SECTIONS
   PROVIDE (etext = .);
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
   .rodata1        : { *(.rodata1) }
-  .eh_frame_hdr : { *(.eh_frame_hdr) }
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :data :eh_frame_hdr
   /* .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
   .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } */
   /* Adjust the address for the data segment.  We want to adjust up to
diff --git a/ldscripts/elf_i386.xBDT b/ldscripts/elf_i386.xBDT
index 8b7b621..977ac17 100644
--- a/ldscripts/elf_i386.xBDT
+++ b/ldscripts/elf_i386.xBDT
@@ -16,6 +16,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -79,7 +80,7 @@ SECTIONS
   PROVIDE (etext = .);
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :text
   .rodata1        : { *(.rodata1) } :text
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :text
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
   /* .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :text
   .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } :text */
 
diff --git a/ldscripts/elf_x86_64.xB b/ldscripts/elf_x86_64.xB
index f57bdda..450d237 100644
--- a/ldscripts/elf_x86_64.xB
+++ b/ldscripts/elf_x86_64.xB
@@ -17,6 +17,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -78,7 +79,7 @@ SECTIONS
   PROVIDE (etext = .);
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :text
   .rodata1        : { *(.rodata1) } :text
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :text
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :text
   .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } :text
   /* Adjust the address for the data segment.  We want to adjust up to
diff --git a/ldscripts/elf_x86_64.xBDT b/ldscripts/elf_x86_64.xBDT
index cbe00b4..2394c71 100644
--- a/ldscripts/elf_x86_64.xBDT
+++ b/ldscripts/elf_x86_64.xBDT
@@ -16,6 +16,7 @@ PHDRS
   dynamic PT_DYNAMIC ;
   note PT_NOTE ;
   gnu_stack PT_GNU_STACK ;
+  eh_frame_hdr 1685382480 FLAGS (0x00000004);
 }
 SECTIONS
 {
@@ -79,7 +80,7 @@ SECTIONS
   PROVIDE (etext = .);
   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) } :text
   .rodata1        : { *(.rodata1) } :text
-  .eh_frame_hdr : { *(.eh_frame_hdr) } :text
+  .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr
   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) } :text
   .gcc_except_table   : ONLY_IF_RO { KEEP (*(.gcc_except_table)) 
*(.gcc_except_table.*) } :text
   /* We don't maintain address congruence here, because saving

-- 
Nishanth Aravamudan <[EMAIL PROTECTED]>
IBM Linux Technology Center

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to