[llvm] ddf5bfd - Fix test bot breakage from bd0dd27bb5be0fbf60c1b2a4ce15188812388574

Alexey Lapshin via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 02:04:19 PDT 2023


Author: Alexey Lapshin
Date: 2023-05-17T10:57:31+02:00
New Revision: ddf5bfd6e6e2fc5b94718a29e718b4f821a3b853

URL: https://github.com/llvm/llvm-project/commit/ddf5bfd6e6e2fc5b94718a29e718b4f821a3b853
DIFF: https://github.com/llvm/llvm-project/commit/ddf5bfd6e6e2fc5b94718a29e718b4f821a3b853.diff

LOG: Fix test bot breakage from bd0dd27bb5be0fbf60c1b2a4ce15188812388574

This addresses the issue found by: https://lab.llvm.org/buildbot/#/builders/93/builds/14929

Added: 
    

Modified: 
    llvm/include/llvm/DWARFLinker/DWARFLinker.h
    llvm/lib/DWARFLinker/DWARFLinker.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index d94e31d5e6cd..8090bfdef10a 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -713,7 +713,7 @@ class DWARFLinker {
     void cloneExpression(DataExtractor &Data, DWARFExpression Expression,
                          const DWARFFile &File, CompileUnit &Unit,
                          SmallVectorImpl<uint8_t> &OutputBuffer,
-                         int64_t AddrRelocAdjustment);
+                         int64_t AddrRelocAdjustment, bool IsLittleEndian);
 
     /// Clone an attribute referencing another DIE and add
     /// it to \p Die.

diff  --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 93c03a10cf91..b87fb98cb269 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1142,7 +1142,7 @@ unsigned DWARFLinker::DIECloner::cloneDieReferenceAttribute(
 void DWARFLinker::DIECloner::cloneExpression(
     DataExtractor &Data, DWARFExpression Expression, const DWARFFile &File,
     CompileUnit &Unit, SmallVectorImpl<uint8_t> &OutputBuffer,
-    int64_t AddrRelocAdjustment) {
+    int64_t AddrRelocAdjustment, bool IsLittleEndian) {
   using Encoding = DWARFExpression::Operation::Encoding;
 
   uint8_t OrigAddressByteSize = Unit.getOrigUnit().getAddressByteSize();
@@ -1208,6 +1208,8 @@ void DWARFLinker::DIECloner::cloneExpression(
         // processed by applyValidRelocs.
         OutputBuffer.push_back(dwarf::DW_OP_addr);
         uint64_t LinkedAddress = SA->Address + AddrRelocAdjustment;
+        if (!IsLittleEndian)
+          sys::swapByteOrder(LinkedAddress);
         ArrayRef<uint8_t> AddressBytes(
             reinterpret_cast<const uint8_t *>(&LinkedAddress),
             OrigAddressByteSize);
@@ -1240,6 +1242,8 @@ void DWARFLinker::DIECloner::cloneExpression(
         if (OutOperandKind) {
           OutputBuffer.push_back(*OutOperandKind);
           uint64_t LinkedAddress = SA->Address + AddrRelocAdjustment;
+          if (!IsLittleEndian)
+            sys::swapByteOrder(LinkedAddress);
           ArrayRef<uint8_t> AddressBytes(
               reinterpret_cast<const uint8_t *>(&LinkedAddress),
               OrigAddressByteSize);
@@ -1294,7 +1298,7 @@ unsigned DWARFLinker::DIECloner::cloneBlockAttribute(
     DWARFExpression Expr(Data, OrigUnit.getAddressByteSize(),
                          OrigUnit.getFormParams().Format);
     cloneExpression(Data, Expr, File, Unit, Buffer,
-                    Unit.getInfo(InputDIE).AddrAdjust);
+                    Unit.getInfo(InputDIE).AddrAdjust, IsLittleEndian);
     Bytes = Buffer;
   }
   for (auto Byte : Bytes)
@@ -2553,7 +2557,8 @@ uint64_t DWARFLinker::DIECloner::cloneAllCompileUnits(
         cloneExpression(Data,
                         DWARFExpression(Data, OrigUnit.getAddressByteSize(),
                                         OrigUnit.getFormParams().Format),
-                        File, *CurrentUnit, OutBytes, RelocAdjustment);
+                        File, *CurrentUnit, OutBytes, RelocAdjustment,
+                        IsLittleEndian);
       };
       Linker.generateUnitLocations(*CurrentUnit, File, ProcessExpr);
     }


        


More information about the llvm-commits mailing list