diff options
Diffstat (limited to 'lld/ELF/Relocations.cpp')
-rw-r--r-- | lld/ELF/Relocations.cpp | 13 |
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); |