[Bug 921] Erroneus crti.o causes the wrong code path to be taken

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Aug 5 16:59:49 UTC 2008


http://www.rtems.org/bugzilla/show_bug.cgi?id=921


Joel Sherrill <joel.sherrill at oarcorp.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING
             Status|ASSIGNED                    |RESOLVED
           Platform|                            |All
         Resolution|                            |WONTFIX
   Target Milestone|---                         |4.9


The SPARC version of rtems-gcc 3.2.3 builds with a faulty crti.o lib (located
in lib/gcc-lib/sparc-rtems/3.2.3/). The issue occurs in both my attempt to a
private build of the tool chain and the rtems sparc gcc rpm-distribution i.e.
rtems-4.6-sparc-rtems-gcc-gcc3.2.3newlib1.11.0-4.i686.rpm.

The problem is that the preamble of the init and fini have two saves, reviewing
the gcc source (gcc/config/sparc/sol2-ci.asm), it is clear that the first save
is not supposed to be there (the hashes are misinterpreted as comments instead
of being run as preprocessor directives).

This results in the wrong code path being taken during initialisation and
during clean-up, as the extra save will move result in the wrong return address
when init / fini returns. This can potentially lead to corruption of data.

Release:
unknown

Environment:
Host: P4, LINUX (Feodora Core 4), gcc32 (GCC) 3.2.3 20030502 (Red Hat Linux
3.2.3-47.fc4)

How-To-Repeat:
Build sparc-rtems-gcc (with patches), with configuration according to the
manual.


--- Comment #1 from holm at virtutech.com  2006-03-15 12:05:29 ---
Fix:
Replace crti.o with a working version.

--- Comment #2 from Joel Sherrill <joel.sherrill at oarcorp.com>  2006-03-15 13:02:04 ---
State-Changed-From-To: open->feedback
State-Changed-Why: I have checked the 3.2.3 source and just don't see the
commented out line you are referring to.  With objdump, I
see the duplicated save instructions but don't see the
commented out save in sol2-ci.asm.  Help.


--- Comment #3 from holm at virtutech.se  2006-03-16 09:31:47 ---
From: Mattias CW Holm <holm at virtutech.se>
To: bugs at rtems.com
Cc: 
Subject: Re: RTEMS Re: tools/921
Date: Thu, 16 Mar 2006 09:31:47 +0100

 Hi,
 
 Sorry, I was a bit unclear on this. My sol2-ci.asm (from the tarball
 with patches) have this code at BOTH the init and fini preambles.
 
 #ifdef __sparcv9
         save    %sp, -176, %sp
 #else
         save    %sp, -96, %sp
 #endif
 
 So, only one save is to be issued (that would be the second one in this
 case). However, both of these are issued which should not be possible in
 the case. What gcc / gas seem to do is to interprete the # character as
 the beginning of a comment and not as a preprocessor directive.
 
 Removing the save %sp, -176, %sp lines (in init and in fini) solves the
 problem and produce a working crti.o but prevents the compiler from
 emitting working SPARC V9 binaries.
 
 
 Regards,
 Mattias Holm
 
 
 On Wed, 2006-03-15 at 19:02 +0000, RTEMS-gnats at rtems.com wrote:
 > Synopsis: Erroneus crti.o causes the wrong code path to be taken
 > 
 > State-Changed-From-To: open->feedback
 > State-Changed-By: joel
 > State-Changed-When: Wed, 15 Mar 2006 13:02:04 -0600
 > State-Changed-Why:
 > I have checked the 3.2.3 source and just don't see the
 > commented out line you are referring to.  With objdump, I
 > see the duplicated save instructions but don't see the
 > commented out save in sol2-ci.asm.  Help.
 > 
 > 
 > 
 > 
 >  http://www.rtems.com/cgi-bin/gnatsweb.pl?cmd=view&database=RTEMS&pr=921

--- Comment #4 from Joel Sherrill <joel.sherrill at oarcorp.com>  2008-08-05 11:59:44 ---
Very old against very old tools.


-- 
Configure bugmail: http://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the bugs mailing list