Index: lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp =================================================================== --- lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp +++ lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp @@ -92,6 +92,15 @@ if (CM == CodeModel::JITDefault) RM = Reloc::Static; else if (RM == Reloc::Default) + // We currently default to PIC code generation. This differs from + // other architectures, such as x86 and ARM, and from GCC's handling of + // MIPS. The reasons for defaulting to PIC appear to be historical. + // It used to be the case that the linker did not support producing + // dynamically-linked executables containing non-position-independent + // code on MIPS. + // TODO: Linker support for non-PIC was added in 2008, so it may be + // possible to make non-PIC the default here now, which would have the + // benefit of generating slightly faster code. RM = Reloc::PIC_; X->InitMCCodeGenInfo(RM, CM, OL); return X;