<div dir="ltr">Nice. Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 30, 2016 at 6:27 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Mar 30 08:27:50 2016<br>
New Revision: 264866<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264866&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=264866&view=rev</a><br>
Log:<br>
No relocation needs bot SA and ZA.<br>
<br>
Pass only one of them to relocateOne.<br>
<br>
Modified:<br>
lld/trunk/ELF/InputSection.cpp<br>
lld/trunk/ELF/Target.cpp<br>
lld/trunk/ELF/Target.h<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=264866&r1=264865&r2=264866&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=264866&r1=264865&r2=264866&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Wed Mar 30 08:27:50 2016<br>
@@ -261,7 +261,7 @@ void InputSectionBase<ELFT>::relocate(ui<br>
// that does not have a corresponding symbol.<br>
if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) {<br>
uintX_t SymVA = getPPC64TocBase() + A;<br>
- Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, 0);<br>
+ Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA);<br>
continue;<br>
}<br>
<br>
@@ -299,8 +299,10 @@ void InputSectionBase<ELFT>::relocate(ui<br>
Body.isPreemptible()) {<br>
continue;<br>
}<br>
- uintX_t Size = Body.getSize<ELFT>();<br>
- Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, Size + A);<br>
+ if (Target->isSizeRel(Type))<br>
+ SymVA = Body.getSize<ELFT>() + A;<br>
+<br>
+ Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA);<br>
}<br>
}<br>
<br>
<br>
Modified: lld/trunk/ELF/Target.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=264866&r1=264865&r2=264866&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=264866&r1=264865&r2=264866&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Target.cpp (original)<br>
+++ lld/trunk/ELF/Target.cpp Wed Mar 30 08:27:50 2016<br>
@@ -87,7 +87,7 @@ public:<br>
bool needsGot(uint32_t Type, SymbolBody &S) const override;<br>
bool needsPltImpl(uint32_t Type) const override;<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA = 0) const override;<br>
+ uint64_t SA) const override;<br>
<br>
size_t relaxTlsGdToIe(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
uint64_t P, uint64_t SA) const override;<br>
@@ -121,7 +121,7 @@ public:<br>
bool refersToGotEntry(uint32_t Type) const override;<br>
bool needsPltImpl(uint32_t Type) const override;<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA = 0) const override;<br>
+ uint64_t SA) const override;<br>
bool isRelRelative(uint32_t Type) const override;<br>
bool isSizeRel(uint32_t Type) const override;<br>
<br>
@@ -139,7 +139,7 @@ class PPCTargetInfo final : public Targe<br>
public:<br>
PPCTargetInfo();<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA) const override;<br>
+ uint64_t SA) const override;<br>
bool isRelRelative(uint32_t Type) const override;<br>
};<br>
<br>
@@ -151,7 +151,7 @@ public:<br>
bool needsGot(uint32_t Type, SymbolBody &S) const override;<br>
bool needsPltImpl(uint32_t Type) const override;<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA) const override;<br>
+ uint64_t SA) const override;<br>
bool isRelRelative(uint32_t Type) const override;<br>
};<br>
<br>
@@ -171,7 +171,7 @@ public:<br>
bool needsGot(uint32_t Type, SymbolBody &S) const override;<br>
bool needsPltImpl(uint32_t Type) const override;<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA = 0) const override;<br>
+ uint64_t SA) const override;<br>
size_t relaxTlsGdToLe(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
uint64_t P, uint64_t SA) const override;<br>
size_t relaxTlsIeToLe(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
@@ -185,7 +185,7 @@ class AMDGPUTargetInfo final : public Ta<br>
public:<br>
AMDGPUTargetInfo() {}<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA) const override;<br>
+ uint64_t SA) const override;<br>
};<br>
<br>
template <class ELFT> class MipsTargetInfo final : public TargetInfo {<br>
@@ -202,7 +202,7 @@ public:<br>
bool needsGot(uint32_t Type, SymbolBody &S) const override;<br>
bool needsPltImpl(uint32_t Type) const override;<br>
void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type, uint64_t P,<br>
- uint64_t SA, uint64_t ZA) const override;<br>
+ uint64_t SA) const override;<br>
bool isHintRel(uint32_t Type) const override;<br>
bool isRelRelative(uint32_t Type) const override;<br>
bool refersToGotEntry(uint32_t Type) const override;<br>
@@ -525,7 +525,7 @@ uint64_t X86TargetInfo::getImplicitAdden<br>
}<br>
<br>
void X86TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA) const {<br>
+ uint64_t P, uint64_t SA) const {<br>
switch (Type) {<br>
case R_386_32:<br>
write32le(Loc, SA);<br>
@@ -941,7 +941,7 @@ size_t X86_64TargetInfo::relaxTlsLdToLe(<br>
}<br>
<br>
void X86_64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA) const {<br>
+ uint64_t P, uint64_t SA) const {<br>
switch (Type) {<br>
case R_X86_64_32:<br>
checkUInt<32>(SA, Type);<br>
@@ -968,10 +968,10 @@ void X86_64TargetInfo::relocateOne(uint8<br>
write32le(Loc, SA - P);<br>
break;<br>
case R_X86_64_SIZE32:<br>
- write32le(Loc, ZA);<br>
+ write32le(Loc, SA);<br>
break;<br>
case R_X86_64_SIZE64:<br>
- write64le(Loc, ZA);<br>
+ write64le(Loc, SA);<br>
break;<br>
case R_X86_64_TPOFF32: {<br>
uint64_t Val = SA - Out<ELF64LE>::TlsPhdr->p_memsz;<br>
@@ -1000,7 +1000,7 @@ PPCTargetInfo::PPCTargetInfo() {}<br>
bool PPCTargetInfo::isRelRelative(uint32_t Type) const { return false; }<br>
<br>
void PPCTargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA) const {<br>
+ uint64_t P, uint64_t SA) const {<br>
switch (Type) {<br>
case R_PPC_ADDR16_HA:<br>
write16be(Loc, applyPPCHa(SA));<br>
@@ -1103,7 +1103,7 @@ bool PPC64TargetInfo::isRelRelative(uint<br>
}<br>
<br>
void PPC64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA) const {<br>
+ uint64_t P, uint64_t SA) const {<br>
uint64_t TB = getPPC64TocBase();<br>
<br>
// For a TOC-relative relocation, adjust the addend and proceed in terms of<br>
@@ -1393,8 +1393,8 @@ static uint64_t getAArch64Page(uint64_t<br>
}<br>
<br>
void AArch64TargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd,<br>
- uint32_t Type, uint64_t P, uint64_t SA,<br>
- uint64_t ZA) const {<br>
+ uint32_t Type, uint64_t P,<br>
+ uint64_t SA) const {<br>
switch (Type) {<br>
case R_AARCH64_ABS16:<br>
checkIntUInt<16>(SA, Type);<br>
@@ -1569,7 +1569,7 @@ size_t AArch64TargetInfo::relaxTlsIeToLe<br>
// actually called (relocateOne is called for each relocation).<br>
// That's why the AMDGPU port works without implementing this function.<br>
void AMDGPUTargetInfo::relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA) const {<br>
+ uint64_t P, uint64_t SA) const {<br>
llvm_unreachable("not implemented");<br>
}<br>
<br>
@@ -1750,8 +1750,8 @@ uint64_t MipsTargetInfo<ELFT>::getImplic<br>
<br>
template <class ELFT><br>
void MipsTargetInfo<ELFT>::relocateOne(uint8_t *Loc, uint8_t *BufEnd,<br>
- uint32_t Type, uint64_t P, uint64_t SA,<br>
- uint64_t ZA) const {<br>
+ uint32_t Type, uint64_t P,<br>
+ uint64_t SA) const {<br>
const endianness E = ELFT::TargetEndianness;<br>
// Thread pointer and DRP offsets from the start of TLS data area.<br>
// <a href="https://www.linux-mips.org/wiki/NPTL" rel="noreferrer" target="_blank">https://www.linux-mips.org/wiki/NPTL</a><br>
<br>
Modified: lld/trunk/ELF/Target.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=264866&r1=264865&r2=264866&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.h?rev=264866&r1=264865&r2=264866&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Target.h (original)<br>
+++ lld/trunk/ELF/Target.h Wed Mar 30 08:27:50 2016<br>
@@ -63,7 +63,7 @@ public:<br>
PltNeed needsPlt(uint32_t Type, const SymbolBody &S) const;<br>
<br>
virtual void relocateOne(uint8_t *Loc, uint8_t *BufEnd, uint32_t Type,<br>
- uint64_t P, uint64_t SA, uint64_t ZA = 0) const = 0;<br>
+ uint64_t P, uint64_t SA) const = 0;<br>
virtual bool isGotRelative(uint32_t Type) const;<br>
bool canRelaxTls(uint32_t Type, const SymbolBody *S) const;<br>
template <class ELFT><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>