aboutsummaryrefslogtreecommitdiffhomepage
path: root/builder
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-10-07 23:21:11 +0200
committerRon Evans <[email protected]>2022-10-13 18:57:49 +0200
commit2072d1bb5ce05161ae4a52401cbcd09a23e7e9db (patch)
treefc42a93dd51b5df00d4f50e6ee8883526178a3e1 /builder
parent636a151ffe99487240b4208948ec5a4e621c463c (diff)
downloadtinygo-2072d1bb5ce05161ae4a52401cbcd09a23e7e9db.tar.gz
tinygo-2072d1bb5ce05161ae4a52401cbcd09a23e7e9db.zip
main: print ldflags including ThinLTO flags with -x
The -x flag prints commands as they are executed. Unfortunately, for the link command, they were printed too early: before the ThinLTO flags were added. This is somewhat confusing while debugging.
Diffstat (limited to 'builder')
-rw-r--r--builder/build.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/builder/build.go b/builder/build.go
index 2008c897b..478d8a733 100644
--- a/builder/build.go
+++ b/builder/build.go
@@ -738,9 +738,6 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
}
ldflags = append(ldflags, dependency.result)
}
- if config.Options.PrintCommands != nil {
- config.Options.PrintCommands(config.Target.Linker, ldflags...)
- }
if config.UseThinLTO() {
ldflags = append(ldflags, "-mllvm", "-mcpu="+config.CPU())
if config.GOOS() == "windows" {
@@ -772,6 +769,9 @@ func Build(pkgName, outpath string, config *compileopts.Config, action func(Buil
"-mllvm", "--rotation-max-header-size=0")
}
}
+ if config.Options.PrintCommands != nil {
+ config.Options.PrintCommands(config.Target.Linker, ldflags...)
+ }
err = link(config.Target.Linker, ldflags...)
if err != nil {
return &commandError{"failed to link", executable, err}