1
0
mirror of https://github.com/golang/go synced 2024-11-14 20:00:31 -07:00

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 <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Siddhartha Bagaria 2024-09-18 15:05:40 -07:00 committed by Gopher Robot
parent 0f2353997a
commit 87c03bdf62

View File

@ -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 != "" {