Adjust PTXLinker LTO logic and CLI

This commit is contained in:
Denys Zariaiev 2019-01-28 23:56:37 +01:00
parent 8d53c9247c
commit 6f86a70ea1
2 changed files with 9 additions and 10 deletions

View File

@ -6,7 +6,7 @@ RUN apt-get install -y --no-install-recommends \
cmake sudo gdb
# FIXME: setup `ptx-linker` CI for automatic binary releases.
RUN curl -sL https://github.com/denzp/rust-ptx-linker/releases/download/v0.9.0-alpha/rust-ptx-linker.linux64.tar.gz | \
RUN curl -sL https://github.com/denzp/rust-ptx-linker/releases/download/v0.9.0-alpha.1/rust-ptx-linker.linux64.tar.gz | \
tar -xzvC /usr/bin
COPY scripts/sccache.sh /scripts/

View File

@ -13,7 +13,7 @@ use rustc::hir::def_id::{LOCAL_CRATE, CrateNum};
use rustc::middle::dependency_format::Linkage;
use rustc::session::Session;
use rustc::session::config::{self, CrateType, OptLevel, DebugInfo,
CrossLangLto};
CrossLangLto, Lto};
use rustc::ty::TyCtxt;
use rustc_target::spec::{LinkerFlavor, LldFlavor};
use serialize::{json, Encoder};
@ -1118,14 +1118,13 @@ impl<'a> Linker for PtxLinker<'a> {
}
fn optimize(&mut self) {
self.cmd.arg(match self.sess.opts.optimize {
OptLevel::No => "-O0",
OptLevel::Less => "-O1",
OptLevel::Default => "-O2",
OptLevel::Aggressive => "-O3",
OptLevel::Size => "-Os",
OptLevel::SizeMin => "-Os"
});
match self.sess.lto() {
Lto::Thin | Lto::Fat | Lto::ThinLocal => {
self.cmd.arg("-Olto");
},
Lto::No => { },
};
}
fn output_filename(&mut self, path: &Path) {