diff mbox

readd crti/crtn to sparc-*-rtems*

Message ID 4D2792F7.6060301@oarcorp.com
State New
Headers show

Commit Message

Joel Sherrill Jan. 7, 2011, 10:25 p.m. UTC
Hi,

The recent rework in config/sparc broke
sparc-*-rtems*.  This patch restores it
to functional state.

OK to commit.

2011-01-07  Joel Sherrill <joel.sherrill@oarcorp.com>

         * config.gcc (tmake_file): Add t-rtems to list.
         (extra_parts): Add crti.o and crtn.o.
         * config/sparc/t-rtems: New file.

Comments

Eric Botcazou Jan. 8, 2011, 12:03 a.m. UTC | #1
> The recent rework in config/sparc broke
> sparc-*-rtems*.  This patch restores it
> to functional state.
>
> OK to commit.

Not OK, the usage of the Solaris startup files is wrong.  sparc64-*-rtems* 
doesn't need them so it isn't clear why sparc-*-rtems* really would.
Ralf Corsepius Jan. 8, 2011, 2:57 a.m. UTC | #2
On 01/08/2011 01:03 AM, Eric Botcazou wrote:
>> The recent rework in config/sparc broke
>> sparc-*-rtems*.  This patch restores it
>> to functional state.
>>
>> OK to commit.
> Not OK, the usage of the Solaris startup files is wrong.  sparc64-*-rtems*
> doesn't need them so it isn't clear why sparc-*-rtems* really would
Well, I think the converse is true, i.e. sparc64-*rtems* misses these 
startup files.

Ralf
Joel Sherrill Jan. 8, 2011, 4:18 p.m. UTC | #3
On 01/07/2011 08:57 PM, Ralf Corsepius wrote:
> On 01/08/2011 01:03 AM, Eric Botcazou wrote:
>>> The recent rework in config/sparc broke
>>> sparc-*-rtems*.  This patch restores it
>>> to functional state.
>>>
>>> OK to commit.
>> Not OK, the usage of the Solaris startup files is wrong.  sparc64-*-rtems*
>> doesn't need them so it isn't clear why sparc-*-rtems* really would
> Well, I think the converse is true, i.e. sparc64-*rtems* misses these
> startup files.
>
I agree with Ralf.  We have very good testing on sparc-rtems
and very light testing on sparc64-rtems.  We do not have a
free simulator to test on.

The sparc-rtems target currently uses init/fini for C++
constructors and without crti/n, they do not have the symbols.

Longer term, both probably need to switch to how sparc-elf
does it but I was just trying to fix the breakage.  And I didn't
build sparc64-rtems.  This is how sparc-rtems has done it
for at least 10 years.

--joel
> Ralf
>
Eric Botcazou Jan. 10, 2011, 11:47 a.m. UTC | #4
> The sparc-rtems target currently uses init/fini for C++
> constructors and without crti/n, they do not have the symbols.

OK, this is indeed done the same way (hijacking the Solaris files) for i386.

> Longer term, both probably need to switch to how sparc-elf
> does it but I was just trying to fix the breakage.  And I didn't
> build sparc64-rtems.  This is how sparc-rtems has done it
> for at least 10 years.

The patch is OK modulo the following couple of changes:

1) copy and adjust (x86 -> SPARC) the lines:

# This file was based on t-sol2 - x68 Solaris implementation. Actually,
# the source code to create crti.o anf crtn.o are exactly the same 
# as the ones for Solaris. Later, we might want to have a RTEMS's 
# version of these files.

from config/i386/t-rtems-i386 to the new config/sparc/t-rtems.

2) apply the config.gcc changes to both sparc-*-rtems* and sparc64-*-rtems*.

Thanks in advance.
Joel Sherrill Jan. 10, 2011, 4:31 p.m. UTC | #5
On 01/10/2011 05:47 AM, Eric Botcazou wrote:
>> The sparc-rtems target currently uses init/fini for C++
>> constructors and without crti/n, they do not have the symbols.
> OK, this is indeed done the same way (hijacking the Solaris files) for i386.
>
>> Longer term, both probably need to switch to how sparc-elf
>> does it but I was just trying to fix the breakage.  And I didn't
>> build sparc64-rtems.  This is how sparc-rtems has done it
>> for at least 10 years.
> The patch is OK modulo the following couple of changes:
>
> 1) copy and adjust (x86 ->  SPARC) the lines:
>
> # This file was based on t-sol2 - x68 Solaris implementation. Actually,
> # the source code to create crti.o anf crtn.o are exactly the same
> # as the ones for Solaris. Later, we might want to have a RTEMS's
> # version of these files.
>
> from config/i386/t-rtems-i386 to the new config/sparc/t-rtems.
>
> 2) apply the config.gcc changes to both sparc-*-rtems* and sparc64-*-rtems*.
>
Agreed.  I just got email back from the sparc64 RTEMS person
and they admitted they never had global ctors working.  Which
confirms what Ralf and I said.

OK.  I will get a patch together and submit when tested.

Thanks.
> Thanks in advance.
>
diff mbox

Patch

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 168556)
+++ gcc/config.gcc	(working copy)
@@ -2481,8 +2487,8 @@ 
 	;;
 sparc-*-rtems*)
 	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/sp-elf.h sparc/rtemself.h rtems.h newlib-stdint.h"
-	tmake_file="sparc/t-elf sparc/t-crtfm t-rtems"
-	extra_parts="crtbegin.o crtend.o"
+	tmake_file="sparc/t-elf sparc/t-crtfm sparc/t-rtems t-rtems"
+	extra_parts="crti.o crtn.o crtbegin.o crtend.o"
 	;;
 sparc-*-linux*)
 	tm_file="${tm_file} dbxelf.h elfos.h sparc/sysv4.h linux.h glibc-stdint.h"
Index: gcc/config/sparc/t-rtems
===================================================================
--- gcc/config/sparc/t-rtems	(revision 0)
+++ gcc/config/sparc/t-rtems	(revision 0)
@@ -0,0 +1,23 @@ 
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Assemble startup files.
+$(T)crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm
+$(T)crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
+	$(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm