[PATCH] Fix LD test FAIL: bootstrap with --static on Cygwin

Dave Korn dave.korn.cygwin@googlemail.com
Sat Mar 14 04:19:00 GMT 2009

    Hello again,

  The ld boostrap --static test fails on Cygwin with:

Executing on host: sh -c {/gnu/binutils/obj1908-i686-pc-cygwin/ld/ld-new -m
i386pe  -o tmpdir/ld1 /lib/crt0.o --static -liconv tmpdir/ld-partial.o
../bfd/.libs/libbfd.a ../libiberty/libiberty.a -lintl -lz  --start-group
/usr/lib/gcc/i686-pc-cygwin/4.3.2/libgcc_eh.a -lc --end-group -lcygwin
-L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32
/usr/lib/gcc/i686-pc-cygwin/4.3.2/libgcc.a 2>&1}  /dev/null ld.tmp (timeout = 300)
/usr/lib/libintl.a(dcigettext.o):dcigettext.c:(.text+0x744): undefined
reference to `libiconv'
/usr/lib/libintl.a(dcigettext.o):dcigettext.c:(.text+0x913): undefined
reference to `libiconv_open'
/usr/lib/libintl.a(dcigettext.o):dcigettext.c:(.text+0xaaa): undefined
reference to `libiconv_open'
/usr/lib/libintl.a(relocatable.o):relocatable.c:(.text+0x57): undefined
reference to `libiconv_set_relocation_prefix'

  On Cygwin, statically linking against -lintl means you have to explicitly
add -liconv.  (In dynamic linking, the libintl import lib contains import
sections for the functions it needs from the libiconv dll that resolve these
references.  When static linking there are no such DLL import tables in the
library .a file so any dependencies must be explicitly added).  The attached
patch does just that.

  Tested natively on i686-pc-cygwin and i686-pc-linux-gnu with one fix and no
regressions.  Ok for HEAD?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testsuite-fix.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20090314/5877de35/attachment.ksh>

More information about the Binutils mailing list