This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Allow collect2 to work with some linkers

Marc Espie wrote:
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/
- is mistaken for an object file.
- we end up with -dynamic-linker /tmp/ccxadad.o /usr/libexec/

The resulting error message is thoroughly confusing...

The fix is to explicitly parse -dynamic-linker, so that /usr/libexec/
stays with it:

OK, but:

2005-01-08 Marc Espie <>

* 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 ----
+ 	      if (!strcmp (arg, "-dynamic-linker") && argv[1] != (char *) 0)
+ 	        {
+ 		  ++argv;
+ 		  *ld1++ = *ld2++ = *argv;
+ 		}

Please write the condition as:

strcmp (...) == 0 && argv[1]


Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]