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
{{ message }}
Repository navigation
cc_binary's linkopts should expand labels used with "-Wl," #4440
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.
Activity
pmuetschard commentedon Jan 12, 2018
Oops, never mind
["-Wl,--version-script,", "script.ldscript"]actually works. Sorry about that.