diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-06-18 18:59:48 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-06-19 18:45:12 -0400 |
commit | bfad381c0d1e19cae8461e105d8d4387dd2a14fe (patch) | |
tree | c4f4fba23ad53bfe9c6f99c4c9156716fa3fa5c5 /arch/x86/vdso/vdso-layout.lds.S | |
parent | c1979c370273fd9f7326ffa27a63b9ddb0f495f4 (diff) |
x86/vdso: Improve the fake section headers
Fully stripping the vDSO has other unfortunate side effects:
- binutils is unable to find ELF notes without a SHT_NOTE section.
- Even elfutils has trouble: it can find ELF notes without a section
table at all, but if a section table is present, it won't look for
PT_NOTE.
- gdb wants section names to match between stripped DSOs and their
symbols; otherwise it will corrupt symbol addresses.
We're also breaking the rules: section 0 is supposed to be SHT_NULL.
Fix these problems by building a better fake section table. While
we're at it, we might as well let buggy Go versions keep working well
by giving the SHT_DYNSYM entry the correct size.
This is a bit unfortunate: it adds quite a bit of size to the vdso
image.
If/when binutils improves and the improved versions become widespread,
it would be worth considering dropping most of this.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/0e546a5eeaafdf1840e6ee654a55c1e727c26663.1403129369.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/vdso/vdso-layout.lds.S')
-rw-r--r-- | arch/x86/vdso/vdso-layout.lds.S | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/arch/x86/vdso/vdso-layout.lds.S b/arch/x86/vdso/vdso-layout.lds.S index c84166cbcd28..e4cbc2145bab 100644 --- a/arch/x86/vdso/vdso-layout.lds.S +++ b/arch/x86/vdso/vdso-layout.lds.S | |||
@@ -6,6 +6,16 @@ | |||
6 | * This script controls its layout. | 6 | * This script controls its layout. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #if defined(BUILD_VDSO64) | ||
10 | # define SHDR_SIZE 64 | ||
11 | #elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32) | ||
12 | # define SHDR_SIZE 40 | ||
13 | #else | ||
14 | # error unknown VDSO target | ||
15 | #endif | ||
16 | |||
17 | #define NUM_FAKE_SHDRS 16 | ||
18 | |||
9 | SECTIONS | 19 | SECTIONS |
10 | { | 20 | { |
11 | . = SIZEOF_HEADERS; | 21 | . = SIZEOF_HEADERS; |
@@ -25,15 +35,29 @@ SECTIONS | |||
25 | 35 | ||
26 | .dynamic : { *(.dynamic) } :text :dynamic | 36 | .dynamic : { *(.dynamic) } :text :dynamic |
27 | 37 | ||
28 | .rodata : { *(.rodata*) } :text | 38 | .rodata : { |
39 | *(.rodata*) | ||
40 | |||
41 | /* | ||
42 | * Ideally this would live in a C file, but that won't | ||
43 | * work cleanly for x32 until we start building the x32 | ||
44 | * C code using an x32 toolchain. | ||
45 | */ | ||
46 | VDSO_FAKE_SECTION_TABLE_START = .; | ||
47 | . = . + NUM_FAKE_SHDRS * SHDR_SIZE; | ||
48 | VDSO_FAKE_SECTION_TABLE_END = .; | ||
49 | } :text | ||
50 | |||
51 | .fake_shstrtab : { *(.fake_shstrtab) } :text | ||
52 | |||
29 | .data : { | 53 | .data : { |
30 | *(.data*) | 54 | *(.data*) |
31 | *(.sdata*) | 55 | *(.sdata*) |
32 | *(.got.plt) *(.got) | 56 | *(.got.plt) *(.got) |
33 | *(.gnu.linkonce.d.*) | 57 | *(.gnu.linkonce.d.*) |
34 | *(.bss*) | 58 | *(.bss*) |
35 | *(.dynbss*) | 59 | *(.dynbss*) |
36 | *(.gnu.linkonce.b.*) | 60 | *(.gnu.linkonce.b.*) |
37 | } | 61 | } |
38 | 62 | ||
39 | .altinstructions : { *(.altinstructions) } | 63 | .altinstructions : { *(.altinstructions) } |