Skip to content

Commit

Permalink
env/corellium/ios: special case "--print-prog-name=ar" in clang wrapper
Browse files Browse the repository at this point in the history
Intercept the "--print-prog-name=ar" flag in the clang wrapper and
return "ar" from the system path, as opposed to the "ar" selected
by clang. This is needed to avoid bypassing the ar wrapper installed
in /var/root/bin, which is the one we want.

Updates golang/go#59221.

Change-Id: I907a6d6be2e6439901b36d6f7f8669939fd82e94
Reviewed-on: https://go-review.googlesource.com/c/build/+/480675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
  • Loading branch information
thanm committed Mar 31, 2023
1 parent bd9da1b commit fd3d87a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions env/corellium/ios/files/clangwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ func main() {
os.Exit(1)
}
args := os.Args[1:]
// Intercept requests for the path of the "ar" tool and instead
// always return "ar", so that the "ar" wrapper is used instead of
// /usr/bin/ar. See issue https://go.dev/issue/59221 and CL
// https://go.dev/cl/479775 for more detail.
if len(args) != 0 && args[0] == "--print-prog-name=ar" {
fmt.Printf("ar\n")
os.Exit(0)
}
cmd := exec.Command("clang", "-isysroot", sdkpath, "-mios-version-min=12.0")
cmd.Args = append(cmd.Args, args...)
cmd.Stdout = os.Stdout
Expand Down

0 comments on commit fd3d87a

Please sign in to comment.