Repository navigation
Let -Crelocation-model better control -pie linking - #40245
Conversation
Prior to this, if relocation model in the target options was "pic", as most targets have it, then the user's `-Crelocation-model` had no effect on whether `-pie` would be used. Only `-Clink-arg=-static` would have a further override here. Now we use `context::get_reloc_model`, which gives precedence to the user's option, and if it's `RelocMode::PIC` we enable `-pie`. This is the same test as `context::is_pie_binary`, except that folds across all `sess.crate_types`, not just the current one.
|
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
|
I first noticed this in #37874 (comment), but #35061 is more direct. I'd like a test for this, but I'm not sure how. It will already get exercised in |
|
@bors: r+ Nah I think it's ok to avoid a test here in this case, thanks! |
|
📌 Commit 111fbe7 has been approved by |
Let `-Crelocation-model` better control `-pie` linking Prior to this, if relocation model in the target options was "pic", as most targets have it, then the user's `-Crelocation-model` had no effect on whether `-pie` would be used. Only `-Clink-arg=-static` would have a further override here. Now we use `context::get_reloc_model`, which gives precedence to the user's option, and if it's `RelocMode::PIC` we enable `-pie`. This is the same test as `context::is_pie_binary`, except that folds across all `sess.crate_types`, not just the current one. Fixes #35061.
|
☀️ Test successful - status-appveyor, status-travis |
Prior to this, if relocation model in the target options was "pic", as
most targets have it, then the user's
-Crelocation-modelhad no effecton whether
-piewould be used. Only-Clink-arg=-staticwould have afurther override here.
Now we use
context::get_reloc_model, which gives precedence to theuser's option, and if it's
RelocMode::PICwe enable-pie. This isthe same test as
context::is_pie_binary, except that folds across allsess.crate_types, not just the current one.Fixes #35061.