升级GCC至8.5.0后zLinux编译报错(汇编行尾冗余)如何解决?
GCC 8.5.0升级后zLinux上汇编器报错(行尾垃圾字符
,3/,4) 在zLinux(s390x架构)把GCC从8.2.1升到8.5.0后,之前能正常编译的代码突然出现大量汇编器错误,全是提示行尾有,3、,4这类垃圾字符。以下是针对性的解决方向:
检查汇编器版本兼容性
GCC 8.5.0在s390x上生成的汇编语法可能有更新,要是系统里的汇编器(as)版本太老,就认不出新语法。先跑as --version查看当前版本,GCC 8.x系列在s390x上一般要求binutils 2.30以上,版本不够就升级binutils。临时降低优化级别
报错出现在-O3优化下,大概率是GCC 8.5.0的O3优化在s390x上生成了有问题的汇编代码。试试把编译参数里的-O3改成-O2或-O1,重新编译看能不能解决。要是可行,还能单独给报错的文件调整优化选项,比如给buffer.cc用-O2,其他文件保留-O3。指定正确的s390x架构参数
GCC 8.5.0可能调整了架构默认值,试试显式添加架构选项,比如-march=z14(根据你的服务器型号选对应架构),保证生成的汇编指令和硬件、汇编器兼容。也检查下有没有-mtune相关选项,改成匹配当前硬件的值。排查GCC bug或代码问题
要是上面的方法都没用,可能是GCC 8.5.0在s390x上的bug。可以查GCC的bug库,看有没有类似的汇编生成错误报告和修复补丁。也可以临时回退到GCC 8.2.1,同时排查代码里有没有依赖旧GCC行为的非标准语法(比如内联汇编),这类代码升级后最容易出问题。
原编译命令及报错信息
Error executing command: g++ src/buffer.cc -c -Wno-deprecated-declarations -Wunused -Wno-unused-result -Werror -Wparentheses -DV8_REVERSE_JSARGS -std=c++17 -Wno-register -DUSE_KERBEROS -DUSE_LDAP -pedantic-errors -g -O3 -I v8 -I v8/include -I openssl/include -I zlib -I snappy/build -I snappy -I brotli/c/include -I openldap/include -I krb5/src/include -I . -o out/s390x.lin.release/obj/buffer.o /tmp/ccClzTUm.s: Assembler messages: /tmp/ccClzTUm.s:1935: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:10670: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:10875: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:21852: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:21862: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:21911: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:21912: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:22141: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:22151: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:22200: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:22201: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:24080: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:24084: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:25733: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:25737: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:26008: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:26010: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:50715: Error: junk at end of line: `,3' /tmp/ccClzTUm.s:62134: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:62138: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:62818: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:62819: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:62955: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:62956: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:63039: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:63043: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:63174: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:63175: Error: junk at end of line: `,4' /tmp/ccClzTUm.s:63716: Error: junk at end of line: `,3'
内容的提问来源于stack exchange,提问作者Alex
相关产品推荐
相关产品推荐

