gpt4 book ai didi

linux - 即使指定了 '--32',gcc 汇编程序似乎也使用 x86_64

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:10:58 24 4
gpt4 key购买 nike

我正在 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?

谢谢。

最佳答案

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

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

关于linux - 即使指定了 '--32',gcc 汇编程序似乎也使用 x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14249311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com