Skip to content

Commit 99d7121

Browse files
cerisiergopherbot
authored andcommitted
cmd/link: add more clang driver flags when testing flag
This changes does 2 things: - Move `-L` to `prefixesToKeep` since it allows providing a custom default libs search path. - Allow various flags that impact the behaviour of the clang driver. The latter allows for LLVM only toolchains to be compatible with linkerFlagSupported checks. The end goal of this PR is to allow fully hermetic toolchains, especially pure LLVM ones, to be used to cross-compile CGO. Fixes golang#76825 Change-Id: I2311c9566ce9c7e8f6b325258af58eb333663cf0 GitHub-Last-Rev: 74342aa GitHub-Pull-Request: golang#76858 Reviewed-on: https://go-review.googlesource.com/c/go/+/730561 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
1 parent b8bccb9 commit 99d7121

File tree

1 file changed

+18
-1
lines changed
  • src/cmd/link/internal/ld

1 file changed

+18
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2208,20 +2208,30 @@ func trimLinkerArgv(argv []string) []string {
22082208
flagsWithNextArgSkip := []string{
22092209
"-F",
22102210
"-l",
2211-
"-L",
22122211
"-framework",
22132212
"-Wl,-framework",
22142213
"-Wl,-rpath",
22152214
"-Wl,-undefined",
22162215
}
22172216
flagsWithNextArgKeep := []string{
2217+
"-B",
2218+
"-L",
22182219
"-arch",
22192220
"-isysroot",
22202221
"--sysroot",
22212222
"-target",
22222223
"--target",
2224+
"-resource-dir",
2225+
"-rtlib",
2226+
"--rtlib",
2227+
"-stdlib",
2228+
"--stdlib",
2229+
"-unwindlib",
2230+
"--unwindlib",
22232231
}
22242232
prefixesToKeep := []string{
2233+
"-B",
2234+
"-L",
22252235
"-f",
22262236
"-m",
22272237
"-p",
@@ -2231,6 +2241,13 @@ func trimLinkerArgv(argv []string) []string {
22312241
"--sysroot",
22322242
"-target",
22332243
"--target",
2244+
"-resource-dir",
2245+
"-rtlib",
2246+
"--rtlib",
2247+
"-stdlib",
2248+
"--stdlib",
2249+
"-unwindlib",
2250+
"--unwindlib",
22342251
}
22352252

22362253
var flags []string

0 commit comments

Comments
 (0)