]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: permit .tbd files as a linker flag
authorKevin Albertson <kevin.albertson@mongodb.com>
Tue, 16 Feb 2021 14:40:49 +0000 (14:40 +0000)
committerCherry Mui <cherryyz@google.com>
Thu, 13 May 2021 18:59:27 +0000 (18:59 +0000)
A .tbd file is a macOS text-based stub library and is a valid input to
the macOS linker. This change adds .tbd to the allow-list for acceptable
linker flags.

Fixes golang/go#44263

Change-Id: Ie5439a13325dbc908e42f95ec70aca518bb549f9
GitHub-Last-Rev: 6055c3b5fa8c8146c0c5c976aa8e1d219e01e414
GitHub-Pull-Request: golang/go#44276
Reviewed-on: https://go-review.googlesource.com/c/go/+/292269
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>

src/cmd/go/internal/work/security.go
src/cmd/go/internal/work/security_test.go

index 36bbab37ee23e89943f26a543e5a230ae1fb70a0..e9b9f6c6c0f24417652309b4d2b13b098677db73 100644 (file)
@@ -208,8 +208,8 @@ var validLinkerFlags = []*lazyregexp.Regexp{
        re(`-Wl,-z,(no)?execstack`),
        re(`-Wl,-z,relro`),
 
-       re(`[a-zA-Z0-9_/].*\.(a|o|obj|dll|dylib|so)`), // direct linker inputs: x.o or libfoo.so (but not -foo.o or @foo.o)
-       re(`\./.*\.(a|o|obj|dll|dylib|so)`),
+       re(`[a-zA-Z0-9_/].*\.(a|o|obj|dll|dylib|so|tbd)`), // direct linker inputs: x.o or libfoo.so (but not -foo.o or @foo.o)
+       re(`\./.*\.(a|o|obj|dll|dylib|so|tbd)`),
 }
 
 var validLinkerFlagsWithNextArg = []string{
index 4f2e0eb21ab842dd80c4425fa806ca2998000f73..8d4be0abfc09e6c21c9a51ea6a32696c4fa6e259 100644 (file)
@@ -164,6 +164,8 @@ var goodLinkerFlags = [][]string{
        {"-Wl,-framework", "-Wl,Chocolate"},
        {"-Wl,-framework,Chocolate"},
        {"-Wl,-unresolved-symbols=ignore-all"},
+       {"libcgotbdtest.tbd"},
+       {"./libcgotbdtest.tbd"},
 }
 
 var badLinkerFlags = [][]string{