Explain why we switch away from large code model when PIC is enabled.

Note that I don't explain why Small vs Medium. I'm not sure myself.
This commit is contained in:
Nick Lewycky
2020-08-10 16:32:35 -07:00
parent b8df7fc398
commit 6b1df05582

View File

@@ -95,6 +95,11 @@ impl LLVM {
}
fn code_model(&self) -> CodeModel {
// We normally use the large code model, but when targeting shared
// objects, we are required to use PIC. If we use PIC anyways, we lose
// any benefit from large code model and there's some cost on all
// platforms, plus some platforms (MachO) don't support PIC + large
// at all.
if self.is_pic {
CodeModel::Small
} else {