@@ -241,12 +241,12 @@ InputSection *InputSectionBase::getLinkOrderDep() const {
241241 return cast<InputSection>(file->getSections ()[link]);
242242}
243243
244- // Find a function symbol that encloses a given location.
245- Defined *InputSectionBase::getEnclosingFunction (uint64_t offset) {
244+ // Find a symbol that encloses a given location.
245+ Defined *InputSectionBase::getEnclosingSymbol (uint64_t offset, uint8_t type ) {
246246 for (Symbol *b : file->getSymbols ())
247247 if (Defined *d = dyn_cast<Defined>(b))
248- if (d->section == this && d->type == STT_FUNC && d-> value <= offset &&
249- offset < d->value + d->size )
248+ if (d->section == this && d->value <= offset &&
249+ offset < d->value + d->size && (type == 0 || type == d-> type ) )
250250 return d;
251251 return nullptr ;
252252}
@@ -296,10 +296,8 @@ std::string InputSectionBase::getObjMsg(uint64_t off) {
296296 // Find a symbol that encloses a given location. getObjMsg may be called
297297 // before ObjFile::initSectionsAndLocalSyms where local symbols are
298298 // initialized.
299- for (Symbol *b : file->getSymbols ())
300- if (auto *d = dyn_cast_or_null<Defined>(b))
301- if (d->section == this && d->value <= off && off < d->value + d->size )
302- return filename + " :(" + toString (*d) + " )" + archive;
299+ if (Defined *d = getEnclosingSymbol (off))
300+ return filename + " :(" + toString (*d) + " )" + archive;
303301
304302 // If there's no symbol, print out the offset in the section.
305303 return (filename + " :(" + name + " +0x" + utohexstr (off) + " )" + archive)
0 commit comments