libtool
[Top][All Lists]
Advanced

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

Re: func_win32_import_lib_p when file is missing


From: Peter Rosin
Subject: Re: func_win32_import_lib_p when file is missing
Date: Sun, 07 Oct 2012 11:37:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

On 2012-10-07 06:04, Gary V. Vaughan wrote:
> Hi Peter,
> 
> On 7 Oct 2012, at 06:53, Peter Rosin <address@hidden> wrote:
>> How is the below function supposed to work
>> when $file_magic_cmd is '$OBJDUMP -f' and not 'func_win32_libid'?
> 
> I have no idea :(
> 
>> objdump doesn't output "import" for me, at least not for any
>> import lib I have given it. Chunk?
>>
>> # func_win32_import_lib_p ARG
>> # True if ARG is an import lib, as indicated by $file_magic_cmd
>> func_win32_import_lib_p ()
>> {
>>    $debug_cmd
>>
>>    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
>>    *import*) : ;;
>>    *) false ;;
>>    esac
>> }
> 
> Does '$OBJDUMP -f' output anything that can be used to distinguish an
> import library?

Don't think so.

> If so, add that to the *import* leg of the case statement above.  If not,

"objdump -f" output from normal static lib:
--------------8<---------------
In archive ../msvc/tests/testsuite.dir/035/.libs/hello.lib:

libhello_la-foo.obj:     file format pe-i386
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

libhello_la-hello.obj:     file format pe-i386
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
--------------8<---------------

And from an import lib:

--------------8<---------------
In archive ../msvc/tests/testsuite.dir/034/.libs/hello.dll.lib:

hello-2.dll:     file format pe-i386
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

hello-2.dll:     file format pe-i386
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

hello-2.dll:     file format pe-i386
architecture: i386, flags 0x0000003d:
HAS_RELOC, HAS_LINENO, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000

hello-2.dll:     file format pei-i386
architecture: i386, flags 0x00000018:
HAS_DEBUG, HAS_SYMS
start address 0x00000000

hello-2.dll:     file format pei-i386
architecture: i386, flags 0x00000018:
HAS_DEBUG, HAS_SYMS
start address 0x00000000

hello-2.dll:     file format pei-i386
architecture: i386, flags 0x00000018:
HAS_DEBUG, HAS_SYMS
start address 0x00000000
--------------8<---------------

I don't imagine any of the differences to be really useful. I don't
know though... pe-i386 vs. pei-i386 looks promising, but I don't
possess enough PE-COFF-fuu to tell for sure. I think it would
have been used previously if it really did work?

> then file_magic_cmd should not be set to '$OBJDUMP -f' for at least that
> particular combination of MSVC/objdump/mingw that you are using:

I don't think this is particular to my specific objdump, as it
is the one from GNU binutils, and I believe this problem with
func_win32_import_lib_p to be generic to all known objdumps out
there. I don't think this has ever worked as intended.

>> mingw* | pw32*)
>>  # Base MSYS/MinGW do not provide the 'file' command needed by
>>  # func_win32_libid shell function, so use a weaker test based on 'objdump',
>>  # unless we find 'file', for example because we are cross-compiling.
>>  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
>>  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
>>    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
>>    lt_cv_file_magic_cmd='func_win32_libid'
>>  else
>>    # Keep this pattern in sync with the one in func_win32_libid.
>>    lt_cv_deplibs_check_method='file_magic file format 
>> (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
>>    lt_cv_file_magic_cmd='$OBJDUMP -f'
> 
>      lt_cv_file_magic_cmd='func_win32_libid'
> 
> ??

func_win32_libid requires file(1) to be present (wasn't always the
case on MSYS) and that "$NM -f posix -A <file>" is useful (obviously
not the case when NM="dumpbin -symbols").

I suppose one way forward is to flesh out func_win32_libid to also
handle $lt_cv_nm_interface = "MS dumpbin" and then rely on file to
be present. That would make MSVC work on modern but not legacy
MSYS, which does not seem like much of an issue. But that would not
solve matters for wince and old MSYS lacking file(1), and any solution
for those would perhaps be a solution for NM="dumpbin -symbols" as
well, and piggybacking like that is always nice.

Cheers,
Peter




reply via email to

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