Fix "-shared" bug in collect2

John David Anglin dave@hiauly1.hia.nrc.ca
Wed Jan 2 18:59:00 GMT 2002


The change to using a shared libgcc for 32-bit hpux 10 and 11 exposed
a small bug in collect2 that causes numerous failures in the g++ and objc
testsuites.  Collect2's argument processing doesn't distinguish between
"-shared" and "-shared-libgcc", and as a result, incorrect constructor
files are created for non-shared objects.  Tested on hppa2.0w-hp-hpux11.11:
<http://gcc.gnu.org/ml/gcc-testresults/2002-01/msg00034.html>.

OK?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2002-01-02  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* collect2.c (main): Use strcmp when testing for "-shared".

--- collect2.c.orig	Wed Dec 26 22:35:19 2001
+++ collect2.c	Wed Jan  2 17:16:21 2002
@@ -1080,7 +1080,7 @@
 	*c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
       if (strcmp (q, "-EL") == 0 || strcmp (q, "-EB") == 0)
 	*c_ptr++ = obstack_copy0 (&permanent_obstack, q, strlen (q));
-      if (strncmp (q, "-shared", sizeof ("-shared") - 1) == 0)
+      if (strcmp (q, "-shared") == 0)
 	shared_obj = 1;
       if (*q == '-' && q[1] == 'B')
 	{



More information about the Gcc-patches mailing list