Quick fix
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This doesn't look correct either:
EndianCorrectedNameString[0] = 0xFEFF;
On a big-endian host system, this will set the endian marker to FE FF, i.e. to indicate BE instead of LE.
Probably needs a ulittle16 somewhere to work on both big- and little-endian hosts.
| llvm/tools/llvm-readobj/COFFDumper.cpp | ||
|---|---|---|
| 1565–1572 ↗ | (On Diff #98331) | How about this: ArrayRef<UTF16> RawEntryNameString = unwrapOrError(RSF.getEntryNameString(Entry));
std::vector<UTF16> EndianCorrectedString;
if (llvm::sys::IsBigEndianHost) {
EndianCorrectedString.resize(RawEntryNameString.size() + 1);
std::copy(RawEntryNameString.begin(), RawEntryNameString.end(), EndianCorrectedString.begin() + 1);
EndianCorrectedString[0] = UNI_UTF16_BYTE_ORDER_MARK_SWAPPED;
RawEntryNameString = makeArrayRef(EndianCorrectedString);
} |
Comment Actions
Adding a byte order mark doesn't seems like a good way to fix the issue. Why don't you add a flag indicating whether it is BE or LE to convertUTF16ToUTF8String?
| llvm/tools/llvm-readobj/COFFDumper.cpp | ||
|---|---|---|
| 1565–1572 ↗ | (On Diff #98331) | This does fix the problem for me. |
Comment Actions
Do you mean the bot is still red? If I broke something I'd first try to roll it back if the error is not just a simple mistake but needs another round of code review.