bfd/
authorAlan Modra <amodra@gmail.com>
Fri, 5 Aug 2011 06:22:22 +0000 (06:22 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 5 Aug 2011 06:22:22 +0000 (06:22 +0000)
* elf64-ppc.c (maybe_strip_output): New function.
(ppc64_elf_size_stubs): Use it to strip .branch_lt and .eh_frame.
ld/testsuite/
* ld-powerpc/tlsexe.r: Update for stripped .branch_lt.
* ld-powerpc/tlsexetoc.r: Likewise.
* ld-powerpc/tlsso.r: Likewise.
* ld-powerpc/tlstocso.r: Likewise.

bfd/ChangeLog
bfd/elf64-ppc.c
ld/testsuite/ChangeLog
ld/testsuite/ld-powerpc/tlsexe.r
ld/testsuite/ld-powerpc/tlsexetoc.r
ld/testsuite/ld-powerpc/tlsso.r
ld/testsuite/ld-powerpc/tlstocso.r

index 82defd9ff126aee04f054d19db4f20addf01b88c..3280ac9edb5d0d9da44ee059cc1c926be49e42ab 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-05  Alan Modra  <amodra@gmail.com>
+
+       * elf64-ppc.c (maybe_strip_output): New function.
+       (ppc64_elf_size_stubs): Use it to strip .branch_lt and .eh_frame.
+
 2011-08-05  Alan Modra  <amodra@gmail.com>
 
        PR ld/12762
index d13447e048b3a251d9bf6f2a5b89c6a857643983..e942a7a7b98c02be4b9b475d3ae09cc05ff73c37 100644 (file)
@@ -10871,6 +10871,26 @@ static const unsigned char glink_eh_frame_cie[] =
   DW_CFA_def_cfa, 1, 0                 /* def_cfa: r1 offset 0.  */
 };
 
+/* Stripping output sections is normally done before dynamic section
+   symbols have been allocated.  This function is called later, and
+   handles cases like htab->brlt which is mapped to its own output
+   section.  */
+
+static void
+maybe_strip_output (struct bfd_link_info *info, asection *isec)
+{
+  if (isec->size == 0
+      && isec->output_section->size == 0
+      && !bfd_section_removed_from_list (info->output_bfd,
+                                        isec->output_section)
+      && elf_section_data (isec->output_section)->dynindx == 0)
+    {
+      isec->output_section->flags |= SEC_EXCLUDE;
+      bfd_section_list_remove (info->output_bfd, isec->output_section);
+      info->output_bfd->section_count--;
+    }
+}
+
 /* Determine and set the size of the stub section for a final link.
 
    The basic idea here is to examine all the relocations looking for
@@ -11251,10 +11271,9 @@ ppc64_elf_size_stubs (struct bfd_link_info *info, bfd_signed_vma group_size,
       (*htab->layout_sections_again) ();
     }
 
-  /* It would be nice to strip htab->brlt from the output if the
-     section is empty, but it's too late.  If we strip sections here,
-     the dynamic symbol table is corrupted since the section symbol
-     for the stripped section isn't written.  */
+  maybe_strip_output (info, htab->brlt);
+  if (htab->glink_eh_frame != NULL)
+    maybe_strip_output (info, htab->glink_eh_frame);
 
   return TRUE;
 }
index 7a3fd7066931e07de88045f9f0d7d8448061e777..aebe33736227cb97d80f0215d8cd9928c85aad9b 100644 (file)
@@ -1,3 +1,10 @@
+2011-08-05  Alan Modra  <amodra@gmail.com>
+
+       * ld-powerpc/tlsexe.r: Update for stripped .branch_lt.
+       * ld-powerpc/tlsexetoc.r: Likewise.
+       * ld-powerpc/tlsso.r: Likewise.
+       * ld-powerpc/tlstocso.r: Likewise.
+
 2011-08-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/13048
index 264e891ae2cb08553987c042d9e625a6e7d41520..d79248ea11a305560f93e8e140b5e159095cb6dc 100644 (file)
@@ -20,7 +20,6 @@ Section Headers:
  +\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+160 10 +WA +4 +0 +8
- +\[[ 0-9]+\] \.branch_lt + PROGBITS .* 0+ 0+ +WA +0 +0 +8
  +\[[ 0-9]+\] \.got +PROGBITS .* 0+30 08 +WA +0 +0 +8
  +\[[ 0-9]+\] \.plt +.*
  +\[[ 0-9]+\] \.shstrtab +.*
@@ -47,7 +46,7 @@ Program Headers:
  +0+ +
  +01 +\.interp 
  +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text 
- +03 +\.tdata \.dynamic (\.branch_lt |)\.got \.plt 
+ +03 +\.tdata \.dynamic \.got \.plt 
  +04 +\.dynamic 
  +05 +\.tdata \.tbss 
 
@@ -87,7 +86,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* SECTION +LOCAL +DEFAULT +10 
 .* SECTION +LOCAL +DEFAULT +11 
 .* SECTION +LOCAL +DEFAULT +12 
-.* SECTION +LOCAL +DEFAULT +13 
 .* TLS +LOCAL +DEFAULT +8 gd4
 .* TLS +LOCAL +DEFAULT +8 ld4
 .* TLS +LOCAL +DEFAULT +8 ld5
index ab65fe3cef11518c7d235642c1486264860c47ba..d175aa7077f8f38a4142e519edf081002cb502b9 100644 (file)
@@ -20,7 +20,6 @@ Section Headers:
  +\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.dynamic +DYNAMIC .* 0+160 10 +WA +4 +0 +8
