[llvm] dbb64b3 - Fix a print error found while testing llvm-objcopy

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 05:15:20 PST 2019


Author: Aaron Smith
Date: 2019-11-18T13:07:35Z
New Revision: dbb64b39b8bc137bb88b9f847ab8adf25a8c8583

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

LOG: Fix a print error found while testing llvm-objcopy

A value was not printed as hex. This updates the output and test cases.

Added: 
    

Modified: 
    llvm/include/llvm/Object/ELF.h
    llvm/test/Object/invalid.test

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 0d5482ae831d..dc848cee7e57 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -406,7 +406,7 @@ ELFFile<ELFT>::getSectionContentsAsArray(const Elf_Shdr *Sec) const {
       Offset + Size > Buf.size())
     return createError("section " + getSecIndexForError(this, Sec) +
                        " has a sh_offset (0x" + Twine::utohexstr(Offset) +
-                       ") + sh_size (0x" + Twine(Size) +
+                       ") + sh_size (0x" + Twine::utohexstr(Size) +
                        ") that cannot be represented");
 
   if (Offset % alignof(T))

diff  --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test
index ab498f237c9f..254b8f43e7bc 100644
--- a/llvm/test/Object/invalid.test
+++ b/llvm/test/Object/invalid.test
@@ -41,7 +41,7 @@ Sections:
 # RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-size.elf 2>&1 \
 # RUN:   | FileCheck %s -DFILE=%p/Inputs/invalid-strtab-size.elf --check-prefix=INVALID-STRTAB-SIZE
 
-# INVALID-STRTAB-SIZE: error: '[[FILE]]': section [index 1] has a sh_offset (0x70) + sh_size (0x16777215) that cannot be represented
+# INVALID-STRTAB-SIZE: error: '[[FILE]]': section [index 1] has a sh_offset (0x70) + sh_size (0xffffff) that cannot be represented
 
 ## Check that llvm-dwarfdump reports an error during relocation resolution
 ## when instead of expected SHT_RELA section it locates a section of a 
diff erent type.
@@ -282,7 +282,7 @@ Sections:
 # RUN: yaml2obj %s --docnum=14 -o %t14
 # RUN: not llvm-readobj --symbols %t14 2>&1 | FileCheck -DFILE=%t14 --check-prefix=INVALID-SECTION-SIZE2 %s
 
-# INVALID-SECTION-SIZE2: error: '[[FILE]]': section [index 1] has a sh_offset (0xffffffff) + sh_size (0x27) that cannot be represented
+# INVALID-SECTION-SIZE2: error: '[[FILE]]': section [index 1] has a sh_offset (0xffffffff) + sh_size (0x1b) that cannot be represented
 
 --- !ELF
 FileHeader:


        


More information about the llvm-commits mailing list