[PATCH] D42927: Add a WriteAddends config variable
Rafael Avila de Espindola via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 5 11:49:46 PST 2018
espindola created this revision.
espindola added a reviewer: ruiu.
Herald added a subscriber: emaste.
This is the same idea for having
Config->CopyRelocs = (Config->Relocatable || Config->EmitRelocs);
it is easier IMHO to read this closer to where the other Config variables are set then in the middle of the dynamic relocation processing code.
https://reviews.llvm.org/D42927
Files:
ELF/Config.h
ELF/Driver.cpp
ELF/SyntheticSections.cpp
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1211,7 +1211,7 @@
// relocations for compatibility with GNU Linkers. There is some system
// software such as the Bionic dynamic linker that uses the addend prior
// to dynamic relocation resolution.
- if ((!Config->IsRela || Config->ApplyDynamicRelocs) && UseSymVA)
+ if (Config->WriteAddends && UseSymVA)
InputSec->Relocations.push_back({Expr, Type, OffsetInSec, Addend, Sym});
addReloc({DynType, InputSec, OffsetInSec, UseSymVA, Sym, Addend});
}
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -821,6 +821,7 @@
(Config->Is64 || IsX32 || Machine == EM_PPC) && Machine != EM_MIPS;
Config->Pic = Config->Pie || Config->Shared;
Config->Wordsize = Config->Is64 ? 8 : 4;
+ Config->WriteAddends = Config->ApplyDynamicRelocs || !Config->IsRela;
}
// Returns a value of "-format" option.
Index: ELF/Config.h
===================================================================
--- ELF/Config.h
+++ ELF/Config.h
@@ -154,6 +154,7 @@
bool Verbose;
bool WarnCommon;
bool WarnMissingEntry;
+ bool WriteAddends;
bool ZCombreloc;
bool ZExecstack;
bool ZNocopyreloc;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42927.132874.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180205/3889807f/attachment.bin>
More information about the llvm-commits
mailing list