bfd/
authorJan Beulich <jbeulich@novell.com>
Mon, 4 Dec 2006 08:57:09 +0000 (08:57 +0000)
committerJan Beulich <jbeulich@novell.com>
Mon, 4 Dec 2006 08:57:09 +0000 (08:57 +0000)
2006-12-04  Jan Beulich  <jbeulich@novell.com>

* elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
.eh_frame_hdr section from here anymore.
(bfd_elf_size_dynamic_sections): Call _bfd_elf_maybe_strip_eh_frame_hdr
a little earlier.

ld/
2006-12-04  Jan Beulich  <jbeulich@novell.com>

* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Create
.eh_frame_hdr section here.

ld/testsuite/
2006-12-04  Jan Beulich  <jbeulich@novell.com>

* ld-elf/eh-frame-hdr.d: New.
* ld-elf/eh-frame-hdr.s: New.
* ld-ia64/tlsbin.dd, ld-ia64/tlsbin.sd: Don't depend on exact linkage
table layout.

bfd/ChangeLog
bfd/elflink.c
ld/ChangeLog
ld/emultempl/elf32.em
ld/testsuite/ChangeLog
ld/testsuite/ld-elf/eh-frame-hdr.d [new file with mode: 0644]
ld/testsuite/ld-elf/eh-frame-hdr.s [new file with mode: 0644]
ld/testsuite/ld-ia64/tlsbin.dd
ld/testsuite/ld-ia64/tlsbin.sd

index dbbddd5..92cfcd6 100644 (file)
@@ -1,3 +1,10 @@
+2006-12-04  Jan Beulich  <jbeulich@novell.com>
+
+       * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
+       .eh_frame_hdr section from here anymore.
+       (bfd_elf_size_dynamic_sections): Call _bfd_elf_maybe_strip_eh_frame_hdr
+       a little earlier.
+
 2006-12-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/3609
index b250758..b0227d8 100644 (file)
@@ -185,16 +185,6 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
        return FALSE;
     }
 
-  if (! info->traditional_format)
-    {
-      s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr",
-                                      flags | SEC_READONLY);
-      if (s == NULL
-         || ! bfd_set_section_alignment (abfd, s, 2))
-       return FALSE;
-      elf_hash_table (info)->eh_info.hdr_sec = s;
-    }
-
   /* Create sections to hold version informations.  These are removed
      if they are not needed.  */
   s = bfd_make_section_with_flags (abfd, ".gnu.version_d",
@@ -5281,6 +5271,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
       && ! (*bed->elf_backend_always_size_sections) (output_bfd, info))
     return FALSE;
 
+  if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
+    return FALSE;
+
   dynobj = elf_hash_table (info)->dynobj;
 
   /* If there were no dynamic objects in the link, there is nothing to
@@ -5288,9 +5281,6 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
   if (dynobj == NULL)
     return TRUE;
 
-  if (! _bfd_elf_maybe_strip_eh_frame_hdr (info))
-    return FALSE;
-
   if (elf_hash_table (info)->dynamic_sections_created)
     {
       struct elf_info_failed eif;
index 209e8d9..df00020 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-04  Jan Beulich  <jbeulich@novell.com>
+
+       * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Create
+       .eh_frame_hdr section here.
+
 2006-11-27  Ian Lance Taylor  <ian@airs.com>
 
        * Makefile.am (EXTRA_DIST): Put spu_ovl.o in the emultempl
index 03d9d8d..2888008 100644 (file)
@@ -865,6 +865,42 @@ gld${EMULATION_NAME}_after_open (void)
 {
   struct bfd_link_needed_list *needed, *l;
 
+  if (link_info.eh_frame_hdr
+      && ! link_info.traditional_format
+      && ! link_info.relocatable)
+    {
+      struct elf_link_hash_table *htab;
+
+      htab = elf_hash_table (&link_info);
+      if (is_elf_hash_table (htab))
+       {
+         bfd *abfd;
+         asection *s;
+
+         for (abfd = link_info.input_bfds; abfd; abfd = abfd->link_next)
+           {
+             s = bfd_get_section_by_name (abfd, ".eh_frame");
+             if (s && s->size > 8 && !bfd_is_abs_section (s->output_section))
+                break;
+           }
+         if (abfd)
+           {
+             const struct elf_backend_data *bed;
+
+             bed = get_elf_backend_data (abfd);
+             s = bfd_make_section_with_flags (abfd, ".eh_frame_hdr",
+                                              bed->dynamic_sec_flags
+                                              | SEC_READONLY);
+             if (s != NULL
+                && bfd_set_section_alignment (abfd, s, 2))
+               htab->eh_info.hdr_sec = s;
+             else
+               einfo ("%P: warning: Cannot create .eh_frame_hdr section,"
+                      " --eh-frame-hdr ignored.\n");
+           }
+       }
+    }
+
   /* We only need to worry about this when doing a final link.  */
   if (link_info.relocatable || !link_info.executable)
     return;
