This is the mail archive of the 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]

PATCH: profiling broken when PROFDIR is used with solaris

	Profiling support is broken when the PROFDIR variable is set 
to a non-null string for solaris2.6 machines. It used to work with 

mururoa->g++ -v
Reading specs from /u/corse/2/robotvis/gnu/bin/egcs/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.93.02/specs
gcc version egcs-2.93.02 19990118 (gcc2 ss-980609 experimental)

A simple workaround is to undefine PROFDIR.

This simple program shows the bug.

mururoa->more pg.C 
main(int argc,char **argv)

mururoa->g++ -pg -g pg.C
mururoa->setenv PROFDIR "."

Segmentation fault

Gdb shows the problem to be at line 201 of the file gmon-sol2.c 
(_mcleanup), when accessing to the string ___Argv
which seems to have never been set.

	progname=strrchr(___Argv[0], '/');

Checking the assembly, it looks that sol2-c1.asm has been used 
instead of sol2-g1.asm. Indeed, gcrt1.o and crt1.o are identical
(which is not the case of sol2-c1.asm and sol2-g1.asm).

The build.log confirms this, since no conditionnal symbol GCRT1 can 
be found in sol2-c1.asm:

./xgcc -B./ -B/u/corse/2/robotvis/gnu/bin/egcs/sparc-sun-solaris2.6/bin/  -c -DGCRT1 -o gcrt1.o -x assembler-with-cpp ../../egcs/gcc/config/sparc/sol2-c1.asm

I guess that the change that created this situation is:

Wed Sep  9 01:32:01 1998  David S. Miller  <>

	Add preliminary native sparcv9 Solaris support.
	* Recognize sparv9-*-solaris2*
	* configure: rebuilt
	* config.sub: Recognize sparcv9 just like sparc64.
	* config/sparc/sol2-c1.asm config/sparc/sol2-ci.asm
	config/sparc/sol2-cn.asm: Macroize so it can be shared between
	32-bit and 64-bit Solaris systems.
	* config/sparc/t-sol2: Assemble those with cpp.
	* config/sparc/sparc.h (TARGET_CPU_sparcv9): New alias for v9.
	(*TF*_LIBCALL): If ARCH64 use V9 names.
	* config/sparc/{xm-sysv4-64,sol2-sld-64}.h: New	files.

The following trivial patch should take care of the problem (I guess 
that sol2-g1.asm can be removed). Notice also that the copyright 
date (1992) might also need to be updated. I'm not sure so I did 
nothing with this respect.


Tue Mar  2 16:31:52 1999 T. Papadopoulo (

	* config/sparc/sol2-c1.asm: integrate config/sparc/sol2-g1.asm.

Index: sol2-c1.asm
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/sparc/sol2-c1.asm,v
retrieving revision 1.3
diff -c -3 -p -r1.3 sol2-c1.asm
*** sol2-c1.asm 1998/12/16 21:13:21     1.3
--- sol2-c1.asm 1999/03/02 15:20:25
*************** _start:
*** 92,97 ****
--- 92,101 ----
        ! access those data anyway.  Instead, go straight to main:
        mov     %l0, %o0        ! argc
        mov     %l1, %o1        ! argv
+ #ifdef GCRT1
+       setn(___Argv, %o4, %o3)
+       st      %o1, [%o3]      ! *___Argv
+ #endif
        ! Skip argc words past argv, to env:
        sll     %l0, CPTRSHIFT, %o2
        add     %o2, CPTRSIZE, %o2

 Theodore Papadopoulo
 Email: Tel: (33) 04 92 38 76 01

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