即使指定了“--32”,gcc汇编器似乎也使用x86_64

时间:2013-01-10 01:14:54

标签: linux kernel

我正在64位Linux主机上构建32位Linux内核。 (主机和目标上的版本2.6.9)。我正在做以下事情:

make ARCH=i386 CFLAGS='-m32 -Iinclude/asm/mach-default' ASFLAGS='-march=i386 --32' 

即使我为make指定了ASFLAGS,我仍然收到以下警告和错误:

  AS      usr/initramfs_data.o
  LD      usr/built-in.o
ld: warning: i386:x86-64 architecture of input file `usr/initramfs_data.o' is incompatible with i386 output

<snip>
  AS      arch/i386/kernel/entry.o
arch/i386/kernel/entry.S: Assembler messages:
arch/i386/kernel/entry.S:145: Error: suffix or operands invalid for `pushf'

entry.S:145处的代码是:

 pushfl                  # We get a different stack layout with call
                         # gates, which has to be cleaned up later..

任何想法如何确保AS使用的是i386(32位),而不是x86_64?

感谢。

1 个答案:

答案 0 :(得分:0)

对linux内核makefile的粗略检查似乎向我表明你应该使用AFLAGS,而不是ASFLAGS。我的顶级内核makefile的第647行说:

# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments