]> Git Repo - linux.git/commitdiff
x86, relocs: ignore R_386_NONE in kernel relocation entries
authorTejun Heo <[email protected]>
Tue, 26 May 2009 05:42:40 +0000 (14:42 +0900)
committerH. Peter Anvin <[email protected]>
Tue, 26 May 2009 05:52:49 +0000 (22:52 -0700)
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 <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Ingo Molnar <[email protected]>
LKML-Reference: <4A1B8150[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
arch/x86/boot/compressed/relocs.c

index 857e492c571e05ac7714d4b54144acc9560110e1..bbeb0c3fbd90e7ba875c583ab3e2e57cca216714 100644 (file)
@@ -504,8 +504,11 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
                        if (sym->st_shndx == SHN_ABS) {
                                continue;
                        }
-                       if (r_type == R_386_PC32) {
-                               /* PC relative relocations don't need to be adjusted */
+                       if (r_type == R_386_NONE || r_type == R_386_PC32) {
+                               /*
+                                * NONE can be ignored and and PC relative
+                                * relocations don't need to be adjusted.
+                                */
                        }
                        else if (r_type == R_386_32) {
                                /* Visit relocations that need to be adjusted */
This page took 0.056678 seconds and 4 git commands to generate.