diff options
author | Alan Modra <amodra@gmail.com> | 2022-06-24 13:25:45 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2022-06-27 12:28:59 +0930 |
commit | 648f6099d4dcadf446f3f00790ad4b16dd4042f6 (patch) | |
tree | f806f1f5fa08ad7937c657b8f5107c05afbfee97 /ld/testsuite/ld-x86-64/pr21038b.d | |
parent | b4eb841afe9306fd7a6df95efcde120bfaa71e32 (diff) | |
download | gdb-648f6099d4dcadf446f3f00790ad4b16dd4042f6.zip gdb-648f6099d4dcadf446f3f00790ad4b16dd4042f6.tar.gz gdb-648f6099d4dcadf446f3f00790ad4b16dd4042f6.tar.bz2 |
-z relro relaxation and ld script SIZEOF
A number of targets use assignments like:
. = DATA_SEGMENT_RELRO_END (SIZEOF (.got.plt) >= 12 ? 12 : 0, .);
(from i386) in linker scripts to put the end of the relro segment past
the header in .got.plt. Examination of testcases like those edited by
this patch instead sees the end of the relro segment being placed at
the start of .got.plt. For the i386 pie1 test:
[ 9] .got.plt PROGBITS 00002000 001000 00000c 04 WA 0 0 4
GNU_RELRO 0x000f90 0x00001f90 0x00001f90 0x00070 0x00070 R 0x1
A map file shows:
.dynamic 0x0000000000001f90 0x70
*(.dynamic)
.dynamic 0x0000000000001f90 0x70 tmpdir/pie1.o
0x0000000000001f90 _DYNAMIC
.got 0x0000000000002000 0x0
*(.got)
.got 0x0000000000002000 0x0 tmpdir/pie1.o
*(.igot)
0x0000000000002ff4 . = DATA_SEGMENT_RELRO_END (., (SIZEOF (.got.plt) >= 0xc)?0xc:0x0)
.got.plt 0x0000000000002000 0xc
*(.got.plt)
.got.plt 0x0000000000002000 0xc tmpdir/pie1.o
0x0000000000002000 _GLOBAL_OFFSET_TABLE_
The DATA_SEGMENT_RELRO_END value in the map file is weird too. All of
this is triggered by SIZEOF (.got.plt) being evaluated wrongly as
zero. Fix it by taking into account the action of
lang_reset_memory_regions during relaxation.
* ldexp.c (fold_name <SIZEOF>): Use rawsize if size has been reset.
* ldlang.c (lang_size_sections_1): Don't reset processed_vma here.
* testsuite/ld-i386/pie1.d: Adjust to suit.
* testsuite/ld-x86-64/pr20830a.d: Likewise.
* testsuite/ld-x86-64/pr20830b.d: Likewise.
* testsuite/ld-x86-64/pr21038a.d: Likewise.
* testsuite/ld-x86-64/pr21038b.d: Likewise.
* testsuite/ld-x86-64/pr21038c.d: Likewise.
Diffstat (limited to 'ld/testsuite/ld-x86-64/pr21038b.d')
-rw-r--r-- | ld/testsuite/ld-x86-64/pr21038b.d | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ld/testsuite/ld-x86-64/pr21038b.d b/ld/testsuite/ld-x86-64/pr21038b.d index d6a9567..0e77d2c 100644 --- a/ld/testsuite/ld-x86-64/pr21038b.d +++ b/ld/testsuite/ld-x86-64/pr21038b.d @@ -49,8 +49,8 @@ Contents of the .eh_frame section: Disassembly of section .plt: 0+1b0 <.plt>: - +[a-f0-9]+: ff 35 52 fe 3f 00 push 0x3ffe52\(%rip\) # 400008 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: f2 ff 25 53 fe 3f 00 bnd jmp \*0x3ffe53\(%rip\) # 400010 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 3a fe 3f 00 push 0x3ffe3a\(%rip\) # 3ffff0 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: f2 ff 25 3b fe 3f 00 bnd jmp \*0x3ffe3b\(%rip\) # 3ffff8 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 00 nopl \(%rax\) +[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmp 1b0 <func@plt-0x20> @@ -59,7 +59,7 @@ Disassembly of section .plt: Disassembly of section .plt.sec: 0+1d0 <func@plt>: - +[a-f0-9]+: f2 ff 25 41 fe 3f 00 bnd jmp \*0x3ffe41\(%rip\) # 400018 <func> + +[a-f0-9]+: f2 ff 25 29 fe 3f 00 bnd jmp \*0x3ffe29\(%rip\) # 400000 <func> +[a-f0-9]+: 90 nop Disassembly of section .text: |