8000 Rollup of 17 pull requests by kennytm · Pull Request #48531 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 17 pull requests #48531

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

Merged
merged 63 commits into from
Feb 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
7d296c4
Add Condvar APIs not susceptible to spurious wake
Feb 2, 2018
404e1a6
Fix typo
Feb 2, 2018
e72bd6d
Review response
Feb 2, 2018
95e4dc2
Simplify wait_timeout_until & fix condition typo
Feb 5, 2018
770fded
Stabilize 'entry_and_modify' feature for BTreeMap
hedgehog1024 Feb 12, 2018
862132b
Stabilize 'entry_and_modify' feature for HashMap
hedgehog1024 Feb 12, 2018
4360dfa
Delete information about 'entry_and_modify' from Unstable book
hedgehog1024 Feb 12, 2018
97df227
Fix wait_timeout value
Feb 13, 2018
f45a474
rustc_trans: add abi::CastTarget::ChunkedPrefix
jcowgill Feb 6, 2018
6fe2d1d
Misc fixes
Feb 13, 2018
1635052
pass correct pie args to gcc linker
canarysnort01 Feb 8, 2018
8a72f58
pass correct pie args to gcc linker 2
canarysnort01 Feb 10, 2018
f0e9af1
verify passed -no-pie arg before retrying failed link
canarysnort01 Feb 11, 2018
c8def92
handle -no-pie error from clang
canarysnort01 Feb 12, 2018
ab9cae1
only pass -no-pie if linker_is_gnu
canarysnort01 Feb 14, 2018
68042ba
rustc_trans: rewrite mips64 abi
jcowgill Feb 8, 2018
05d66dc
rustc_trans: add chunked prefix fields to CastTarget
jcowgill Feb 14, 2018
47c33f7
rustc_trans: adjust mips64 abi to use new CastTarget
jcowgill Feb 14, 2018
ebec5e3
Add powerpc-unknown-netbsd target
jakllsch Feb 16, 2018
b1f04a3
Fix unit test compilation
Feb 15, 2018
d549db8
Fix tidy violation
Feb 17, 2018
6ad328c
Move macro-at-most-once-rep-ambig test to ui test
mark-i-m Feb 17, 2018
d17d645
Add tests ensuring zero-Duration timeouts result in errors.
frewsxcv Feb 18, 2018
c0e87f1
Make ".e0" not parse as 0.0
varkor Feb 15, 2018
80970e6
rustbuild: Restore Config.libdir_relative
cuviper Feb 19, 2018
8174c0d
rustbuild: make libdir_relative a method
cuviper Feb 20, 2018
6af23f9
add Iterator::flatten and redefine flat_map(f) in terms of map(f).fla…
Centril Feb 20, 2018
36be763
Iterator::flatten: fix tracking issue number on FusedIterator for Fla…
Centril Feb 10, 2018
0e39401
core::iter::Flatten: update FlatMap & Flatten according to discussion
Centril Feb 13, 2018
3d74c74
core::iter::Iterator::flatten: tracking issue is #48213
Centril Feb 14, 2018
819d57a
core::iter::Iterator::flatten: improve docs wrt. deep vs. shallow fla…
Centril Feb 16, 2018
98d8fc1
added rdrand feature and removed rdrnd feature
newpavlov Feb 20, 2018
4c6b9bc
features in alphabetic order
newpavlov Feb 20, 2018
14b403c
Fix doc compile error
Feb 20, 2018
a33c1da
typo fix
newpavlov Feb 21, 2018
a895d43
bootstrap: Add missing cputype matching for sparc
glaubitz Feb 17, 2018
871e82e
bootstrap: Add openssl configuration for sparc-unknown-linux-gnu
glaubitz Feb 17, 2018
100469f
librustc_back: Add support for sparc-linux-gnu
glaubitz Feb 17, 2018
84aae4e
Add sparc-unknown-linux-gnu target
glaubitz Feb 23, 2018
0b6583e
bootstrap: Add openssl configuration for x86_64-unknown-linux-gnux32
glaubitz Feb 24, 2018
e3781c6
test: Fix s390x-unknown-linux-gnu atomic-lock-free test not run for s…
glaubitz Feb 24, 2018
34b45c1
Workaround abort(2) on compilation error on FreeBSD.
bdrewery Feb 24, 2018
264a921
Added error-format flag to x.py.
Feb 24, 2018
6423609
Fixes docs for ASCII functions to no longer claim U+0021 is '@'.
Feb 25, 2018
0aa753b
1.25.0 -> 1.26.-
Manishearth Feb 25, 2018
f5116e7
Rollup merge of #47964 - jcowgill:mips64-abi, r=eddyb
kennytm Feb 25, 2018
e253224
Rollup merge of #47970 - vlovich:condvar_wait_until, r=dtolnay
kennytm Feb 25, 2018
725856d
Rollup merge of #48076 - canarysnort01:fix_pie, r=alexcrichton
kennytm Feb 25, 2018
562626a
Rollup merge of #48115 - Centril:feature/iterator_flatten, r=alexcric…
kennytm Feb 25, 2018
b443e57
Rollup merge of #48166 - hedgehog1024:hedgehog1024-stabilize-entry_an…
kennytm Feb 25, 2018
3e2072e
Rollup merge of #48281 - jakllsch:netbsd-powerpc, r=alexcrichton
kennytm Feb 25, 2018
b571155
Rollup merge of #48297 - glaubitz:sparc-linux, r=estebank
kennytm Feb 25, 2018
6627cba
Rollup merge of #48302 - mark-i-m:markim_macro-test, r=aturon
kennytm Feb 25, 2018
f28931f
Rollup merge of #48362 - cuviper:libdir_relative, r=Mark-Simulacrum
kennytm Feb 25, 2018
c9b6dca
Rollup merge of #48369 - newpavlov:rdrand, r=nagisa
kennytm Feb 25, 2018
266386a
Rollup merge of #48489 - glaubitz:x32-linux, r=alexcrichton
kennytm Feb 25, 2018
1c62067
Rollup merge of #48491 - glaubitz:s390x-linux, r=sanxiyn
kennytm Feb 25, 2018
4ab2184
Rollup merge of #48494 - bdrewery:freebsd-omit-frame-pointer, r=eddyb
kennytm Feb 25, 2018
eb0ab5e
Rollup merge of #48517 - penpalperson:master, r=Mark-Simulacrum
kennytm Feb 25, 2018
268b6d6
Rollup merge of #48529 - remexre:docs/fix/unicode-0021, r=kennytm
kennytm Feb 25, 2018
0652af2
Rollup merge of #48235 - varkor:parse-float-lonely-exponent, r=alexcr…
kennytm Feb 25, 2018
a554a2f
Return error if timeout is zero-Duration on Redox.
frewsxcv Feb 19, 2018
1aa1035
Rollup merge of #48330 - frewsxcv:frewsxcv-tests-zero-duration, r=sfa…
kennytm Feb 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pass correct pie args to gcc linker
When linking with gcc, run gcc -v to see if --enable-default-pie is
compiled in. If it is, pass -no-pie when necessary to disable pie.
Otherwise, pass -pie when necessary to enable it.

