From 0dd94ed521e52ca901e845b39bbc33f16174a325 Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Fri, 19 Oct 2012 17:19:50 +0200 Subject: [PATCH] libtool: parse "dumpbin -headers" to get symbols exported from implibs * m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS) [MSVC]: Extract symbols imported from DLLs by import libraries in the Microsoft dumpbin wrapper. (LT_PATH_NM): Add -headers option if dumpbin is the located name lister to feed the above new code. * NEWS: Update. Signed-off-by: Peter Rosin --- NEWS | 6 ++++-- m4/libtool.m4 | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7f70eaf9..d0107a9b 100644 --- a/NEWS +++ b/NEWS @@ -56,8 +56,10 @@ NEWS - list of user-visible changes between releases of GNU Libtool will now correctly fallback to using only vanilla shell features instead of failing with a parse at startup. - Correctly recognize import libraries when Microsoft dumpbin is used - as the name lister. Also fix a bug in the dumpbin wrapper which could - lead to broken symbol listings in some corner cases. + as the name lister and extend the dumpbin wrapper to find symbols + in import libraries using the -headers option of dumpbin. Also fix a + bug in the dumpbin wrapper which could lead to broken symbol listings + in some corner cases. ** Important incompatible changes: diff --git a/m4/libtool.m4 b/m4/libtool.m4 index e216f725..c85a85f2 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -3426,9 +3426,9 @@ else # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) - DUMPBIN="$DUMPBIN -symbols" + DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: @@ -3682,6 +3682,9 @@ for ac_symprfx in "" "_"; do " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"D\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\