Skip to content

Commit c18fe32

Browse files
Stylie777MaskRay
authored andcommitted
Fix failing tests & ensure section name is carried through
for obj files This ensures that the section name is correct for the error messages when parsing Obj files, keeping the same behaviour as was present previously
1 parent c8787ea commit c18fe32

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lld/ELF/InputFiles.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,11 @@ template <typename ELFT>
922922
static void parseGnuPropertyNote(Ctx &ctx, uint32_t &featureAndType,
923923
ArrayRef<uint8_t> &desc, ELFFileBase *f,
924924
const uint8_t *base,
925-
ArrayRef<uint8_t> *data = nullptr) {
925+
ArrayRef<uint8_t> *data = nullptr,
926+
StringRef sectionName = ".note.gnu.property") {
926927
auto err = [&](const uint8_t *place) -> ELFSyncStream {
927928
auto diag = Err(ctx);
928-
diag << f->getName() << ":(" << ".note.gnu.properties" << "+0x"
929+
diag << f->getName() << ":(" << sectionName << "+0x"
929930
<< Twine::utohexstr(place - base) << "): ";
930931
return diag;
931932
};
@@ -1008,8 +1009,8 @@ static void readGnuProperty(Ctx &ctx, const InputSection &sec,
10081009

10091010
// Read a body of a NOTE record, which consists of type-length-value fields.
10101011
ArrayRef<uint8_t> desc = note.getDesc(sec.addralign);
1011-
const uint8_t *base = f.getObj().base();
1012-
parseGnuPropertyNote<ELFT>(ctx, featureAndType, desc, &f, base, &data);
1012+
const uint8_t *base = sec.content().data();
1013+
parseGnuPropertyNote<ELFT>(ctx, featureAndType, desc, &f, base, &data, sec.name);
10131014

10141015
// Go to next NOTE record to look for more FEATURE_1_AND descriptions.
10151016
data = data.slice(nhdr->getSize(sec.addralign));

0 commit comments

Comments
 (0)