Skip to contentSkip to conversation

x86/purgatory: Use approprate -m64/-32 build flag for arch/x86/purgatory

PATCH New Vivek Goyal 1 participant 1 message Aug 20, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/purgatory: Use approprate -m64/-32 build flag for arch/x86/purgatory

Thomas reported that build of x86_64 kernel was failing for him. He is using 32bit tool chain.

Problem is that while compiling purgatory, I have not specified -m64 flag. And 32bit tool chain must be assuming -m32 by default.

Following is error message.

(mini) [~/work/linux-2.6] make
scripts/kconfig/conf --silentoldconfig Kconfig

  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      arch/x86/purgatory/purgatory.o

arch/x86/purgatory/purgatory.c:1:0: error: code model 'large' not supported in the 32 bit mode
make[1]: *** [arch/x86/purgatory/purgatory.o] Error 1
make: *** [archprepare] Error 2

Fix it by explicitly passing appropriate -m64/-m32 build flag for purgatory.

---
 arch/x86/purgatory/Makefile |    1 +
 1 file changed, 1 insertion(+)
arch/x86/purgatory/Makefile +1 -0
Index: linux-2.6/arch/x86/purgatory/Makefile
===================================================================
@@ -11,6 +11,7 @@ targets += purgatory.ro
 # sure how to relocate those. Like kexec-tools, use custom flags.
 
 KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
+KBUILD_CFLAGS += -m$(BITS)
 
 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
 		$(call if_changed,ld)