diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-26 13:42:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-26 13:42:29 +0200 |
| commit | 96c1bb571abd77fcb706d7cdb4a0823a471767c2 (patch) | |
| tree | 12440be847fa3007e0910cc30df384a75fb34293 /src/rustllvm/PassWrapper.cpp | |
| parent | ec1f28f9614292c36b371d3758afffdd52cb9786 (diff) | |
| parent | 45fbe8f21c959bfe52b3b94b1ad775e9fbab529e (diff) | |
| download | rust-96c1bb571abd77fcb706d7cdb4a0823a471767c2.tar.gz rust-96c1bb571abd77fcb706d7cdb4a0823a471767c2.zip | |
Rollup merge of #71490 - petrochenkov:passcheck2, r=davidtwco
Cleanup and document `-C relocation-model` As the title says, this is mostly a refactoring and documentation. One potentially observable change here is that `-C relocation-model=default` now takes the default from the Rust target, rather than from the underlying LLVM target. In other words, `-C relocation-model=default` is now equivalent to not specifying the relocation model on command line at all. Apparently no one used that option because it has other bugs as well, e.g. PIC `default` wasn't treated as PIC in some places.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
| -rw-r--r-- | src/rustllvm/PassWrapper.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp index b221c17b422..e31dd77d8af 100644 --- a/src/rustllvm/PassWrapper.cpp +++ b/src/rustllvm/PassWrapper.cpp @@ -346,8 +346,7 @@ static PassBuilder::OptimizationLevel fromRust(LLVMRustPassBuilderOptLevel Level } } -enum class LLVMRustRelocMode { - Default, +enum class LLVMRustRelocModel { Static, PIC, DynamicNoPic, @@ -356,21 +355,19 @@ enum class LLVMRustRelocMode { ROPIRWPI, }; -static Optional<Reloc::Model> fromRust(LLVMRustRelocMode RustReloc) { +static Reloc::Model fromRust(LLVMRustRelocModel RustReloc) { switch (RustReloc) { - case LLVMRustRelocMode::Default: - return None; - case LLVMRustRelocMode::Static: + case LLVMRustRelocModel::Static: return Reloc::Static; - case LLVMRustRelocMode::PIC: + case LLVMRustRelocModel::PIC: return Reloc::PIC_; - case LLVMRustRelocMode::DynamicNoPic: + case LLVMRustRelocModel::DynamicNoPic: return Reloc::DynamicNoPIC; - case LLVMRustRelocMode::ROPI: + case LLVMRustRelocModel::ROPI: return Reloc::ROPI; - case LLVMRustRelocMode::RWPI: + case LLVMRustRelocModel::RWPI: return Reloc::RWPI; - case LLVMRustRelocMode::ROPIRWPI: + case LLVMRustRelocModel::ROPIRWPI: return Reloc::ROPI_RWPI; } report_fatal_error("Bad RelocModel."); @@ -440,7 +437,7 @@ extern "C" const char* LLVMRustGetHostCPUName(size_t *len) { extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine( const char *TripleStr, const char *CPU, const char *Feature, - const char *ABIStr, LLVMRustCodeModel RustCM, LLVMRustRelocMode RustReloc, + const char *ABIStr, LLVMRustCodeModel RustCM, LLVMRustRelocModel RustReloc, LLVMRustCodeGenOptLevel RustOptLevel, bool UseSoftFloat, bool PositionIndependentExecutable, bool FunctionSections, bool DataSections, |
