Subject: Re: make build error
To: None <cmcmanis@mcmanis.com, jkunz@unixag-kl.fh-kl.de>
From: John Darrow <John.P.Darrow@wheaton.edu>
List: port-vax
Date: 04/28/2000 12:12:36
Chuck McManis <cmcmanis@mcmanis.com> wrote:
>At 05:45 PM 4/28/00 +0200, jkunz@unixag-kl.fh-kl.de wrote:
>>I have the same error:

>>ld: /usr/src/current/dest/usr/lib: malformed input file (not rel or archive)
>>collect2: ld returned 1 exit status

>>while building 1.4X (last week) with 1.4X (this week). So I think there
>>is something else broken. 

>This is caused by the fact that bsd.prog.mk was changed to include the
>options "-W1,-rpath-link,$DESTDIR/usr/lib". This passes the option
>-rpath-link to ld which on the VAX hasn't a clue what to do about it and so
>the VAX takes the next argument as link file and it happens to be a
>directory and you get the message above. 

>Unfortunately, I just checked and the fix for this isn't in ld yet, this is
>the patch:
[deleted]
>You will need to apply this patch, make ld and install it, or you have to
>edit the bsd.prog.mk file to not pass the rpath link stuff.

Actually, a patch did go in, in ld.c 1.69.  Unfortunately, both that patch
and the one you posted make -rpath-link behave just like -R/-rpath, giving
invalid rpath entries in generated binaries.  (If -rpath-link was supposed
to be just like -rpath/-R, the whole bsd.prog.mk change wouldn't have been
necessary!)

The correct solution for the old gnu ld is to recognize that -rpath-link
takes an argument, but then ignore both it and its argument, just as is
done with -soname.  I'll include patches vs. both 1.68 and 1.69 here...

Index: /var/src/gnu/usr.bin/ld/ld/ld.c
===================================================================
RCS file: /source/cvs/netbsd/current/src/gnu/usr.bin/ld/ld/ld.c,v
retrieving revision 1.68
diff -u -r1.68 ld.c
--- ld.c	2000/01/13 16:22:44	1.68
+++ ld.c	2000/04/28 17:08:27
@@ -690,8 +690,9 @@
 
 	/* GNU binutils 2.x  forward-compatible flags. */
 	case 'r':
-		/* Ignore "-rpath" and hope ld.so.conf will cover our sins. */
-		if (!strcmp(&arg[1], "rpath"))
+		/* Ignore "-rpath" and "-rpath-link" hope ld.so.conf will cover
+		   our sins. */
+		if (!strcmp(&arg[1], "rpath") || !strcmp(&arg[1], "rpath-link"))
 			return 2;
 		return 1;
 
@@ -921,6 +922,11 @@
 		if (warn_forwards_compatible_inexact)
 			warnx("%s %s ignored", swt, arg);
 		goto do_rpath;
+	}
+	if (strcmp(swt + 1, "rpath-link") == 0) {
+		if (warn_forwards_compatible_inexact)
+			warnx("%s %s ignored", swt, arg);
+		return;
 	}
 #endif /* GNU_BINUTIL_COMPAT */
 

Index: /var/src/gnu/usr.bin/ld/ld/ld.c
===================================================================
RCS file: /source/cvs/netbsd/current/src/gnu/usr.bin/ld/ld/ld.c,v
retrieving revision 1.69
diff -u -r1.69 ld.c
--- ld.c	2000/04/27 00:36:02	1.69
+++ ld.c	2000/04/28 17:08:27
@@ -918,11 +918,15 @@
 			warnx("-soname %s ignored", arg);
 		return;
 	}
-	if (strcmp(swt + 1, "rpath") == 0 ||
-	    strcmp(swt + 1, "rpath-link") == 0) {
+	if (strcmp(swt + 1, "rpath") == 0) {
 		if (warn_forwards_compatible_inexact)
 			warnx("%s %s ignored", swt, arg);
 		goto do_rpath;
+	}
+	if (strcmp(swt + 1, "rpath-link") == 0) {
+		if (warn_forwards_compatible_inexact)
+			warnx("%s %s ignored", swt, arg);
+		return;
 	}
 #endif /* GNU_BINUTIL_COMPAT */
 


jdarrow

-- 
John Darrow - Senior Technical Specialist               Office: 630/752-5201
Computing Services, Wheaton College, Wheaton, IL 60187  Fax:    630/752-5968
Alphapage: 6303160707@alphapage.airtouch.com            Pager:  630/316-0707
Email:     John.P.Darrow@wheaton.edu