index cce90f9..b578008 100644 (file)
@@ -1,3 +1,10 @@
+2006-12-04  Jan Beulich  <jbeulich@novell.com>
+
+       * ld-elf/eh-frame-hdr.d: New.
+       * ld-elf/eh-frame-hdr.s: New.
+       * ld-ia64/tlsbin.dd, ld-ia64/tlsbin.sd: Don't depend on exact linkage
+       table layout.
+
 2006-11-23  Thiemo Seufer  <ths@mips.com>
 
        * ld-elf/warn2.d: Match regex also for the second segment.
diff --git a/ld/testsuite/ld-elf/eh-frame-hdr.d b/ld/testsuite/ld-elf/eh-frame-hdr.d
new file mode 100644 (file)
index 0000000..b465e5d
--- /dev/null
@@ -0,0 +1,17 @@
+#source: eh-frame-hdr.s
+#ld: -e _start --eh-frame-hdr
+#objdump: -hw
+#target: alpha*-*-*
+#target: arm*-*-*
+#target: i?86-*-*
+#target: m68k-*-*
+#target: mips*-*-*
+#target: powerpc*-*-*
+#target: s390*-*-*
+#target: sh*-*-*
+#xfail: sh*l*-*-*
+#target: sparc*-*-*
+#target: x86_64-*-*
+#...
+  [0-9] .eh_frame_hdr 0*[12][048c] .*
+#pass
diff --git a/ld/testsuite/ld-elf/eh-frame-hdr.s b/ld/testsuite/ld-elf/eh-frame-hdr.s
new file mode 100644 (file)
index 0000000..e5d3318
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .global _start
+_start:
+       .cfi_startproc
+       .skip 16
+       .cfi_endproc
index d581579..1c5bc2f 100644 (file)
@@ -13,25 +13,25 @@ Disassembly of section .text:
 40+1000:       10 10 15 06 80 05[      ]+\[MIB\][      ]+alloc r34=ar.pfs,5,3,0
 40+1006:       10 02 00 62 00 00[      ]+mov r33=b0
 40+100c:       00 00 00 20[    ]+nop.b 0x0
-40+1010:       0d 70 80 02 00 24[      ]+\[MFI\][      ]+addl r14=32,r1
+40+1010:       0d 70 .0 0. 00 24[      ]+\[MFI\][      ]+addl r14=(24|32|40|48|56|64),r1
 40+1016:       00 00 00 02 00 e0[      ]+nop.f 0x0
-40+101c:       81 0a 00 90[    ]+addl r15=40,r1;;
+40+101c:       .1 0. 00 90[    ]+addl r15=(24|32|40|48|56|64),r1;;
 40+1020:       19 18 01 1c 18 10[      ]+\[MMB\][      ]+ld8 r35=\[r14\]
 40+1026:       40 02 3c 30 20 00[      ]+ld8 r36=\[r15\]
 40+102c:       [0-9a-f         ]+br.call.sptk.many b0=[0-9a-f]+ <.*>;;
