]> Cypherpunks repositories - gostls13.git/commit
cmd/go/internal/work: allow @ character in some -Wl, linker flags on darwin
authorPedro Tôrres <t0rr3sp3dr0@gmail.com>
Fri, 27 Dec 2024 07:21:53 +0000 (07:21 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 27 Dec 2024 20:34:09 +0000 (12:34 -0800)
commite3cd55e9d293d519e622e788e902f372dc30338a
tree4312ec94abe0b73a2c75913075c50d610645e07b
parent39794819aa0950f143fa59c41b577bf6a2f81455
cmd/go/internal/work: allow @ character in some -Wl, linker flags on darwin

The GNU linker interprets @file as "read command-line options from file".
Thus, we forbid values starting with @ on linker flags. However, this
causes a problem when targeting Darwin. @executable_path, @loader_path, and
@rpath are special values used in Mach-O to change the library search path
and can be used in 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".

Fixes #40559

Change-Id: I0896758f0835e444ea0d501ea3fd8423cff97a27
GitHub-Last-Rev: 2b81dcd12e7ae0bbb77deccc9973f84a3aa6d750
GitHub-Pull-Request: golang/go#70939
Reviewed-on: https://go-review.googlesource.com/c/go/+/638075
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/go/internal/work/security.go
src/cmd/go/internal/work/security_test.go