File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -395,6 +395,16 @@ func (c *Config) LDFlags() []string {
395
395
if c .Target .LinkerScript != "" {
396
396
ldflags = append (ldflags , "-T" , c .Target .LinkerScript )
397
397
}
398
+
399
+ if c .Options .ExtLDFlags != "" {
400
+ ext , err := shlex .Split (c .Options .ExtLDFlags )
401
+ if err != nil {
402
+ // if shlex can't split it, pass it as-is and let the external linker complain
403
+ ext = []string {c .Options .ExtLDFlags }
404
+ }
405
+ ldflags = append (ldflags , ext ... )
406
+ }
407
+
398
408
return ldflags
399
409
}
400
410
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ type Options struct {
56
56
Timeout time.Duration
57
57
WITPackage string // pass through to wasm-tools component embed invocation
58
58
WITWorld string // pass through to wasm-tools component embed -w option
59
+ ExtLDFlags string
59
60
}
60
61
61
62
// Verify performs a validation on the given options, raising an error if options are not valid.
Original file line number Diff line number Diff line change @@ -1388,6 +1388,7 @@ func main() {
1388
1388
cpuprofile := flag .String ("cpuprofile" , "" , "cpuprofile output" )
1389
1389
monitor := flag .Bool ("monitor" , false , "enable serial monitor" )
1390
1390
baudrate := flag .Int ("baudrate" , 115200 , "baudrate of serial monitor" )
1391
+ extLDFlags := flag .String ("extldflags" , "" , "additional flags to pass to external linker" )
1391
1392
1392
1393
// Internal flags, that are only intended for TinyGo development.
1393
1394
printIR := flag .Bool ("internal-printir" , false , "print LLVM IR" )
@@ -1503,6 +1504,7 @@ func main() {
1503
1504
Timeout : * timeout ,
1504
1505
WITPackage : witPackage ,
1505
1506
WITWorld : witWorld ,
1507
+ ExtLDFlags : * extLDFlags ,
1506
1508
}
1507
1509
if * printCommands {
1508
1510
options .PrintCommands = printCommand
You can’t perform that action at this time.
0 commit comments