This is the mail archive of the gcc-patches@gcc.gnu.org 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]

libtool piecewise linking


libtool uses intermediate "ld -r" link stages as a workaround for
command line limits when building shared libs from a larger number of
object files.  This has unfortunate effects for powerpc64-linux.

powerpc64-linux uses a TOC section to store 64 bit constants and
addresses, which is limited to 64k in size.  With some linker magic
involving call stubs, it's possible to extend this limit to 64k per
relocatable object file.  Now if "ld -r" links a number of object files
together the TOCs are merged, and may exceed the 64k limit per file.
This happens when building libjava soft-float libs.

	* ltmain.sh: Use ld script in preference to piecewise linking.

-w diff, normal diff attached.
--- gcc-ppc64-33.orig/ltmain.sh	2002-11-22 08:23:42.000000000 +1030
+++ gcc-ppc64-33/ltmain.sh	2003-08-22 00:05:20.000000000 +0930
@@ -3214,7 +3214,12 @@ EOF
           :
         else
 	  # The command line is too long to link in one step, link piecewise.
+	  ldscript=
+	  if $LD --version | grep GNU > /dev/null 2>&1; then
+	    ldscript=y
+	  else
           $echo "creating reloadable object files..."
+	  fi
 
 	  # Save the value of $output and $libobjs because we want to
 	  # use them later.  If we have whole_archive_flag_spec, we
@@ -3238,6 +3243,7 @@ EOF
           last_robj=
           k=1
           output=$output_objdir/$save_output-${k}.$objext
+	  if test x$ldscript = x; then
 	  # Loop over the list of objects to be linked.
           for obj in $save_libobjs
           do
@@ -3290,6 +3296,14 @@ EOF
           done
           IFS="$save_ifs"
 
+	  else
+	    $echo "creating GNU ld script: $output"
+	    cat > $output <<EOF
+INPUT ( $save_libobjs )
+EOF
+	    delfiles=$output
+	  fi
+
           libobjs=$output
 	  # Restore the value of output.
           output=$save_output

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Attachment: lt.diff
Description: Text document


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