Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ pub mod write {
(sess.targ_cfg.os == abi::OsMacos &&
sess.targ_cfg.arch == abi::X86_64);

let any_library = sess.crate_types.borrow().iter().any(|ty| {
*ty != config::CrateTypeExecutable
});

// OSX has -dead_strip, which doesn't rely on ffunction_sections
// FIXME(#13846) this should be enabled for windows
let ffunction_sections = sess.targ_cfg.os != abi::OsMacos &&
Expand Down Expand Up @@ -249,6 +253,7 @@ pub mod write {
true /* EnableSegstk */,
use_softfp,
no_fp_elim,
!any_library && reloc_model == llvm::RelocPIC,
ffunction_sections,
fdata_sections,
)
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ pub enum CodeGenOptLevel {
CodeGenLevelAggressive = 3,
}

#[deriving(PartialEq)]
#[repr(C)]
pub enum RelocMode {
RelocDefault = 0,
Expand Down Expand Up @@ -1869,6 +1870,7 @@ extern {
EnableSegstk: bool,
UseSoftFP: bool,
NoFramePointerElim: bool,
PositionIndependentExecutable: bool,
FunctionSections: bool,
DataSections: bool) -> TargetMachineRef;
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
Expand Down
2 changes: 2 additions & 0 deletions src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ LLVMRustCreateTargetMachine(const char *triple,
bool EnableSegmentedStacks,
bool UseSoftFloat,
bool NoFramePointerElim,
bool PositionIndependentExecutable,
bool FunctionSections,
bool DataSections) {
std::string Error;
Expand All @@ -83,6 +84,7 @@ LLVMRustCreateTargetMachine(const char *triple,
}

TargetOptions Options;
Options.PositionIndependentExecutable = PositionIndependentExecutable;
Options.NoFramePointerElim = NoFramePointerElim;
#if LLVM_VERSION_MINOR < 5
Options.EnableSegmentedStacks = EnableSegmentedStacks;
Expand Down