@@ -71,7 +71,7 @@ const ELFSyncStream &elf::operator<<(const ELFSyncStream &s,
7171 return s << toString (f);
7272}
7373
74- static ELFKind getELFKind (MemoryBufferRef mb, StringRef archiveName) {
74+ static ELFKind getELFKind (Ctx &ctx, MemoryBufferRef mb, StringRef archiveName) {
7575 unsigned char size;
7676 unsigned char endian;
7777 std::tie (size, endian) = getElfArchType (mb.getBuffer ());
@@ -1350,7 +1350,7 @@ static bool isNonCommonDef(Ctx &ctx, ELFKind ekind, MemoryBufferRef mb,
13501350
13511351static bool isNonCommonDef (Ctx &ctx, MemoryBufferRef mb, StringRef symName,
13521352 StringRef archiveName) {
1353- switch (getELFKind (mb, archiveName)) {
1353+ switch (getELFKind (ctx, mb, archiveName)) {
13541354 case ELF32LEKind:
13551355 return isNonCommonDef<ELF32LE>(ctx, ELF32LEKind, mb, symName, archiveName);
13561356 case ELF32BEKind:
@@ -1367,8 +1367,8 @@ static bool isNonCommonDef(Ctx &ctx, MemoryBufferRef mb, StringRef symName,
13671367unsigned SharedFile::vernauxNum;
13681368
13691369SharedFile::SharedFile (Ctx &ctx, MemoryBufferRef m, StringRef defaultSoName)
1370- : ELFFileBase(ctx, SharedKind, getELFKind(m, " " ), m), soName(defaultSoName ),
1371- isNeeded(!ctx.arg.asNeeded) {}
1370+ : ELFFileBase(ctx, SharedKind, getELFKind(ctx, m, " " ), m),
1371+ soName(defaultSoName), isNeeded(!ctx.arg.asNeeded) {}
13721372
13731373// Parse the version definitions in the object file if present, and return a
13741374// vector whose nth element contains a pointer to the Elf_Verdef for version
@@ -1641,7 +1641,8 @@ static ELFKind getBitcodeELFKind(const Triple &t) {
16411641 return t.isArch64Bit () ? ELF64BEKind : ELF32BEKind;
16421642}
16431643
1644- static uint16_t getBitcodeMachineKind (StringRef path, const Triple &t) {
1644+ static uint16_t getBitcodeMachineKind (Ctx &ctx, StringRef path,
1645+ const Triple &t) {
16451646 switch (t.getArch ()) {
16461647 case Triple::aarch64:
16471648 case Triple::aarch64_be:
@@ -1732,7 +1733,7 @@ BitcodeFile::BitcodeFile(Ctx &ctx, MemoryBufferRef mb, StringRef archiveName,
17321733
17331734 Triple t (obj->getTargetTriple ());
17341735 ekind = getBitcodeELFKind (t);
1735- emachine = getBitcodeMachineKind (mb.getBufferIdentifier (), t);
1736+ emachine = getBitcodeMachineKind (ctx, mb.getBufferIdentifier (), t);
17361737 osabi = getOsAbi (t);
17371738}
17381739
@@ -1883,7 +1884,7 @@ InputFile *elf::createInternalFile(Ctx &ctx, StringRef name) {
18831884ELFFileBase *elf::createObjFile (Ctx &ctx, MemoryBufferRef mb,
18841885 StringRef archiveName, bool lazy) {
18851886 ELFFileBase *f;
1886- switch (getELFKind (mb, archiveName)) {
1887+ switch (getELFKind (ctx, mb, archiveName)) {
18871888 case ELF32LEKind:
18881889 f = make<ObjFile<ELF32LE>>(ctx, ELF32LEKind, mb, archiveName);
18891890 break ;
0 commit comments