-40+1030:       0d 70 c0 02 00 24[      ]+\[MFI\][      ]+addl r14=48,r1
+40+1030:       0d 70 .0 0. 00 24[      ]+\[MFI\][      ]+addl r14=(24|32|40|48|56|64),r1
 40+1036:       00 00 00 02 00 e0[      ]+nop.f 0x0
-40+103c:       01 0c 00 90[    ]+addl r15=64,r1;;
+40+103c:       .1 0. 00 90[    ]+addl r15=(24|32|40|48|56|64),r1;;
 40+1040:       19 18 01 1c 18 10[      ]+\[MMB\][      ]+ld8 r35=\[r14\]
 40+1046:       40 02 3c 30 20 00[      ]+ld8 r36=\[r15\]
 40+104c:       [0-9a-f         ]+br.call.sptk.many b0=[0-9a-f]+ <.*>;;
-40+1050:       0d 70 c0 02 00 24[      ]+\[MFI\][      ]+addl r14=48,r1
+40+1050:       0d 70 .0 0. 00 24[      ]+\[MFI\][      ]+addl r14=(24|32|40|48|56|64),r1
 40+1056:       00 00 00 02 00 80[      ]+nop.f 0x0
 40+105c:       14 02 00 90[    ]+mov r36=33;;
 40+1060:       1d 18 01 1c 18 10[      ]+\[MFB\][      ]+ld8 r35=\[r14\]
 40+1066:       00 00 00 02 00 00[      ]+nop.f 0x0
 40+106c:       [0-9a-f         ]+br.call.sptk.many b0=[0-9a-f]+ <.*>;;
-40+1070:       0d 70 c0 02 00 24[      ]+\[MFI\][      ]+addl r14=48,r1
+40+1070:       0d 70 .0 0. 00 24[      ]+\[MFI\][      ]+addl r14=(24|32|40|48|56|64),r1
 40+1076:       00 00 00 02 00 80[      ]+nop.f 0x0
 40+107c:       04 00 00 84[    ]+mov r36=r0;;
 40+1080:       1d 18 01 1c 18 10[      ]+\[MFB\][      ]+ld8 r35=\[r14\]
@@ -51,11 +51,11 @@ Disassembly of section .text:
 40+10cc:       08 00 84 00[    ]+br.ret.sptk.many b0;;
 
 40+10d0 <_start>:
-40+10d0:       0b 70 60 02 00 24[      ]+\[MMI\][      ]+addl r14=24,r1;;
+40+10d0:       0b 70 .0 0. 00 24[      ]+\[MMI\][      ]+addl r14=(24|32|40|48|56|64),r1;;
 40+10d6:       e0 00 38 30 20 00[      ]+ld8 r14=\[r14\]
 40+10dc:       00 00 04 00[    ]+nop.i 0x0;;
 40+10e0:       0b 70 38 1a 00 20[      ]+\[MMI\][      ]+add r14=r14,r13;;
-40+10e6:       e0 c0 05 00 48 00[      ]+addl r14=56,r1
+40+10e6:       e0 .0 0. 00 48 00[      ]+addl r14=(24|32|40|48|56|64),r1
 40+10ec:       00 00 04 00[    ]+nop.i 0x0;;
 40+10f0:       0b 70 00 1c 18 10[      ]+\[MMI\][      ]+ld8 r14=\[r14\];;
 40+10f6:       e0 70 34 00 40 00[      ]+add r14=r14,r13
index 5d8ab65..411eedb 100644 (file)
@@ -11,5 +11,5 @@ Contents of section .got:
  (60+)?1318 0+ 0+ 0+ 0+  .*
  (60+)?1328 0+ 0+ 0+ 0+  .*
  (60+)?1338 0+ 0+ 0+ 0+  .*
- (60+)?1348 01000000 0+ 90000000 0+  .*
- (60+)?1358 24000000 0+  .*
+ (60+)?1348 (00|01|24|90)000000 0+ (00|01|24|90)000000 0+  .*
+ (60+)?1358 (00|01|24|90)000000 0+  .*