- +\[[ 0-9]+\] \.branch_lt +PROGBITS .* 0+ 0+ +WA +0 +0 +8
  +\[[ 0-9]+\] \.got +PROGBITS .* 0+58 08 +WA +0 +0 +8
  +\[[ 0-9]+\] \.plt +.*
  +\[[ 0-9]+\] \.shstrtab +.*
@@ -47,7 +46,7 @@ Program Headers:
  +0+ +
  +01 +\.interp 
  +02 +\.interp \.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text 
- +03 +\.tdata \.dynamic (\.branch_lt |)\.got \.plt 
+ +03 +\.tdata \.dynamic \.got \.plt 
  +04 +\.dynamic 
  +05 +\.tdata \.tbss 
 
@@ -86,7 +85,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* SECTION +LOCAL +DEFAULT +10 
 .* SECTION +LOCAL +DEFAULT +11 
 .* SECTION +LOCAL +DEFAULT +12 
-.* SECTION +LOCAL +DEFAULT +13 
 .* TLS +LOCAL +DEFAULT +8 gd4
 .* TLS +LOCAL +DEFAULT +8 ld4
 .* TLS +LOCAL +DEFAULT +8 ld5
@@ -94,7 +92,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* TLS +LOCAL +DEFAULT +8 ie4
 .* TLS +LOCAL +DEFAULT +8 le4
 .* TLS +LOCAL +DEFAULT +8 le5
-.* NOTYPE +LOCAL +DEFAULT +12 \.Lie0
+.* NOTYPE +LOCAL +DEFAULT +11 \.Lie0
 .* OBJECT +LOCAL +DEFAULT +10 _DYNAMIC
 .* (NOTYPE +LOCAL +DEFAULT +7 00000010\.plt_call\.__tls_get_addr(|_opt)\+0|(FUNC|NOTYPE) +LOCAL +DEFAULT +UND \.__tls_get_addr(|_opt))
 .* (NOTYPE +LOCAL +DEFAULT +7 __glink_PLTresolve|NOTYPE +LOCAL +DEFAULT +7 00000010\.plt_call\.__tls_get_addr(|_opt)\+0)
index 99c3659f64f014fb08b8dab0bc633d4e0d6dbf02..3879d505281ea97cc184dbd517eb7cee1d79d3a0 100644 (file)
@@ -18,7 +18,6 @@ Section Headers:
  +\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.dynamic .*
- +\[[ 0-9]+\] \.branch_lt .*
  +\[[ 0-9]+\] \.got .*
  +\[[ 0-9]+\] \.plt .*
  +\[[ 0-9]+\] \.shstrtab .*
@@ -40,7 +39,7 @@ Program Headers:
  Section to Segment mapping:
  +Segment Sections\.\.\.
  +0+ +\.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text 
- +01 +\.tdata \.dynamic (\.branch_lt |)\.got \.plt 
+ +01 +\.tdata \.dynamic .got \.plt 
  +02 +\.dynamic 
  +03 +\.tdata \.tbss 
 
@@ -101,7 +100,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* SECTION +LOCAL +DEFAULT +9 
 .* SECTION +LOCAL +DEFAULT +10 
 .* SECTION +LOCAL +DEFAULT +11 
-.* SECTION +LOCAL +DEFAULT +12 
 .* TLS +LOCAL +DEFAULT +7 gd4
 .* TLS +LOCAL +DEFAULT +7 ld4
 .* TLS +LOCAL +DEFAULT +7 ld5
index d04cf7087aefd50d2f30cd45c6638ca174c6a5b7..040d69fa48a5219d106bc02784219df5df8c9b7e 100644 (file)
@@ -18,7 +18,6 @@ Section Headers:
  +\[[ 0-9]+\] \.tdata +PROGBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.tbss +NOBITS .* 0+38 0+ WAT +0 +0 +8
  +\[[ 0-9]+\] \.dynamic .*
- +\[[ 0-9]+\] \.branch_lt .*
  +\[[ 0-9]+\] \.got .*
  +\[[ 0-9]+\] \.plt .*
  +\[[ 0-9]+\] \.shstrtab .*
@@ -40,7 +39,7 @@ Program Headers:
  Section to Segment mapping:
  +Segment Sections\.\.\.
  +0+ +\.hash \.dynsym \.dynstr \.rela\.dyn \.rela\.plt \.text 
- +01 +\.tdata \.dynamic (\.branch_lt |)\.got \.plt 
+ +01 +\.tdata \.dynamic \.got \.plt 
  +02 +\.dynamic 
  +03 +\.tdata \.tbss 
 
@@ -96,7 +95,6 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* SECTION +LOCAL +DEFAULT +9 
 .* SECTION +LOCAL +DEFAULT +10 
 .* SECTION +LOCAL +DEFAULT +11 
-.* SECTION +LOCAL +DEFAULT +12 
 .* TLS +LOCAL +DEFAULT +7 gd4
 .* TLS +LOCAL +DEFAULT +7 ld4
 .* TLS +LOCAL +DEFAULT +7 ld5
@@ -104,7 +102,7 @@ Symbol table '\.symtab' contains [0-9]+ entries:
 .* TLS +LOCAL +DEFAULT +7 ie4
 .* TLS +LOCAL +DEFAULT +7 le4
 .* TLS +LOCAL +DEFAULT +7 le5
-.* NOTYPE +LOCAL +DEFAULT +11 \.Lie0
+.* NOTYPE +LOCAL +DEFAULT +10 \.Lie0
 .* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
 .* NOTYPE +LOCAL +DEFAULT +6 00000010\.plt_call\.__tls_get_addr\+0
 .* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
This page took 0.038124 seconds and 4 git commands to generate.