Skip to content

Add linker_script option to rust_binary - #208

Merged
damienmg merged 2 commits into
bazelbuild:masterfrom
m3rcuriel:master
Mar 21, 2019
Merged

damienmg merged 2 commits into
bazelbuild:masterfrom
m3rcuriel:master

Conversation

@m3rcuriel

Copy link
Copy Markdown
Contributor

This explicitly adds a linker_script option to rust_binary as suggested in the bottom of #204.

It's fundamentally identical to adding the ldscript to data and then adding --codegen=link-args=-T$(location //:ldscript) to rustc_flags, but now without the hassle of figuring that out yourself.

@m3rcuriel

Copy link
Copy Markdown
Contributor Author

Also because I just thought of it does anyone else think we should maybe break data into runtime and compile time data?

Comment thread rust/private/rust.bzl Resolved
@damienmg

Copy link
Copy Markdown
Collaborator

Also because I just thought of it does anyone else think we should maybe break data into runtime and compile time data?

In which case is there's a need for compile time data that is not passed as a different attribute? Do you mean a linker script can use data? If so and there is no other case, maybe either add a linker_scripts_data or make linker_script a label_list and have a convention about which one is the script.

@m3rcuriel

Copy link
Copy Markdown
Contributor Author

Also because I just thought of it does anyone else think we should maybe break data into runtime and compile time data?

In which case is there's a need for compile time data that is not passed as a different attribute? Do you mean a linker script can use data? If so and there is no other case, maybe either add a linker_scripts_data or make linker_script a label_list and have a convention about which one is the script.

I was referring to data in general not in the context of linker scripts. data in Bazel in general seems to me to refer to runtime data, i.e in https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes.

I understand that compile time dependencies are good for include_str! but I was just pointing that out.

@damienmg damienmg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's wait for either Marco or Alex to review too.

As for the "compile-time" data, we have the out_dir_tar input which is a bit like that. I have a change to change it so it also accept a directory artifact (in order to have a better integration with crate build script)

@mfarrugi

Copy link
Copy Markdown
Collaborator

On the compile_data tangent, yes I think that would be a useful distinction. Bundling it into out_dir_tar makes sense, but I don't recall that being easy/intuitive to use.

@damienmg
damienmg merged commit 4243769 into bazelbuild:master Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants