File tree 3 files changed +6
-7
lines changed
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 {
108
108
}
109
109
}
110
110
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 {
112
112
match code_model {
113
113
Some ( CodeModel :: Tiny ) => llvm:: CodeModel :: Tiny ,
114
114
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(
182
182
}
183
183
}
184
184
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.
185
190
llvm:: LLVMRustSetModuleCodeModel ( llmod, to_llvm_code_model ( sess. code_model ( ) ) ) ;
186
191
187
192
// 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) {
1163
1163
unwrap (M)->setPIELevel (PIELevel::Level::Large);
1164
1164
}
1165
1165
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.
1172
1166
extern " C" void LLVMRustSetModuleCodeModel (LLVMModuleRef M,
1173
1167
LLVMRustCodeModel Model) {
1174
1168
auto CM = fromRust (Model);
You can’t perform that action at this time.
0 commit comments