Skip to contentSkip to conversation

x86: relocs is only used with 32bit

PATCH In review Yinghai Lu 3 participants 4 messages Mar 11, 2009 – Mar 13, 2009 x86

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 x86: relocs is only used with 32bit

Impact: cleanup

those lines is not needed for 64bit

---
 arch/x86/boot/compressed/Makefile |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/boot/compressed/Makefile +1 -2
Index: linux-2.6/arch/x86/boot/compressed/Makefile
===================================================================
@@ -26,6 +26,7 @@ OBJCOPYFLAGS_vmlinux.bin :=  -R .comment
 $(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 
+ifeq ($(CONFIG_X86_32),y)
 
 targets += vmlinux.bin.all vmlinux.relocs relocs
 hostprogs-$(CONFIG_X86_32) += relocs
@@ -42,8 +43,6 @@ quiet_cmd_relocbin = BUILD   $@
 $(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE
 	$(call if_changed,relocbin)
 
-ifeq ($(CONFIG_X86_32),y)
-
 ifdef CONFIG_RELOCATABLE
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
 	$(call if_changed,gzip)
#1 lore raw

Hi Yinghai,

In general I prefer minimizing the conditional sections rather than maximizing them. If nothing else, it catches errors earlier that way, and makes it easier to eventually eliminate them entirely.

-hpa

Quoted 31 lines · Yinghai Lu

Impact: cleanup

those lines is not needed for 64bit

---
 arch/x86/boot/compressed/Makefile |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux-2.6/arch/x86/boot/compressed/Makefile
===================================================================

arch/x86/boot/compressed/Makefile +1 -2
@@ -26,6 +26,7 @@ OBJCOPYFLAGS_vmlinux.bin :=  -R .comment
 $(obj)/vmlinux.bin: vmlinux FORCE
 	$(call if_changed,objcopy)
 
+ifeq ($(CONFIG_X86_32),y)
 
 targets += vmlinux.bin.all vmlinux.relocs relocs
 hostprogs-$(CONFIG_X86_32) += relocs
@@ -42,8 +43,6 @@ quiet_cmd_relocbin = BUILD   $@
 $(obj)/vmlinux.bin.all: $(vmlinux.bin.all-y) FORCE
 	$(call if_changed,relocbin)
 
-ifeq ($(CONFIG_X86_32),y)
-
 ifdef CONFIG_RELOCATABLE
 $(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin.all FORCE
 	$(call if_changed,gzip)
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#2 lore raw
Quoted 5 lines · H. Peter Anvin

Hi Yinghai,

In general I prefer minimizing the conditional sections rather than maximizing them. If nothing else, it catches errors earlier that way, and makes it easier to eventually eliminate them entirely.

Makes sense. Although in this case that rule appears like it can't even execute on x86_64.

The architectural differences result in different tradeoffs so the relocation design is completely different on x86_64 and x86_32.

On x86_64 we just change the underlying page tables to point at different physical addresses and have a fixed virtual address. Since x86_64 is best with short (< 2GB) offsets that is a fairly optimal.

On x86_32 where address space is precious and it doesn't really matter where the kernel lives we take a 5% or so size penalty to hold relocations in the binary and update the kernel at boot time so everything assumes we run at the loaded address.

With the result that we need a link time helper on x86_32 and not on x86_64.

Eric

#3 lore raw
Quoted 8 lines · Eric W. Biederman
Quoted 4 lines

In general I prefer minimizing the conditional sections rather than maximizing them. If nothing else, it catches errors earlier that way, and makes it easier to eventually eliminate them entirely.

Makes sense. Although in this case that rule appears like it can't even execute on x86_64.

That's fine. This is the same reason why it's better to have
if () { ... } than #ifdef as long as the condition can be statically determined -- at least this way make will complain about a syntax error.

-hpa