Fixes #48032 and fixes #35061
  • Loading branch information
canarysnort01 committed Feb 14, 2018
commit 16350526d8d8b514327c62b904d26f74937a1b23
66 changes: 56 additions & 10 deletions src/librustc_trans/back/link.rs
8000
Original file line number Diff line number Diff line change
Expand Up @@ -897,16 +897,33 @@ fn link_args(cmd: &mut Linker,

let used_link_args = &trans.crate_info.link_args;

if crate_type == config::CrateTypeExecutable &&
t.options.position_independent_executables {
let empty_vec = Vec::new();
let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec);
let more_args = &sess.opts.cg.link_arg;
let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter());

if get_reloc_model(sess) == llvm::RelocMode::PIC
&& !sess.crt_static() && !args.any(|x| *x == "-static") {
cmd.position_independent_executable();
if crate_type == config::CrateTypeExecutable {
let mut position_independent_executable = false;

if t.options.position_independent_executables {
let empty_vec = Vec::new();
let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec);
let more_args = &sess.opts.cg.link_arg;
let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter());

if get_reloc_model(sess) == llvm::RelocMode::PIC
&& !sess.crt_static() && !args.any(|x| *x == "-static") {
position_independent_executable = true;
}
}

// Check to see if gcc defaults to generating a position independent
// executable. If so, tell it when to disable pie. Otherwise, tell it
// when to enable it. We can't do both because older versions of gcc
// don't understand -no-pie and will blow up.
if is_pie_default(sess) {
if !position_independent_executable {
cmd.no_position_independent_executable();
}
} else {
if position_independent_executable {
cmd.position_independent_executable();
}
}
}

Expand Down Expand Up @@ -1421,3 +1438,32 @@ fn is_full_lto_enabled(sess: &Session) -> bool {
Lto::ThinLocal => false,
}
}

fn is_pie_default(sess: &Session) -> bool {
match sess.linker_flavor() {
LinkerFlavor::Gcc => {
let (_, mut cmd, envs) = get_linker(sess);
// This will set PATH on windows
cmd.envs(envs);
cmd.arg("-v");

info!("{:?}", &cmd);

let output = cmd.command()
.stdout(Stdio::piped()).stderr(Stdio::piped())
.spawn()
.unwrap()
.wait_with_output()
.unwrap();

let ret = String::from_utf8_lossy(&output.stderr)
.contains("--enable-default-pie");

info!("gcc {} compiled with --enable-default-pie",
if ret { "IS" } else { "is NOT" });

ret
},
_ => false,
}
}
10 changes: 10 additions & 0 deletions src/librustc_trans/back/linker.rs
8000
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ pub trait Linker {
fn add_object(&mut self, path: &Path);
fn gc_sections(&mut self, keep_metadata: bool);
fn position_independent_executable(&mut self);
fn no_position_independent_executable(&mut self);
fn partial_relro(&mut self);
fn full_relro(&mut self);
fn optimize(&mut self);
Expand Down Expand Up @@ -179,6 +180,7 @@ impl<'a> Linker for GccLinker<'a> {
fn output_filename(&mut self, path: &Path) { self.cmd.arg("-o").arg(path); }
fn add_object(&mut self, path: &Path) { self.cmd.arg(path); }
fn position_independent_executable(&mut self) { self.cmd.arg("-pie"); }
fn no_position_independent_executable(&mut self) { self.cmd.arg("-no-pie"); }
fn partial_relro(&mut self) { self.linker_arg("-z,relro"); }
fn full_relro(&mut self) { self.linker_arg("-z,relro,-z,now"); }
fn build_static_executable(&mut self) { self.cmd.arg("-static"); }
Expand Down Expand Up @@ -439,6 +441,10 @@ impl<'a> Linker for MsvcLinker<'a> {
// noop
}

fn no_position_independent_executable(&mut self) {
// noop
}

fn partial_relro(&mut self) {
// noop
}
Expand Down Expand Up @@ -647,6 +653,10 @@ impl<'a> Linker for EmLinker<'a> {
// noop
}

fn no_position_independent_executable(&mut self) {
// noop
}

fn partial_relro(&mut self) {
// noop
}
Expand Down
0