[PATCH] D119577: [BOLT][DWARF] Add ability to insert new entries in to DIE
Vladislav Khmelevsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 15 15:37:14 PST 2022
yota9 added inline comments.
================
Comment at: bolt/lib/Core/DebugData.cpp:422
+static std::string encodeLE(size_t ByteSize, uint64_t NewValue) {
+ std::string LE64(ByteSize, 0);
----------------
maksfb wrote:
> We need a proper way to handle endianness.
You can take a look to support::endian::Writer, here is an example I'm using in golang support:
```
template <typename T>
static T writeEndian(BinaryContext &BC, T Val) {
T ret;
SmallVector<char, sizeof(T)> Tmp;
raw_svector_ostream OS(Tmp);
if (BC.AsmInfo->isLittleEndian())
support::endian::Writer<support::little>(OS).write<T>(Val);
else
support::endian::Writer<support::big>(OS).write<T>(Val);
memcpy(&ret, OS.str().data(), sizeof(T));
return ret;
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119577/new/
https://reviews.llvm.org/D119577
More information about the llvm-commits
mailing list