cmd/go: permit .tbd files as a linker flag

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
This commit is contained in:
Kevin Albertson 2021-02-15 17:42:12 -05:00
parent 33d72fd412
commit 764a090b68
No known key found for this signature in database
GPG Key ID: 0CCC496D1049E918
2 changed files with 2 additions and 1 deletions

View File

@ -208,7 +208,7 @@ 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-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)`),
}

View File

@ -164,6 +164,7 @@ var goodLinkerFlags = [][]string{
{"-Wl,-framework", "-Wl,Chocolate"},
{"-Wl,-framework,Chocolate"},
{"-Wl,-unresolved-symbols=ignore-all"},
{"libcgotbdtest.tbd"},
}
var badLinkerFlags = [][]string{