Skip to content

Commit 67a5e2b

Browse files
committed
Fix for reviews
1 parent 4a89c9f commit 67a5e2b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/librustc_codegen_llvm/back/write.rs

+1-1
Original file line numberDiff line numberDiff 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,

src/librustc_codegen_llvm/context.rs

+5
Original file line numberDiff line numberDiff 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

src/rustllvm/PassWrapper.cpp

-6
Original file line numberDiff line numberDiff 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.
11721166
extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
11731167
LLVMRustCodeModel Model) {
11741168
auto CM = fromRust(Model);

0 commit comments

Comments
 (0)