This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Allow collect2 to work with some linkers
- From: Marc Espie <espie at nerim dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Jan 2005 01:50:32 +0100
- Subject: [PATCH] Allow collect2 to work with some linkers
- Reply-to: espie at nerim dot net
This happens very infrequently.
- on some systems, collect2 is called to compile extra files to handle
constructors/destructors. This doesn't happen too often.
- it then tries to insert that extra object file on the linker file.
- on OpenBSD-sparc, that linker line happens to begin
with -dynamic-linker /usr/libexec/ld.so
- ld.so is mistaken for an object file.
- we end up with -dynamic-linker /tmp/ccxadad.o /usr/libexec/ld.so
The resulting error message is thoroughly confusing...
The fix is to explicitly parse -dynamic-linker, so that /usr/libexec/ld.so
stays with it:
2005-01-08 Marc Espie <espie@openbsd.org>
* collect2.c (main): Explicitly parse -dynamic-linker option.
*** collect2.c.orig Mon Jan 10 01:44:29 2005
--- collect2.c Mon Jan 10 01:44:01 2005
*************** main (int argc, char **argv)
*** 1097,1102 ****
--- 1097,1107 ----
ld1--;
ld2--;
}
+ if (!strcmp (arg, "-dynamic-linker") && argv[1] != (char *) 0)
+ {
+ ++argv;
+ *ld1++ = *ld2++ = *argv;
+ }
break;
case 'l':