[PATCH] D19490: ELF: Move code to where it is used, and related cleanups. NFC.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 15:29:55 PDT 2016
pcc added inline comments.
================
Comment at: ELF/MarkLive.cpp:28
@@ -27,2 +27,3 @@
#include "Symbols.h"
+#include "Target.h"
#include "Writer.h"
----------------
rafael wrote:
> Can you remove the include from InputSection.cpp?
We still need it in (e.g.) `InputSection<ELFT>::getThunksSize()`.
================
Comment at: ELF/OutputSections.cpp:1155
@@ -1154,10 +1154,3 @@
fatal("FDE doesn't reference another section");
- InputSectionBase<ELFT> *Target = S->getRelocTarget(*RelI).first;
- if (Target && Target->Live) {
- uint32_t CieOffset = Offset + 4 - ID;
- auto I = OffsetToIndex.find(CieOffset);
- if (I == OffsetToIndex.end())
- fatal("invalid CIE reference");
- Cies[I->second].Fdes.push_back(EHRegion<ELFT>(S, Index));
- Out<ELFT>::EhFrameHdr->reserveFde();
- this->Header.sh_size += alignTo(Length, sizeof(uintX_t));
+ uint32_t SymIndex = RelI->getSymbol(Config->Mips64EL);
+ SymbolBody &B = S->getFile()->getSymbolBody(SymIndex).repl();
----------------
rafael wrote:
> This code is pretty much exactly what getRelocTargetSym was. Maybe keep just that as an utility function and move the rest to MarkLive?
I found that the two lines that retrieved the replacement SymbolBody were duplicated in several places, so I pulled that out into a utility function and updated the users. The rest of the code is only duplicated here and in MarkLive, so it's probably simplest to keep the duplication.
http://reviews.llvm.org/D19490
More information about the llvm-commits
mailing list