Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$(TARGET_CFLAGS) causes build to fail for ramips #31

Closed
cpswan opened this issue Nov 27, 2024 · 0 comments · Fixed by #32
Closed

$(TARGET_CFLAGS) causes build to fail for ramips #31

cpswan opened this issue Nov 27, 2024 · 0 comments · Fixed by #32
Assignees
Labels
bug Something isn't working

Comments

@cpswan
Copy link
Member

cpswan commented Nov 27, 2024

Describe the bug

#26 introduced the $(TARGET_CFLAGS) to -DMAKE_C_FLAGS to prevent numerous someone does not honour COPTS correctly warnings during builds.

This has broken building for ramips targets (e.g. GL.iNet MT1300):

[  6%] Building C object _deps/mbedtls-build/library/CMakeFiles/mbedcrypto.dir/bignum_core.c.o
{standard input}: Assembler messages:
{standard input}:1110: Error: invalid operands `lw $10,16($sp)'
.
<snip>
.
{standard input}:1261: Error: invalid operands `sw $10,16($sp)'

Steps to reproduce

  1. First I install the GL.Inet SDK and download the ramips platform (or an equivalent OpenWrt SDK)
  2. Then I follow the steps in fix: Working Makefile for csshnpd on MIPS #14 to configure feeds and update CMake
  3. And then I make V=s package/csshnpd/compile

Expected behavior

The build should complete without compiler errors.

👀 @XavierChanth @JeremyTubongbanua so that you're aware, though I'm seeing this as an OpenWrt thing rather than C sshnpd or at_c

Additional context

The build logs show this being passed for C_FLAGS:

CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -iremap/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/build_dir/target-mipsel_24kc_musl/csshnpd-c0.2.4:csshnpd-c0.2.4 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/staging_dir/target-mipsel_24kc_musl/usr/include -I/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/staging_dir/target-mipsel_24kc_musl/include -I/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/usr/include -I/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include/fortify -I/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/include "

I strongly suspect that mips16 is the problem here, and it probably should not be passed along with -mips32r2 -mtune=24kc

If I pass -fhonour-copts in place of $(TARGET_CFLAGS) then it's possible to get a good build with no warnings.

Full log from failed build step:

