Bug 10768 - dlltool: selecting machine arch when creating .lib from .def file failed with unclear error message
Summary: dlltool: selecting machine arch when creating .lib from .def file failed with...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-13 16:31 UTC by Yann Droneaud
Modified: 2009-10-16 14:03 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
dlltool: Improve error reporting regarding BFD open operations (958 bytes, patch)
2009-10-14 12:29 UTC, Yann Droneaud
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yann Droneaud 2009-10-13 16:31:38 UTC
I'm creating an import library for a proprietary DLL using a hand made .def file.

The following command fail:

arm-mingw32ce-dlltool -d libGLES_CM.def -D libGLES_CM.dll -l libGLES_CM.lib -m
$MACHINE

with MACHINE either arm or thumb, it failed with a strange message:

"Can't open .lib file: libGLES_CM.lib."

Using strace, one can see dlltool removing libGLES_CM.lib before failing.

Hopefully, removing -m thumb/arm, dlltool works and produces a .lib that can be
used on my target.

So either -m is not needed here and needed a proper error message/handling, or
this is a bug and i have luck to have a working .lib.
Comment 1 Yann Droneaud 2009-10-14 12:21:27 UTC
Using gdb help find the problem: when another machine architecture is selected, the bfd target is not the one per default. And the selected bfd is not part of the build.
So there's no bug, but the error message is unclear.
Comment 2 Yann Droneaud 2009-10-14 12:29:14 UTC
Created attachment 4278 [details]
dlltool: Improve error reporting regarding BFD open operations

Here's a patch which help to diagnose problem regarding BFD open calls.
Patch against CVS HEAD.
Comment 3 Sourceware Commits 2009-10-16 14:03:11 UTC
Subject: Bug 10768

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-10-16 14:02:55

Modified files:
	binutils       : ChangeLog dlltool.c 

Log message:
	PR 10768
	* dlltool.c (bfd_get_errmsg): New macro.
	(scan_obj_file): Use it.
	(make_one_lib_file): Use it.
	(make_head): Use it.
	(make_delay_head): Use it.
	(make_tail): Use it.
	(gen_lib_file): Use it.
	(identify_dll_for_implib): Use it.
	(identify_search_archive):  Use it.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1546&r2=1.1547
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/dlltool.c.diff?cvsroot=src&r1=1.93&r2=1.94

Comment 4 Nick Clifton 2009-10-16 14:03:36 UTC
Hi Yann,

  Thanks for the patch.  I have now applied it to the sources along with this
changelog entry.

Cheers
  Nick

binutils/ChangeLog
2009-10-16  Yann Droneaud  <yann@droneaud.fr>

	PR 10768
	* dlltool.c (bfd_get_errmsg): New macro.
	(scan_obj_file): Use it.
	(make_one_lib_file): Use it.
	(make_head): Use it.
	(make_delay_head): Use it.
	(make_tail): Use it.
	(gen_lib_file): Use it.
	(identify_dll_for_implib): Use it.
	(identify_search_archive):  Use it.