Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "link-args=-no-pie" automatically where apropriate #11

Merged
merged 2 commits into from
Jul 23, 2017

Conversation

yodaldevoid
Copy link
Contributor

@yodaldevoid yodaldevoid commented Jul 23, 2017

Fixes #7

These patches teach Tarpaulin to add the "-no-pie" flag where allowed and needed.

This has been tested on Ubuntu 17.04 (requires the linker flag) and Ubuntu 15.04 (rejects the linker flag).

…ssed.

This implementation gets the configured linker for the target if one has been
set using the same meathod as Cargo. That can be found in `scrape_build_config`
and `scrape_target_config` in "src/cargo/ops/cargo_compile.rs" in Cargo.

Sadly we cannot query `rustc` for its default linker for a target without
nightly-only shenanigans so we have to make some assuptions. For Linux (and most
everything that isn't Windows) it is fair to assume the default linker is `cc`
and that `cc` is GCC based. Even if it is not, if the call to the linker to get
its version information fails to does not contain "--enable-default-pie" no
flags are set.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
The splitting of RUSTFLAGS into tokens is ripped from Cargo so it should work
exactly as it does.

Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
@xd009642
Copy link
Owner

Thanks for this, just tested on my system and it all looks good to go! Merging this now 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants