Skip to contentSkip to conversation

: cross-compiling x86_64 kernel on i386 user-space fails

PATCH In review Chris Clayton 5 participants 8 messages Nov 22, 2014 – Dec 1, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : cross-compiling x86_64 kernel on i386 user-space fails

Hi,

Commit e6023367d779060fddc9a52d1f474085b2b36298 broke building an x86_64 kernel in an i386. The change added a call to objdump but neglected to cater for cross-compiling.

The patch below fixes the problem for me. I see the commit is now in 3.14 and 3.17 -stable, so the patch needs to go there too.

CC Junjie Mao <[email protected]>
CC Kees Cook <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>

---

arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 renamed from arch/x86/boot/compressed/Makefile~ 2014-11-22 08:56:50.359706324 +0000 +1 -1
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)    := xz
 suffix-$(CONFIG_KERNEL_LZO)    := lzo
 suffix-$(CONFIG_KERNEL_LZ4)    := lz4
 
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell ${CROSS_COMPILE}objdump -h vmlinux | \
             perl $(srctree)/arch/x86/tools/calc_run_size.pl)
 quiet_cmd_mkpiggy = MKPIGGY $@
       cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Chris Clayton

Hi,

Yeah, next time make sure you actually CC people :-)

I've added them to CC now.

Quoted 5 lines

Commit e6023367d779060fddc9a52d1f474085b2b36298 broke building an x86_64 kernel in an i386. The change added a call to objdump but neglected to cater for cross-compiling.

The patch below fixes the problem for me. I see the commit is now in 3.14 and 3.17 -stable, so the patch needs to go there too.

in the commit message should help there.

Quoted 5 lines
CC Junjie Mao <[email protected]>
CC Kees Cook <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
Quoted 19 lines

---

arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 renamed from arch/x86/boot/compressed/Makefile~ 2014-11-22 08:56:50.359706324 +0000 +1 -2
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)    := xz
 suffix-$(CONFIG_KERNEL_LZO)    := lzo
 suffix-$(CONFIG_KERNEL_LZ4)    := lz4
 
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell ${CROSS_COMPILE}objdump -h vmlinux | \
             perl $(srctree)/arch/x86/tools/calc_run_size.pl)
 quiet_cmd_mkpiggy = MKPIGGY $@
       cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
Acked-by
#2 lore raw
Quoted 12 lines · Borislav Petkov
Quoted 1 line · Chris Clayton

Hi,

Yeah, next time make sure you actually CC people :-)

I've added them to CC now.

Quoted 5 lines

Commit e6023367d779060fddc9a52d1f474085b2b36298 broke building an x86_64 kernel in an i386. The change added a call to objdump but neglected to cater for cross-compiling.

The patch below fixes the problem for me. I see the commit is now in 3.14 and 3.17 -stable, so the patch needs to go there too.

Good catch, thanks!

Quoted 6 lines

in the commit message should help there.

Quoted 7 lines
Quoted 5 lines
CC Junjie Mao <[email protected]>
CC Kees Cook <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>

-Kees

Quoted 27 lines
Quoted 15 lines

---

arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 renamed from arch/x86/boot/compressed/Makefile~ 2014-11-22 08:56:50.359706324 +0000 +1 -2
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)    := xz
 suffix-$(CONFIG_KERNEL_LZO)    := lzo
 suffix-$(CONFIG_KERNEL_LZ4)    := lz4
 
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell ${CROSS_COMPILE}objdump -h vmlinux | \
             perl $(srctree)/arch/x86/tools/calc_run_size.pl)
 quiet_cmd_mkpiggy = MKPIGGY $@
       cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
 
--
Quoted 5 lines

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
Regards/Gruss,
Boris.

Sent from a fat crate under my desk. Formatting is fine. --

Signature · 2 lines
Kees Cook
Chrome OS Security
#3 lore raw
In reply to Borislav Petkov
Quoted 12 lines · Borislav Petkov
Quoted 1 line · Chris Clayton

Hi,

Yeah, next time make sure you actually CC people :-)

I've added them to CC now.

Quoted 5 lines

Commit e6023367d779060fddc9a52d1f474085b2b36298 broke building an x86_64 kernel in an i386. The change added a call to objdump but neglected to cater for cross-compiling.

The patch below fixes the problem for me. I see the commit is now in 3.14 and 3.17 -stable, so the patch needs to go there too.

That's not a specific problem of building x86_64 on i386. The missing cross compile prefix prevents any cross build of x86.

Quoted 20 lines

in the commit message should help there.

Quoted 5 lines
CC Junjie Mao <[email protected]>
CC Kees Cook <[email protected]>
CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
Quoted 7 lines

---

arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 renamed from arch/x86/boot/compressed/Makefile~ 2014-11-22 08:56:50.359706324 +0000 +0 -0
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)    := xz
 suffix-$(CONFIG_KERNEL_LZO)    := lzo
 suffix-$(CONFIG_KERNEL_LZ4)    := lz4
 
Quoted 2 lines

arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 suffix-$(CONFIG_KERNEL_XZ) := xz · line 79

Quoted 2 lines
arch/x86/boot/compressed/Makefile 2014-11-22 09:04:06.615693435 +0000 renamed from arch/x86/boot/compressed/Makefile~ 2014-11-22 08:56:50.359706324 +0000 +1 -1
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell ${CROSS_COMPILE}objdump -h vmlinux | \

While that works, this wants to be:

+RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \

I'll fix it up.

Thanks,

tglx

maintainer
#4 lore raw
Quoted 3 lines · Thomas Gleixner

While that works, this wants to be:

+RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \

Ah, true:

$ git grep OBJDUMP Makefile
Makefile:363:OBJDUMP            = $(CROSS_COMPILE)objdump
Makefile:420:export CPP AR NM STRIP OBJCOPY OBJDUMP
Makefile:1483:  $(OBJDUMP) -d vmlinux $$(find . -name '*.ko') | \

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#5 lore raw

[tip:x86/urgent] x86: Use $(OBJDUMP) instead of plain objdump

In reply to Chris Clayton
x86: Use $(OBJDUMP) instead of plain objdump
Commit-ID:  e2e68ae688b0a3766cd75aedf4ed4e39be402009
Gitweb:     http://git.kernel.org/tip/e2e68ae688b0a3766cd75aedf4ed4e39be402009
Author:     Chris Clayton <[email protected]>
AuthorDate: Sat, 22 Nov 2014 09:51:10 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 23 Nov 2014 21:21:53 +0100

x86: Use $(OBJDUMP) instead of plain objdump

commit e6023367d779 'x86, kaslr: Prevent .bss from overlaping initrd' broke the cross compile of x86. It added a objdump invocation, which invokes the host native objdump and ignores an active cross tool chain.

Use $(OBJDUMP) instead which takes the CROSS_COMPILE prefix into account.

[ tglx: Massage changelog and use $(OBJDUMP) ]

Fixes e6023367d779 'x86, kaslr: Prevent .bss from overlaping initrd'
Cc Junjie Mao <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/boot/compressed/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/Makefile +1 -1
index be1e07d..45abc36 100644
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)	:= xz
 suffix-$(CONFIG_KERNEL_LZO) 	:= lzo
 suffix-$(CONFIG_KERNEL_LZ4) 	:= lz4
 
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \
 	     perl $(srctree)/arch/x86/tools/calc_run_size.pl)
 quiet_cmd_mkpiggy = MKPIGGY $@
       cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
#6 lore raw

Re: [tip:x86/urgent] x86: Use $(OBJDUMP) instead of plain objdump

Hi,

Is it planned to get this fix through in time for release of 3.18? It appears to have been in -next for a week.

Chris

Quoted 47 lines · tip-bot for Chris Clayton
Commit-ID:  e2e68ae688b0a3766cd75aedf4ed4e39be402009
Gitweb:     http://git.kernel.org/tip/e2e68ae688b0a3766cd75aedf4ed4e39be402009
Author:     Chris Clayton <[email protected]>
AuthorDate: Sat, 22 Nov 2014 09:51:10 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 23 Nov 2014 21:21:53 +0100

x86: Use $(OBJDUMP) instead of plain objdump

commit e6023367d779 'x86, kaslr: Prevent .bss from overlaping initrd' broke the cross compile of x86. It added a objdump invocation, which invokes the host native objdump and ignores an active cross tool chain.

Use $(OBJDUMP) instead which takes the CROSS_COMPILE prefix into account.

[ tglx: Massage changelog and use $(OBJDUMP) ]

Fixes e6023367d779 'x86, kaslr: Prevent .bss from overlaping initrd'
Cc Junjie Mao <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc H. Peter Anvin <[email protected]>
---
 arch/x86/boot/compressed/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/Makefile +1 -1
index be1e07d..45abc36 100644
@@ -76,7 +76,7 @@ suffix-$(CONFIG_KERNEL_XZ)	:= xz
 suffix-$(CONFIG_KERNEL_LZO) 	:= lzo
 suffix-$(CONFIG_KERNEL_LZ4) 	:= lz4
 
-RUN_SIZE = $(shell objdump -h vmlinux | \
+RUN_SIZE = $(shell $(OBJDUMP) -h vmlinux | \
 	     perl $(srctree)/arch/x86/tools/calc_run_size.pl)
 quiet_cmd_mkpiggy = MKPIGGY $@
       cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false )
#7 lore raw

Re: [tip:x86/urgent] x86: Use $(OBJDUMP) instead of plain objdump

Quoted 2 lines · Chris Clayton

Is it planned to get this fix through in time for release of 3.18? It appears to have been in -next for a week.

Yes. I missed it for rc7, but its scheduled for 3.18 final.

Thanks,

tglx