Skip to content

Commit 96a466c

Browse files
committed
linker: Support -static-pie and -static -shared
1 parent eccaa01 commit 96a466c

File tree

2 files changed

+118
-131
lines changed

2 files changed

+118
-131
lines changed

src/librustc_codegen_ssa/back/link.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -1530,16 +1530,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
15301530
}
15311531

15321532
// NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
1533-
// FIXME: Support `StaticPicExe` correctly.
1534-
match link_output_kind {
1535-
LinkOutputKind::DynamicPicExe | LinkOutputKind::StaticPicExe => {
1536-
cmd.position_independent_executable()
1537-
}
1538-
LinkOutputKind::DynamicNoPicExe | LinkOutputKind::StaticNoPicExe => {
1539-
cmd.no_position_independent_executable()
1540-
}
1541-
_ => {}
1542-
}
1533+
cmd.set_output_kind(link_output_kind, out_filename);
15431534

15441535
// OBJECT-FILES-NO, AUDIT-ORDER
15451536
add_relro_args(cmd, sess);
@@ -1568,17 +1559,6 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
15681559
tmpdir,
15691560
);
15701561

1571-
// NO-OPT-OUT, OBJECT-FILES-NO, AUDIT-ORDER
1572-
// FIXME: Merge with the previous `link_output_kind` match,
1573-
// and support `StaticPicExe` and `StaticDylib` correctly.
1574-
match link_output_kind {
1575-
LinkOutputKind::StaticNoPicExe | LinkOutputKind::StaticPicExe => {
1576-
cmd.build_static_executable()
1577-
}
1578-
LinkOutputKind::DynamicDylib | LinkOutputKind::StaticDylib => cmd.build_dylib(out_filename),
1579-
_ => {}
1580-
}
1581-
15821562
// OBJECT-FILES-NO, AUDIT-ORDER
15831563
if sess.opts.cg.profile_generate.enabled() {
15841564
cmd.pgo_gen();

0 commit comments

Comments
 (0)