[PATCH] D148208: [llvm-readobj] fix unit test failure on 32bit machines

antoine moynault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 03:07:59 PDT 2023


antmo created this revision.
Herald added a reviewer: jhenderson.
Herald added a project: All.
antmo requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Several bots are failing on 32-bit since https://reviews.llvm.org/D145761 was merged

  https://lab.llvm.org/buildbot/#/builders/178/builds/4384

It seems due to the use of uintptr_t (32bit here) for storing 64 bit values.

Issue is fixed by replacing to uint64_t (as suggested by DavidSpickett).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148208

Files:
  llvm/tools/llvm-readobj/ELFDumper.cpp


Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -221,7 +221,7 @@
   void printArchSpecificInfo() override;
   void printStackMap() const override;
   void printMemtag() override;
-  ArrayRef<uint8_t> getMemtagGlobalsSectionContents(uintptr_t ExpectedAddr);
+  ArrayRef<uint8_t> getMemtagGlobalsSectionContents(uint64_t ExpectedAddr);
 
   // Hash histogram shows statistics of how efficient the hash was for the
   // dynamic symbol table. The table shows the number of hash buckets for
@@ -5971,7 +5971,7 @@
 
 template <class ELFT>
 ArrayRef<uint8_t>
-ELFDumper<ELFT>::getMemtagGlobalsSectionContents(uintptr_t ExpectedAddr) {
+ELFDumper<ELFT>::getMemtagGlobalsSectionContents(uint64_t ExpectedAddr) {
   for (const typename ELFT::Shdr &Sec : cantFail(Obj.sections())) {
     if (Sec.sh_type != SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC)
       continue;
@@ -6005,7 +6005,7 @@
   if (Obj.getHeader().e_machine != EM_AARCH64) return;
   std::vector<std::pair<std::string, std::string>> DynamicEntries;
   size_t MemtagGlobalsSz = 0;
-  uintptr_t MemtagGlobals = 0;
+  uint64_t MemtagGlobals = 0;
   for (const typename ELFT::Dyn &Entry : dynamic_table()) {
     uintX_t Tag = Entry.getTag();
     switch (Tag) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148208.513143.patch
Type: text/x-patch
Size: 1358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/ffa605a7/attachment-0001.bin>


More information about the llvm-commits mailing list