谷动谷力

 找回密码
 立即注册
查看: 1066|回复: 0
打印 上一主题 下一主题
收起左侧

【openwrt】openwrt CC 编译错误 Error: invalid instruction suffix for `p...

[复制链接]
跳转到指定楼层
楼主
发表于 2023-7-5 17:20:25 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 sunsili 于 2023-7-13 16:48 编辑

【openwrt】openwrt CC 编译xz-5.2.1错误 Error: invalid instruction suffix for `push'解决方法

开发环境:
源码:openwrt_CC(Chaos Calmer, r49396) 15.05
开发主机:WSL ubuntu LTS 16.04

出错文件:
crc32_x86.S
crc64_x86.S

出错提示:
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/include -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/usr/include -O2 -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/include -I/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/host/usr/include -MT liblzma_la-crc32_x86.lo -MD -MP -MF .deps/liblzma_la-crc32_x86.Tpo -c check/crc32_x86.S  -fPIC -DPIC -o .libs/liblzma_la-crc32_x86.o
check/crc32_x86.S: Assembler messages:
check/crc32_x86.S:96: Error: invalid instruction suffix for `push'
check/crc32_x86.S:97: Error: invalid instruction suffix for `push'
check/crc32_x86.S:98: Error: invalid instruction suffix for `push'
check/crc32_x86.S:99: Error: invalid instruction suffix for `push'
check/crc32_x86.S:132: Error: relocated field and relocation type differ in signedness
check/crc32_x86.S:265: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:266: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:267: Error: invalid instruction suffix for `pop'
check/crc32_x86.S:268: Error: invalid instruction suffix for `pop'
Makefile:936: recipe for target 'liblzma_la-crc32_x86.lo' failed
make[8]: *** [liblzma_la-crc32_x86.lo] Error 1
make[8]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:1550: recipe for target 'all-recursive' failed
make[7]: *** [all-recursive] Error 1
make[7]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:419: recipe for target 'all-recursive' failed
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src'
Makefile:612: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:479: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:24: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built' failed
make[3]: *** [/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built] Error 2
make[3]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/xz'
tools/Makefile:122: recipe for target 'tools/xz/compile' failed
make[2]: *** [tools/xz/compile] Error 2
make[2]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
tools/Makefile:121: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy' failed
make[1]: *** [/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2
make[1]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
/home/fan/openwrt_CC_mt76xx_omj_source/include/toplevel.mk:181: recipe for target 'world' failed
make: *** [world] Error 2


原因:
错误原因是,在64位系统和32位系统的as命令对于某些汇编指令的处理支持不一样造成的。在文件crc32_x86.S中,包含指令:pushl  %ebp,该指令在64位系统下就编译不过。

解决方法:
./build_dir/host/xz-5.2.1/src/liblzma/check/crc32_x86.S中,在代码头部添加.code32
vim ./build_dir/host/xz-5.2.1/src/liblzma/check/crc32_x86.S同样的编译crc64_x86.S出现同样的问题:
check/crc64_x86.S: Assembler messages:
check/crc64_x86.S:86: Error: invalid instruction suffix for `push'
check/crc64_x86.S:87: Error: invalid instruction suffix for `push'
check/crc64_x86.S:88: Error: invalid instruction suffix for `push'
check/crc64_x86.S:89: Error: invalid instruction suffix for `push'
check/crc64_x86.S:123: Error: relocated field and relocation type differ in signedness
check/crc64_x86.S:248: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:249: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:250: Error: invalid instruction suffix for `pop'
check/crc64_x86.S:251: Error: invalid instruction suffix for `pop'
Makefile:943: recipe for target 'liblzma_la-crc64_x86.lo' failedMakefile:936: recipe for target 'liblzma_la-crc32_x86.lo' failed
make[8]: *** [liblzma_la-crc32_x86.lo] Error 1
make[8]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:1550: recipe for target 'all-recursive' failed
make[7]: *** [all-recursive] Error 1
make[7]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src/liblzma'
Makefile:419: recipe for target 'all-recursive' failed
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/src'
Makefile:612: recipe for target 'all-recursive' failed
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:479: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1'
Makefile:24: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built' failed
make[3]: *** [/home/fan/openwrt_CC_mt76xx_omj_source/build_dir/host/xz-5.2.1/.built] Error 2
make[3]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source/tools/xz'
tools/Makefile:122: recipe for target 'tools/xz/compile' failed
make[2]: *** [tools/xz/compile] Error 2
make[2]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
tools/Makefile:121: recipe for target '/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy' failed
make[1]: *** [/home/fan/openwrt_CC_mt76xx_omj_source/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.tools_install_yynyynynynyyyyyyyyynyyyyyyyyynyyyyynnyyynnyynnnyy] Error 2
make[1]: Leaving directory '/home/fan/openwrt_CC_mt76xx_omj_source'
/home/fan/openwrt_CC_mt76xx_omj_source/include/toplevel.mk:181: recipe for target 'world' failed
make: *** [world] Error 2

同样解决方法:
crc64_x86.S中,在代码头部添加.code32
vim ./build_dir/host/xz-5.2.1/src/liblzma/check/crc64_x86.S

同样修改Makefile 使用32位编译
vim ./build_dir/host/xz-5.2.1/src/liblzma/Makefile
install_sh_DATA = $(install_sh) -c -m m32 #644



+10

本帖被以下淘专辑推荐:

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|深圳市光明谷科技有限公司|光明谷商城|Sunshine Silicon Corpporation ( 粤ICP备14060730号|Sitemap

GMT+8, 2024-12-27 07:31 , Processed in 0.084074 second(s), 44 queries .

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表