mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-03 08:51:43 +00:00
Split Alignment out of the Section Characteristics.
The alignment is just a byte in the middle of Characteristics, not an independent flag. Making it an independent field in the yaml representation makes it more yamlio friendly. llvm-svn: 181243
This commit is contained in:
parent
0ec07a2dbc
commit
d896db3c7d
@ -5,7 +5,8 @@ header: !Header
|
||||
sections:
|
||||
- !Section
|
||||
Name: .text
|
||||
Characteristics: [IMAGE_SCN_CNT_CODE, IMAGE_SCN_ALIGN_16BYTES, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ, ] # 0x60500020
|
||||
Alignment: 16
|
||||
Characteristics: [IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ, ] # 0x60500020
|
||||
SectionData: !hex "83EC0CC744240800000000C7042400000000E800000000E8000000008B44240883C40CC3" # |....D$.......$...............D$.....|
|
||||
|
||||
Relocations:
|
||||
@ -26,7 +27,8 @@ sections:
|
||||
|
||||
- !Section
|
||||
Name: .data
|
||||
Characteristics: [IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_ALIGN_1BYTES, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE, ] # 0xc0100040
|
||||
Alignment: 1
|
||||
Characteristics: [IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE, ] # 0xc0100040
|
||||
SectionData: !hex "48656C6C6F20576F726C642100" # |Hello World!.|
|
||||
|
||||
symbols:
|
||||
|
@ -4,7 +4,8 @@ header: !Header
|
||||
sections:
|
||||
- !Section
|
||||
Name: .text
|
||||
Characteristics: [IMAGE_SCN_CNT_CODE, IMAGE_SCN_ALIGN_16BYTES, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ, ] # 0x60500020
|
||||
Alignment: 16
|
||||
Characteristics: [IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ, ] # 0x60500020
|
||||
SectionData: !hex "4883EC28C744242400000000488D0D00000000E800000000E8000000008B4424244883C428C3" # |H..(.D$$....H.................D$$H..(.|
|
||||
|
||||
Relocations:
|
||||
@ -25,7 +26,8 @@ sections:
|
||||
|
||||
- !Section
|
||||
Name: .data
|
||||
Characteristics: [IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_ALIGN_1BYTES, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE, ] # 0xc0100040
|
||||
Alignment: 1
|
||||
Characteristics: [IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE, ] # 0xc0100040
|
||||
SectionData: !hex "48656C6C6F20576F726C642100" # |Hello World!.|
|
||||
|
||||
symbols:
|
||||
|
@ -42,6 +42,7 @@ static cl::opt<std::string>
|
||||
namespace COFFYAML {
|
||||
struct Section {
|
||||
COFF::section Header;
|
||||
unsigned Alignment;
|
||||
StringRef SectionData;
|
||||
std::vector<COFF::relocation> Relocations;
|
||||
StringRef Name;
|
||||
@ -102,6 +103,8 @@ struct COFFParser {
|
||||
Sec.Header.Name[0] = '/';
|
||||
std::copy(str.begin(), str.end(), Sec.Header.Name + 1);
|
||||
}
|
||||
|
||||
Sec.Header.Characteristics |= (Log2_32(Sec.Alignment) + 1) << 20;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -358,20 +361,6 @@ struct ScalarBitSetTraits<COFF::SectionCharacteristics> {
|
||||
BCase(IMAGE_SCN_MEM_16BIT);
|
||||
BCase(IMAGE_SCN_MEM_LOCKED);
|
||||
BCase(IMAGE_SCN_MEM_PRELOAD);
|
||||
BCase(IMAGE_SCN_ALIGN_1BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_2BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_4BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_8BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_16BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_32BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_64BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_128BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_256BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_512BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_1024BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_2048BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_4096BYTES);
|
||||
BCase(IMAGE_SCN_ALIGN_8192BYTES);
|
||||
BCase(IMAGE_SCN_LNK_NRELOC_OVFL);
|
||||
BCase(IMAGE_SCN_MEM_DISCARDABLE);
|
||||
BCase(IMAGE_SCN_MEM_NOT_CACHED);
|
||||
@ -641,6 +630,7 @@ struct MappingTraits<COFFYAML::Section> {
|
||||
IO.mapRequired("SectionData", Sec.SectionData);
|
||||
IO.mapRequired("Characteristics", NC->Characteristics);
|
||||
IO.mapRequired("Name", Sec.Name);
|
||||
IO.mapOptional("Alignment", Sec.Alignment);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user