diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2015-08-21 22:57:17 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-08-21 22:57:17 +0000 |
| commit | 44ee84eec5ffc9bed4daee3de971689ae2e31501 (patch) | |
| tree | bf37b95c9290478ee05e715822de8f6144fe5b85 /llvm/tools | |
| parent | bd8a0856e2f959d313f8a8888ca468f02e6e4173 (diff) | |
| download | bcm5719-llvm-44ee84eec5ffc9bed4daee3de971689ae2e31501.tar.gz bcm5719-llvm-44ee84eec5ffc9bed4daee3de971689ae2e31501.zip | |
LTO: Change signature of LTOCodeGenerator::setCodePICModel() to take a Reloc::Model.
This allows us to remove a bunch of code in LTOCodeGenerator and llvm-lto
and has the side effect of improving error handling in the libLTO C API.
llvm-svn: 245756
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 14 | ||||
| -rw-r--r-- | llvm/tools/lto/lto.cpp | 18 |
2 files changed, 17 insertions, 15 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index 7f87859f3b2..b17f1ea307b 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -174,19 +174,7 @@ int main(int argc, char **argv) { if (UseDiagnosticHandler) CodeGen.setDiagnosticHandler(handleDiagnostics, nullptr); - switch (RelocModel) { - case Reloc::Static: - CodeGen.setCodePICModel(LTO_CODEGEN_PIC_MODEL_STATIC); - break; - case Reloc::PIC_: - CodeGen.setCodePICModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC); - break; - case Reloc::DynamicNoPIC: - CodeGen.setCodePICModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC); - break; - default: - CodeGen.setCodePICModel(LTO_CODEGEN_PIC_MODEL_DEFAULT); - } + CodeGen.setCodePICModel(RelocModel); CodeGen.setDebugInfo(LTO_DEBUG_MODEL_DWARF); CodeGen.setTargetOptions(Options); diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index 5c712f18c9e..aebb1c64a31 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -269,8 +269,22 @@ bool lto_codegen_set_debug_model(lto_code_gen_t cg, lto_debug_model debug) { } bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) { - unwrap(cg)->setCodePICModel(model); - return false; + switch (model) { + case LTO_CODEGEN_PIC_MODEL_STATIC: + unwrap(cg)->setCodePICModel(Reloc::Static); + return false; + case LTO_CODEGEN_PIC_MODEL_DYNAMIC: + unwrap(cg)->setCodePICModel(Reloc::PIC_); + return false; + case LTO_CODEGEN_PIC_MODEL_DYNAMIC_NO_PIC: + unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC); + return false; + case LTO_CODEGEN_PIC_MODEL_DEFAULT: + unwrap(cg)->setCodePICModel(Reloc::Default); + return false; + } + sLastErrorString = "Unknown PIC model"; + return true; } void lto_codegen_set_cpu(lto_code_gen_t cg, const char *cpu) { |

