bfd/
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 6 Aug 2009 13:05:24 +0000 (13:05 +0000)
committerNathan Sidwell <nathan@codesourcery.com>
Thu, 6 Aug 2009 13:05:24 +0000 (13:05 +0000)
* elf32-arm.c (elf32_arm_size_stubs): Call layout_sections_again
at least once when fixing cortex-a8.

ld/testsuite/
* ld-arm/arm-elf.exp: Add new test.
* ld-arm/cortex-a8-fix-hdr.d: New.
* ld-arm/cortex-a8-fix-hdr.s: New.
* ld-arm/cortex-a8-fix-hdr.t: New.

bfd/ChangeLog
bfd/elf32-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-elf.exp
ld/testsuite/ld-arm/cortex-a8-fix-hdr.d [new file with mode: 0644]
ld/testsuite/ld-arm/cortex-a8-fix-hdr.s [new file with mode: 0644]
ld/testsuite/ld-arm/cortex-a8-fix-hdr.t [new file with mode: 0644]

index 95e033c15002df86004b0ba34673b2f9611dd569..c63bc2f8237cf45023219b5ddf3dbeb8545f69ea 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * elf32-arm.c (elf32_arm_size_stubs): Call layout_sections_again
+       at least once when fixing cortex-a8.
+
 2009-08-05  Chao-ying Fu  <fu@mips.com>
 
        * elf32-mips.c (mips_reloc_map): Add BFD_RELOC_MIPS_JALR.
index 5aba3f360a78e50f16510bbff5c089f89c4a2be3..fbb4454ae94e2a04ba34ed0e492bebe914351821 100644 (file)
@@ -4246,6 +4246,16 @@ elf32_arm_size_stubs (bfd *output_bfd,
 
   group_sections (htab, stub_group_size, stubs_always_after_branch);
 
+  /* If we're applying the cortex A8 fix, we need to determine the
+     program header size now, because we cannot change it later --
+     that could alter section placements.  Notice the A8 erratum fix
+     ends up requiring the section addresses to remain unchanged
+     modulo the page size.  That's something we cannot represent
+     inside BFD, and we don't want to force the section alignment to
+     be the page size.  */
+  if (htab->fix_cortex_a8)
+    (*htab->layout_sections_again) ();
+
   while (1)
     {
       bfd *input_bfd;
index 13861620a2964e38b6a65de7465aaf7b38a66348..d0e1699d7f8e4ab87391eb2535eb6b33f52343f8 100644 (file)
@@ -1,3 +1,10 @@
+2009-08-06  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * ld-arm/arm-elf.exp: Add new test.
+       * ld-arm/cortex-a8-fix-hdr.d: New.
+       * ld-arm/cortex-a8-fix-hdr.s: New.
+       * ld-arm/cortex-a8-fix-hdr.t: New.
+
 2009-08-05  Trevor Smigiel  <Trevor_Smigiel@playstation.sony.com>
 
        * ld-spu/fixup.d: New.
index 941ef50c6976043089bea556d45e49501d36efc9..4fcee6817a25f2f5fb44b5a3296845189997aae4 100644 (file)
@@ -209,6 +209,10 @@ set armelftests {
      "-EL -Ttext=0x00 --fix-cortex-a8 --defsym far_fn1=0x80000000 --defsym far_fn2=0x80000004  --defsym far_fn=0x7fff0000 --defsym _start=0" "-EL" {cortex-a8-far-1.s cortex-a8-far-2.s}
      {{objdump -dr cortex-a8-far.d}}
      "cortex-a8-far"}
+    {"Cortex-A8 erratum fix, headers"
+     "-EL --fix-cortex-a8 -T cortex-a8-fix-hdr.t" "-EL" {cortex-a8-fix-hdr.s}
+     {{objdump -dr cortex-a8-fix-hdr.d}}
+     "cortex-a8-fix-hdr"}
     {"Unwinding and -gc-sections" "-gc-sections" "" {gc-unwind.s}
      {{objdump -sj.data gc-unwind.d}}
      "gc-unwind"}
diff --git a/ld/testsuite/ld-arm/cortex-a8-fix-hdr.d b/ld/testsuite/ld-arm/cortex-a8-fix-hdr.d
new file mode 100644 (file)
index 0000000..027d2a1
--- /dev/null
@@ -0,0 +1,24 @@
+
+.*:     file format .*
+
+
+Disassembly of section \.text:
+
+00000fe0 <_start>:
+     fe0:      bf00            nop
+     fe2:      bf00            nop
+     fe4:      bf00            nop
+     fe6:      bf00            nop
+     fe8:      bf00            nop
+     fea:      bf00            nop
+     fec:      bf00            nop
+     fee:      bf00            nop
+     ff0:      bf00            nop
+     ff2:      bf00            nop
+     ff4:      bf00            nop
+     ff6:      bf00            nop
+     ff8:      bf00            nop
+     ffa:      ea81 0002       eor.w   r0, r1, r2
+     ffe:      f000 b80f       b.w     1020 <_start\+0x40>
+#...
+    1020:      f7ff bfde       b.w     fe0 <_start>
diff --git a/ld/testsuite/ld-arm/cortex-a8-fix-hdr.s b/ld/testsuite/ld-arm/cortex-a8-fix-hdr.s
new file mode 100644 (file)
index 0000000..827c0f8
--- /dev/null
@@ -0,0 +1,14 @@
+       .syntax unified
+
+       .section .text, "ax"
+
+       .align 5
+       .globl _start
+       .thumb_func
+_start:
+       .rept 13
+       nop
+       .endr
+       eor     r0, r1, r2
+       b.w     _start
+
diff --git a/ld/testsuite/ld-arm/cortex-a8-fix-hdr.t b/ld/testsuite/ld-arm/cortex-a8-fix-hdr.t
new file mode 100644 (file)
index 0000000..d3afacb
--- /dev/null
@@ -0,0 +1,10 @@
+
+
+SECTIONS {
+       . = SIZEOF_HEADERS;
+       . += 0xf80;
+       .text : {
+          *(.text)      
+       } = 0
+       /DISCARD/ : { *(*) }
+}