[PATCH] D87503: [llvm-readobj/elf] - Don't use unwrapOrError when reporting errors about SHT_DYNAMIC sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 05:01:54 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7448e64a790b: [llvm-readobj/elf] - Don't use unwrapOrError when reporting errors about… (authored by grimar).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87503/new/

https://reviews.llvm.org/D87503

Files:
  llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test
  llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test
  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
@@ -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());
   }
Index: llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/non-dynamic-in-pt-dynamic.test
+++ 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
Index: llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/dynamic-not-in-pt-dynamic.test
+++ 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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87503.291545.patch
Type: text/x-patch
Size: 3733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200914/a881c5d4/attachment.bin>


More information about the llvm-commits mailing list