Lines Matching refs:ELF
126 if (LHSType == ELF::STT_SECTION && RHSType != ELF::STT_SECTION) in operator <()
128 if (LHSType != ELF::STT_SECTION && RHSType == ELF::STT_SECTION) in operator <()
130 if (LHSType == ELF::STT_SECTION && RHSType == ELF::STT_SECTION) in operator <()
140 StringTableBuilder StrTabBuilder{StringTableBuilder::ELF};
367 bool LargeIndex = shndx >= ELF::SHN_LORESERVE && !Reserved; in writeSymbol()
379 uint16_t Index = LargeIndex ? uint16_t(ELF::SHN_XINDEX) : shndx; in writeSymbol()
418 W.OS << ELF::ElfMagic; // e_ident[EI_MAG0] to e_ident[EI_MAG3] in writeHeader()
420 W.OS << char(is64Bit() ? ELF::ELFCLASS64 : ELF::ELFCLASS32); // e_ident[EI_CLASS] in writeHeader()
423 W.OS << char(W.Endian == support::little ? ELF::ELFDATA2LSB in writeHeader()
424 : ELF::ELFDATA2MSB); in writeHeader()
426 W.OS << char(ELF::EV_CURRENT); // e_ident[EI_VERSION] in writeHeader()
432 W.OS.write_zeros(ELF::EI_NIDENT - ELF::EI_PAD); in writeHeader()
434 W.write<uint16_t>(ELF::ET_REL); // e_type in writeHeader()
438 W.write<uint32_t>(ELF::EV_CURRENT); // e_version in writeHeader()
447 W.write<uint16_t>(is64Bit() ? sizeof(ELF::Elf64_Ehdr) in writeHeader()
448 : sizeof(ELF::Elf32_Ehdr)); in writeHeader()
454 W.write<uint16_t>(is64Bit() ? sizeof(ELF::Elf64_Shdr) in writeHeader()
455 : sizeof(ELF::Elf32_Shdr)); in writeHeader()
461 assert(StringTableIndex < ELF::SHN_LORESERVE); in writeHeader()
491 case ELF::STT_GNU_IFUNC: in mergeTypeForSet()
492 if (Type == ELF::STT_FUNC || Type == ELF::STT_OBJECT || in mergeTypeForSet()
493 Type == ELF::STT_NOTYPE || Type == ELF::STT_TLS) in mergeTypeForSet()
494 Type = ELF::STT_GNU_IFUNC; in mergeTypeForSet()
496 case ELF::STT_FUNC: in mergeTypeForSet()
497 if (Type == ELF::STT_OBJECT || Type == ELF::STT_NOTYPE || in mergeTypeForSet()
498 Type == ELF::STT_TLS) in mergeTypeForSet()
499 Type = ELF::STT_FUNC; in mergeTypeForSet()
501 case ELF::STT_OBJECT: in mergeTypeForSet()
502 if (Type == ELF::STT_NOTYPE) in mergeTypeForSet()
503 Type = ELF::STT_OBJECT; in mergeTypeForSet()
505 case ELF::STT_TLS: in mergeTypeForSet()
506 if (Type == ELF::STT_OBJECT || Type == ELF::STT_NOTYPE || in mergeTypeForSet()
507 Type == ELF::STT_GNU_IFUNC || Type == ELF::STT_FUNC) in mergeTypeForSet()
508 Type = ELF::STT_TLS; in mergeTypeForSet()
516 while (Symbol->getType() != ELF::STT_GNU_IFUNC) { in isIFunc()
521 mergeTypeForSet(Symbol->getType(), ELF::STT_GNU_IFUNC) != ELF::STT_GNU_IFUNC) in isIFunc()
542 Type = ELF::STT_GNU_IFUNC; in writeSymbol()
601 if (Symbol.getType() == ELF::STT_SECTION) in isInSymtab()
615 unsigned EntrySize = is64Bit() ? ELF::SYMENTRY_SIZE64 : ELF::SYMENTRY_SIZE32; in computeSymbolTable()
617 Ctx.getELFSection(".symtab", ELF::SHT_SYMTAB, 0, EntrySize, ""); in computeSymbolTable()
650 bool Local = Symbol.getBinding() == ELF::STB_LOCAL; in computeSymbolTable()
654 MSD.SectionIndex = ELF::SHN_ABS; in computeSymbolTable()
660 MSD.SectionIndex = ELF::SHN_COMMON; in computeSymbolTable()
665 if (MSD.SectionIndex >= ELF::SHN_LORESERVE) in computeSymbolTable()
668 MSD.SectionIndex = ELF::SHN_UNDEF; in computeSymbolTable()
681 ELF::STT_SECTION); in computeSymbolTable()
691 if (MSD.SectionIndex >= ELF::SHN_LORESERVE) in computeSymbolTable()
698 if (Symbol.getType() != ELF::STT_SECTION) { in computeSymbolTable()
714 Ctx.getELFSection(".symtab_shndx", ELF::SHT_SYMTAB_SHNDX, 0, 4, ""); in computeSymbolTable()
729 ELF::STT_FILE | ELF::STB_LOCAL, 0, 0, ELF::STV_DEFAULT, in computeSymbolTable()
730 ELF::SHN_ABS, true); in computeSymbolTable()
741 unsigned StringIndex = MSD.Symbol->getType() == ELF::STT_SECTION in computeSymbolTable()
755 assert(MSD.Symbol->getBinding() != ELF::STB_LOCAL); in computeSymbolTable()
793 EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rela) : sizeof(ELF::Elf32_Rela); in createRelocationSection()
795 EntrySize = is64Bit() ? sizeof(ELF::Elf64_Rel) : sizeof(ELF::Elf32_Rel); in createRelocationSection()
798 if (Sec.getFlags() & ELF::SHF_GROUP) in createRelocationSection()
799 Flags = ELF::SHF_GROUP; in createRelocationSection()
802 RelaSectionName, hasRelocationAddend() ? ELF::SHT_RELA : ELF::SHT_REL, in createRelocationSection()
814 is64Bit() ? sizeof(ELF::Elf32_Chdr) : sizeof(ELF::Elf64_Chdr); in maybeWriteCompression()
820 write(static_cast<ELF::Elf64_Word>(ELF::ELFCOMPRESS_ZLIB)); in maybeWriteCompression()
821 write(static_cast<ELF::Elf64_Word>(0)); // ch_reserved field. in maybeWriteCompression()
822 write(static_cast<ELF::Elf64_Xword>(Size)); in maybeWriteCompression()
823 write(static_cast<ELF::Elf64_Xword>(Alignment)); in maybeWriteCompression()
826 write(static_cast<ELF::Elf32_Word>(ELF::ELFCOMPRESS_ZLIB)); in maybeWriteCompression()
827 write(static_cast<ELF::Elf32_Word>(Size)); in maybeWriteCompression()
828 write(static_cast<ELF::Elf32_Word>(Alignment)); in maybeWriteCompression()
888 Section.setFlags(Section.getFlags() | ELF::SHF_COMPRESSED); in writeSectionData()
934 if (OWriter.TargetObjectWriter->getEMachine() == ELF::EM_MIPS) { in writeRelocations()
942 struct ELF::Elf64_Rela ERE64; in writeRelocations()
951 struct ELF::Elf32_Rela ERE32; in writeRelocations()
958 if (OWriter.TargetObjectWriter->getEMachine() == ELF::EM_MIPS) { in writeRelocations()
997 case ELF::SHT_DYNAMIC: in writeSection()
1000 case ELF::SHT_REL: in writeSection()
1001 case ELF::SHT_RELA: { in writeSection()
1009 case ELF::SHT_SYMTAB: in writeSection()
1014 case ELF::SHT_SYMTAB_SHNDX: in writeSection()
1015 case ELF::SHT_LLVM_CALL_GRAPH_PROFILE: in writeSection()
1016 case ELF::SHT_LLVM_ADDRSIG: in writeSection()
1020 case ELF::SHT_GROUP: in writeSection()
1026 if (Section.getFlags() & ELF::SHF_LINK_ORDER) { in writeSection()
1045 (NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0; in writeSectionHeader()
1051 if (Type != ELF::SHT_GROUP) in writeSectionHeader()
1059 if (Type == ELF::SHT_NOBITS) in writeSectionHeader()
1074 Ctx.getELFSection(".strtab", ELF::SHT_STRTAB, 0); in writeObject()
1137 ELF::SHT_LLVM_CALL_GRAPH_PROFILE, in writeObject()
1138 ELF::SHF_EXCLUDE, 16, ""); in writeObject()
1150 write(uint32_t(ELF::GRP_COMDAT)); in writeObject()
1167 AddrsigSection = Ctx.getELFSection(".llvm_addrsig", ELF::SHT_LLVM_ADDRSIG, in writeObject()
1168 ELF::SHF_EXCLUDE); in writeObject()
1224 (SectionTable.size() + 1 >= ELF::SHN_LORESERVE) ? (uint16_t)ELF::SHN_UNDEF in writeObject()
1234 offsetof(ELF::Elf64_Ehdr, e_shoff)); in writeObject()
1235 NumSectionsOffset = offsetof(ELF::Elf64_Ehdr, e_shnum); in writeObject()
1240 offsetof(ELF::Elf32_Ehdr, e_shoff)); in writeObject()
1241 NumSectionsOffset = offsetof(ELF::Elf32_Ehdr, e_shnum); in writeObject()
1360 case ELF::STB_LOCAL: in shouldRelocateWithSymbol()
1362 case ELF::STB_WEAK: in shouldRelocateWithSymbol()
1367 case ELF::STB_GLOBAL: in shouldRelocateWithSymbol()
1376 if (Sym->getType() == ELF::STT_GNU_IFUNC) in shouldRelocateWithSymbol()
1389 if (Flags & ELF::SHF_MERGE) { in shouldRelocateWithSymbol()
1403 if (Flags & ELF::SHF_TLS) in shouldRelocateWithSymbol()
1517 if (SymA.getBinding() != ELF::STB_LOCAL || in isSymbolRefDifferenceFullyResolvedImpl()
1518 SymA.getType() == ELF::STT_GNU_IFUNC) in isSymbolRefDifferenceFullyResolvedImpl()