You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Passing options to the linker requires -Wl,<option>. To pass an option with a value, one can do one of the following:
-Wl,<option> -Wl,<value>
-Wl,<option>=<value>
-Wl,<option>,<value>
Bazel's cc_binary rule, however, only expands labels in the linkopts field if the string "does not start with $ or -". This makes it impossible to pass a file that is a label as a value to a link option.
For example, to pass a linker version script, one would need to cause the following flag passed to gcc: -Wl,--version-script,<script>
However this is impossible: linkopts = ["-Wl,--version-script,", "script.ldscript"] although performing label expansion, passes the script.ldscript file as a separate argument, which gets ignored. linkopts = ["-Wl,--version-script", "-Wl,script.ldscript"] doesn't do label expansion, nor does it if using any of the other formats, and $(location script.ldscript) is not allowed.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Description of the problem / feature request:
Passing options to the linker requires
-Wl,<option>
. To pass an option with a value, one can do one of the following:-Wl,<option> -Wl,<value>
-Wl,<option>=<value>
-Wl,<option>,<value>
Bazel's cc_binary rule, however, only expands labels in the linkopts field if the string "does not start with $ or -". This makes it impossible to pass a file that is a label as a value to a link option.
For example, to pass a linker version script, one would need to cause the following flag passed to gcc:
-Wl,--version-script,<script>
However this is impossible:
linkopts = ["-Wl,--version-script,", "script.ldscript"]
although performing label expansion, passes thescript.ldscript
file as a separate argument, which gets ignored.linkopts = ["-Wl,--version-script", "-Wl,script.ldscript"]
doesn't do label expansion, nor does it if using any of the other formats, and$(location script.ldscript)
is not allowed.Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
Linux, but this is likely present on all OSs.
What's the output of
bazel info release
?0.9.0, but also TOTT
The text was updated successfully, but these errors were encountered: