summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2017-03-07 18:50:58 +0000
committerChris Bieneman <beanz@apple.com>2017-03-07 18:50:58 +0000
commitb3ca711ab38eee12bddb6275967d739c05b73dc1 (patch)
tree15259297ba7f355d77a6806166ac53030da9411e /llvm/lib/ObjectYAML
parent44296ea4db3e5055bd4c7ae5da31be285dc7ac34 (diff)
downloadbcm5719-llvm-b3ca711ab38eee12bddb6275967d739c05b73dc1.tar.gz
bcm5719-llvm-b3ca711ab38eee12bddb6275967d739c05b73dc1.zip
[ObjectYAML] Add support for DWARF5 Unit header
In DWARF5 the Unit header added a new field, UnitType, and swapped the order of the address size and abbreviation offset fields. llvm-svn: 297183
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/DWARFEmitter.cpp11
-rw-r--r--llvm/lib/ObjectYAML/DWARFYAML.cpp2
2 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index c1116a1be46..1aa1519b708 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -130,8 +130,15 @@ protected:
virtual void onStartCompileUnit(const DWARFYAML::Unit &CU) {
writeInitialLength(CU.Length, OS, DebugInfo.IsLittleEndian);
writeInteger((uint16_t)CU.Version, OS, DebugInfo.IsLittleEndian);
- writeInteger((uint32_t)CU.AbbrOffset, OS, DebugInfo.IsLittleEndian);
- writeInteger((uint8_t)CU.AddrSize, OS, DebugInfo.IsLittleEndian);
+ if(CU.Version >= 5) {
+ writeInteger((uint8_t)CU.Type, OS, DebugInfo.IsLittleEndian);
+ writeInteger((uint8_t)CU.AddrSize, OS, DebugInfo.IsLittleEndian);
+ writeInteger((uint32_t)CU.AbbrOffset, OS, DebugInfo.IsLittleEndian);
+ }else {
+ writeInteger((uint32_t)CU.AbbrOffset, OS, DebugInfo.IsLittleEndian);
+ writeInteger((uint8_t)CU.AddrSize, OS, DebugInfo.IsLittleEndian);
+ }
+
}
virtual void onStartDIE(const DWARFYAML::Unit &CU,
diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp
index 2a8cdd5fd4a..edb9545f14b 100644
--- a/llvm/lib/ObjectYAML/DWARFYAML.cpp
+++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp
@@ -99,6 +99,8 @@ void MappingTraits<DWARFYAML::PubSection>::mapping(
void MappingTraits<DWARFYAML::Unit>::mapping(IO &IO, DWARFYAML::Unit &Unit) {
IO.mapRequired("Length", Unit.Length);
IO.mapRequired("Version", Unit.Version);
+ if (Unit.Version >= 5)
+ IO.mapRequired("UnitType", Unit.Type);
IO.mapRequired("AbbrOffset", Unit.AbbrOffset);
IO.mapRequired("AddrSize", Unit.AddrSize);
IO.mapOptional("Entries", Unit.Entries);
OpenPOWER on IntegriCloud