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: Sat, 20 Aug 2005 11:04:46 +0200
User-agent: Mutt/1.5.9i

Hi Peter,

* Peter Ekberg wrote on Thu, Aug 18, 2005 at 02:36:47PM CEST:
> Ralf Wildenhues wrote:
> 
> > 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.
> 
> I have attached (to prevent distortions) the output from "dumpbin
> -symbols" after compiling the following with cl -c -o sym.obj sym.c

OK, thanks.

*snip*
> Regarding dumpbin not being present in the 2003 version, I
> *think* it's just missing from the free toolkit and that it is
> still going strong in "the real" releases of Visual Studio.

OK.  I just can't test it then.

> > Also, there seem to be third-party programs named `dumpbin'.  
> > Does your1> test av oid 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.)
> 
> Hmm, I was not aware of other dumpbins, so if they are similar
> there might be a problem.

Completely untested (and no idea about trustworthiness):
http://www.freedownloadscenter.com/Best/coff-dumpbin.html

> But, as the test is currently, the located dumpbin must
> not choke on the -symbols option and it must output a line
> with both "External" and "some_variable" on it. So false
> positives seem unlikely to me, but the test can always be
> hardened.

OK.

> If the test is negative the found dumpbin is
> assumed to support the BSD nm interface, which is probably
> more likely to happen. But as you noted below, nm must be
> Missing for that to happen and in that case you were toast
> previously as well...

ACK.

> > Another remark: we change the interface provided by 
> > libtool.m4.  Please
> > update the serial number of the file.
*snip*

> Ok.

Thanks.

> > 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.
> 
> No problem at all, I'm just beginning to feel that I have soon
> filled the quota for at least some people with very similar-
> looking patches, and that people are perhaps no longer reading.

I am reading, but I need time.

> So I just pictured your request for a 2nd maintainer to chip in
> disappearing in the bitbucket...

Well, can't do much about that, can I?

> Regarding the changes to the documentation, I have not tested
> it, so it just might look like crap or generally suck in other
> ways. Feel free to edit or suggest fixes.

Yep, sucks.  :)
To be serious: the line length is too long.  Suggested change below.

OK.  Please apply after the following changes, if you agree.  No need to
post this for review again.

Cheers,
Ralf


| Index: doc/libtool.texi
| ===================================================================
| RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
| retrieving revision 1.193
| diff -u -r1.193 libtool.texi
| --- doc/libtool.texi  12 Aug 2005 22:52:30 -0000      1.193
| +++ doc/libtool.texi  18 Aug 2005 12:32:30 -0000
| @@ -1685,9 +1685,9 @@
|  @end defmac
|  
|  @defmac LT_PATH_NM
| -Try to find a @sc{bsd} compatible @command{nm} command on this
| -machine.  The result is stored in the shell variable @samp{$NM}, which
| -is @code{AC_SUBST}ed.
| +Try to find a @sc{bsd} compatible @command{nm} or a @sc{ms} compatible
| address@hidden command on this machine.  The result is stored in the
| +shell variable @samp{$NM}, which is @code{AC_SUBST}ed.
|  @end defmac
|  
|  @noindent
| @@ -4980,14 +4980,27 @@
|  @end defvar
|  
|  @defvar NM
| -The name of a BSD-compatible @command{nm} program that produces listings
| -of global symbols in one the following formats:
| +The name of a BSD- or MS-compatible program that produces listings of
| +global symbols.
| +For BSD @command{nm}, the symbols should be in one the following formats:
|  
|  @example
|  @var{address} C @var{global-variable-name}
|  @var{address} D @var{global-variable-name}
|  @var{address} T @var{global-function-name}
|  @end example
| +
| +For MS @command{dumpbin}, the symbols should be in one of the following
| +formats:
| +
| address@hidden
| address@hidden @var{size}    UNDEF          notype       External     | 
@var{global-variable-name}
| address@hidden @var{address} @var{section}  notype       External     | 
@var{global-variable-name}
| address@hidden @var{address} @var{section}  notype ()    External     | 
@var{global-function-name}
| address@hidden example

Please replace this with

address@hidden
address@hidden @var{size}    UNDEF    notype       External     | 
@var{global-var}
address@hidden @var{address} @var{section}  notype       External     | 
@var{global-var}
address@hidden @var{address} @var{section}  notype ()    External     | 
@var{global-func}
address@hidden example

and be done with it.

| +
| +The @var{size} of the global variables are not zero and the @var{section}
| +of the global functions are not "UNDEF".
|  @end defvar
|  
|  @defvar RANLIB
| Index: m4/libtool.m4
| ===================================================================
| RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
| retrieving revision 1.211
| diff -u -r1.211 libtool.m4
| --- m4/libtool.m4     18 Aug 2005 06:55:40 -0000      1.211
| +++ m4/libtool.m4     18 Aug 2005 12:32:33 -0000
| @@ -37,7 +37,7 @@
|  # the same distribution terms that you use for the rest of that program.
|  ])
|  
| -# serial 50 LT_INIT
| +# serial 51 LT_INIT
|  
|  
|  # LT_PREREQ(VERSION)
| @@ -2736,9 +2736,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- or MS-compatible name lister (nm)], lt_cv_path_NM,
|  [if test -n "$NM"; then
|    # Let the user override the test.
|    lt_cv_path_NM="$NM"
| @@ -2775,10 +2777,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:
| @@ -2915,7 +2942,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;

I think you are missing a pair of brackets here:         ^^^ 
  [[^|]]

But I'd rather like the whole sed script:

| +     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'"

in a pair of brackets, like so:

+    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]