summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm/llvm-nm.cpp
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2017-11-03 07:18:14 +0000
committerMartin Storsjo <martin@martin.st>2017-11-03 07:18:14 +0000
commit1401524e20ddc7ec5839d86a87a10ee32b67dae1 (patch)
tree3cd03e2506930d32ceb6ca02f947b6a05f5bcf56 /llvm/tools/llvm-nm/llvm-nm.cpp
parent333897ec31d752a4cf4d27c71b9a37d1cfd7dfad (diff)
downloadbcm5719-llvm-1401524e20ddc7ec5839d86a87a10ee32b67dae1.tar.gz
bcm5719-llvm-1401524e20ddc7ec5839d86a87a10ee32b67dae1.zip
[llvm-nm] Print 'I' for import table data in COFF
The character gets uppercased into 'I' when it's a global symbol. In GNU binutils, nm prints 'I' for symbols classified by bfd_is_ind_section - which probably isn't exactly/only import tables. When building for win32, (some incarnations of?) libtool has got rules that try to inspect linked libraries, and in order to be sure that it is linking to a DLL import library as opposed to a static library, it expects to find the string " I " in the output of $NM when run on such an import library. GNU binutils nm also flags all of the .idata$X chunks as 'i' (while this patch only makes it set on .idata$2 and .idata$6) and also flags __imp__function as 'I'. Differential Revision: https://reviews.llvm.org/D39540 llvm-svn: 317300
Diffstat (limited to 'llvm/tools/llvm-nm/llvm-nm.cpp')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index 4ad0d95d67f..1b093f501d5 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -946,6 +946,10 @@ static char getSymbolNMTypeChar(COFFObjectFile &Obj, symbol_iterator I) {
section_iterator SecI = *SecIOrErr;
const coff_section *Section = Obj.getCOFFSection(*SecI);
Characteristics = Section->Characteristics;
+ StringRef SectionName;
+ Obj.getSectionName(Section, SectionName);
+ if (SectionName.startswith(".idata"))
+ return 'i';
}
switch (Symb.getSectionNumber()) {
OpenPOWER on IntegriCloud