[  6%] Building C object _deps/mbedtls-build/library/CMakeFiles/mbedcrypto.dir/bignum_core.c.o
{standard input}: Assembler messages:
{standard input}:1110: Error: invalid operands `lw $10,16($sp)'
{standard input}:1111: Error: invalid operands `lw $11,8($sp)'
{standard input}:1112: Error: invalid operands `lw $12,4($sp)'
{standard input}:1113: Error: invalid operands `lw $13,24($sp)'
{standard input}:1114: Error: invalid operands `lw $14,0($10)'
{standard input}:1115: Error: invalid operands `multu $13,$14'
{standard input}:1116: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1117: Error: invalid operands `mflo $14'
{standard input}:1118: Error: invalid operands `mfhi $9'
{standard input}:1119: Error: invalid operands `addu $14,$12,$14'
{standard input}:1120: Error: invalid operands `lw $15,0($11)'
{standard input}:1121: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1122: Error: invalid operands `addu $15,$14,$15'
{standard input}:1123: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1124: Error: invalid operands `addu $12,$12,$9'
{standard input}:1125: Error: invalid operands `sw $15,0($11)'
{standard input}:1126: Error: invalid operands `addu $12,$12,$14'
{standard input}:1127: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1128: Error: invalid operands `lw $14,0($10)'
{standard input}:1129: Error: invalid operands `multu $13,$14'
{standard input}:1130: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1131: Error: invalid operands `mflo $14'
{standard input}:1132: Error: invalid operands `mfhi $9'
{standard input}:1133: Error: invalid operands `addu $14,$12,$14'
{standard input}:1134: Error: invalid operands `lw $15,0($11)'
{standard input}:1135: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1136: Error: invalid operands `addu $15,$14,$15'
{standard input}:1137: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1138: Error: invalid operands `addu $12,$12,$9'
{standard input}:1139: Error: invalid operands `sw $15,0($11)'
{standard input}:1140: Error: invalid operands `addu $12,$12,$14'
{standard input}:1141: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1142: Error: invalid operands `lw $14,0($10)'
{standard input}:1143: Error: invalid operands `multu $13,$14'
{standard input}:1144: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1145: Error: invalid operands `mflo $14'
{standard input}:1146: Error: invalid operands `mfhi $9'
{standard input}:1147: Error: invalid operands `addu $14,$12,$14'
{standard input}:1148: Error: invalid operands `lw $15,0($11)'
{standard input}:1149: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1150: Error: invalid operands `addu $15,$14,$15'
{standard input}:1151: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1152: Error: invalid operands `addu $12,$12,$9'
{standard input}:1153: Error: invalid operands `sw $15,0($11)'
{standard input}:1154: Error: invalid operands `addu $12,$12,$14'
{standard input}:1155: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1156: Error: invalid operands `lw $14,0($10)'
{standard input}:1157: Error: invalid operands `multu $13,$14'
{standard input}:1158: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1159: Error: invalid operands `mflo $14'
{standard input}:1160: Error: invalid operands `mfhi $9'
{standard input}:1161: Error: invalid operands `addu $14,$12,$14'
{standard input}:1162: Error: invalid operands `lw $15,0($11)'
{standard input}:1163: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1164: Error: invalid operands `addu $15,$14,$15'
{standard input}:1165: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1166: Error: invalid operands `addu $12,$12,$9'
{standard input}:1167: Error: invalid operands `sw $15,0($11)'
{standard input}:1168: Error: invalid operands `addu $12,$12,$14'
{standard input}:1169: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1170: Error: invalid operands `lw $14,0($10)'
{standard input}:1171: Error: invalid operands `multu $13,$14'
{standard input}:1172: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1173: Error: invalid operands `mflo $14'
{standard input}:1174: Error: invalid operands `mfhi $9'
{standard input}:1175: Error: invalid operands `addu $14,$12,$14'
{standard input}:1176: Error: invalid operands `lw $15,0($11)'
{standard input}:1177: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1178: Error: invalid operands `addu $15,$14,$15'
{standard input}:1179: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1180: Error: invalid operands `addu $12,$12,$9'
{standard input}:1181: Error: invalid operands `sw $15,0($11)'
{standard input}:1182: Error: invalid operands `addu $12,$12,$14'
{standard input}:1183: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1184: Error: invalid operands `lw $14,0($10)'
{standard input}:1185: Error: invalid operands `multu $13,$14'
{standard input}:1186: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1187: Error: invalid operands `mflo $14'
{standard input}:1188: Error: invalid operands `mfhi $9'
{standard input}:1189: Error: invalid operands `addu $14,$12,$14'
{standard input}:1190: Error: invalid operands `lw $15,0($11)'
{standard input}:1191: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1192: Error: invalid operands `addu $15,$14,$15'
{standard input}:1193: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1194: Error: invalid operands `addu $12,$12,$9'
{standard input}:1195: Error: invalid operands `sw $15,0($11)'
{standard input}:1196: Error: invalid operands `addu $12,$12,$14'
{standard input}:1197: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1198: Error: invalid operands `lw $14,0($10)'
{standard input}:1199: Error: invalid operands `multu $13,$14'
{standard input}:1200: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1201: Error: invalid operands `mflo $14'
{standard input}:1202: Error: invalid operands `mfhi $9'
{standard input}:1203: Error: invalid operands `addu $14,$12,$14'
{standard input}:1204: Error: invalid operands `lw $15,0($11)'
{standard input}:1205: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1206: Error: invalid operands `addu $15,$14,$15'
{standard input}:1207: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1208: Error: invalid operands `addu $12,$12,$9'
{standard input}:1209: Error: invalid operands `sw $15,0($11)'
{standard input}:1210: Error: invalid operands `addu $12,$12,$14'
{standard input}:1211: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1212: Error: invalid operands `lw $14,0($10)'
{standard input}:1213: Error: invalid operands `multu $13,$14'
{standard input}:1214: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1215: Error: invalid operands `mflo $14'
{standard input}:1216: Error: invalid operands `mfhi $9'
{standard input}:1217: Error: invalid operands `addu $14,$12,$14'
{standard input}:1218: Error: invalid operands `lw $15,0($11)'
{standard input}:1219: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1220: Error: invalid operands `addu $15,$14,$15'
{standard input}:1221: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1222: Error: invalid operands `addu $12,$12,$9'
{standard input}:1223: Error: invalid operands `sw $15,0($11)'
{standard input}:1224: Error: invalid operands `addu $12,$12,$14'
{standard input}:1225: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1226: Error: invalid operands `sw $12,4($sp)'
{standard input}:1227: Error: invalid operands `sw $11,8($sp)'
{standard input}:1228: Error: invalid operands `sw $10,16($sp)'
{standard input}:1241: Error: invalid operands `lw $10,16($sp)'
{standard input}:1242: Error: invalid operands `lw $11,8($sp)'
{standard input}:1243: Error: invalid operands `lw $12,4($sp)'
{standard input}:1244: Error: invalid operands `lw $13,24($sp)'
{standard input}:1245: Error: invalid operands `lw $14,0($10)'
{standard input}:1246: Error: invalid operands `multu $13,$14'
{standard input}:1247: Error: unrecognized opcode `addi $10,$10,4'
{standard input}:1248: Error: invalid operands `mflo $14'
{standard input}:1249: Error: invalid operands `mfhi $9'
{standard input}:1250: Error: invalid operands `addu $14,$12,$14'
{standard input}:1251: Error: invalid operands `lw $15,0($11)'
{standard input}:1252: Error: invalid operands `sltu $12,$14,$12'
{standard input}:1253: Error: invalid operands `addu $15,$14,$15'
{standard input}:1254: Error: invalid operands `sltu $14,$15,$14'
{standard input}:1255: Error: invalid operands `addu $12,$12,$9'
{standard input}:1256: Error: invalid operands `sw $15,0($11)'
{standard input}:1257: Error: invalid operands `addu $12,$12,$14'
{standard input}:1258: Error: unrecognized opcode `addi $11,$11,4'
{standard input}:1259: Error: invalid operands `sw $12,4($sp)'
{standard input}:1260: Error: invalid operands `sw $11,8($sp)'
{standard input}:1261: Error: invalid operands `sw $10,16($sp)'
make[5]: *** [_deps/mbedtls-build/library/CMakeFiles/mbedcrypto.dir/build.make:188: _deps/mbedtls-build/library/CMakeFiles/mbedcrypto.dir/bignum_core.c.o] Error 1
make[5]: Leaving directory '/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/build_dir/target-mipsel_24kc_musl/csshnpd-c0.2.4'
make[4]: *** [CMakeFiles/Makefile2:1019: _deps/mbedtls-build/library/CMakeFiles/mbedcrypto.dir/all] Error 2
make[4]: Leaving directory '/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/build_dir/target-mipsel_24kc_musl/csshnpd-c0.2.4'
make[3]: *** [Makefile:136: all] Error 2
make[3]: Leaving directory '/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/build_dir/target-mipsel_24kc_musl/csshnpd-c0.2.4'
make[2]: *** [Makefile:56: /home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/build_dir/target-mipsel_24kc_musl/csshnpd-c0.2.4/.built] Error 2
make[2]: Leaving directory '/home/chris/git/github.com/atsign-foundation/Atsign_OpenWRT_packages/packages/csshnpd'
time: package/feeds/atsign/csshnpd/compile#10.06#4.58#16.73
make[1]: *** [package/Makefile:113: package/feeds/atsign/csshnpd/compile] Error 2
make[1]: Leaving directory '/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips'
make: *** [/home/chris/git/github.com/gl-inet/sdk/sdk/1907/ramips/include/toplevel.mk:220: package/csshnpd/compile] Error 2
@cpswan cpswan added the bug Something isn't working label Nov 27, 2024
@cpswan cpswan self-assigned this Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant