[PATCH] MIPS: Add comment to explain why PIC code gen is the default for MIPS

Mark Seaborn mseaborn at chromium.org
Wed Sep 24 16:07:03 PDT 2014


Hi petarj, sstankovic, dsanders,

The question of why LLVM defaults to PIC for MIPS, when GCC doesn't, keeps coming up.

It seems like it would be useful to add an explanatory comment, even if it's only a partial explanation.

This is based on:

 * What Sasa Sankovic wrote in http://reviews.llvm.org/D3928: "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."

 * This thread from 2008, "RFC: Adding non-PIC executable support to MIPS": https://sourceware.org/ml/binutils/2008-06/msg00280.html

 * Part of http://www.linux-mips.org/wiki/PIC_code, which is presumably out of date (from 2008 or earlier), which says: "All userspace code in Linux is PIC code. It is currently not possible to mix non-PIC object files and PIC object files when linking. Therefore the customer needs to generate PIC objects."

Please feel free to suggest a different wording for the comment!

http://reviews.llvm.org/D5487

Files:
  lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5487.14057.patch
Type: text/x-patch
Size: 1014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140924/5fdf0c72/attachment.bin>


More information about the llvm-commits mailing list