1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:10:22 -07:00

cmd/link/internal/ld: use linkerFlagSupported to check -Qunused-arguments

Rather than checking the linker name or its path for the string "clang",
use linkerFlagSupported to determine whether the -Qunused-arguments flag
may be passed to the linker.

Fixes #45241

Change-Id: I4c1e4d4ecba4cf5823e8f39cfda5d20404ebf513
Reviewed-on: https://go-review.googlesource.com/c/go/+/304692
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Tobias Klauser 2021-03-26 11:00:40 +01:00 committed by Tobias Klauser
parent 6f90ee36e9
commit 565e70fcef

View File

@ -1475,8 +1475,9 @@ func (ctxt *Link) hostlink() {
argv = append(argv, "-Wl,-bE:"+fileName)
}
if strings.Contains(argv[0], "clang") {
argv = append(argv, "-Qunused-arguments")
const unusedArguments = "-Qunused-arguments"
if linkerFlagSupported(ctxt.Arch, argv[0], altLinker, unusedArguments) {
argv = append(argv, unusedArguments)
}
const compressDWARF = "-Wl,--compress-debug-sections=zlib-gnu"