ld is broken
H. J. Lu
hjl@lucon.org
Tue Oct 8 09:04:00 GMT 2002
On Tue, Oct 08, 2002 at 07:00:33AM -0700, H. J. Lu wrote:
> I got
>
> mipsel-linux-gcc -O2 -DPURE_TERMINFO -DSVR4_CURSES -o ncurses ../obj_s/ncurses.o -L../lib -lform -lmenu -lpanel -lncurses -Wl,-rpath,/export/redhat/rpms/BUILD/ncurses-5.2/lib
> /export/tools/lib/gcc-lib/mipsel-linux/2.96/collect2 -dynamic-linker /lib/ld.so.1 -o ncurses /export/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/lib/crt1.o /export/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/lib/crti.o /export/tools/lib/gcc-lib/mipsel-linux/2.96/crtbegin.o -L../lib -L/export/tools/lib/gcc-lib/mipsel-linux/2.96 -L/export/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/lib ../obj_s/ncurses.o -lform -lmenu -lpanel -lncurses -rpath /export/redhat/rpms/BUILD/ncurses-5.2/lib -lgcc -lc -lgcc /export/tools/lib/gcc-lib/mipsel-linux/2.96/crtend.o /export/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/lib/crtn.o
> /export/tools/lib/gcc-lib/mipsel-linux/2.96/../../../../mipsel-linux/bin/ld: input file ncurses is also the output file!
> collect2: ld returned 1 exit status
>
> I will try to write a testcase for it.
>
This patch
http://sources.redhat.com/ml/binutils/2002-10/msg00129.html
is almost completely bogus. For one thing, the error message is very
much misleading. There is no such a input file `ncurses' above. Also it
doesn't check symlinks/hardlinks. Many targets, like Linux, may open
some files for read implicitly via DT_NEEDED. I'd like to revert it
now.
To do it right, you have to check every open against the output. Also
comparing filename is not enough in that case.
H.J.
More information about the Binutils
mailing list