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]

Fix PowerPC64 TOC overflow building libjava


It seems the TOC is now overflowing on normal powerpc64-linux libjava
builds.

creating reloadable object files...
creating a temporary reloadable object file: .libs/libgcj.la-2.o
ld -m elf64ppc -r -o .libs/libgcj.la-1.o .libs/prims.o .libs/jni.o [snip]
ld: TOC section size exceeds 64k

Previously, this only happened when building a soft-float version of
libjava.  At the time I hit the problem with soft-float libjava, I
developed a libtool patch (see
http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01263.html), but because
there were some objections and soft-float multilibs aren't built unless
you patch gcc, I didn't pursue the libtool change.

The following addresses two of the objections raised by Alex.  We still
have the minor problem of double-quotes in filenames not being handled
by ld scripts, but I reckon that pales into insignificance compared to
the side-effects of using "ld -r". (*)

	* ltconfig (with_gnu_ld): Set.
	* ltmain.sh: Use ld script in preference to piecewise linking
	when using GNU ld.

powerpc64-linux bootstrap and regression test in progress.  I'm past
the previous libjava failure point..

The diff below uses -w to highlight the significant changes, while the
attached diff does the indentation required by my use of an extra
conditional.

(*) The trouble is that ld -r does quite a lot more than just packaging
object files together.  One ill effect on all targets is that code may
be re-ordered if using -ffunction-sections.  ld -r will place sections
of the same name together.  eg. All "setup" functions get placed
together.  This isn't ideal, since you lose code locality with
potentially bad icache effects.

--- gcc-virgin/ltconfig	2004-04-29 14:16:02.000000000 +0930
+++ gcc-current/ltconfig	2004-08-23 12:35:34.012779532 +0930
@@ -2462,6 +2462,9 @@ deplibs_check_method=$deplibs_check_meth
 # Command to use when deplibs_check_method == file_magic.
 file_magic_cmd=$file_magic_cmd
 
+# Whether we are using GNU ld or not.
+with_gnu_ld=$with_gnu_ld
+
 # Flag that allows shared libraries with undefined symbols to be built.
 allow_undefined_flag=$allow_undefined_flag
 
--- gcc-virgin/ltmain.sh	2004-02-05 13:00:56.000000000 +1030
+++ gcc-current/ltmain.sh	2004-08-23 12:39:09.326573375 +0930
@@ -3262,7 +3262,9 @@ EOF
           :
         else
 	  # The command line is too long to link in one step, link piecewise.
+	  if test "$with_gnu_ld" != yes; then
           $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
@@ -3285,6 +3287,7 @@ EOF
           delfiles=
           last_robj=
           k=1
+	  if test "$with_gnu_ld" != yes; then
           output=$output_objdir/$save_output-${k}.$objext
 	  # Loop over the list of objects to be linked.
           for obj in $save_libobjs
@@ -3339,6 +3342,17 @@ EOF
           done
           IFS="$save_ifs"
 
+	  else
+            output=${output_objdir}/${save_output}.lnk
+	    $echo "creating GNU ld script: $output"
+	    $echo 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      $echo \""$obj"\" >> $output
+	    done
+	    $echo ')' >> $output
+	  fi
+
           libobjs=$output
 	  # Restore the value of output.
           output=$save_output

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Attachment: libtool.diff
Description: Text document


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