File tree Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Expand file tree Collapse file tree 3 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ fn to_llvm_relocation_model(relocation_model: RelocModel) -> llvm::RelocModel {
108108 }
109109}
110110
111- pub fn to_llvm_code_model ( code_model : Option < CodeModel > ) -> llvm:: CodeModel {
111+ pub ( crate ) fn to_llvm_code_model ( code_model : Option < CodeModel > ) -> llvm:: CodeModel {
112112 match code_model {
113113 Some ( CodeModel :: Tiny ) => llvm:: CodeModel :: Tiny ,
114114 Some ( CodeModel :: Small ) => llvm:: CodeModel :: Small ,
Original file line number Diff line number Diff line change @@ -182,6 +182,11 @@ pub unsafe fn create_module(
182182 }
183183 }
184184
185+ // Linking object files with different code models is undefined behavior
186+ // because the compiler would have to generate additional code (to span
187+ // longer jumps) if a larger code model is used with a smaller one.
188+ //
189+ // See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
185190 llvm:: LLVMRustSetModuleCodeModel ( llmod, to_llvm_code_model ( sess. code_model ( ) ) ) ;
186191
187192 // If skipping the PLT is enabled, we need to add some module metadata
Original file line number Diff line number Diff line change @@ -1163,12 +1163,6 @@ extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
11631163 unwrap (M)->setPIELevel (PIELevel::Level::Large);
11641164}
11651165
1166- // Linking object files with different code models is undefined behavior
1167- // because the compiler would have to generate additional code (to span
1168- // longer jumps) if a larger code model is used with a smaller one.
1169- // Therefore we will treat attempts to mix code models as an error.
1170- //
1171- // See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323.
11721166extern " C" void LLVMRustSetModuleCodeModel (LLVMModuleRef M,
11731167 LLVMRustCodeModel Model) {
11741168 auto CM = fromRust (Model);
You can’t perform that action at this time.
0 commit comments