diff options
author | Yonghong Song <yhs@fb.com> | 2019-03-27 15:45:27 +0000 |
---|---|---|
committer | Yonghong Song <yhs@fb.com> | 2019-03-27 15:45:27 +0000 |
commit | 6c56edfe420dbd298d1487ac5a6b68fc94141030 (patch) | |
tree | b4a6e489fd5b47e63fd1de601cad08b6e64a3ca8 /llvm/lib/Target/BPF/BTFDebug.h | |
parent | 678d128b5ab6e43582ae642c011b9173607bdb8a (diff) | |
download | bcm5719-llvm-6c56edfe420dbd298d1487ac5a6b68fc94141030.tar.gz bcm5719-llvm-6c56edfe420dbd298d1487ac5a6b68fc94141030.zip |
[BPF] use std::map to ensure consistent output
The .BTF.ext FuncInfoTable and LineInfoTable contain
information organized per ELF section. Current definition
of FuncInfoTable/LineInfoTable is:
std::unordered_map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable
std::unordered_map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable
where the key is the section name off in the string table.
The unordered_map may cause the order of section output
different for different platforms.
The same for unordered map definition of
std::unordered_map<std::string, std::unique_ptr<BTFKindDataSec>>
DataSecEntries
where BTF_KIND_DATASEC entries may have different ordering
for different platforms.
This patch fixed the issue by using std::map.
Test static-var-derived-type.ll is modified to generate two
DataSec's which will ensure the ordering is the same for all
supported platforms.
Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 357077
Diffstat (limited to 'llvm/lib/Target/BPF/BTFDebug.h')
-rw-r--r-- | llvm/lib/Target/BPF/BTFDebug.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h index 016cc985283..58fba7f5a9c 100644 --- a/llvm/lib/Target/BPF/BTFDebug.h +++ b/llvm/lib/Target/BPF/BTFDebug.h @@ -229,10 +229,10 @@ class BTFDebug : public DebugHandlerBase { BTFStringTable StringTable; std::vector<std::unique_ptr<BTFTypeBase>> TypeEntries; std::unordered_map<const DIType *, uint32_t> DIToIdMap; - std::unordered_map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable; - std::unordered_map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable; + std::map<uint32_t, std::vector<BTFFuncInfo>> FuncInfoTable; + std::map<uint32_t, std::vector<BTFLineInfo>> LineInfoTable; StringMap<std::vector<std::string>> FileContent; - std::unordered_map<std::string, std::unique_ptr<BTFKindDataSec>> + std::map<std::string, std::unique_ptr<BTFKindDataSec>> DataSecEntries; /// Add types to TypeEntries. |