diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-26 01:42:40 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-05-26 01:52:49 -0400 |
commit | 46176b4f6bac19454b7b5c35f68594b85850a600 (patch) | |
tree | c67571802f614aa361726d513e9a8fcaee603fb1 /arch/x86/boot/compressed/relocs.c | |
parent | 71c9d8b68b299bef614afc7907393564a9f1476f (diff) |
x86, relocs: ignore R_386_NONE in kernel relocation entries
For relocatable 32bit kernels, boot/compressed/relocs.c processes
relocation entries in the kernel image and appends it to the kernel
image such that boot/compressed/head_32.S can relocate the kernel.
The kernel image is one statically linked object and only uses two
relocation types - R_386_PC32 and R_386_32, of the two only the latter
needs massaging during kernel relocation and thus handled by relocs.
R_386_PC32 is ignored and all other relocation types are considered
error.
When the target of a relocation resides in a discarded section,
binutils doesn't throw away the relocation record but nullifies it by
changing it to R_386_NONE, which unfortunately makes relocs fail.
The problem was triggered by yet out-of-tree x86 stack unwind patches
but given the binutils behavior, ignoring R_386_NONE is the right
thing to do.
The problem has been tracked down to binutils behavior by Jan Beulich.
[ Impact: fix build with certain binutils by ignoring R_386_NONE ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Jan Beulich <JBeulich@novell.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <4A1B8150.40702@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/boot/compressed/relocs.c')
-rw-r--r-- | arch/x86/boot/compressed/relocs.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c index 857e492c571e..bbeb0c3fbd90 100644 --- a/arch/x86/boot/compressed/relocs.c +++ b/arch/x86/boot/compressed/relocs.c | |||
@@ -504,8 +504,11 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym)) | |||
504 | if (sym->st_shndx == SHN_ABS) { | 504 | if (sym->st_shndx == SHN_ABS) { |
505 | continue; | 505 | continue; |
506 | } | 506 | } |
507 | if (r_type == R_386_PC32) { | 507 | if (r_type == R_386_NONE || r_type == R_386_PC32) { |
508 | /* PC relative relocations don't need to be adjusted */ | 508 | /* |
509 | * NONE can be ignored and and PC relative | ||
510 | * relocations don't need to be adjusted. | ||
511 | */ | ||
509 | } | 512 | } |
510 | else if (r_type == R_386_32) { | 513 | else if (r_type == R_386_32) { |
511 | /* Visit relocations that need to be adjusted */ | 514 | /* Visit relocations that need to be adjusted */ |