Skip to content

Commit

Permalink
x86-64: Work around gold bug 13023
Browse files Browse the repository at this point in the history
Gold has trouble assigning numbers to the location counter inside of
an output section description.  The bug was triggered by
9fd67b4, which consolidated all of
the vsyscall sections into a single section.  The workaround is IMO
still nicer than the old way of doing it.

This produces an apparently valid kernel image and passes my vdso
tests on both GNU ld version 2.21.51.0.6-2.fc15 20110118 and GNU
gold (version 2.21.51.0.6-2.fc15 20110118) 1.10 as distributed by
Fedora 15.

Signed-off-by: Andy Lutomirski <[email protected]>
Link: http://lkml.kernel.org/r/0b260cb806f1f9a25c00ce8377a5f035d57f557a.1312378163.git.luto@mit.edu
Reported-by: Arkadiusz Miskiewicz <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
  • Loading branch information
amluto authored and H. Peter Anvin committed Aug 4, 2011
1 parent 9c40818 commit f670bb7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions arch/x86/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ SECTIONS
__vvar_page = .;

.vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
/* work around gold bug 13023 */
__vvar_beginning_hack = .;

/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) \
. = offset; \
/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) \
. = __vvar_beginning_hack + offset; \
*(.vvar_ ## name)
#define __VVAR_KERNEL_LDS
#include <asm/vvar.h>
Expand All @@ -184,15 +186,17 @@ SECTIONS

. = VSYSCALL_ADDR;
.vsyscall : AT(VLOAD(.vsyscall)) {
/* work around gold bug 13023 */
__vsyscall_beginning_hack = .;
*(.vsyscall_0)

. = 1024;
. = __vsyscall_beginning_hack + 1024;
*(.vsyscall_1)

. = 2048;
. = __vsyscall_beginning_hack + 2048;
*(.vsyscall_2)

. = 4096; /* Pad the whole page. */
. = __vsyscall_beginning_hack + 4096; /* Pad the whole page. */
} :user =0xcc
. = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE);

Expand Down

0 comments on commit f670bb7

Please sign in to comment.