From: Siddhartha Bagaria Date: Wed, 18 Sep 2024 22:05:40 +0000 (-0700) Subject: cmd/link: fix flags order in linkerFlagSupported X-Git-Tag: go1.24rc1~620 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=87c03bdf62bfece1d74039e4e07c2aa277149b17;p=gostls13.git cmd/link: fix flags order in linkerFlagSupported Flags from CGo directives should be placed before extldflags so that extldflags get more preference. This is also the order followed by the final link command. Fixes #69350 Change-Id: I2cfb22ae4ea7a160cc614440e88ef2eb82ea7399 Reviewed-on: https://go-review.googlesource.com/c/go/+/614275 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Commit-Queue: Ian Lance Taylor --- diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go index 02bea8e443..a9eda54713 100644 --- a/src/cmd/link/internal/ld/lib.go +++ b/src/cmd/link/internal/ld/lib.go @@ -2133,7 +2133,7 @@ func linkerFlagSupported(arch *sys.Arch, linker, altLinker, flag string) bool { flags := hostlinkArchArgs(arch) - moreFlags := trimLinkerArgv(append(flagExtldflags, ldflag...)) + moreFlags := trimLinkerArgv(append(ldflag, flagExtldflags...)) flags = append(flags, moreFlags...) if altLinker != "" {