Approval: can I commit this please?

Kean Johnston jkj@sco.com
Sat Apr 19 23:02:00 GMT 2003


The first patch is to configure.in. It detects the GNU
linker, and only used ld -shared if the GNU linker is
being used. It used -G else. It also adds /usr/ccs/bin/elf
to the list of search directories looking for tools, and it
corrects a test for RO/RW section mixing. The second patch
is to tlink.c, it adds missing = signs to the putenv calls.
Someone previously wondered why the arguments to putenv are
xstrdup'ed in the first place, and I can only assume that
it helps eliminate warnings, as some systems declare putenv
to take a char * instead of a const char *.

If someone can give me the nod I'll commit these two changes,
it's the last of the stuff required to get the SCO port working.

Kean

Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.660
diff -u -r1.660 configure.in
--- configure.in	16 Apr 2003 06:51:19 -0000	1.660
+++ configure.in	19 Apr 2003 21:30:41 -0000
@@ -1508,6 +1508,7 @@
 	    test_dirs="$test_dirs \
 		   /usr/libexec \
 		   /usr/ccs/gcc \
+		   /usr/ccs/bin/elf \
 		   /usr/ccs/bin \
 		   /udk/usr/ccs/bin \
 		   /bsd43/usr/lib/cmplrs/cc \
@@ -1619,6 +1620,7 @@
 	    test_dirs="$test_dirs \
 		   /usr/libexec \
 		   /usr/ccs/gcc \
+		   /usr/ccs/bin/elf \
 		   /usr/ccs/bin \
 		   /udk/usr/ccs/bin \
 		   /bsd43/usr/lib/cmplrs/cc \
@@ -1645,6 +1647,14 @@
     ;;
 esac
 
+AC_MSG_CHECKING(if the linker is GNU ld)
+if $gcc_cv_ld -v 2>&1 </dev/null | egrep '(GNU|with BFD)' > /dev/null;
then
+  gcc_cv_ld_is_gnu=yes
+else
+  gcc_cv_ld_is_gnu=no
+fi
+AC_MSG_RESULT($gcc_cv_ld_is_gnu)
+
 # Figure out what nm we will be using.
 gcc_cv_binutils_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/binutils
 AC_MSG_CHECKING(what nm to use)
@@ -2491,15 +2501,20 @@
   echo '.byte 1' >> conftest2.s
   echo '.section "myfoosect", "a"' > conftest3.s
   echo '.byte 0' >> conftest3.s
+  if test "x$gcc_cv_ld_is_gnu" = "xyes"; then
+    ldshared=-shared
+  else
+    ldshared=-G
+  fi
   if $gcc_cv_as -o conftest1.o conftest1.s > /dev/null 2>&1 \
      && $gcc_cv_as -o conftest2.o conftest2.s > /dev/null 2>&1 \
      && $gcc_cv_as -o conftest3.o conftest3.s > /dev/null 2>&1 \
-     && $gcc_cv_ld -shared -o conftest1.so conftest1.o \
+     && $gcc_cv_ld $ldshared -o conftest1.so conftest1.o \
 	conftest2.o conftest3.o; then
-    gcc_cv_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
-			 | grep -A1 myfoosect`
-    if echo "$gcc_cv_ld_ro_rw_mix" | grep CONTENTS > /dev/null; then
-      if echo "$gcc_cv_ld_ro_rw_mix" | grep READONLY > /dev/null; then
+    can_ld_ro_rw_mix=`$gcc_cv_objdump -h conftest1.so \
+			| sed -n '/myfoosect/,/CONTENTS/p'`
+    if test -n "$can_ld_ro_rw_mix"; then
+      if echo "$can_ld_ro_rw_mix" | grep READONLY > /dev/null; then
 	gcc_cv_ld_ro_rw_mix=read-only
       else
 	gcc_cv_ld_ro_rw_mix=read-write

Index: tlink.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tlink.c,v
retrieving revision 1.49
diff -u -r1.49 tlink.c
--- tlink.c	26 Feb 2003 05:21:26 -0000	1.49
+++ tlink.c	19 Apr 2003 21:30:41 -0000
@@ -467,8 +467,8 @@
 {
   file *f;
 
-  putenv (xstrdup ("COMPILER_PATH"));
-  putenv (xstrdup ("LIBRARY_PATH"));
+  putenv (xstrdup ("COMPILER_PATH="));
+  putenv (xstrdup ("LIBRARY_PATH="));
 
   while ((f = file_pop ()) != NULL)
     {



More information about the Gcc-patches mailing list