[PATCH] Modify MIPS long branch for NaCl
Sasa Stankovic
Sasa.Stankovic at imgtec.com
Wed May 28 13:23:18 PDT 2014
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.
Regards,
Sasa
________________________________________
From: mseaborn at google.com [mseaborn at google.com] on behalf of Mark Seaborn [mseaborn at chromium.org]
Sent: Wednesday, May 28, 2014 9:05 PM
To: reviews+D3928+public+f7afee4420e9e625 at reviews.llvm.org
Cc: Sasa Stankovic; Petar Jovanovic; llvm-commits
Subject: Re: [PATCH] Modify MIPS long branch for NaCl
On 28 May 2014 11:29, Sasa Stankovic <Sasa.Stankovic at imgtec.com<mailto:Sasa.Stankovic at imgtec.com>> wrote:
> BTW, if you're hitting this when targeting NaCl at the moment, you should probably turn off PIC code generation, since you don't need PIC for NaCl nexes.
Should this be done in LLVM, or in pnacl/driver scripts?
That depends. Why does LLVM default to using -relocation-model=pic on MIPS? This differs from GCC, and it differs from other architectures.
The default appears to be set by this code in lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp:
if (RM == Reloc::Default)
RM = Reloc::PIC_;
but there's no explanation of the reason there.
I would recommend taking that out and changing the default to be non-PIC, for efficiency, and for consistency with other architectures and with GCC. But maybe there is a reason for it?
Cheers,
Mark
More information about the llvm-commits
mailing list