Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/ObjectYAML/DWARFYAML.h b/linux-x64/clang/include/llvm/ObjectYAML/DWARFYAML.h
index 78d736c..856cea9 100644
--- a/linux-x64/clang/include/llvm/ObjectYAML/DWARFYAML.h
+++ b/linux-x64/clang/include/llvm/ObjectYAML/DWARFYAML.h
@@ -15,35 +15,18 @@
#ifndef LLVM_OBJECTYAML_DWARFYAML_H
#define LLVM_OBJECTYAML_DWARFYAML_H
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/ObjectYAML/YAML.h"
#include "llvm/Support/YAMLTraits.h"
#include <cstdint>
+#include <unordered_map>
#include <vector>
namespace llvm {
namespace DWARFYAML {
-struct InitialLength {
- uint32_t TotalLength;
- uint64_t TotalLength64;
-
- bool isDWARF64() const { return TotalLength == UINT32_MAX; }
-
- uint64_t getLength() const {
- return isDWARF64() ? TotalLength64 : TotalLength;
- }
-
- void setLength(uint64_t Len) {
- if (Len >= (uint64_t)UINT32_MAX) {
- TotalLength64 = Len;
- TotalLength = UINT32_MAX;
- } else {
- TotalLength = Len;
- }
- }
-};
-
struct AttributeAbbrev {
llvm::dwarf::Attribute Attribute;
llvm::dwarf::Form Form;
@@ -51,26 +34,46 @@
};
struct Abbrev {
- llvm::yaml::Hex32 Code;
+ Optional<yaml::Hex64> Code;
llvm::dwarf::Tag Tag;
llvm::dwarf::Constants Children;
std::vector<AttributeAbbrev> Attributes;
};
+struct AbbrevTable {
+ Optional<uint64_t> ID;
+ std::vector<Abbrev> Table;
+};
+
struct ARangeDescriptor {
llvm::yaml::Hex64 Address;
- uint64_t Length;
+ yaml::Hex64 Length;
};
struct ARange {
- InitialLength Length;
+ dwarf::DwarfFormat Format;
+ Optional<yaml::Hex64> Length;
uint16_t Version;
- uint32_t CuOffset;
- uint8_t AddrSize;
- uint8_t SegSize;
+ yaml::Hex64 CuOffset;
+ Optional<yaml::Hex8> AddrSize;
+ yaml::Hex8 SegSize;
std::vector<ARangeDescriptor> Descriptors;
};
+/// Class that describes a range list entry, or a base address selection entry
+/// within a range list in the .debug_ranges section.
+struct RangeEntry {
+ llvm::yaml::Hex64 LowOffset;
+ llvm::yaml::Hex64 HighOffset;
+};
+
+/// Class that describes a single range list inside the .debug_ranges section.
+struct Ranges {
+ Optional<llvm::yaml::Hex64> Offset;
+ Optional<llvm::yaml::Hex8> AddrSize;
+ std::vector<RangeEntry> Entries;
+};
+
struct PubEntry {
llvm::yaml::Hex32 DieOffset;
llvm::yaml::Hex8 Descriptor;
@@ -78,11 +81,11 @@
};
struct PubSection {
- InitialLength Length;
+ dwarf::DwarfFormat Format;
+ yaml::Hex64 Length;
uint16_t Version;
uint32_t UnitOffset;
uint32_t UnitSize;
- bool IsGNUStyle = false;
std::vector<PubEntry> Entries;
};
@@ -97,12 +100,20 @@
std::vector<FormValue> Values;
};
+/// Class that contains helpful context information when mapping YAML into DWARF
+/// data structures.
+struct DWARFContext {
+ bool IsGNUPubSec = false;
+};
+
struct Unit {
- InitialLength Length;
+ dwarf::DwarfFormat Format;
+ Optional<yaml::Hex64> Length;
uint16_t Version;
+ Optional<uint8_t> AddrSize;
llvm::dwarf::UnitType Type; // Added in DWARF 5
- uint32_t AbbrOffset;
- uint8_t AddrSize;
+ Optional<uint64_t> AbbrevTableID;
+ Optional<yaml::Hex64> AbbrOffset;
std::vector<Entry> Entries;
};
@@ -115,7 +126,7 @@
struct LineTableOpcode {
dwarf::LineNumberOps Opcode;
- uint64_t ExtLen;
+ Optional<uint64_t> ExtLen;
dwarf::LineNumberExtendedOps SubOpcode;
uint64_t Data;
int64_t SData;
@@ -125,48 +136,124 @@
};
struct LineTable {
- InitialLength Length;
+ dwarf::DwarfFormat Format;
+ Optional<uint64_t> Length;
uint16_t Version;
- uint64_t PrologueLength;
+ Optional<uint64_t> PrologueLength;
uint8_t MinInstLength;
uint8_t MaxOpsPerInst;
uint8_t DefaultIsStmt;
uint8_t LineBase;
uint8_t LineRange;
- uint8_t OpcodeBase;
- std::vector<uint8_t> StandardOpcodeLengths;
+ Optional<uint8_t> OpcodeBase;
+ Optional<std::vector<uint8_t>> StandardOpcodeLengths;
std::vector<StringRef> IncludeDirs;
std::vector<File> Files;
std::vector<LineTableOpcode> Opcodes;
};
+struct SegAddrPair {
+ yaml::Hex64 Segment;
+ yaml::Hex64 Address;
+};
+
+struct AddrTableEntry {
+ dwarf::DwarfFormat Format;
+ Optional<yaml::Hex64> Length;
+ yaml::Hex16 Version;
+ Optional<yaml::Hex8> AddrSize;
+ yaml::Hex8 SegSelectorSize;
+ std::vector<SegAddrPair> SegAddrPairs;
+};
+
+struct StringOffsetsTable {
+ dwarf::DwarfFormat Format;
+ Optional<yaml::Hex64> Length;
+ yaml::Hex16 Version;
+ yaml::Hex16 Padding;
+ std::vector<yaml::Hex64> Offsets;
+};
+
+struct DWARFOperation {
+ dwarf::LocationAtom Operator;
+ std::vector<yaml::Hex64> Values;
+};
+
+struct RnglistEntry {
+ dwarf::RnglistEntries Operator;
+ std::vector<yaml::Hex64> Values;
+};
+
+struct LoclistEntry {
+ dwarf::LoclistEntries Operator;
+ std::vector<yaml::Hex64> Values;
+ Optional<yaml::Hex64> DescriptionsLength;
+ std::vector<DWARFOperation> Descriptions;
+};
+
+template <typename EntryType> struct ListEntries {
+ Optional<std::vector<EntryType>> Entries;
+ Optional<yaml::BinaryRef> Content;
+};
+
+template <typename EntryType> struct ListTable {
+ dwarf::DwarfFormat Format;
+ Optional<yaml::Hex64> Length;
+ yaml::Hex16 Version;
+ Optional<yaml::Hex8> AddrSize;
+ yaml::Hex8 SegSelectorSize;
+ Optional<uint32_t> OffsetEntryCount;
+ Optional<std::vector<yaml::Hex64>> Offsets;
+ std::vector<ListEntries<EntryType>> Lists;
+};
+
struct Data {
bool IsLittleEndian;
- std::vector<Abbrev> AbbrevDecls;
- std::vector<StringRef> DebugStrings;
- std::vector<ARange> ARanges;
- PubSection PubNames;
- PubSection PubTypes;
+ bool Is64BitAddrSize;
+ std::vector<AbbrevTable> DebugAbbrev;
+ Optional<std::vector<StringRef>> DebugStrings;
+ Optional<std::vector<StringOffsetsTable>> DebugStrOffsets;
+ Optional<std::vector<ARange>> DebugAranges;
+ Optional<std::vector<Ranges>> DebugRanges;
+ Optional<std::vector<AddrTableEntry>> DebugAddr;
+ Optional<PubSection> PubNames;
+ Optional<PubSection> PubTypes;
- PubSection GNUPubNames;
- PubSection GNUPubTypes;
+ Optional<PubSection> GNUPubNames;
+ Optional<PubSection> GNUPubTypes;
std::vector<Unit> CompileUnits;
std::vector<LineTable> DebugLines;
+ Optional<std::vector<ListTable<RnglistEntry>>> DebugRnglists;
+ Optional<std::vector<ListTable<LoclistEntry>>> DebugLoclists;
bool isEmpty() const;
+
+ SetVector<StringRef> getNonEmptySectionNames() const;
+
+ struct AbbrevTableInfo {
+ uint64_t Index;
+ uint64_t Offset;
+ };
+ Expected<AbbrevTableInfo> getAbbrevTableInfoByID(uint64_t ID) const;
+ StringRef getAbbrevTableContentByIndex(uint64_t Index) const;
+
+private:
+ mutable std::unordered_map<uint64_t, AbbrevTableInfo> AbbrevTableInfoMap;
+ mutable std::unordered_map<uint64_t, std::string> AbbrevTableContents;
};
} // end namespace DWARFYAML
} // end namespace llvm
-LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex64)
-LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::Hex8)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AttributeAbbrev)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Abbrev)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AbbrevTable)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARangeDescriptor)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::ARange)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::RangeEntry)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Ranges)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::PubEntry)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::Unit)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::FormValue)
@@ -174,6 +261,20 @@
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::File)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::LineTable)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::LineTableOpcode)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::SegAddrPair)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::AddrTableEntry)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::StringOffsetsTable)
+LLVM_YAML_IS_SEQUENCE_VECTOR(
+ llvm::DWARFYAML::ListTable<DWARFYAML::RnglistEntry>)
+LLVM_YAML_IS_SEQUENCE_VECTOR(
+ llvm::DWARFYAML::ListEntries<DWARFYAML::RnglistEntry>)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::RnglistEntry)
+LLVM_YAML_IS_SEQUENCE_VECTOR(
+ llvm::DWARFYAML::ListTable<DWARFYAML::LoclistEntry>)
+LLVM_YAML_IS_SEQUENCE_VECTOR(
+ llvm::DWARFYAML::ListEntries<DWARFYAML::LoclistEntry>)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::LoclistEntry)
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::DWARFYAML::DWARFOperation)
namespace llvm {
namespace yaml {
@@ -182,6 +283,10 @@
static void mapping(IO &IO, DWARFYAML::Data &DWARF);
};
+template <> struct MappingTraits<DWARFYAML::AbbrevTable> {
+ static void mapping(IO &IO, DWARFYAML::AbbrevTable &AbbrevTable);
+};
+
template <> struct MappingTraits<DWARFYAML::Abbrev> {
static void mapping(IO &IO, DWARFYAML::Abbrev &Abbrev);
};
@@ -195,7 +300,15 @@
};
template <> struct MappingTraits<DWARFYAML::ARange> {
- static void mapping(IO &IO, DWARFYAML::ARange &Range);
+ static void mapping(IO &IO, DWARFYAML::ARange &ARange);
+};
+
+template <> struct MappingTraits<DWARFYAML::RangeEntry> {
+ static void mapping(IO &IO, DWARFYAML::RangeEntry &Entry);
+};
+
+template <> struct MappingTraits<DWARFYAML::Ranges> {
+ static void mapping(IO &IO, DWARFYAML::Ranges &Ranges);
};
template <> struct MappingTraits<DWARFYAML::PubEntry> {
@@ -230,11 +343,50 @@
static void mapping(IO &IO, DWARFYAML::LineTable &LineTable);
};
-template <> struct MappingTraits<DWARFYAML::InitialLength> {
- static void mapping(IO &IO, DWARFYAML::InitialLength &DWARF);
+template <> struct MappingTraits<DWARFYAML::SegAddrPair> {
+ static void mapping(IO &IO, DWARFYAML::SegAddrPair &SegAddrPair);
};
-#define HANDLE_DW_TAG(unused, name, unused2, unused3) \
+template <> struct MappingTraits<DWARFYAML::DWARFOperation> {
+ static void mapping(IO &IO, DWARFYAML::DWARFOperation &DWARFOperation);
+};
+
+template <typename EntryType>
+struct MappingTraits<DWARFYAML::ListTable<EntryType>> {
+ static void mapping(IO &IO, DWARFYAML::ListTable<EntryType> &ListTable);
+};
+
+template <typename EntryType>
+struct MappingTraits<DWARFYAML::ListEntries<EntryType>> {
+ static void mapping(IO &IO, DWARFYAML::ListEntries<EntryType> &ListEntries);
+ static std::string validate(IO &IO,
+ DWARFYAML::ListEntries<EntryType> &ListEntries);
+};
+
+template <> struct MappingTraits<DWARFYAML::RnglistEntry> {
+ static void mapping(IO &IO, DWARFYAML::RnglistEntry &RnglistEntry);
+};
+
+template <> struct MappingTraits<DWARFYAML::LoclistEntry> {
+ static void mapping(IO &IO, DWARFYAML::LoclistEntry &LoclistEntry);
+};
+
+template <> struct MappingTraits<DWARFYAML::AddrTableEntry> {
+ static void mapping(IO &IO, DWARFYAML::AddrTableEntry &AddrTable);
+};
+
+template <> struct MappingTraits<DWARFYAML::StringOffsetsTable> {
+ static void mapping(IO &IO, DWARFYAML::StringOffsetsTable &StrOffsetsTable);
+};
+
+template <> struct ScalarEnumerationTraits<dwarf::DwarfFormat> {
+ static void enumeration(IO &IO, dwarf::DwarfFormat &Format) {
+ IO.enumCase(Format, "DWARF32", dwarf::DWARF32);
+ IO.enumCase(Format, "DWARF64", dwarf::DWARF64);
+ }
+};
+
+#define HANDLE_DW_TAG(unused, name, unused2, unused3, unused4) \
io.enumCase(value, "DW_TAG_" #name, dwarf::DW_TAG_##name);
template <> struct ScalarEnumerationTraits<dwarf::Tag> {
@@ -302,6 +454,34 @@
}
};
+#define HANDLE_DW_RLE(unused, name) \
+ io.enumCase(value, "DW_RLE_" #name, dwarf::DW_RLE_##name);
+
+template <> struct ScalarEnumerationTraits<dwarf::RnglistEntries> {
+ static void enumeration(IO &io, dwarf::RnglistEntries &value) {
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+};
+
+#define HANDLE_DW_LLE(unused, name) \
+ io.enumCase(value, "DW_LLE_" #name, dwarf::DW_LLE_##name);
+
+template <> struct ScalarEnumerationTraits<dwarf::LoclistEntries> {
+ static void enumeration(IO &io, dwarf::LoclistEntries &value) {
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+};
+
+#define HANDLE_DW_OP(id, name, version, vendor) \
+ io.enumCase(value, "DW_OP_" #name, dwarf::DW_OP_##name);
+
+template <> struct ScalarEnumerationTraits<dwarf::LocationAtom> {
+ static void enumeration(IO &io, dwarf::LocationAtom &value) {
+#include "llvm/BinaryFormat/Dwarf.def"
+ io.enumFallback<yaml::Hex8>(value);
+ }
+};
+
} // end namespace yaml
} // end namespace llvm