Skip to content

Commit

Permalink
x86, vdso: Make the vdso linker script compatible with Gold
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Lutomirski authored and H. Peter Anvin committed Apr 3, 2014
1 parent 37c9755 commit 378ed3c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions arch/x86/vdso/vdso-layout.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@ SECTIONS
#ifdef BUILD_VDSO32
#include <asm/vdso32.h>

.hpet_sect : {
hpet_page = . - VDSO_OFFSET(VDSO_HPET_PAGE);
} :text :hpet_sect
hpet_page = . - VDSO_OFFSET(VDSO_HPET_PAGE);

.vvar_sect : {
vvar = . - VDSO_OFFSET(VDSO_VVAR_PAGE);
vvar = . - VDSO_OFFSET(VDSO_VVAR_PAGE);

/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) vvar_ ## name = vvar + offset;
#define __VVAR_KERNEL_LDS
#include <asm/vvar.h>
#undef __VVAR_KERNEL_LDS
#undef EMIT_VVAR
} :text :vvar_sect
#endif
. = SIZEOF_HEADERS;

Expand Down Expand Up @@ -61,7 +57,12 @@ SECTIONS
*/
. = ALIGN(0x100);

.text : { *(.text*) } :text =0x90909090
.text : { *(.text*) } :text =0x90909090,

/*
* The comma above works around a bug in gold:
* https://sourceware.org/bugzilla/show_bug.cgi?id=16804
*/

/DISCARD/ : {
*(.discard)
Expand All @@ -84,8 +85,4 @@ PHDRS
dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
note PT_NOTE FLAGS(4); /* PF_R */
eh_frame_hdr PT_GNU_EH_FRAME;
#ifdef BUILD_VDSO32
vvar_sect PT_NULL FLAGS(4); /* PF_R */
hpet_sect PT_NULL FLAGS(4); /* PF_R */
#endif
}

0 comments on commit 378ed3c

Please sign in to comment.