diff options
author | Alan Modra <amodra@gmail.com> | 2015-01-20 17:19:15 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-01-20 19:52:42 +1030 |
commit | 23283c1be02de06666e4d934b1fc499c0d72f9c2 (patch) | |
tree | cd6bc9ab21af319ff36832b68394d152bd3e1946 /ld/testsuite/ld-powerpc | |
parent | 3e2b0f3116a46c8a9a6ffbcb5ae4847b6601467a (diff) | |
download | gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.zip gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.tar.gz gdb-23283c1be02de06666e4d934b1fc499c0d72f9c2.tar.bz2 |
Reorder more powerpc64 sections for -z relro
This moves .got too, which requires .sdata and .sbss to move with it,
because these sections share addressing via the toc pointer and with
small-model code must be within a 16-bit signed offset. .plt, .iplt
and .branch_lt must also be moved since they are addressed via a
32-bit offset from the toc pointer, and we might have a very large
.data section.
This change means we may have some bss style sections before the data
segment, necessitating another PT_LOAD header. Also, since _edata is
defined at the end of the data segment it's possible with an empty
.data to have _edata at the end of .plt which looks a little unusual
since .plt is a bss style section. That should only happen rarely in
real world binaries, but does occur in the ld testsuite.
ld/
* emulparams/elf64ppc.sh (BSS_PLT): Don't define.
(OTHER_READWRITE_SECTIONS): Move .branch_lt to..
(OTHER_RELRO_SECTIONS_2): ..here.
(DATA_GOT, SEPARATE_GOTPLT, DATA_SDATA, DATA_PLT,
PLT_BEFORE_GOT): Define.
* scripttempl/elf.sc: Handle DATA_SDATA and DATA_GOT/DATA_PLT/
PLT_BEFORE_GOT combination.
(DATA_GOT, SDATA_GOT): Don't define if either is already defined.
ld/testsuite/
* ld-powerpc/ambiguousv1.d,
* ld-powerpc/ambiguousv1b.d,
* ld-powerpc/ambiguousv2.d,
* ld-powerpc/ambiguousv2b.d,
* ld-powerpc/elfv2exe.d,
* ld-powerpc/elfv2so.d,
* ld-powerpc/tlsexe.r,
* ld-powerpc/tlsexetoc.r,
* ld-powerpc/tlsso.r,
* ld-powerpc/tlstocso.r: Update.
Diffstat (limited to 'ld/testsuite/ld-powerpc')
-rw-r--r-- | ld/testsuite/ld-powerpc/ambiguousv1.d | 26 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/ambiguousv1b.d | 27 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/ambiguousv2.d | 27 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/ambiguousv2b.d | 28 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/elfv2exe.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/elfv2so.d | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexe.r | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsexetoc.r | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlsso.r | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-powerpc/tlstocso.r | 4 |
10 files changed, 30 insertions, 114 deletions
diff --git a/ld/testsuite/ld-powerpc/ambiguousv1.d b/ld/testsuite/ld-powerpc/ambiguousv1.d index 458c554..a74325a 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv1.d +++ b/ld/testsuite/ld-powerpc/ambiguousv1.d @@ -17,28 +17,8 @@ Symbol table '\.dynsym' contains 5 entries: .* 0: .* 1: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func - 2: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 __bss_start - 3: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _edata - 4: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _end - +#... Symbol table '\.symtab' contains 19 entries: - Num: Value Size Type Bind Vis Ndx Name - 0: .* - 1: 0+10000158 0 SECTION LOCAL DEFAULT 1 - 2: 0+10000170 0 SECTION LOCAL DEFAULT 2 - 3: 0+10000198 0 SECTION LOCAL DEFAULT 3 - 4: 0+10000210 0 SECTION LOCAL DEFAULT 4 - 5: 0+10000248 0 SECTION LOCAL DEFAULT 5 - 6: 0+10000260 0 SECTION LOCAL DEFAULT 6 - 7: 0+10000264 0 SECTION LOCAL DEFAULT 7 - 8: 0+10010268 0 SECTION LOCAL DEFAULT 8 - 9: 0+10010368 0 SECTION LOCAL DEFAULT 9 - 10: 0+10010370 0 SECTION LOCAL DEFAULT 10 - 11: 0+10010388 0 SECTION LOCAL DEFAULT 11 - 12: 0+10010268 0 OBJECT LOCAL DEFAULT 8 _DYNAMIC - 13: 0+10010368 0 NOTYPE GLOBAL DEFAULT 9 func_tab +#... 14: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func - 15: 0+10010370 0 FUNC GLOBAL DEFAULT 10 _start - 16: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 __bss_start - 17: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _edata - 18: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _end +#pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv1b.d b/ld/testsuite/ld-powerpc/ambiguousv1b.d index 69bee95..b20ad9f 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv1b.d +++ b/ld/testsuite/ld-powerpc/ambiguousv1b.d @@ -17,29 +17,8 @@ Symbol table '\.dynsym' contains 5 entries: .* 0: .* 1: 0+10010390 4 FUNC GLOBAL DEFAULT 12 my_func - 2: 0+10010390 0 NOTYPE GLOBAL DEFAULT 12 __bss_start - 3: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _edata - 4: 0+10010398 0 NOTYPE GLOBAL DEFAULT 12 _end - +#... Symbol table '\.symtab' contains 20 entries: -.* - 0: .* - 1: 0+10000158 0 SECTION LOCAL DEFAULT 1 - 2: 0+10000170 0 SECTION LOCAL DEFAULT 2 - 3: 0+10000198 0 SECTION LOCAL DEFAULT 3 - 4: 0+10000210 0 SECTION LOCAL DEFAULT 4 - 5: 0+10000248 0 SECTION LOCAL DEFAULT 5 - 6: 0+10000260 0 SECTION LOCAL DEFAULT 6 - 7: 0+10000264 0 SECTION LOCAL DEFAULT 7 - 8: 0+1000026c 0 SECTION LOCAL DEFAULT 8 - 9: 0+10010270 0 SECTION LOCAL DEFAULT 9 - 10: 0+10010370 0 SECTION LOCAL DEFAULT 10 - 11: 0+10010388 0 SECTION LOCAL DEFAULT 11 - 12: 0+10010390 0 SECTION LOCAL DEFAULT 12 - 13: 0+10010270 0 OBJECT LOCAL DEFAULT 9 _DYNAMIC - 14: 0+10000264 0 NOTYPE GLOBAL DEFAULT 7 func_tab +#... 15: 0+10010390 4 FUNC GLOBAL DEFAULT 12 my_func - 16: 0+10010370 0 FUNC GLOBAL DEFAULT 10 _start - 17: 0+10010390 0 NOTYPE GLOBAL DEFAULT 12 __bss_start - 18: 0+10010390 0 NOTYPE GLOBAL DEFAULT 11 _edata - 19: 0+10010398 0 NOTYPE GLOBAL DEFAULT 12 _end +#pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv2.d b/ld/testsuite/ld-powerpc/ambiguousv2.d index cfa5cb4..99c8a39 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv2.d +++ b/ld/testsuite/ld-powerpc/ambiguousv2.d @@ -22,30 +22,9 @@ Symbol table '\.dynsym' contains 5 entries: .* 0: .* 1: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func - 2: 0+10010438 0 NOTYPE GLOBAL DEFAULT 12 __bss_start - 3: 0+10010438 0 NOTYPE GLOBAL DEFAULT 11 _edata - 4: 0+10010450 0 NOTYPE GLOBAL DEFAULT 12 _end +#... Symbol table '\.symtab' contains 21 entries: -.* - 0: .* - 1: 0+10000158 0 SECTION LOCAL DEFAULT 1 - 2: 0+10000170 0 SECTION LOCAL DEFAULT 2 - 3: 0+10000198 0 SECTION LOCAL DEFAULT 3 - 4: 0+10000210 0 SECTION LOCAL DEFAULT 4 - 5: 0+10000248 0 SECTION LOCAL DEFAULT 5 - 6: 0+10000260 0 SECTION LOCAL DEFAULT 6 - 7: 0+10000278 0 SECTION LOCAL DEFAULT 7 - 8: 0+100002c4 0 SECTION LOCAL DEFAULT 8 - 9: 0+100102c8 0 SECTION LOCAL DEFAULT 9 - 10: 0+10010428 0 SECTION LOCAL DEFAULT 10 - 11: 0+10010430 0 SECTION LOCAL DEFAULT 11 - 12: 0+10010438 0 SECTION LOCAL DEFAULT 12 - 13: 0+100102c8 0 OBJECT LOCAL DEFAULT 9 _DYNAMIC - 14: 0+10000288 0 NOTYPE LOCAL DEFAULT 7 __glink_PLTresolve - 15: 0+10010428 0 NOTYPE GLOBAL DEFAULT 10 func_tab +#... 16: 0+00000000 0 FUNC GLOBAL DEFAULT UND my_func - 17: 0+10000278 0 NOTYPE GLOBAL DEFAULT 7 _start - 18: 0+10010438 0 NOTYPE GLOBAL DEFAULT 12 __bss_start - 19: 0+10010438 0 NOTYPE GLOBAL DEFAULT 11 _edata - 20: 0+10010450 0 NOTYPE GLOBAL DEFAULT 12 _end +#pass diff --git a/ld/testsuite/ld-powerpc/ambiguousv2b.d b/ld/testsuite/ld-powerpc/ambiguousv2b.d index a95faa7..859a3ea 100644 --- a/ld/testsuite/ld-powerpc/ambiguousv2b.d +++ b/ld/testsuite/ld-powerpc/ambiguousv2b.d @@ -18,30 +18,8 @@ Symbol table '\.dynsym' contains 5 entries: .* 0: .* 1: 0+100002b8 0 FUNC GLOBAL DEFAULT UND my_func - 2: 0+10010408 0 NOTYPE GLOBAL DEFAULT 11 __bss_start - 3: 0+10010408 0 NOTYPE GLOBAL DEFAULT 10 _edata - 4: 0+10010420 0 NOTYPE GLOBAL DEFAULT 11 _end - +#... Symbol table '\.symtab' contains 21 entries: -.* - 0: .* - 1: 0+10000158 0 SECTION LOCAL DEFAULT 1 - 2: 0+10000170 0 SECTION LOCAL DEFAULT 2 - 3: 0+10000198 0 SECTION LOCAL DEFAULT 3 - 4: 0+10000210 0 SECTION LOCAL DEFAULT 4 - 5: 0+10000248 0 SECTION LOCAL DEFAULT 5 - 6: 0+10000260 0 SECTION LOCAL DEFAULT 6 - 7: 0+100002c8 0 SECTION LOCAL DEFAULT 7 - 8: 0+100002d0 0 SECTION LOCAL DEFAULT 8 - 9: 0+100102d0 0 SECTION LOCAL DEFAULT 9 - 10: 0+10010400 0 SECTION LOCAL DEFAULT 10 - 11: 0+10010408 0 SECTION LOCAL DEFAULT 11 - 12: 0+100102d0 0 OBJECT LOCAL DEFAULT 9 _DYNAMIC - 13: 0+100002b8 0 NOTYPE LOCAL DEFAULT 6 00000011\.global_entry\.my_func - 14: 0+10000270 0 NOTYPE LOCAL DEFAULT 6 __glink_PLTresolve - 15: 0+100002c8 0 NOTYPE GLOBAL DEFAULT 7 func_tab +#... 16: 0+100002b8 0 FUNC GLOBAL DEFAULT UND my_func - 17: 0+10000260 0 NOTYPE GLOBAL DEFAULT 6 _start - 18: 0+10010408 0 NOTYPE GLOBAL DEFAULT 11 __bss_start - 19: 0+10010408 0 NOTYPE GLOBAL DEFAULT 10 _edata - 20: 0+10010420 0 NOTYPE GLOBAL DEFAULT 11 _end +#pass diff --git a/ld/testsuite/ld-powerpc/elfv2exe.d b/ld/testsuite/ld-powerpc/elfv2exe.d index 9ea816c..78d3727 100644 --- a/ld/testsuite/ld-powerpc/elfv2exe.d +++ b/ld/testsuite/ld-powerpc/elfv2exe.d @@ -21,7 +21,7 @@ Disassembly of section \.text: 0+100000e0 <_start>: .*: (02 10 40 3c|3c 40 10 02) lis r2,4098 -.*: (40 81 42 38|38 42 81 40) addi r2,r2,-32448 +.*: (38 81 42 38|38 42 81 38) addi r2,r2,-32456 .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 .*: (e1 ff 21 f8|f8 21 ff e1) stdu r1,-32\(r1\) .*: (30 00 01 f8|f8 01 00 30) std r0,48\(r1\) diff --git a/ld/testsuite/ld-powerpc/elfv2so.d b/ld/testsuite/ld-powerpc/elfv2so.d index 963dbb6..28cfdb0 100644 --- a/ld/testsuite/ld-powerpc/elfv2so.d +++ b/ld/testsuite/ld-powerpc/elfv2so.d @@ -7,33 +7,33 @@ Disassembly of section \.text: -0+300 <.*\.plt_call\.f4>: +0+320 <.*\.plt_call\.f4>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (38 80 82 e9|e9 82 80 38) ld r12,-32712\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+310 <.*\.plt_call\.f3>: +0+330 <.*\.plt_call\.f3>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (28 80 82 e9|e9 82 80 28) ld r12,-32728\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+320 <.*\.plt_call\.f2>: +0+340 <.*\.plt_call\.f2>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (30 80 82 e9|e9 82 80 30) ld r12,-32720\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+330 <.*\.plt_call\.f1>: +0+350 <.*\.plt_call\.f1>: .*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\) .*: (40 80 82 e9|e9 82 80 40) ld r12,-32704\(r2\) .*: (a6 03 89 7d|7d 89 03 a6) mtctr r12 .*: (20 04 80 4e|4e 80 04 20) bctr -0+340 <f1>: +0+360 <f1>: .*: (02 00 4c 3c|3c 4c 00 02) addis r2,r12,2 -.*: (e0 81 42 38|38 42 81 e0) addi r2,r2,-32288 +.*: (d8 81 42 38|38 42 81 d8) addi r2,r2,-32296 .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 .*: (e1 ff 21 f8|f8 21 ff e1) stdu r1,-32\(r1\) .*: (30 00 01 f8|f8 01 00 30) std r0,48\(r1\) @@ -50,10 +50,10 @@ Disassembly of section \.text: .*: (20 00 21 38|38 21 00 20) addi r1,r1,32 .*: (a6 03 08 7c|7c 08 03 a6) mtlr r0 .*: (20 00 80 4e|4e 80 00 20) blr -.*: (a0 01 01 00|00 00 00 00) .* -.*: (00 00 00 00|00 01 01 a0) .* +.*: (98 01 01 00|00 00 00 00) .* +.*: (00 00 00 00|00 01 01 98) .* -0+390 <__glink_PLTresolve>: +0+3b0 <__glink_PLTresolve>: .*: (a6 02 08 7c|7c 08 02 a6) mflr r0 .*: (05 00 9f 42|42 9f 00 05) bcl .* .*: (a6 02 68 7d|7d 68 02 a6) mflr r11 diff --git a/ld/testsuite/ld-powerpc/tlsexe.r b/ld/testsuite/ld-powerpc/tlsexe.r index f78f300..2ec65ab 100644 --- a/ld/testsuite/ld-powerpc/tlsexe.r +++ b/ld/testsuite/ld-powerpc/tlsexe.r @@ -69,7 +69,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +9 ld2 .* NOTYPE +GLOBAL +DEFAULT +13 __bss_start .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt -.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +13 _edata .* NOTYPE +GLOBAL +DEFAULT +13 _end Symbol table '\.symtab' contains [0-9]+ entries: @@ -111,7 +111,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +9 ld1 .* NOTYPE +GLOBAL +DEFAULT +13 __bss_start .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt -.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +13 _edata .* NOTYPE +GLOBAL +DEFAULT +13 _end .* TLS +GLOBAL +DEFAULT +9 gd0 .* TLS +GLOBAL +DEFAULT +9 ie0 diff --git a/ld/testsuite/ld-powerpc/tlsexetoc.r b/ld/testsuite/ld-powerpc/tlsexetoc.r index d238f26..d09aabe 100644 --- a/ld/testsuite/ld-powerpc/tlsexetoc.r +++ b/ld/testsuite/ld-powerpc/tlsexetoc.r @@ -68,7 +68,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +UND ld .* NOTYPE +GLOBAL +DEFAULT +13 __bss_start .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt -.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +13 _edata .* NOTYPE +GLOBAL +DEFAULT +13 _end Symbol table '\.symtab' contains [0-9]+ entries: @@ -111,7 +111,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +9 ld1 .* NOTYPE +GLOBAL +DEFAULT +13 __bss_start .* FUNC +GLOBAL +DEFAULT +UND __tls_get_addr_opt -.* NOTYPE +GLOBAL +DEFAULT +12 _edata +.* NOTYPE +GLOBAL +DEFAULT +13 _edata .* NOTYPE +GLOBAL +DEFAULT +13 _end .* TLS +GLOBAL +DEFAULT +9 gd0 .* TLS +GLOBAL +DEFAULT +9 ie0 diff --git a/ld/testsuite/ld-powerpc/tlsso.r b/ld/testsuite/ld-powerpc/tlsso.r index ddaaebc..4043797 100644 --- a/ld/testsuite/ld-powerpc/tlsso.r +++ b/ld/testsuite/ld-powerpc/tlsso.r @@ -84,7 +84,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +8 ld2 .* TLS +GLOBAL +DEFAULT +8 ld1 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start -.* NOTYPE +GLOBAL +DEFAULT +11 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _edata .* NOTYPE +GLOBAL +DEFAULT +12 _end .* TLS +GLOBAL +DEFAULT +8 gd0 .* TLS +GLOBAL +DEFAULT +8 ie0 @@ -127,7 +127,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +8 ld2 .* TLS +GLOBAL +DEFAULT +8 ld1 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start -.* NOTYPE +GLOBAL +DEFAULT +11 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _edata .* NOTYPE +GLOBAL +DEFAULT +12 _end .* TLS +GLOBAL +DEFAULT +8 gd0 .* TLS +GLOBAL +DEFAULT +8 ie0 diff --git a/ld/testsuite/ld-powerpc/tlstocso.r b/ld/testsuite/ld-powerpc/tlstocso.r index f5bdfe3..a414151 100644 --- a/ld/testsuite/ld-powerpc/tlstocso.r +++ b/ld/testsuite/ld-powerpc/tlstocso.r @@ -79,7 +79,7 @@ Symbol table '\.dynsym' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +8 ld2 .* TLS +GLOBAL +DEFAULT +8 ld1 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start -.* NOTYPE +GLOBAL +DEFAULT +11 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _edata .* NOTYPE +GLOBAL +DEFAULT +12 _end .* TLS +GLOBAL +DEFAULT +8 gd0 .* TLS +GLOBAL +DEFAULT +8 ie0 @@ -123,7 +123,7 @@ Symbol table '\.symtab' contains [0-9]+ entries: .* TLS +GLOBAL +DEFAULT +8 ld2 .* TLS +GLOBAL +DEFAULT +8 ld1 .* NOTYPE +GLOBAL +DEFAULT +12 __bss_start -.* NOTYPE +GLOBAL +DEFAULT +11 _edata +.* NOTYPE +GLOBAL +DEFAULT +12 _edata .* NOTYPE +GLOBAL +DEFAULT +12 _end .* TLS +GLOBAL +DEFAULT +8 gd0 .* TLS +GLOBAL +DEFAULT +8 ie0 |