Commit dcca47f
main: add -ldflags='-extldflags=...' support
This matches upstream Go. Example:
$ go test -ldflags='-extldflags=-foobar' os
# os.test
/usr/local/go1.23.1/pkg/tool/linux_arm64/link: running gcc failed: exit status 1
/usr/bin/gcc -s -o $WORK/b001/os.test -rdynamic /tmp/go-link-914594215/go.o /tmp/go-link-914594215/000000.o /tmp/go-link-914594215/000001.o /tmp/go-link-914594215/000002.o /tmp/go-link-914594215/000003.o /tmp/go-link-914594215/000004.o /tmp/go-link-914594215/000005.o /tmp/go-link-914594215/000006.o /tmp/go-link-914594215/000007.o /tmp/go-link-914594215/000008.o /tmp/go-link-914594215/000009.o /tmp/go-link-914594215/000010.o /tmp/go-link-914594215/000011.o /tmp/go-link-914594215/000012.o /tmp/go-link-914594215/000013.o /tmp/go-link-914594215/000014.o /tmp/go-link-914594215/000015.o /tmp/go-link-914594215/000016.o /tmp/go-link-914594215/000017.o /tmp/go-link-914594215/000018.o /tmp/go-link-914594215/000019.o /tmp/go-link-914594215/000020.o /tmp/go-link-914594215/000021.o -O2 -g -O2 -g -lresolv -O2 -g -lpthread -foobar
gcc: error: unrecognized command-line option ‘-foobar’
FAIL os [build failed]
FAIL
And TinyGo, with this patch:
$ tinygo test -ldflags='-extldflags=-foobar' os
FAIL os 0.000s
ld.lld: error: unknown argument '-foobar'
Also note that Go doesn't support the `-extldflags` directly (which was
previously the case with TinyGo):
$ go test -extldflags='-foobar' os
flag provided but not defined: -extldflags
[...]1 parent 892efae commit dcca47f
1 file changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1304 | 1304 | | |
1305 | 1305 | | |
1306 | 1306 | | |
1307 | | - | |
| 1307 | + | |
1308 | 1308 | | |
1309 | 1309 | | |
1310 | 1310 | | |
| 1311 | + | |
1311 | 1312 | | |
1312 | 1313 | | |
1313 | | - | |
| 1314 | + | |
1314 | 1315 | | |
1315 | 1316 | | |
1316 | 1317 | | |
1317 | | - | |
| 1318 | + | |
1318 | 1319 | | |
1319 | | - | |
| 1320 | + | |
1320 | 1321 | | |
1321 | 1322 | | |
1322 | 1323 | | |
| |||
1388 | 1389 | | |
1389 | 1390 | | |
1390 | 1391 | | |
1391 | | - | |
1392 | 1392 | | |
1393 | 1393 | | |
1394 | 1394 | | |
| |||
1449 | 1449 | | |
1450 | 1450 | | |
1451 | 1451 | | |
1452 | | - | |
| 1452 | + | |
1453 | 1453 | | |
1454 | 1454 | | |
1455 | 1455 | | |
| |||
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
1507 | | - | |
| 1507 | + | |
1508 | 1508 | | |
1509 | 1509 | | |
1510 | 1510 | | |
| |||
0 commit comments