]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: permit wrongly rejected -Wl,-O... linker flags
authorKai Lüke <kai@kinvolk.io>
Mon, 16 Nov 2020 12:05:13 +0000 (12:05 +0000)
committerIan Lance Taylor <iant@golang.org>
Mon, 16 Nov 2020 15:00:31 +0000 (15:00 +0000)
A typo caused the validation rule to check against -WL,-O... which is
not a regular flag because the L should be lowercase as in the other
rules. This caused valid linker flags to be rejected and people had to
work around this by filtering their default flags that include, e.g.,
-Wl,-O1 for a simple link optimization.
Fix the typo that wrongly rejected -Wl,-O... but allowed a non-existing
-WL,-O flag.

Change-Id: Ia3bf730f16f5ad98a39d7f17159de17b44075462
GitHub-Last-Rev: 2ec7f2a2b92c9c76e707a71f6c5273aa1d512006
GitHub-Pull-Request: golang/go#42631
Reviewed-on: https://go-review.googlesource.com/c/go/+/270278
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Jay Conrod <jayconrod@google.com>

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

index b8df3dddd36db5b61ae78a10a4a3ddb0775cdc30..36bbab37ee23e89943f26a543e5a230ae1fb70a0 100644 (file)
@@ -179,7 +179,7 @@ var validLinkerFlags = []*lazyregexp.Regexp{
        re(`-Wl,-berok`),
        re(`-Wl,-Bstatic`),
        re(`-Wl,-Bsymbolic-functions`),
-       re(`-WL,-O([^@,\-][^,]*)?`),
+       re(`-Wl,-O([^@,\-][^,]*)?`),
        re(`-Wl,-d[ny]`),
        re(`-Wl,--disable-new-dtags`),
        re(`-Wl,-e[=,][a-zA-Z0-9]*`),