llvm.org GIT mirror llvm / 218b64b
[llvm-cxxdump] Correctly process relocations when given multiple files Archive files wouldn't lead to us reprocessing the section relocations for the new object files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244932 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 4 years ago
1 changed file(s) with 10 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
6363 reportError(Input, EC.message());
6464 }
6565
66 static SmallVectorImpl &getRelocSections(const ObjectFile *Obj,
67 const SectionRef &Sec) {
68 static bool MappingDone = false;
69 static std::map> SectionRelocMap;
70 if (!MappingDone) {
71 for (const SectionRef &Section : Obj->sections()) {
72 section_iterator Sec2 = Section.getRelocatedSection();
73 if (Sec2 != Obj->section_end())
74 SectionRelocMap[*Sec2].push_back(Section);
75 }
76 MappingDone = true;
77 }
78 return SectionRelocMap[Sec];
79 }
66 static std::map> SectionRelocMap;
8067
8168 static void collectRelocatedSymbols(const ObjectFile *Obj,
8269 const SectionRef &Sec, uint64_t SecAddress,
8471 StringRef *I, StringRef *E) {
8572 uint64_t SymOffset = SymAddress - SecAddress;
8673 uint64_t SymEnd = SymOffset + SymSize;
87 for (const SectionRef &SR : getRelocSections(Obj, Sec)) {
74 for (const SectionRef &SR : SectionRelocMap[Sec]) {
8875 for (const object::RelocationRef &Reloc : SR.relocations()) {
8976 if (I == E)
9077 break;
10895 std::map, StringRef> &Collection) {
10996 uint64_t SymOffset = SymAddress - SecAddress;
11097 uint64_t SymEnd = SymOffset + SymSize;
111 for (const SectionRef &SR : getRelocSections(Obj, Sec)) {
98 for (const SectionRef &SR : SectionRelocMap[Sec]) {
11299 for (const object::RelocationRef &Reloc : SR.relocations()) {
113100 const object::symbol_iterator RelocSymI = Reloc.getSymbol();
114101 if (RelocSymI == Obj->symbol_end())
171158 std::map, int64_t> VTableDataEntries;
172159 std::map, StringRef> VTTEntries;
173160 std::map TINames;
161
162 SectionRelocMap.clear();
163 for (const SectionRef &Section : Obj->sections()) {
164 section_iterator Sec2 = Section.getRelocatedSection();
165 if (Sec2 != Obj->section_end())
166 SectionRelocMap[*Sec2].push_back(Section);
167 }
174168
175169 uint8_t BytesInAddress = Obj->getBytesInAddress();
176170