[PATCH] [mips] Set default relocation model to static for NaCl

Mark Seaborn mseaborn at chromium.org
Mon Sep 22 10:56:53 PDT 2014


================
Comment at: lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp:98
@@ +97,3 @@
+    else
+      RM = Reloc::PIC_;
+  }
----------------
Could possibly you add a comment to explain why the default is PIC, and why you don't make Reloc::Static the default for non-NaCl targets as well as for NaCl?

This has come up several times, but I'm still not clear on why LLVM defaults to PIC for MIPS.

e.g. Sasa Sankovic wrote: "MIPS traditionally used PIC relocation model, to be able to use shared libraries. PLT support (which enables non-PIC code to use shared libraries) was added to MIPS only recently, in 2008. I suppose at that time GCC switched to using non-PIC as default. I don't know why LLVM still uses PIC." (see http://reviews.llvm.org/D3928)

Even if the comment is speculative, it would be useful.  The comment could just state that the reasons are unknown, and that Reloc::Static is being left as the default in case changing it breaks anything.

http://reviews.llvm.org/D5442






More information about the llvm-commits mailing list