Bug 6054 - GCC 3.1 for ia64 fails to restore gp after indirect call in Linux kernel
Summary: GCC 3.1 for ia64 fails to restore gp after indirect call in Linux kernel
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.1
: P1 critical
Target Milestone: 3.1.x/3.2.x
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-25 16:46 UTC by smc
Modified: 2005-11-10 03:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
time.c.gz (67.41 KB, application/x-gzip )
2003-05-21 15:17 UTC, smc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description smc 2002-03-25 16:46:00 UTC
The ia64 Linux kernel is compiled with -mconstant-gp, but makes calls to
SAL functions through a function descriptor which causes a new gp to be
loaded.  GCC 3.0.4 restores the original gp after the call returns, but
3.1 does not, so the kernel crashes at the first global data access
following the SAL call.  This occurs in ia64_init_itm() in time.c.

I'm attaching a preprocessed time.c.  I tried to come up with a small
test case, but was unsuccessful.

Release:
gcc version 3.1 20020324 (prerelease)

Environment:
Red Hat Linux release 7.2 (Enigma) on ia64
running 2.4.9-18smp kernel

How-To-Repeat:
Compile time.c with the following options and examine the assembly code.

gcc -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe  -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -Winline -finline-limit=2000 -mb-step -mconstant-gp -S time.c

Compiled with gcc_3_0_4_release, the gp is restored after the indirect call
in ia64_init_itm.  With gcc-3_1-branch, it is not.
Comment 1 Richard Henderson 2002-03-26 22:40:18 UTC
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-Why: .
Comment 2 Richard Henderson 2002-03-27 02:41:46 UTC
State-Changed-From-To: open->closed
State-Changed-Why: http://gcc.gnu.org/ml/gcc-patches/2002-03/msg01779.html
Comment 3 Richard Henderson 2002-03-27 10:04:24 UTC
From: rth@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: target/6054
Date: 27 Mar 2002 10:04:24 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_1-branch
 Changes by:	rth@gcc.gnu.org	2002-03-27 02:04:23
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/ia64: ia64.c 
 Added files:
 	gcc/testsuite/gcc.dg: 20020326-1.c 
 
 Log message:
 	PR target/6054
 	* config/ia64/ia64.c (ia64_expand_call): Use pic patterns for
 	TARGET_CONST_GP.  Simplify conditions.
 	
 	* gcc.dg/20020326-1.c: New.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_1-branch&r1=1.13152.2.217&r2=1.13152.2.218
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&only_with_tag=gcc-3_1-branch&r1=1.139.2.11&r2=1.139.2.12
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20020326-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_1-branch&r1=NONE&r2=1.1.2.1
 

Comment 4 Richard Henderson 2002-03-27 10:34:15 UTC
From: rth@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: target/6054
Date: 27 Mar 2002 10:34:15 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	rth@gcc.gnu.org	2002-03-27 02:34:15
 
 Modified files:
 	gcc            : ChangeLog 
 	gcc/config/ia64: ia64.c 
 Added files:
 	gcc/testsuite/gcc.dg: 20020326-1.c 
 
 Log message:
 	PR target/6054
 	* config/ia64/ia64.c (ia64_expand_call): Use pic patterns for
 	TARGET_CONST_GP.  Simplify conditions.
 	
 	* gcc.dg/20020326-1.c: New.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.13531&r2=1.13532
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&r1=1.153&r2=1.154
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20020326-1.c.diff?cvsroot=gcc&r1=1.1&r2=1.2