summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Relocations.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-03-14 22:50:07 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-03-14 22:50:07 +0000
commitd3c22f08b3138bd1b420e49bd751c20a97a809c5 (patch)
treeaa261969e87332755fdecdfa74c10447d181732f /lld/ELF/Relocations.cpp
parenta9bd572b6ff780749b55cdbc6d47b868f8f15750 (diff)
downloadbcm5719-llvm-d3c22f08b3138bd1b420e49bd751c20a97a809c5.tar.gz
bcm5719-llvm-d3c22f08b3138bd1b420e49bd751c20a97a809c5.zip
Don't create copy relocs or dummy plt's if given -z notext.
Being passed -z notext is a pretty strong indication that the user is OK with text relocations. This is not the same behavior as bfd, but bfd defaults to -z notext, so it has to try to avoid text relocations and use them as a last resort. llvm-svn: 297789
Diffstat (limited to 'lld/ELF/Relocations.cpp')
-rw-r--r--lld/ELF/Relocations.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 7d39b08eeff..7fbcea1a26a 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -520,12 +520,11 @@ static RelExpr adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &Body,
// only memory. We can hack around it if we are producing an executable and
// the refered symbol can be preemepted to refer to the executable.
if (Config->Shared || (Config->pic() && !isRelExpr(Expr))) {
- if (Config->ZText)
- error(S.getLocation<ELFT>(RelOff) + ": can't create dynamic relocation " +
- toString(Type) + " against " +
- (Body.getName().empty() ? "local symbol in readonly segment"
- : "symbol '" + toString(Body) + "'") +
- " defined in " + toString(Body.File));
+ error(S.getLocation<ELFT>(RelOff) + ": can't create dynamic relocation " +
+ toString(Type) + " against " +
+ (Body.getName().empty() ? "local symbol in readonly segment"
+ : "symbol '" + toString(Body) + "'") +
+ " defined in " + toString(Body.File));
return Expr;
}
if (Body.getVisibility() != STV_DEFAULT) {
@@ -655,6 +654,8 @@ static void scanRelocs(InputSectionBase &C, ArrayRef<RelTy> Rels) {
typedef typename ELFT::uint uintX_t;
bool IsWrite = C.Flags & SHF_WRITE;
+ if (!Config->ZText)
+ IsWrite = true;
auto AddDyn = [=](const DynamicReloc<ELFT> &Reloc) {
In<ELFT>::RelaDyn->addReloc(Reloc);
OpenPOWER on IntegriCloud