From 9c680301b0ee28dfea56e0853defc6eec18aef68 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 19 Apr 2018 03:51:26 +0000 Subject: [PATCH] Simplify. NFC. Using getOffset is here was a bit of an overkill. This is being written and has relocations. This implies it is a .eh_frame or regular section. llvm-svn: 330307 --- lld/ELF/InputSection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 1eb7737bb202..fbbd37075dc2 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -710,7 +710,9 @@ void InputSectionBase::relocateAlloc(uint8_t *Buf, uint8_t *BufEnd) { const unsigned Bits = Config->Wordsize * 8; for (const Relocation &Rel : Relocations) { - uint64_t Offset = getOffset(Rel.Offset); + uint64_t Offset = Rel.Offset; + if (auto *Sec = dyn_cast(this)) + Offset += Sec->OutSecOff; uint8_t *BufLoc = Buf + Offset; RelType Type = Rel.Type;