aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-05-06 20:11:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-05-06 20:11:21 +0000
commit7098ae2fee5d89a6e95ff391a9efa78c4a6c8703 (patch)
tree414cc471bf6e6327f4371558e2e9a17d495829ea /tools
parent1a7eab387849feaa3e9c35f145d5b07be54686e3 (diff)
downloadexternal_llvm-7098ae2fee5d89a6e95ff391a9efa78c4a6c8703.zip
external_llvm-7098ae2fee5d89a6e95ff391a9efa78c4a6c8703.tar.gz
external_llvm-7098ae2fee5d89a6e95ff391a9efa78c4a6c8703.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181243 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/yaml2obj/yaml2obj.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/tools/yaml2obj/yaml2obj.cpp b/tools/yaml2obj/yaml2obj.cpp
index 32dee54..707b6b4 100644
--- a/tools/yaml2obj/yaml2obj.cpp
+++ b/tools/yaml2obj/yaml2obj.cpp
@@ -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);
}
};