mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[NFC][XCOFF] Replace structs FileHeader32/SectionHeader32 with constants.
Summary: Some structs like FileHeader32/SectionHeader32 defined in llvm/include/llvm/BinaryFormat/XCOFF.h seem unnecessary, because we only need their size. So this patch removes them and defines size constants directly. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D103901
This commit is contained in:
parent
797dfc4832
commit
10a92ed3bb
@ -26,6 +26,8 @@ namespace XCOFF {
|
||||
|
||||
constexpr size_t FileNamePadSize = 6;
|
||||
constexpr size_t NameSize = 8;
|
||||
constexpr size_t FileHeaderSize32 = 20;
|
||||
constexpr size_t SectionHeaderSize32 = 40;
|
||||
constexpr size_t SymbolTableEntrySize = 18;
|
||||
constexpr size_t RelocationSerializationSize32 = 10;
|
||||
constexpr uint16_t RelocOverflow = 65535;
|
||||
@ -255,29 +257,6 @@ enum RelocationType : uint8_t {
|
||||
///< large code model TOC-relative relocation.
|
||||
};
|
||||
|
||||
struct FileHeader32 {
|
||||
uint16_t Magic;
|
||||
uint16_t NumberOfSections;
|
||||
int32_t TimeStamp;
|
||||
uint32_t SymbolTableFileOffset;
|
||||
int32_t NumberOfSymbolTableEntries;
|
||||
uint16_t AuxiliaryHeaderSize;
|
||||
uint16_t Flags;
|
||||
};
|
||||
|
||||
struct SectionHeader32 {
|
||||
char Name[XCOFF::NameSize];
|
||||
uint32_t PhysicalAddress;
|
||||
uint32_t VirtualAddress;
|
||||
uint32_t Size;
|
||||
uint32_t FileOffsetToData;
|
||||
uint32_t FileOffsetToRelocations;
|
||||
uint32_t FileOffsetToLineNumbers;
|
||||
uint16_t NumberOfRelocations;
|
||||
uint16_t NumberOfLineNumbers;
|
||||
int32_t Flags;
|
||||
};
|
||||
|
||||
enum CFileStringType : uint8_t {
|
||||
XFT_FN = 0, ///< Specifies the source-file name.
|
||||
XFT_CT = 1, ///< Specifies the compiler time stamp.
|
||||
|
@ -922,8 +922,8 @@ void XCOFFObjectWriter::assignAddressesAndIndices(const MCAsmLayout &Layout) {
|
||||
SymbolTableEntryCount = SymbolTableIndex;
|
||||
|
||||
// Calculate the RawPointer value for each section.
|
||||
uint64_t RawPointer = sizeof(XCOFF::FileHeader32) + auxiliaryHeaderSize() +
|
||||
SectionCount * sizeof(XCOFF::SectionHeader32);
|
||||
uint64_t RawPointer = XCOFF::FileHeaderSize32 + auxiliaryHeaderSize() +
|
||||
SectionCount * XCOFF::SectionHeaderSize32;
|
||||
for (auto *Sec : Sections) {
|
||||
if (Sec->Index == Section::UninitializedIndex || Sec->IsVirtual)
|
||||
continue;
|
||||
|
@ -158,8 +158,8 @@ bool XCOFFWriter::initFileHeader(uint64_t CurrentOffset) {
|
||||
|
||||
bool XCOFFWriter::assignAddressesAndIndices() {
|
||||
uint64_t CurrentOffset =
|
||||
sizeof(XCOFF::FileHeader32) /* TODO: + auxiliaryHeaderSize() */ +
|
||||
InitSections.size() * sizeof(XCOFF::SectionHeader32);
|
||||
XCOFF::FileHeaderSize32 /* TODO: + auxiliaryHeaderSize() */ +
|
||||
InitSections.size() * XCOFF::SectionHeaderSize32;
|
||||
|
||||
// Calculate section header info.
|
||||
if (!initSectionHeader(CurrentOffset))
|
||||
|
Loading…
Reference in New Issue
Block a user