Commit 378ed3ccd2a0404d031e771b65aa3af221ea8aea

Authored by Andy Lutomirski
Committed by H. Peter Anvin
1 parent 37c975545e

x86, vdso: Make the vdso linker script compatible with Gold

Gold can't parse the script due to:
https://sourceware.org/bugzilla/show_bug.cgi?id=16804

With a workaround in place for that issue, Gold 2.23 crashes due to:
https://sourceware.org/bugzilla/show_bug.cgi?id=15355

This works around the former bug and avoids the second by removing
the unnecessary vvar and hpet sections and segments.  The vdso and
hpet symbols are still there, and nothing needed the sections or
segments.

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Link: http://lkml.kernel.org/r/243fa205098d112ec759c9b1b26785c09f399833.1396547532.git.luto@amacapital.net
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

Showing 1 changed file with 8 additions and 11 deletions Side-by-side Diff

arch/x86/vdso/vdso-layout.lds.S
... ... @@ -9,12 +9,9 @@
9 9 #ifdef BUILD_VDSO32
10 10 #include <asm/vdso32.h>
11 11  
12   - .hpet_sect : {
13   - hpet_page = . - VDSO_OFFSET(VDSO_HPET_PAGE);
14   - } :text :hpet_sect
  12 + hpet_page = . - VDSO_OFFSET(VDSO_HPET_PAGE);
15 13  
16   - .vvar_sect : {
17   - vvar = . - VDSO_OFFSET(VDSO_VVAR_PAGE);
  14 + vvar = . - VDSO_OFFSET(VDSO_VVAR_PAGE);
18 15  
19 16 /* Place all vvars at the offsets in asm/vvar.h. */
20 17 #define EMIT_VVAR(name, offset) vvar_ ## name = vvar + offset;
... ... @@ -22,7 +19,6 @@
22 19 #include <asm/vvar.h>
23 20 #undef __VVAR_KERNEL_LDS
24 21 #undef EMIT_VVAR
25   - } :text :vvar_sect
26 22 #endif
27 23 . = SIZEOF_HEADERS;
28 24  
29 25  
... ... @@ -61,8 +57,13 @@
61 57 */
62 58 . = ALIGN(0x100);
63 59  
64   - .text : { *(.text*) } :text =0x90909090
  60 + .text : { *(.text*) } :text =0x90909090,
65 61  
  62 + /*
  63 + * The comma above works around a bug in gold:
  64 + * https://sourceware.org/bugzilla/show_bug.cgi?id=16804
  65 + */
  66 +
66 67 /DISCARD/ : {
67 68 *(.discard)
68 69 *(.discard.*)
... ... @@ -84,9 +85,5 @@
84 85 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
85 86 note PT_NOTE FLAGS(4); /* PF_R */
86 87 eh_frame_hdr PT_GNU_EH_FRAME;
87   -#ifdef BUILD_VDSO32
88   - vvar_sect PT_NULL FLAGS(4); /* PF_R */
89   - hpet_sect PT_NULL FLAGS(4); /* PF_R */
90   -#endif
91 88 }