From 2b81dcd12e7ae0bbb77deccc9973f84a3aa6d750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20T=C3=B4rres?= Date: Thu, 26 Dec 2024 23:20:39 -0800 Subject: [PATCH] whitelist ios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pedro Tôrres --- src/cmd/go/internal/work/security.go | 4 ++-- src/cmd/go/internal/work/security_test.go | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cmd/go/internal/work/security.go b/src/cmd/go/internal/work/security.go index 687602b3bf..640281be23 100644 --- a/src/cmd/go/internal/work/security.go +++ b/src/cmd/go/internal/work/security.go @@ -236,7 +236,7 @@ var validLinkerFlagsOnDarwin = []*lazyregexp.Regexp{ // conjunction with the `-install_name` and `-rpath` linker flags. // Since the GNU linker does not support Mach-O, targeting Darwin // implies not using the GNU linker. Therefore, we allow @ in the linker - // flags if and only if cfg.Goos == "darwin". + // flags if and only if cfg.Goos == "darwin" || cfg.Goos == "ios". re(`-Wl,-dylib_install_name,@rpath(/[^,]*)?`), re(`-Wl,-install_name,@rpath(/[^,]*)?`), re(`-Wl,-rpath,@(executable_path|loader_path)(/[^,]*)?`), @@ -265,7 +265,7 @@ func checkCompilerFlags(name, source string, list []string) error { func checkLinkerFlags(name, source string, list []string) error { validLinkerFlagsForPlatform := validLinkerFlags - if cfg.Goos == "darwin" { + if cfg.Goos == "darwin" || cfg.Goos == "ios" { validLinkerFlagsForPlatform = append(validLinkerFlags, validLinkerFlagsOnDarwin...) } diff --git a/src/cmd/go/internal/work/security_test.go b/src/cmd/go/internal/work/security_test.go index 2c95672214..002845bcbc 100644 --- a/src/cmd/go/internal/work/security_test.go +++ b/src/cmd/go/internal/work/security_test.go @@ -294,6 +294,13 @@ func TestCheckLinkerFlags(t *testing.T) { } } + cfg.Goos = "ios" + for _, f := range goodLinkerFlagsOnDarwin { + if err := checkLinkerFlags("test", "test", f); err != nil { + t.Errorf("unexpected error for %q: %v", f, err) + } + } + cfg.Goos = "linux" for _, f := range goodLinkerFlagsOnDarwin { if err := checkLinkerFlags("test", "test", f); err == nil {