diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:19:15 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:19:15 +0000 |
commit | d93e1dfac8711cfed1a9d9cd1876a788b83945cd (patch) | |
tree | 5896fa6c02a262a6148b215487e545d937de58b7 /lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | |
parent | 8d43286d630f9224de07809ea253e83ebb9cdee6 (diff) |
Notes
Diffstat (limited to 'lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp')
-rw-r--r-- | lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp index a17de5be1742..23c7ea17f7e7 100644 --- a/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp +++ b/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp @@ -70,12 +70,12 @@ static llvm::Error forEachLoadCommand( return llvm::make_error<GenericError>("Load command exceeds range"); if (func(slc->cmd, slc->cmdsize, p)) - return llvm::Error(); + return llvm::Error::success(); p += slc->cmdsize; } - return llvm::Error(); + return llvm::Error::success(); } static std::error_code appendRelocations(Relocations &relocs, StringRef buffer, @@ -390,12 +390,14 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, if (sin->n_strx > strSize) return true; sout.name = &strings[sin->n_strx]; - sout.type = (NListType)(sin->n_type & N_TYPE); + sout.type = static_cast<NListType>(sin->n_type & (N_STAB|N_TYPE)); sout.scope = (sin->n_type & (N_PEXT|N_EXT)); sout.sect = sin->n_sect; sout.desc = sin->n_desc; sout.value = sin->n_value; - if (sout.type == N_UNDF) + if (sin->n_type & N_STAB) + f->stabsSymbols.push_back(sout); + else if (sout.type == N_UNDF) f->undefinedSymbols.push_back(sout); else if (sin->n_type & N_EXT) f->globalSymbols.push_back(sout); @@ -429,6 +431,8 @@ readBinary(std::unique_ptr<MemoryBuffer> &mb, f->undefinedSymbols.push_back(sout); else if (sout.scope == (SymbolScope)N_EXT) f->globalSymbols.push_back(sout); + else if (sin->n_type & N_STAB) + f->stabsSymbols.push_back(sout); else f->localSymbols.push_back(sout); } @@ -535,7 +539,7 @@ public: loadFile(std::unique_ptr<MemoryBuffer> mb, const Registry ®istry) const override { std::unique_ptr<File> ret = - llvm::make_unique<MachOFile>(std::move(mb), &_ctx); + llvm::make_unique<MachOFile>(std::move(mb), &_ctx); return std::move(ret); } |