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]

Re: ppc prologue scheduling/ SVR4 rs6000_pic_labelno patch


Am Mit, 26 Jan 2000 schrieb Clinton Popetz:
>Before -msched-prolog came into being, the SVR4 ASM_DECLARE_FUNCTION_NAME was
>called before the prologue was emitted, so it was ok that
>rs6000_output_load_toc_table incremented rs6000_pic_labelno.  With
>-msched-prolog, the reverse is true, so when the constant pool is non-empty,
>ASM_DECLARE_FUNCTION_NAME will emit a .long directive with the wrong label
>(i.e. .LCTOC1-.LCF1 instead of .LCTOC1-.LCF0).  In addition, with the nonlocal
>control pattens using rs6000_emit_load_toc_table, we can have
>rs6000_pic_labelno incremented several times per function, which will also
>cause ASM_DECLARE_FUNCTION_NAME to use the wrong label.
>
>I've reinstated rs6000_pic_func_labelno, and it's set to rs6000_pic_labelno
>when the prologue emitter calls rs6000_output_load_toc_table.  The SVR4
>ASM_DECLARE_FUNCTION_NAME now uses this variable for its labels.
>
>This gets rid of the various compilation failures in gcc-c.torture for -fPIC
>-msched-prolog for powerpc-eabi, and leaves only the execution failures at -O1
>and above where flow doesn't know about the use of PIC register (and I'm
>working on that.)
>
>Ok for newppc-branch?
>
>				-Clint
>
>config/rs6000/ChangeLog:
>
>2000-01-26  Clinton Popetz  <cpopetz@cygnus.com>
>
>	* rs6000.c (rs6000_pic_func_labelno): Define.
>	(rs6000_emit_load_toc_table): Set the above to rs6000_pic_labelno when
>emitting the prologue.
>	* svsv4.h (ASM_DECLARE_FUNCTION_NAME): Declare and use the above 
>	global.  

Hmm, I can't bootstrap with this patch on powerpc-linux-gnu, it fails in stage1
while compiling _bb from libgcc2.c:

[root@enzo gcc]# ./xgcc -B/cvsx/gnubinnp/ppc-redhat-linux/bin/ -B./ -I/cvsx/gnubinnp/ppc-redhat-linux/include -O2   -DIN_GCC    -g -O0 -W -Wall -I./include  -f
PIC -g1 -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED   -mstrict-align -I. -I../../../gccmnp/gcc -I../../../gccmnp/gcc/config -I../../../gccmnp/gcc
/../include -c -DL_bb ../../../gccmnp/gcc/libgcc2.c -o _bb.o -v -save-temps
Reading specs from ./specs
gcc version 2.96 20000126 (experimental)
 ./cpp -lang-c -v -I/cvsx/gnubinnp/ppc-redhat-linux/include -I./include -I. -I../../../gccmnp/gcc -I../../../gccmnp/gcc/config -I../../../gccmnp/gcc/../include
 -iprefix ./../lib/gcc-lib/ppc-redhat-linux/2.96/ -isystem ./include -isystem /cvsx/gnubinnp/ppc-redhat-linux/bin/include -D__GNUC__=2 -D__GNUC_MINOR__=96 -DPP
C -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC -D__powerpc -Acpu(powerpc) -Amachine(powerpc) -D__CHAR_UNSIGNED__ -g -g1 -W -Wall -D__PIC__=2 -
D__pic__=2 -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix) -Asystem(posix) -D
IN_GCC -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -DL_bb ../../../gccmnp/gcc/libgcc2.c libgcc2.i
GNU CPP version 2.96 20000126 (experimental) (PowerPC GNU/Linux)
#include "..." search starts here:
#include <...> search starts here:
 include
 .
 ../../../gccmnp/gcc
 ../../../gccmnp/gcc/config
 ../../../gccmnp/gcc/../include
 include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /cvsx/gnubinnp/lib/gcc-lib/ppc-redhat-linux/2.96/../../../../include/g++-3
 /usr/local/include
 /cvsx/gnubinnp/lib/gcc-lib/ppc-redhat-linux/2.96/../../../../ppc-redhat-linux/include
 /cvsx/gnubinnp/lib/gcc-lib/ppc-redhat-linux/2.96/include
End of omitted list.
 ./cc1 libgcc2.i -quiet -dumpbase libgcc2.c -mstrict-align -g -g1 -O2 -O0 -W -Wall -version -fPIC -o libgcc2.s
GNU C version 2.96 20000126 (experimental) (ppc-redhat-linux) compiled by GNU C version 2.95.2 19991024 (release/franzo).
../../../gccmnp/gcc/libgcc2.c: In function `__bb_exit_func':
../../../gccmnp/gcc/libgcc2.c:1710: warning: implicit declaration of function `time'
 as -mppc -V -Qy -K PIC -o _bb.o libgcc2.s
GNU assembler version 2.9.5 (ppc-redhat-linux) using BFD version 2.9.5.0.14
libgcc2.s: Assembler messages:
libgcc2.s:1760: Error: Symbol .LCL0 already defined.


Looking at the .s I see:
        .section        ".text"
        .align 2
.stabs "__bb_exit_func:F(0,19)",36,0,1590,__bb_exit_func
        .globl __bb_exit_func
.LCL0:
        .long .LCTOC1-.LCF0
        .type    __bb_exit_func,@function
__bb_exit_func:
        stwu 1,-320(1)
        mflr 0
        stw 30,312(1)
        stw 31,316(1)
        stw 0,324(1)
        mr 31,1
        bl .LCF0
.LCF0:
        mflr 30
        lwz 0,.LCL0-.LCF0(30)


and later:
        .section        ".text"
        .align 2
.stabs "__bb_init_func:F(0,19)",36,0,1812,__bb_init_func
.stabs "blocks:p(0,38)",160,0,1811,8
        .globl __bb_init_func
.LCL0:
        .long .LCTOC1-.LCF0
        .type    __bb_init_func,@function
__bb_init_func:
        stwu 1,-32(1)
        mflr 0
        stw 30,24(1)
        stw 31,28(1)
        stw 0,36(1)
        mr 31,1
        bl .LCF1
.LCF1:
        mflr 30
        lwz 0,.LCL1-.LCF1(30)

So it seems the labelno is incremented too late?

Franz.

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