c - SGABIOS 编译错误

标签 c gcc assembly compiler-errors binaryfiles

我正在尝试构建 SGABIOS在我的 Macbook Pro 上。不幸的是,我遇到了一些我不熟悉的奇怪编译错误。当我尝试运行 make 时,这是我得到的输出:

Ajax-2:sgabios-read-only dash$ make
rm -f .depend
cc -E -M -Wall -Os -m32 -nostdlib  sgabios.S >.tmpdepend && mv .tmpdepend .depend
make clean
rm -f sgabios.bin csum8  sgabios.o *.elf *.srec *.com version.h
touch sgabios.S
cc -Wall -Os -m32 -nostdlib -DBUILD_DATE="\"Fri Aug 31 19:10:03 UTC 2012\"" -DBUILD_SHORT_DATE="\"08/31/12\"" -DBUILD_HOST="\"Ajax-2.local\"" -DBUILD_USER="\"dash\""   -c -o sgabios.o sgabios.S
sgabios.S:24:Unknown pseudo-op: .type
sgabios.S:24:Rest of line ignored. 1st junk character valued 95 (_).
sgabios.S:30:Unknown pseudo-op: .size
sgabios.S:30:Rest of line ignored. 1st junk character valued 95 (_).
sgabios.S:33:Unknown pseudo-op: .type
sgabios.S:33:Rest of line ignored. 1st junk character valued 108 (l).
sgabios.S:156:Alignment too large: 15. assumed.
make: *** [sgabios.o] Error 1

我的GCC版本信息如下:

Ajax-2:sgabios-read-only dash$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.1~22/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

我进行了大量的谷歌搜索和猴子测试,但似乎没有任何效果。我也在 cygwin 中尝试了整个困惑,我得到了几乎相同的东西。为了您的引用,我上传了最新版本的一些文件:

sgabios.S

sgabios.h

Makefile

更新:在 cygwin 中发布的 make 输出:

dash@Ajax_virtual ~/sgabios-read-only
$ make
rm -f .depend
cc -E -M -Wall -Os -m32 -nostdlib  sgabios.S >.tmpdepend && mv .tmpdepend .depen                                    d
make clean
make[1]: Entering directory `/home/dash/sgabios-read-only'
rm -f sgabios.bin csum8  sgabios.o *.elf *.srec *.com version.h
make[1]: Leaving directory `/home/dash/sgabios-read-only'
touch sgabios.S
cc -Wall -Os -m32 -nostdlib -DBUILD_DATE="\"Fri, Aug 31, 2012 10:14:21 PM\"" -DB                                    UILD_SHORT_DATE="\"08/31/12\"" -DBUILD_HOST="\"Ajax_virtual\"" -DBUILD_USER="\"d                                    ash\""   -c -o sgabios.o sgabios.S
sgabios.S: Assembler messages:
sgabios.S:22: Error: junk at end of line, first unrecognized character is `"'
sgabios.S:24: Warning: .type pseudo-op used outside of .def/.endef ignored.
sgabios.S:24: Error: junk at end of line, first unrecognized character is `_'
sgabios.S:30: Warning: .size pseudo-op used outside of .def/.endef ignored.
sgabios.S:30: Error: junk at end of line, first unrecognized character is `_'
sgabios.S:33: Warning: .type pseudo-op used outside of .def/.endef ignored.
sgabios.S:33: Error: junk at end of line, first unrecognized character is `l'
<builtin>: recipe for target `sgabios.o' failed
make: *** [sgabios.o] Error 1

最佳答案

这是因为汇编文件是为GNU as写的但 OS X 不使用它而是使用它自己的汇编程序。

此外,根据documentation on the .type directive GNU as 中指令的含义取决于目标平台。链接文件中的指令仅对在 linux(和其他 unices)上使用的 ELF 目标有效,但 cygwin 是一个 COFF 目标。

关于c - SGABIOS 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12221362/

相关文章:

c函数返回数组并将数组与另一个数组进行比较

c - 将 4x4 键盘矩阵与 Atmega32 连接

c++ - std::async 与 gcc 7.2 需要 pthread 链接选项

c - 输出打印扫描功能两次,而不是一次。需要修复

c - 如何运行混合语言程序

windows - Windows 8 x64 上的汇编代码

c - 使用opnet进行协同仿真的问题

mysql - 将 MySQL 与不同的 glibc 链接

assembly - 关于多核CPU的x86 LOCK问题

php - 将 C 语言转换为 PHP 以获得 CRC16 函数