Skip to content

Commit ecea93e

Browse files
Do not add -fPIC by default on UEFI targets (#1263)
This fixes a regression caused by 290a629.
1 parent 140f595 commit ecea93e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1997,7 +1997,7 @@ impl Build {
19971997
if self.pic.unwrap_or(
19981998
target.os != "windows"
19991999
&& target.os != "none"
2000-
&& target.env != "uefi"
2000+
&& target.os != "uefi"
20012001
&& target.os != "wasi",
20022002
) {
20032003
cmd.push_cc_arg("-fPIC".into());

tests/test.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,23 @@ fn gnu_aarch64_none_no_pic() {
283283
}
284284
}
285285

286+
#[test]
287+
fn gnu_uefi_no_pic() {
288+
reset_env();
289+
290+
for arch in &["aarch64", "i686", "x86_64"] {
291+
let target = format!("{}-unknown-uefi", arch);
292+
let test = Test::gnu();
293+
test.gcc()
294+
.target(&target)
295+
.host(&target)
296+
.file("foo.c")
297+
.compile("foo");
298+
299+
test.cmd(0).must_not_have("-fPIC");
300+
}
301+
}
302+
286303
#[test]
287304
fn gnu_set_stdlib() {
288305
reset_env();

0 commit comments

Comments
 (0)