Patchwork [libgcc] fix libgcc configuration for powerpc*-eabi*

login
register
mail settings
Submitter Nathan Froyd
Date July 22, 2010, 6:29 p.m.
Message ID <20100722182921.GF26037@codesourcery.com>
Download mbox | patch
Permalink /patch/59624/
State New
Headers show

Comments

Nathan Froyd - July 22, 2010, 6:29 p.m.
After the transition to top-level libgcc, t-ppccomm was no longer
included for powerpc*-eabi*.  This omission meant that the out-of-line
register save/restore routines were no longer included in libgcc.  Since
gcc generates calls to these routines at -Os, programs that included
code compiled at -Os no longer linked.

This patch corrects this bug.  I would not be totally surprised if
t-ppccomm needed to be included for powerpc* targets...but I can't test
all of them.  The EXTRA_PARTS bit is needed to pass the checking code in
libgcc/Makefile.in that compares libgcc configuration with gcc.

Tested on powerpc-eabispe.  OK to commit?  OK to backport to 4.5 as well?

-Nathan

	* config.host (powerpc*-eabispe*): Set tmake_file.
	(powerpc*-eabi*): Likewise.
	* config/rs6000/t-ppccomm (EXTRA_PARTS): Add crtbegin, crtend,
	crtbeginS, crtendS, crtbeginT.

Index: ChangeLog
===================================================================
David Edelsohn - July 22, 2010, 10:11 p.m.
On Thu, Jul 22, 2010 at 2:29 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> After the transition to top-level libgcc, t-ppccomm was no longer
> included for powerpc*-eabi*.  This omission meant that the out-of-line
> register save/restore routines were no longer included in libgcc.  Since
> gcc generates calls to these routines at -Os, programs that included
> code compiled at -Os no longer linked.
>
> This patch corrects this bug.  I would not be totally surprised if
> t-ppccomm needed to be included for powerpc* targets...but I can't test
> all of them.  The EXTRA_PARTS bit is needed to pass the checking code in
> libgcc/Makefile.in that compares libgcc configuration with gcc.
>
> Tested on powerpc-eabispe.  OK to commit?  OK to backport to 4.5 as well?
>
> -Nathan
>
>        * config.host (powerpc*-eabispe*): Set tmake_file.
>        (powerpc*-eabi*): Likewise.
>        * config/rs6000/t-ppccomm (EXTRA_PARTS): Add crtbegin, crtend,
>        crtbeginS, crtendS, crtbeginT.

Okay.

Thanks, David
Nathan Froyd - Feb. 23, 2011, 6:06 p.m.
On Thu, Jul 22, 2010 at 11:29:21AM -0700, Nathan Froyd wrote:
> After the transition to top-level libgcc, t-ppccomm was no longer
> included for powerpc*-eabi*.  This omission meant that the out-of-line
> register save/restore routines were no longer included in libgcc.  Since
> gcc generates calls to these routines at -Os, programs that included
> code compiled at -Os no longer linked.
> 
> This patch corrects this bug.
> 
> Tested on powerpc-eabispe.  OK to commit?  OK to backport to 4.5 as well?

Since David OK'd this patch, I've (finally!) committed:

http://gcc.gnu.org/ml/gcc-patches/2010-07/msg01766.html

to the 4.5 branch to address PR target/43810--at least the bit about the
symbols not appearing in libgcc.  The --enable-target-optspace bug
described in the comments (where crt*.o get compiled with -Os and then
cannot find the routines) appears to be entirely different and warrants
a new bug.

-Nathan

Patch

Index: config.host
===================================================================
--- config.host	(revision 162421)
+++ config.host	(working copy)
@@ -458,6 +458,7 @@  powerpc*-*-freebsd*)
 powerpc-*-netbsd*)
 	;;
 powerpc-*-eabispe*)
+	tmake_file="${tmake_file} rs6000/t-ppccomm"
 	;;
 powerpc-*-eabisimaltivec*)
 	;;
@@ -468,6 +469,7 @@  powerpc-*-elf*)
 powerpc-*-eabialtivec*)
 	;;
 powerpc-*-eabi*)
+	tmake_file="${tmake_file} rs6000/t-ppccomm"
 	;;
 powerpc-*-rtems*)
 	;;
Index: config/rs6000/t-ppccomm
===================================================================
--- config/rs6000/t-ppccomm	(revision 162421)
+++ config/rs6000/t-ppccomm	(working copy)
@@ -15,7 +15,9 @@  LIB2ADD_ST += crtsavfpr.S crtresfpr.S \
   e500crtsavg64gpr.S \
   e500crtsavg64gprctr.S
 
-EXTRA_PARTS += ecrti$(objext) ecrtn$(objext) ncrti$(objext) ncrtn$(objext)
+EXTRA_PARTS += crtbegin$(objext) crtend$(objext) \
+  crtbeginS$(objext) crtendS$(objext) crtbeginT$(objext) \
+  ecrti$(objext) ecrtn$(objext) ncrti$(objext) ncrtn$(objext)
 
 # We build {e,n}crti.o and {e,n}crtn.o, which serve to add begin and
 # end labels to all of the special sections used when we link using gcc.