| author | |
| committer | |
| log | 76102ea41f6369b2254b4a281001061e48d81ffb |
| tree | eebbcc27d429384591633e564eb4938c209cb5c5 |
| parent | 74ca811a663eb5d5e774fbccc4930da722811036 |
This is needed for LTO builds to pick up the correct module.
Closes #91323 files changed, 11 insertions(+), 0 deletions(-)
src/stage1/codegen.cpp+4| ... | @@ -9289,6 +9289,10 @@ static void init(CodeGen *g) { | ... | @@ -9289,6 +9289,10 @@ static void init(CodeGen *g) { |
| 9289 | ZigLLVMSetModulePIELevel(g->module); | 9289 | ZigLLVMSetModulePIELevel(g->module); |
| 9290 | } | 9290 | } |
| 9291 | 9291 | ||
| 9292 | if (g->code_model != CodeModelDefault) { | ||
| 9293 | ZigLLVMSetModuleCodeModel(g->module, to_llvm_code_model(g)); | ||
| 9294 | } | ||
| 9295 | |||
| 9292 | const char *target_specific_cpu_args = ""; | 9296 | const char *target_specific_cpu_args = ""; |
| 9293 | const char *target_specific_features = ""; | 9297 | const char *target_specific_features = ""; |
| 9294 | 9298 |
src/zig_llvm.cpp+6| ... | @@ -969,6 +969,12 @@ void ZigLLVMSetModulePIELevel(LLVMModuleRef module) { | ... | @@ -969,6 +969,12 @@ void ZigLLVMSetModulePIELevel(LLVMModuleRef module) { |
| 969 | unwrap(module)->setPIELevel(PIELevel::Level::Large); | 969 | unwrap(module)->setPIELevel(PIELevel::Level::Large); |
| 970 | } | 970 | } |
| 971 | 971 | ||
| 972 | void ZigLLVMSetModuleCodeModel(LLVMModuleRef module, LLVMCodeModel code_model) { | ||
| 973 | bool JIT; | ||
| 974 | unwrap(module)->setCodeModel(*unwrap(code_model, JIT)); | ||
| 975 | assert(!JIT); | ||
| 976 | } | ||
| 977 | |||
| 972 | static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) { | 978 | static AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) { |
| 973 | switch (Ordering) { | 979 | switch (Ordering) { |
| 974 | case LLVMAtomicOrderingNotAtomic: return AtomicOrdering::NotAtomic; | 980 | case LLVMAtomicOrderingNotAtomic: return AtomicOrdering::NotAtomic; |
src/zig_llvm.h+1| ... | @@ -208,6 +208,7 @@ ZIG_EXTERN_C void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module); | ... | @@ -208,6 +208,7 @@ ZIG_EXTERN_C void ZigLLVMAddModuleDebugInfoFlag(LLVMModuleRef module); |
| 208 | ZIG_EXTERN_C void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module); | 208 | ZIG_EXTERN_C void ZigLLVMAddModuleCodeViewFlag(LLVMModuleRef module); |
| 209 | ZIG_EXTERN_C void ZigLLVMSetModulePICLevel(LLVMModuleRef module); | 209 | ZIG_EXTERN_C void ZigLLVMSetModulePICLevel(LLVMModuleRef module); |
| 210 | ZIG_EXTERN_C void ZigLLVMSetModulePIELevel(LLVMModuleRef module); | 210 | ZIG_EXTERN_C void ZigLLVMSetModulePIELevel(LLVMModuleRef module); |
| 211 | ZIG_EXTERN_C void ZigLLVMSetModuleCodeModel(LLVMModuleRef module, LLVMCodeModel code_model); | ||
| 211 | 212 | ||
| 212 | ZIG_EXTERN_C void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, | 213 | ZIG_EXTERN_C void ZigLLVMSetCurrentDebugLocation(LLVMBuilderRef builder, int line, int column, |
| 213 | struct ZigLLVMDIScope *scope); | 214 | struct ZigLLVMDIScope *scope); |