summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-11-19 00:51:50 +0000
committerReid Kleckner <rnk@google.com>2015-11-19 00:51:50 +0000
commit697477e00c3fc08795efb81f002fbf4ad3c055d1 (patch)
tree4bdb9a97c20d42e588659a87cbc90abc7211b5b2 /tools
parent1fcad31efaa9c8a7b8bd9e8f1a94ec7f93bee4c5 (diff)
Fix UMR in llvm-nm on IR object files in printDarwinSymbol
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index 4144d538c1a..b812233034e 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -239,9 +239,8 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I,
const char *printDashes, const char *printFormat) {
MachO::mach_header H;
MachO::mach_header_64 H_64;
- uint32_t Filetype, Flags;
- MachO::nlist_64 STE_64;
- MachO::nlist STE;
+ uint32_t Filetype = MachO::MH_OBJECT;
+ uint32_t Flags = 0;
uint8_t NType = 0;
uint8_t NSect = 0;
uint16_t NDesc = 0;
@@ -280,7 +279,7 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I,
H_64 = MachO->MachOObjectFile::getHeader64();
Filetype = H_64.filetype;
Flags = H_64.flags;
- STE_64 = MachO->getSymbol64TableEntry(SymDRI);
+ MachO::nlist_64 STE_64 = MachO->getSymbol64TableEntry(SymDRI);
NType = STE_64.n_type;
NSect = STE_64.n_sect;
NDesc = STE_64.n_desc;
@@ -290,7 +289,7 @@ static void darwinPrintSymbol(SymbolicFile &Obj, SymbolListT::iterator I,
H = MachO->MachOObjectFile::getHeader();
Filetype = H.filetype;
Flags = H.flags;
- STE = MachO->getSymbolTableEntry(SymDRI);
+ MachO::nlist STE = MachO->getSymbolTableEntry(SymDRI);
NType = STE.n_type;
NSect = STE.n_sect;
NDesc = STE.n_desc;