diff --git a/llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test b/llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test --- a/llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test +++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test @@ -11,7 +11,7 @@ # RUN: llvm-readelf --dynamic-table %t1.o 2>&1 \ # RUN: | FileCheck -DFILE=%t1.o --check-prefixes=WARNING1,GNU1 %s -# WARNING1: warning: '[[FILE]]': The SHT_DYNAMIC section '.dynamic' is not contained within the PT_DYNAMIC segment +# WARNING1: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 is not contained within the PT_DYNAMIC segment # WARNING1: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x1){{$}} # WARNING1: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table # WARNING1: warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used @@ -69,7 +69,7 @@ # RUN: llvm-readelf --dynamic-table %t2.o 2>&1 \ # RUN: | FileCheck -DFILE=%t2.o --check-prefixes=WARNING2,GNU2 %s -# WARNING2: warning: '[[FILE]]': The SHT_DYNAMIC section '.dynamic' is not contained within the PT_DYNAMIC segment +# WARNING2: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 is not contained within the PT_DYNAMIC segment # WARNING2: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table # LLVM2: DynamicSection [ (1 entries) diff --git a/llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test b/llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test --- a/llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test +++ b/llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test @@ -10,7 +10,7 @@ # RUN: llvm-readelf --dynamic-table %t1.o 2>&1 \ # RUN: | FileCheck %s --DFILE=%t1.o --check-prefixes=WARNING,GNU -# WARNING: warning: '[[FILE]]': The SHT_DYNAMIC section '.dynamic' is not at the start of PT_DYNAMIC segment +# WARNING: warning: '[[FILE]]': SHT_DYNAMIC section with index 2 is not at the start of PT_DYNAMIC segment # WARNING: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x21){{$}} # WARNING: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table # WARNING: warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp --- a/llvm/tools/llvm-readobj/ELFDumper.cpp +++ b/llvm/tools/llvm-readobj/ELFDumper.cpp @@ -1886,19 +1886,17 @@ } if (DynamicPhdr && DynamicSec) { - StringRef Name = - unwrapOrError(ObjF->getFileName(), Obj->getSectionName(DynamicSec)); if (DynamicSec->sh_addr + DynamicSec->sh_size > DynamicPhdr->p_vaddr + DynamicPhdr->p_memsz || DynamicSec->sh_addr < DynamicPhdr->p_vaddr) - reportWarning(createError("The SHT_DYNAMIC section '" + Name + - "' is not contained within the " + reportWarning(createError(describe(*DynamicSec) + + " is not contained within the " "PT_DYNAMIC segment"), ObjF->getFileName()); if (DynamicSec->sh_addr != DynamicPhdr->p_vaddr) - reportWarning(createError("The SHT_DYNAMIC section '" + Name + - "' is not at the start of " + reportWarning(createError(describe(*DynamicSec) + + " is not at the start of " "PT_DYNAMIC segment"), ObjF->getFileName()); }