rules_go
rules_go copied to clipboard
setting `extldflags` as flag does not parse properly
Setting -extldflags
via command line flag, (e.g. bazel --@rules_go//go/config:gc_goopts=-extldflags=-Wl,-ld_classic
) emits duplicate linker arguments for -extldflags
instead of combining with the toolchain arguments (see below for detailed output). There is a test for this at the rule level but this does not appear to cover the case where it is specified via command line.
What version of rules_go are you using?
v0.46.0
What version of gazelle are you using?
v0.35.0
What version of Bazel are you using?
Bazelisk version: development
Build label: 7.1.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Mar 21 18:08:59 2024 (1711044539)
Build timestamp: 1711044539
Build timestamp as int: 1711044539
Does this issue reproduce with the latest releases of all the above?
yes
What operating system and processor architecture are you using?
macos 14.4.1, arm64
Any other potentially useful information about your toolchain?
What did you do?
in current rules_go
# cd examples/basic-gazelle
# bazel aquery --@io_bazel_rules_go//go/config:gc_linkopts=extldflags=-Wl,-ld_classic 'mnemonic("GoLink", //:basic-gazelle)'
...
Command Line: (exec bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/go_sdk/builder_reset/builder \
link \
...
'extldflags=-Wl' \
-ld_classic \
...
-extldflags \
'-mmacosx-version-min=10.11 -no-canonical-prefixes -fobjc-link-runtime -headerpad_max_install_names -lm')
What did you expect to see?
# bazel aquery --@io_bazel_rules_go//go/config:gc_linkopts=extldflags=-Wl,-ld_classic 'mnemonic("GoLink", //:basic-gazelle)'
...
Command Line: (exec bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/go_sdk/builder_reset/builder \
link \
...
-extldflags \
'-Wl,-ld_classic -mmacosx-version-min=10.11 -no-canonical-prefixes -fobjc-link-runtime -headerpad_max_install_names -lm')
What did you see instead?
Good catch, this looks clearly wrong. Would you be willing to send a PR?