[PATCH] D149268: [LLD][COFF] Fix PDB relocation on big-endian hosts
Ulrich Weigand via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 27 08:48:51 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb8557813afd: Fix PDB relocation on big-endian hosts (authored by uweigand).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149268/new/
https://reviews.llvm.org/D149268
Files:
lld/COFF/PDB.cpp
Index: lld/COFF/PDB.cpp
===================================================================
--- lld/COFF/PDB.cpp
+++ lld/COFF/PDB.cpp
@@ -950,7 +950,7 @@
// must also be rewritten to use the PDB string table.
for (const UnrelocatedFpoData &subsec : frameDataSubsecs) {
// Relocate the first four bytes of the subection and reinterpret them as a
- // 32 bit integer.
+ // 32 bit little-endian integer.
SectionChunk *debugChunk = subsec.debugChunk;
ArrayRef<uint8_t> subsecData = subsec.subsecData;
uint32_t relocIndex = subsec.relocIndex;
@@ -959,8 +959,9 @@
debugChunk->writeAndRelocateSubsection(debugChunk->getContents(),
unrelocatedRvaStart, relocIndex,
&relocatedRvaStart[0]);
- uint32_t rvaStart;
- memcpy(&rvaStart, &relocatedRvaStart[0], sizeof(uint32_t));
+ // Use of memcpy here avoids violating type-based aliasing rules.
+ support::ulittle32_t rvaStart;
+ memcpy(&rvaStart, &relocatedRvaStart[0], sizeof(support::ulittle32_t));
// Copy each frame data record, add in rvaStart, translate string table
// indices, and add the record to the PDB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149268.517587.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230427/f1ef6a8e/attachment.bin>
More information about the llvm-commits
mailing list