[llvm] r317300 - [llvm-nm] Print 'I' for import table data in COFF
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 00:18:14 PDT 2017
Author: mstorsjo
Date: Fri Nov 3 00:18:14 2017
New Revision: 317300
URL: http://llvm.org/viewvc/llvm-project?rev=317300&view=rev
Log:
[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
Modified:
llvm/trunk/test/tools/llvm-nm/X86/importlibrary.test
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/test/tools/llvm-nm/X86/importlibrary.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-nm/X86/importlibrary.test?rev=317300&r1=317299&r2=317300&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-nm/X86/importlibrary.test (original)
+++ llvm/trunk/test/tools/llvm-nm/X86/importlibrary.test Fri Nov 3 00:18:14 2017
@@ -1,5 +1,7 @@
# RUN: llvm-nm -B %S/Inputs/example.lib | FileCheck --match-full-lines %s
+CHECK: 00000000 I __IMPORT_DESCRIPTOR_example
+CHECK: 00000000 I __NULL_IMPORT_DESCRIPTOR
CHECK: 00000000 R __imp__constant
CHECK: 00000000 R _constant
CHECK: 00000000 D __imp__data
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=317300&r1=317299&r2=317300&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Fri Nov 3 00:18:14 2017
@@ -946,6 +946,10 @@ static char getSymbolNMTypeChar(COFFObje
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()) {
More information about the llvm-commits
mailing list