[PATCH] D73586: [llvm-objdump] Suppress spurious warnings when parsing Mach-O binaries.
Michael Trent via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 11:00:54 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0ad18bf37b2d: [llvm-objdump] Suppress spurious warnings when parsing Mach-O binaries. (authored by mtrent).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73586/new/
https://reviews.llvm.org/D73586
Files:
llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test
llvm/tools/llvm-objdump/MachODump.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -338,7 +338,7 @@
HelpResponse("\nPass @FILE as argument to read options from FILE.\n");
static StringSet<> DisasmFuncsSet;
-static StringSet<> FoundSectionSet;
+StringSet<> FoundSectionSet;
static StringRef ToolName;
typedef std::vector<std::tuple<uint64_t, StringRef, uint8_t>> SectionSymbolsTy;
Index: llvm/tools/llvm-objdump/MachODump.cpp
===================================================================
--- llvm/tools/llvm-objdump/MachODump.cpp
+++ llvm/tools/llvm-objdump/MachODump.cpp
@@ -14,6 +14,7 @@
#include "llvm-c/Disassembler.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Triple.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Config/config.h"
@@ -191,6 +192,8 @@
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
cl::ZeroOrMore, cl::cat(MachOCat));
+extern StringSet<> FoundSectionSet;
+
bool ArchAll = false;
static std::string ThumbTripleName;
@@ -1754,6 +1757,9 @@
else
consumeError(SecNameOrErr.takeError());
+ if (!DumpSection.empty())
+ FoundSectionSet.insert(DumpSection);
+
DataRefImpl Ref = Section.getRawDataRefImpl();
StringRef SegName = O->getSectionFinalSegmentName(Ref);
if ((DumpSegName.empty() || SegName == DumpSegName) &&
Index: llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test
+++ llvm/test/tools/llvm-objdump/X86/macho-cstring-dump.test
@@ -1,9 +1,9 @@
-RUN: llvm-objdump -m -section __TEXT,__cstring %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
-RUN: llvm-objdump -m -section __TEXT,__cstring -no-leading-addr %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NO_ADDR
-RUN: llvm-objdump -m -section __TEXT,__cstring -non-verbose %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NON_VERBOSE
+RUN: llvm-objdump -m -section __TEXT,__cstring %p/Inputs/hello.obj.macho-x86_64 2>&1 | FileCheck %s --implicit-check-not="warning:"
+RUN: llvm-objdump -m -section __TEXT,__cstring -no-leading-addr %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NO_ADDR --implicit-check-not="warning:"
+RUN: llvm-objdump -m -section __TEXT,__cstring -non-verbose %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NON_VERBOSE --implicit-check-not="warning:"
CHECK: Contents of (__TEXT,__cstring) section
-CHECK: 000000000000003b Hello world\n
+CHECK-NEXT: 000000000000003b Hello world\n
NO_ADDR: Contents of (__TEXT,__cstring) section
NO_ADDR: Hello world\n
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73586.242130.patch
Type: text/x-patch
Size: 2880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200203/c275ff2d/attachment.bin>
More information about the llvm-commits
mailing list