Make sure we only run the --push-state logic when -Wl,--push-state is a
prefix of the argument, not just present in the argument string.
Thanks to Juho Forsén of Mattermost for reporting this issue.
Change-Id: I799f7854ff680674fd84cf2136fadf70817fc7e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/628415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
for _, re := range valid {
if match := re.FindString(arg); match == arg { // must be complete match
continue Args
- } else if match == "-Wl,--push-state" {
+ } else if strings.HasPrefix(arg, "-Wl,--push-state,") {
// Examples for --push-state are written
// -Wl,--push-state,--as-needed
// Support other commands in the same -Wl arg.
{"-Wl,-R,-flag"},
{"-Wl,--push-state,"},
{"-Wl,--push-state,@foo"},
+ {"-fplugin=./-Wl,--push-state,-R.so"},
+ {"./-Wl,--push-state,-R.c"},
}
func TestCheckLinkerFlags(t *testing.T) {