Index: include/llvm/MC/MCContext.h =================================================================== --- include/llvm/MC/MCContext.h +++ include/llvm/MC/MCContext.h @@ -263,7 +263,7 @@ MCSectionELF *createELFSectionImpl(StringRef Section, unsigned Type, unsigned Flags, SectionKind K, - unsigned EntrySize, + uint64_t EntrySize, const MCSymbolELF *Group, unsigned UniqueID, const MCSymbolELF *Associated); @@ -382,13 +382,13 @@ } MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const Twine &Group) { return getELFSection(Section, Type, Flags, EntrySize, Group, ~0); } MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const Twine &Group, unsigned UniqueID) { return getELFSection(Section, Type, Flags, EntrySize, Group, UniqueID, nullptr); @@ -395,12 +395,12 @@ } MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const Twine &Group, unsigned UniqueID, const MCSymbolELF *Associated); MCSectionELF *getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const MCSymbolELF *Group, unsigned UniqueID, const MCSymbolELF *Associated); @@ -410,10 +410,10 @@ /// configure this named section. MCSectionELF *getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, - unsigned EntrySize = 0); + uint64_t EntrySize = 0); MCSectionELF *createELFRelSection(const Twine &Name, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection); Index: include/llvm/MC/MCSectionELF.h =================================================================== --- include/llvm/MC/MCSectionELF.h +++ include/llvm/MC/MCSectionELF.h @@ -18,6 +18,7 @@ #include "llvm/MC/MCSection.h" #include "llvm/MC/MCSymbolELF.h" #include "llvm/MC/SectionKind.h" +#include namespace llvm { @@ -38,10 +39,10 @@ unsigned UniqueID; - /// The size of each entry in this section. This size only makes sense for + /// This is the sh_entsize field of a section. This size only makes sense for /// sections that contain fixed-sized entries. If a section does not contain /// fixed-sized entries 'EntrySize' will be 0. - unsigned EntrySize; + uint64_t EntrySize; const MCSymbolELF *Group; @@ -52,7 +53,7 @@ friend class MCContext; MCSectionELF(StringRef Section, unsigned type, unsigned flags, SectionKind K, - unsigned entrySize, const MCSymbolELF *group, unsigned UniqueID, + uint64_t entrySize, const MCSymbolELF *group, unsigned UniqueID, MCSymbol *Begin, const MCSymbolELF *AssociatedSymbol) : MCSection(SV_ELF, K, Begin), SectionName(Section), Type(type), Flags(flags), UniqueID(UniqueID), EntrySize(entrySize), Group(group), @@ -73,7 +74,7 @@ StringRef getSectionName() const { return SectionName; } unsigned getType() const { return Type; } unsigned getFlags() const { return Flags; } - unsigned getEntrySize() const { return EntrySize; } + uint64_t getEntrySize() const { return EntrySize; } void setFlags(unsigned F) { Flags = F; } const MCSymbolELF *getGroup() const { return Group; } Index: lib/MC/MCContext.cpp =================================================================== --- lib/MC/MCContext.cpp +++ lib/MC/MCContext.cpp @@ -314,7 +314,7 @@ MCSectionELF *MCContext::createELFSectionImpl(StringRef Section, unsigned Type, unsigned Flags, SectionKind K, - unsigned EntrySize, + uint64_t EntrySize, const MCSymbolELF *Group, unsigned UniqueID, const MCSymbolELF *Associated) { @@ -348,7 +348,7 @@ } MCSectionELF *MCContext::createELFRelSection(const Twine &Name, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const MCSymbolELF *Group, const MCSectionELF *RelInfoSection) { StringMap::iterator I; @@ -364,12 +364,12 @@ MCSectionELF *MCContext::getELFNamedSection(const Twine &Prefix, const Twine &Suffix, unsigned Type, unsigned Flags, - unsigned EntrySize) { + uint64_t EntrySize) { return getELFSection(Prefix + "." + Suffix, Type, Flags, EntrySize, Suffix); } MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const Twine &Group, unsigned UniqueID, const MCSymbolELF *Associated) { MCSymbolELF *GroupSym = nullptr; @@ -381,7 +381,7 @@ } MCSectionELF *MCContext::getELFSection(const Twine &Section, unsigned Type, - unsigned Flags, unsigned EntrySize, + unsigned Flags, uint64_t EntrySize, const MCSymbolELF *GroupSym, unsigned UniqueID, const MCSymbolELF *Associated) { Index: test/MC/ELF/entsize.s =================================================================== --- test/MC/ELF/entsize.s +++ test/MC/ELF/entsize.s @@ -32,6 +32,9 @@ .quad 42 .quad 42 + // Large sh_entsize + .section ".enormous_sh_entsize","M",@progbits,0x100000000 + // CHECK: Section { // CHECK: Index: // CHECK: Name: .rodata.str1.1 @@ -82,3 +85,18 @@ // CHECK-NEXT: AddressAlignment: 1 // CHECK-NEXT: EntrySize: 8 // CHECK-NEXT: } +// CHECK: Section { +// CHECK: Index: +// CHECK: Name: .enormous_sh_entsize +// CHECK-NEXT: Type: SHT_PROGBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_MERGE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: +// CHECK-NEXT: Offset: +// CHECK-NEXT: Size: +// CHECK-NEXT: Link: +// CHECK-NEXT: Info: +// CHECK-NEXT: AddressAlignment: +// CHECK-NEXT: EntrySize: 4294967296 +// CHECK-NEXT: }