diff options
author | Kevin Enderby <enderby@apple.com> | 2014-06-05 21:21:57 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2014-06-05 21:21:57 +0000 |
commit | ecbc72405ea7257f726511e4f4409f8ecc0eb426 (patch) | |
tree | ba47fa33e261bba2c6ebdd6aa0d1dc75dcc42ba0 /include/llvm/Object/MachO.h | |
parent | 542fdf5fba28c7325d901f5af16bb10b5bfe2190 (diff) | |
download | llvm-ecbc72405ea7257f726511e4f4409f8ecc0eb426.tar.gz llvm-ecbc72405ea7257f726511e4f4409f8ecc0eb426.tar.bz2 llvm-ecbc72405ea7257f726511e4f4409f8ecc0eb426.tar.xz |
Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.
This is a first step in seeing if it is possible to make llvm-nm produce
the same output as darwin's nm(1). Darwin's default format is bsd but its
-m output prints the longer Mach-O specific details. For now I added the
"-format darwin" to do this (whos name may need to change in the future).
As there are other Mach-O specific flags to nm(1) which I'm hoping to add some
how in the future. But I wanted to see if I could get the correct output for
-m flag using llvm-nm and the libObject interfaces.
I got this working but would love to hear what others think about this approach
to getting object/format specific details printed with llvm-nm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object/MachO.h')
-rw-r--r-- | include/llvm/Object/MachO.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/Object/MachO.h b/include/llvm/Object/MachO.h index 710ad7ef15..ab5b462e01 100644 --- a/include/llvm/Object/MachO.h +++ b/include/llvm/Object/MachO.h @@ -61,6 +61,10 @@ public: void moveSymbolNext(DataRefImpl &Symb) const override; error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const override; + + // MachO specific. + error_code getIndirectName(DataRefImpl Symb, StringRef &Res) const; + error_code getSymbolAddress(DataRefImpl Symb, uint64_t &Res) const override; error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const override; error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const override; @@ -105,6 +109,9 @@ public: LibraryRef &Res) const override; error_code getLibraryPath(DataRefImpl LibData, StringRef &Res) const override; + // MachO specific. + error_code getLibraryShortNameByIndex(unsigned Index, StringRef &Res); + // TODO: Would be useful to have an iterator based version // of the load command interface too. @@ -198,6 +205,9 @@ public: bool is64Bit() const; void ReadULEB128s(uint64_t Index, SmallVectorImpl<uint64_t> &Out) const; + static StringRef guessLibraryShortName(StringRef Name, bool &isFramework, + StringRef &Suffix); + static Triple::ArchType getArch(uint32_t CPUType); static bool classof(const Binary *v) { @@ -207,6 +217,10 @@ public: private: typedef SmallVector<const char*, 1> SectionList; SectionList Sections; + typedef SmallVector<const char*, 1> LibraryList; + LibraryList Libraries; + typedef SmallVector<StringRef, 1> LibraryShortName; + LibraryShortName LibrariesShortNames; const char *SymtabLoadCmd; const char *DysymtabLoadCmd; const char *DataInCodeLoadCmd; |