@@ -202,8 +202,8 @@ static void updateSupportedARMFeatures(Ctx &ctx,
202
202
ctx.arg .armHasThumb2ISA |= thumb && *thumb >= ARMBuildAttrs::AllowThumb32;
203
203
}
204
204
205
- InputFile::InputFile (Kind k, MemoryBufferRef m)
206
- : mb(m), groupId(ctx.driver.nextGroupId), fileKind(k) {
205
+ InputFile::InputFile (Ctx &ctx, Kind k, MemoryBufferRef m)
206
+ : ctx(ctx), mb(m), groupId(ctx.driver.nextGroupId), fileKind(k) {
207
207
// All files within the same --{start,end}-group get the same group ID.
208
208
// Otherwise, a new file will get a new group ID.
209
209
if (!ctx.driver .isInGroup )
@@ -509,8 +509,8 @@ ObjFile<ELFT>::getDILineInfo(const InputSectionBase *s, uint64_t offset) {
509
509
return getDwarf ()->getDILineInfo (offset, sectionIndex);
510
510
}
511
511
512
- ELFFileBase::ELFFileBase (Kind k, ELFKind ekind, MemoryBufferRef mb)
513
- : InputFile(k, mb) {
512
+ ELFFileBase::ELFFileBase (Ctx &ctx, Kind k, ELFKind ekind, MemoryBufferRef mb)
513
+ : InputFile(ctx, k, mb) {
514
514
this ->ekind = ekind;
515
515
}
516
516
@@ -950,7 +950,8 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
950
950
// hardware-assisted call flow control;
951
951
// - AArch64 PAuth ABI core info (16 bytes).
952
952
template <class ELFT >
953
- void readGnuProperty (const InputSection &sec, ObjFile<ELFT> &f) {
953
+ static void readGnuProperty (Ctx &ctx, const InputSection &sec,
954
+ ObjFile<ELFT> &f) {
954
955
using Elf_Nhdr = typename ELFT::Nhdr;
955
956
using Elf_Note = typename ELFT::Note;
956
957
@@ -1070,7 +1071,7 @@ InputSectionBase *ObjFile<ELFT>::createInputSection(uint32_t idx,
1070
1071
// .note.gnu.property containing a single AND'ed bitmap, we discard an input
1071
1072
// file's .note.gnu.property section.
1072
1073
if (name == " .note.gnu.property" ) {
1073
- readGnuProperty<ELFT>(InputSection (*this , sec, name), *this );
1074
+ readGnuProperty<ELFT>(ctx, InputSection (*this , sec, name), *this );
1074
1075
return &InputSection::discarded;
1075
1076
}
1076
1077
@@ -1127,10 +1128,10 @@ void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) {
1127
1128
}
1128
1129
1129
1130
// Some entries have been filled by LazyObjFile.
1131
+ auto *symtab = ctx.symtab .get ();
1130
1132
for (size_t i = firstGlobal, end = eSyms.size (); i != end; ++i)
1131
1133
if (!symbols[i])
1132
- symbols[i] =
1133
- ctx.symtab ->insert (CHECK (eSyms[i].getName (stringTable), this ));
1134
+ symbols[i] = symtab->insert (CHECK (eSyms[i].getName (stringTable), this ));
1134
1135
1135
1136
// Perform symbol resolution on non-local symbols.
1136
1137
SmallVector<unsigned , 32 > undefineds;
@@ -1325,7 +1326,7 @@ static bool isBitcodeNonCommonDef(MemoryBufferRef mb, StringRef symName,
1325
1326
template <class ELFT >
1326
1327
static bool isNonCommonDef (ELFKind ekind, MemoryBufferRef mb, StringRef symName,
1327
1328
StringRef archiveName) {
1328
- ObjFile<ELFT> *obj = make<ObjFile<ELFT>>(ekind, mb, archiveName);
1329
+ ObjFile<ELFT> *obj = make<ObjFile<ELFT>>(ctx, ekind, mb, archiveName);
1329
1330
obj->init ();
1330
1331
StringRef stringtable = obj->getStringTable ();
1331
1332
@@ -1357,7 +1358,7 @@ static bool isNonCommonDef(MemoryBufferRef mb, StringRef symName,
1357
1358
unsigned SharedFile::vernauxNum;
1358
1359
1359
1360
SharedFile::SharedFile (Ctx &ctx, MemoryBufferRef m, StringRef defaultSoName)
1360
- : ELFFileBase(SharedKind, getELFKind(m, " " ), m), soName(defaultSoName),
1361
+ : ELFFileBase(ctx, SharedKind, getELFKind(m, " " ), m), soName(defaultSoName),
1361
1362
isNeeded(!ctx.arg.asNeeded) {}
1362
1363
1363
1364
// Parse the version definitions in the object file if present, and return a
@@ -1697,7 +1698,7 @@ static uint8_t getOsAbi(const Triple &t) {
1697
1698
1698
1699
BitcodeFile::BitcodeFile (Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
1699
1700
uint64_t offsetInArchive, bool lazy)
1700
- : InputFile(BitcodeKind, mb) {
1701
+ : InputFile(ctx, BitcodeKind, mb) {
1701
1702
this ->archiveName = archiveName;
1702
1703
this ->lazy = lazy;
1703
1704
@@ -1859,30 +1860,30 @@ void BinaryFile::parse() {
1859
1860
data.size (), 0 , nullptr });
1860
1861
}
1861
1862
1862
- InputFile *elf::createInternalFile (StringRef name) {
1863
+ InputFile *elf::createInternalFile (Ctx &ctx, StringRef name) {
1863
1864
auto *file =
1864
- make<InputFile>(InputFile::InternalKind, MemoryBufferRef (" " , name));
1865
+ make<InputFile>(ctx, InputFile::InternalKind, MemoryBufferRef (" " , name));
1865
1866
// References from an internal file do not lead to --warn-backrefs
1866
1867
// diagnostics.
1867
1868
file->groupId = 0 ;
1868
1869
return file;
1869
1870
}
1870
1871
1871
- ELFFileBase *elf::createObjFile (MemoryBufferRef mb, StringRef archiveName ,
1872
- bool lazy) {
1872
+ ELFFileBase *elf::createObjFile (Ctx &ctx, MemoryBufferRef mb ,
1873
+ StringRef archiveName, bool lazy) {
1873
1874
ELFFileBase *f;
1874
1875
switch (getELFKind (mb, archiveName)) {
1875
1876
case ELF32LEKind:
1876
- f = make<ObjFile<ELF32LE>>(ELF32LEKind, mb, archiveName);
1877
+ f = make<ObjFile<ELF32LE>>(ctx, ELF32LEKind, mb, archiveName);
1877
1878
break ;
1878
1879
case ELF32BEKind:
1879
- f = make<ObjFile<ELF32BE>>(ELF32BEKind, mb, archiveName);
1880
+ f = make<ObjFile<ELF32BE>>(ctx, ELF32BEKind, mb, archiveName);
1880
1881
break ;
1881
1882
case ELF64LEKind:
1882
- f = make<ObjFile<ELF64LE>>(ELF64LEKind, mb, archiveName);
1883
+ f = make<ObjFile<ELF64LE>>(ctx, ELF64LEKind, mb, archiveName);
1883
1884
break ;
1884
1885
case ELF64BEKind:
1885
- f = make<ObjFile<ELF64BE>>(ELF64BEKind, mb, archiveName);
1886
+ f = make<ObjFile<ELF64BE>>(ctx, ELF64BEKind, mb, archiveName);
1886
1887
break ;
1887
1888
default :
1888
1889
llvm_unreachable (" getELFKind" );
0 commit comments