Skip to content

Commit

Permalink
whitelist ios
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Tôrres <[email protected]>
  • Loading branch information
t0rr3sp3dr0 committed Dec 27, 2024
1 parent 25d06ff commit 2b81dcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/go/internal/work/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)(/[^,]*)?`),
Expand Down Expand Up @@ -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...)
}

Expand Down
7 changes: 7 additions & 0 deletions src/cmd/go/internal/work/security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2b81dcd

Please sign in to comment.