# SIZE-MISMATCH-SAME: SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC section size (0xa)
#########################################
+## Ensure that GLOBALSSZ tag is stored in a 64-bit integer even on 32-bit machines.
+#########################################
+
+# RUN: yaml2obj --docnum=3 %s -o %t \
+# RUN: -D DT_AARCH64_MEMTAG_GLOBALSSZ=0x100000001 \
+# RUN: -D GLOBALS_SECTION_CONTENTS=11
+# RUN: llvm-readelf --memtag %t 2>&1 | FileCheck %s --check-prefixes=SIZE-MISMATCH2
+# RUN: llvm-readobj --memtag %t 2>&1 | FileCheck %s --check-prefixes=SIZE-MISMATCH2
+
+# SIZE-MISMATCH2: warning: {{.*}} mismatch between DT_AARCH64_MEMTAG_GLOBALSSZ (0x100000001) and
+# SIZE-MISMATCH2-SAME: SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC section size (0x1)
+
+#########################################
## Ensure that we fail if DT_AARCH64_MEMTAG_GLOBALS doesn't agree with the address of the section.
#########################################
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
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;
template <typename ELFT> void ELFDumper<ELFT>::printMemtag() {
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 MemtagGlobalsSz = 0;
+ uint64_t MemtagGlobals = 0;
for (const typename ELFT::Dyn &Entry : dynamic_table()) {
uintX_t Tag = Entry.getTag();
switch (Tag) {