diff options
author | Andy Lutomirski <luto@MIT.EDU> | 2011-08-03 09:31:51 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-08-04 19:13:38 -0400 |
commit | f670bb760e7d32ec9c690e748a1d5d04921363ab (patch) | |
tree | 00e4c05a5b92ed93d513af7c5a355980fc0cd7f4 /arch/x86 | |
parent | 9c40818da5b39fca236029059ab839857b1ef56c (diff) |
x86-64: Work around gold bug 13023
Gold has trouble assigning numbers to the location counter inside of
an output section description. The bug was triggered by
9fd67b4ed0714ab718f1f9bd14c344af336a6df7, 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 <luto@mit.edu>
Link: http://lkml.kernel.org/r/0b260cb806f1f9a25c00ce8377a5f035d57f557a.1312378163.git.luto@mit.edu
Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/vmlinux.lds.S | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S index e79fb3951fce..8f3a265476d7 100644 --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S | |||
@@ -158,10 +158,12 @@ SECTIONS | |||
158 | __vvar_page = .; | 158 | __vvar_page = .; |
159 | 159 | ||
160 | .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) { | 160 | .vvar : AT(ADDR(.vvar) - LOAD_OFFSET) { |
161 | /* work around gold bug 13023 */ | ||
162 | __vvar_beginning_hack = .; | ||
161 | 163 | ||
162 | /* Place all vvars at the offsets in asm/vvar.h. */ | 164 | /* Place all vvars at the offsets in asm/vvar.h. */ |
163 | #define EMIT_VVAR(name, offset) \ | 165 | #define EMIT_VVAR(name, offset) \ |
164 | . = offset; \ | 166 | . = __vvar_beginning_hack + offset; \ |
165 | *(.vvar_ ## name) | 167 | *(.vvar_ ## name) |
166 | #define __VVAR_KERNEL_LDS | 168 | #define __VVAR_KERNEL_LDS |
167 | #include <asm/vvar.h> | 169 | #include <asm/vvar.h> |
@@ -184,15 +186,17 @@ SECTIONS | |||
184 | 186 | ||
185 | . = VSYSCALL_ADDR; | 187 | . = VSYSCALL_ADDR; |
186 | .vsyscall : AT(VLOAD(.vsyscall)) { | 188 | .vsyscall : AT(VLOAD(.vsyscall)) { |
189 | /* work around gold bug 13023 */ | ||
190 | __vsyscall_beginning_hack = .; | ||
187 | *(.vsyscall_0) | 191 | *(.vsyscall_0) |
188 | 192 | ||
189 | . = 1024; | 193 | . = __vsyscall_beginning_hack + 1024; |
190 | *(.vsyscall_1) | 194 | *(.vsyscall_1) |
191 | 195 | ||
192 | . = 2048; | 196 | . = __vsyscall_beginning_hack + 2048; |
193 | *(.vsyscall_2) | 197 | *(.vsyscall_2) |
194 | 198 | ||
195 | . = 4096; /* Pad the whole page. */ | 199 | . = __vsyscall_beginning_hack + 4096; /* Pad the whole page. */ |
196 | } :user =0xcc | 200 | } :user =0xcc |
197 | . = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE); | 201 | . = ALIGN(__vsyscall_0 + PAGE_SIZE, PAGE_SIZE); |
198 | 202 | ||