]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix flags order in linkerFlagSupported
authorSiddhartha Bagaria <starsid@gmail.com>
Wed, 18 Sep 2024 22:05:40 +0000 (15:05 -0700)
committerGopher Robot <gobot@golang.org>
Wed, 23 Oct 2024 16:19:08 +0000 (16:19 +0000)
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>

src/cmd/link/internal/ld/lib.go

index 02bea8e443fb3ea329ce99b4cf4eb12e66c23d27..a9eda54713fbef6fb1ac22c158a8098d57dc658c 100644 (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 != "" {