libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Libtool: Microsoft dumpbin as name lister


From: Ralf Wildenhues
Subject: Re: Libtool: Microsoft dumpbin as name lister
Date: Wed, 17 Aug 2005 20:54:10 +0200
User-agent: Mutt/1.5.9i

Hi Peter,

* Peter Ekberg wrote on Mon, Aug 15, 2005 at 11:20:58PM CEST:
> 
> I have forked out this patch (against HEAD) from my MSVC work.

Good work.

Missing bits below, plus: We advertise `NM' in libtool.texi as BSD
compatible, and show how its output looks like (two different sections).
We should update that, if possible.  If you would not like to do that,
I could do it if I knew how dumpbin's output looked like and how it
behaved.  As you noticed already, it's not present in the 2003 version,
and I can't find an older accessible msvc to try out.

Also, there seem to be third-party programs named `dumpbin'.  Does your
test avoid them or do they work with your macro?  Are they in
wide-spread use?  (We can just wait till someone reports a bug, if you
don't know; but maybe you do, or I just missed that info.)

Another remark: we change the interface provided by libtool.m4.  Please
update the serial number of the file.  Strictly speaking, your patch is
an incompatible change, too (as the documented interface, i.e., output
of $NM, is not guaranteed any more), but in practice I think it is a
good compromise: before, without any nm, things would not have worked at
all.  So I consider that OK.

Lastly, can I ask a favor of you?  I've seen your other patches, and
hate to delay them even longer, but I won't be able to test them enough
before the weekend.  So I'd like you to not use the 72 hour rule.
Thanks.  I'll try to get to them as quickly as possible, if nobody else
has before.

Cheers,
Ralf

> 2005-08-15  Peter Ekberg  <address@hidden>
> 
>       * m4/libtool.m4 (LT_PATH_NM): If nm is not found on the
>       path, look for dumpbin. Then check if $NM responds as
>       dumpbin would and if not, assume the name lister is
>       BSD nm compatible.
>       (_LT_CMD_GLOBAL_SYMBOLS): If the name lister uses the
>       dumpbin interface, adjust the test to find a working
>       global_symbol_pipe.


| Index: m4/libtool.m4
| ===================================================================
| RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
| retrieving revision 1.209
| diff -u -r1.209 libtool.m4
| --- m4/libtool.m4     10 Aug 2005 06:25:10 -0000      1.209
| +++ m4/libtool.m4     15 Aug 2005 20:59:40 -0000
| @@ -2729,9 +2729,11 @@
|  
|  # LT_PATH_NM
|  # ----------
| -# find the pathname to a BSD-compatible name lister
| +# find the pathname to a BSD- or MS-compatible name lister
|  AC_DEFUN([LT_PATH_NM],
| -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
| +[AC_REQUIRE([AC_PROG_CC])dnl
| +AC_REQUIRE([AC_OBJEXT])dnl
| +AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,

Maybe rather 'for BSD- or MS-compatible name lister (nm)'?

|  [if test -n "$NM"; then
|    # Let the user override the test.
|    lt_cv_path_NM="$NM"
| @@ -2768,10 +2770,35 @@
|    IFS="$lt_save_ifs"
|    test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
|  fi])
| -NM="$lt_cv_path_NM"
| +if test "$lt_cv_path_NM" != "no"; then
| +  NM="$lt_cv_path_NM"
| +else
| +  # Didn't find any BSD compatible name lister, look for dumpbin.
| +  AC_CHECK_TOOL(DUMPBIN, [dumpbin -symbols], :)
| +  AC_SUBST([DUMPBIN])
| +  if test "$DUMPBIN" != ":"; then
| +    NM="$DUMPBIN"
| +  fi
| +fi
|  test -z "$NM" && NM=nm
|  AC_SUBST([NM])
| -_LT_DECL([], [NM], [1], [A BSD-compatible nm program])dnl
| +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
| +
| +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
| +  [lt_cv_nm_interface="BSD nm"
| +  printf "int some_variable = 0;" > conftest.$ac_ext
| +  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
| +  (eval "$ac_compile" 2>conftest.err)
| +  cat conftest.err >&AS_MESSAGE_LOG_FD
| +  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" 
>&AS_MESSAGE_LOG_FD)
| +  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
| +  cat conftest.err >&AS_MESSAGE_LOG_FD
| +  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
| +  cat conftest.out >&AS_MESSAGE_LOG_FD
| +  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
| +    lt_cv_nm_interface="MS dumpbin"
| +  fi
| +  rm -f conftest*])
|  ])# LT_PATH_NM
|  
|  # Old names:
| @@ -2908,7 +2935,19 @@
|    symxfrm="\\1 $ac_symprfx\\2 \\2"
|  
|    # Write the raw and C identifiers.
| -  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[   
]]\($symcode$symcode*\)[[       ]][[    
]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
| +  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
| +    # Fake it for dumpbin and say T for any non-static function
| +    # and D for any global variable.
| +    # Also find C++ and __fastcall symbols from MSVC++,
| +    # which start with @ or ?.
| +    lt_cv_sys_global_symbol_pipe="$SED -n -e '/ UNDEF [^|]*()/d; / 00* UNDEF 
/d;
| +     s/.*().*External *| *$ac_symprfx$sympat.*/T $ac_symprfx\1 \1/p;
| +     s/.*External *| *$ac_symprfx$sympat.*/D $ac_symprfx\1 \1/p;
| +     s/.*().*External *| *\(address@hidden@?]]*\).*/T \1 \1/p;
| +     s/.*External *| *\(address@hidden@?]]*\).*/D \1 \1/p'"
| +  else
| +    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[         
]]\($symcode$symcode*\)[[       ]][[    
]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
| +  fi
|  
|    # Check to see that the pipe works correctly.
|    pipe_works=no




reply via email to

[Prev in Thread] Current Thread [Next in Thread]