我成功地为arm926ej-s创建了一个目标文件。
我正在使用在qemu上运行的debian arm。
arm-linux-gnueabi-gcc-4.4 -static -O -c -mcpu=arm926ej-s hello.c -o hello
root@at0012-ubuntu:/qemu-deb-squeeze/mnt/package# readelf -A hello
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "ARM926EJ-S"
Tag_CPU_arch: v5TEJ
Tag_ARM_ISA_use: Yes
Tag_THUMB_ISA_use: Thumb-1
Tag_FP_arch: VFPv3-D16
Tag_ABI_PCS_wchar_t: 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte
Tag_ABI_align_preserved: 8-byte, except leaf SP
Tag_ABI_enum_size: int
Tag_ABI_HardFP_use: SP and DP
Tag_ABI_optimization_goals: Prefer Speed
Tag_DIV_use: Not allowed
但是在Ubuntu中,如果我不带-c编译选项,它会为armv7创建可执行文件而不是这个:
那么如何编译适用于正确CPU的代码?
我尝试了以下命令:$ arm-linux-gnueabi-gcc-4.4 -static -mcpu=arm926ej-s hello.c -o hello
它会生成:
Tag_CPU_name: "7-A"
Tag_CPU_arch: v7