aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-07-25 15:24:55 +0930
committerAlan Modra <amodra@gmail.com>2018-07-25 16:52:58 +0930
commit491993044ba6cfb2b0fc93c8b3032d5c91cccda5 (patch)
treeef399640acd0e20d9bd6f165015a882f66f0faad /ld
parentbe3e27bb5554e45d54d7cdc74353dda246239475 (diff)
downloadgdb-491993044ba6cfb2b0fc93c8b3032d5c91cccda5.zip
gdb-491993044ba6cfb2b0fc93c8b3032d5c91cccda5.tar.gz
gdb-491993044ba6cfb2b0fc93c8b3032d5c91cccda5.tar.bz2
Enhance powerpc ld -r --relax
One of the ill effects of ld -r is to mash together sections. That can result in reduced icache performance at runtime due to unexpected movement of code. Another problem is that sections can become too large to link on targets that have limited relative addressing. ld -r --relax attempts to overcome the large section problem for branches by inserting trampolines, but the powerpc support added lots of unnecessary trampolines. This patch trims them somewhat. bfd/ * elf32-ppc.c (ppc_elf_relax_section): Ignore common or undef locals. Avoid trashing toff with added when used as a symbol index. Ignore R_PPC_PLTREL24 addends in unused example code. Avoid creating unnecessary fixups when relocatable. ld/ * testsuite/ld-powerpc/big.s: New file. * testsuite/ld-powerpc/relaxrl.d: New test. * testsuite/ld-powerpc/powerpc.exp: Run new test. * testsuite/ld-powerpc/relaxr.d: Adjust.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/testsuite/ld-powerpc/big.s2
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp3
-rw-r--r--ld/testsuite/ld-powerpc/relaxr.d26
-rw-r--r--ld/testsuite/ld-powerpc/relaxrl.d27
5 files changed, 47 insertions, 18 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ecbbf48..0b3058b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-25 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-powerpc/big.s: New file.
+ * testsuite/ld-powerpc/relaxrl.d: New test.
+ * testsuite/ld-powerpc/powerpc.exp: Run new test.
+ * testsuite/ld-powerpc/relaxr.d: Adjust.
+
2018-07-24 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
diff --git a/ld/testsuite/ld-powerpc/big.s b/ld/testsuite/ld-powerpc/big.s
new file mode 100644
index 0000000..e372c97
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/big.s
@@ -0,0 +1,2 @@
+ .text
+ .space 32*1024*1024
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 0359ba2..cfeb277 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -160,6 +160,9 @@ set ppcelftests {
{"relocatable relaxing" "-melf32ppc -r --relax" "" "-a32" "relax.s"
{{objdump -dr relaxr.d}}
"rrelax"}
+ {"relocatable relaxing large" "-melf32ppc -r --relax" "" "-a32" "relax.s big.s"
+ {{objdump -dr relaxrl.d}}
+ "rrelax"}
}
set ppc64elftests {
diff --git a/ld/testsuite/ld-powerpc/relaxr.d b/ld/testsuite/ld-powerpc/relaxr.d
index 3ce2751..1b3a3c1 100644
--- a/ld/testsuite/ld-powerpc/relaxr.d
+++ b/ld/testsuite/ld-powerpc/relaxr.d
@@ -4,23 +4,13 @@
Disassembly of section .text:
00000000 <_start>:
- 0: (48 00 00 15|15 00 00 48) bl 14 <_start\+0x14>
- 4: (48 00 00 21|21 00 00 48) bl 24 <_start\+0x24>
- 8: (48 00 00 0d|0d 00 00 48) bl 14 <_start\+0x14>
- 8: R_PPC_NONE \*ABS\*
- c: (48 00 00 19|19 00 00 48) bl 24 <_start\+0x24>
- c: R_PPC_NONE \*ABS\*
+ 0: (48 00 00 01|01 00 00 48) bl 0 <_start>
+ 0: R_PPC_REL24 near
+ 4: (48 00 00 01|01 00 00 48) bl 4 <_start\+0x4>
+ 4: R_PPC_REL24 far
+ 8: (48 00 00 01|01 00 00 48) bl 8 <_start\+0x8>
+ 8: R_PPC_REL24 near
+ c: (48 00 00 01|01 00 00 48) bl c <_start\+0xc>
+ c: R_PPC_REL24 far
10: (48 00 00 00|00 00 00 48) b 10 <_start\+0x10>
10: R_PPC_REL24 _start
- 14: (3d 80 00 00|00 00 80 3d) lis r12,0
- 1(6|4): R_PPC_ADDR16_HA near
- 18: (39 8c 00 00|00 00 8c 39) addi r12,r12,0
- 1(a|8): R_PPC_ADDR16_LO near
- 1c: (7d 89 03 a6|a6 03 89 7d) mtctr r12
- 20: (4e 80 04 20|20 04 80 4e) bctr
- 24: (3d 80 00 00|00 00 80 3d) lis r12,0
- 2(6|4): R_PPC_ADDR16_HA far
- 28: (39 8c 00 00|00 00 8c 39) addi r12,r12,0
- 2(a|8): R_PPC_ADDR16_LO far
- 2c: (7d 89 03 a6|a6 03 89 7d) mtctr r12
- 30: (4e 80 04 20|20 04 80 4e) bctr
diff --git a/ld/testsuite/ld-powerpc/relaxrl.d b/ld/testsuite/ld-powerpc/relaxrl.d
new file mode 100644
index 0000000..8557e3f
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/relaxrl.d
@@ -0,0 +1,27 @@
+
+.*: file format .*
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +0: (48 00 00 15|15 00 00 48) bl 14 <_start\+0x14>
+ +4: (48 00 00 21|21 00 00 48) bl 24 <_start\+0x24>
+ +8: (48 00 00 0d|0d 00 00 48) bl 14 <_start\+0x14>
+ 8: R_PPC_NONE \*ABS\*
+ +c: (48 00 00 19|19 00 00 48) bl 24 <_start\+0x24>
+ c: R_PPC_NONE \*ABS\*
+ +10: (48 00 00 00|00 00 00 48) b 10 <_start\+0x10>
+ 10: R_PPC_REL24 _start
+ +14: (3d 80 00 00|00 00 80 3d) lis r12,0
+ 1(6|4): R_PPC_ADDR16_HA near
+ +18: (39 8c 00 00|00 00 8c 39) addi r12,r12,0
+ 1(a|8): R_PPC_ADDR16_LO near
+ +1c: (7d 89 03 a6|a6 03 89 7d) mtctr r12
+ +20: (4e 80 04 20|20 04 80 4e) bctr
+ +24: (3d 80 00 00|00 00 80 3d) lis r12,0
+ 2(6|4): R_PPC_ADDR16_HA far
+ +28: (39 8c 00 00|00 00 8c 39) addi r12,r12,0
+ 2(a|8): R_PPC_ADDR16_LO far
+ +2c: (7d 89 03 a6|a6 03 89 7d) mtctr r12
+ +30: (4e 80 04 20|20 04 80 4e) bctr
+ \.\.\.