llvm.org GIT mirror llvm / e235dc4
Use getValue instead of getAddress in a few MachO only cases. In MachO the value of the symbol is always the address, so we can use the simpler function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241364 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 5 years ago
2 changed file(s) with 11 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
391391 }
392392
393393 uint64_t MachOObjectFile::getCommonSymbolSizeImpl(DataRefImpl DRI) const {
394 uint64_t Value;
395 getSymbolAddress(DRI, Value);
396 return Value;
394 return getSymbolValue(DRI);
397395 }
398396
399397 SymbolRef::Type MachOObjectFile::getSymbolType(DataRefImpl Symb) const {
433431 if (MachOType & MachO::N_EXT) {
434432 Result |= SymbolRef::SF_Global;
435433 if ((MachOType & MachO::N_TYPE) == MachO::N_UNDF) {
436 uint64_t Value;
437 getSymbolAddress(DRI, Value);
434 uint64_t Value = getSymbolValue(DRI);
438435 if (Value && Value != UnknownAddress)
439436 Result |= SymbolRef::SF_Common;
440437 }
177177
178178 struct SymbolSorter {
179179 bool operator()(const SymbolRef &A, const SymbolRef &B) {
180 SymbolRef::Type AType = A.getType();
181 SymbolRef::Type BType = B.getType();
182
183 uint64_t AAddr, BAddr;
184 if (AType != SymbolRef::ST_Function)
185 AAddr = 0;
186 else
187 A.getAddress(AAddr);
188 if (BType != SymbolRef::ST_Function)
189 BAddr = 0;
190 else
191 B.getAddress(BAddr);
180 uint64_t AAddr = (A.getType() != SymbolRef::ST_Function) ? 0 : A.getValue();
181 uint64_t BAddr = (B.getType() != SymbolRef::ST_Function) ? 0 : B.getValue();
192182 return AAddr < BAddr;
193183 }
194184 };
591581 SymbolRef::Type ST = Symbol.getType();
592582 if (ST == SymbolRef::ST_Function || ST == SymbolRef::ST_Data ||
593583 ST == SymbolRef::ST_Other) {
594 uint64_t Address;
595 Symbol.getAddress(Address);
584 uint64_t Address = Symbol.getValue();
596585 ErrorOr SymNameOrErr = Symbol.getName();
597586 if (std::error_code EC = SymNameOrErr.getError())
598587 report_fatal_error(EC.message());
24552444 // and return its name.
24562445 const char *SymbolName = nullptr;
24572446 if (reloc_found && isExtern) {
2458 Symbol.getAddress(n_value);
2447 n_value = Symbol.getValue();
24592448 if (n_value == UnknownAddress)
24602449 n_value = 0;
24612450 ErrorOr NameOrError = Symbol.getName();
56395628 if (info->O->getAnyRelocationPCRel(RE)) {
56405629 unsigned Type = info->O->getAnyRelocationType(RE);
56415630 if (Type == MachO::X86_64_RELOC_SIGNED) {
5642 Symbol.getAddress(ReferenceValue);
5631 ReferenceValue = Symbol.getValue();
56435632 }
56445633 }
56455634 }
61306119 SymbolRef::Type ST = Symbol.getType();
61316120 if (ST == SymbolRef::ST_Function || ST == SymbolRef::ST_Data ||
61326121 ST == SymbolRef::ST_Other) {
6133 uint64_t Address;
6134 Symbol.getAddress(Address);
6122 uint64_t Address = Symbol.getValue();
61356123 ErrorOr SymNameOrErr = Symbol.getName();
61366124 if (std::error_code EC = SymNameOrErr.getError())
61376125 report_fatal_error(EC.message());
61936181 continue;
61946182
61956183 // Start at the address of the symbol relative to the section's address.
6196 uint64_t Start = 0;
6184 uint64_t Start = Symbols[SymIdx].getValue();
61976185 uint64_t SectionAddress = Sections[SectIdx].getAddress();
6198 Symbols[SymIdx].getAddress(Start);
61996186 Start -= SectionAddress;
62006187
62016188 // Stop disassembling either at the beginning of the next symbol or at
62086195 if (NextSymType == SymbolRef::ST_Function) {
62096196 containsNextSym =
62106197 Sections[SectIdx].containsSymbol(Symbols[NextSymIdx]);
6211 Symbols[NextSymIdx].getAddress(NextSym);
6198 NextSym = Symbols[NextSymIdx].getValue();
62126199 NextSym -= SectionAddress;
62136200 break;
62146201 }
68146801 if (Section == Obj->section_end())
68156802 continue;
68166803
6817 uint64_t Addr;
6818 SymRef.getAddress(Addr);
6804 uint64_t Addr = SymRef.getValue();
68196805 Symbols.insert(std::make_pair(Addr, SymRef));
68206806 }
68216807