basic block profiling bug on sparc

Dan Nicolaescu dann@adaptive.ics.uci.edu
Sat Jan 30 04:32:00 GMT 1999


Hi!

There is currently a bug when trying to use gcc -ax on
sparc-sun-solaris2.5.1

The problem is that in the object files calls are generated to
___bb_trace_ret (note the 3 underscores) and also to 
__bb_init_func (note only 2 underscores).

In libgcc.a all the __bb_* functions are defined with 2 underscores.

Looking in sparc.h both function calls look like are generated with 3
underscores, so I don't realy know what is the problem. 

This bug has been around for a while, since I could reproduce is with
gcc-2.8.0 

Please tell me if you need further details. 

Here is how to reproduce the bug:

adaptive:~> echo ' int main () {return 1;}' >bb-bug.c

adaptive:~> ~/build/egcs-1801/bin/gcc -g -ax -v bb-bug.c -o tst
Reading specs from /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/specs
gcc version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental)
 /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/cpp -lang-c -v -undef -D__GNUC__=2 -D__GNUC_MINOR__=93 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -g -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) bb-bug.c /var/tmp/ccYL3sce.i
GNU CPP version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/../../../../sparc-sun-solaris2.5.1/include
 /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/include
 /usr/include
End of search list.
 /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/cc1 /var/tmp/ccYL3sce.i -quiet -dumpbase bb-bug.c -ax -g -version -o /var/tmp/cc6bw31k.s
GNU C version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental) (sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental).
 /usr/ccs/bin/as -V -Qy -s -o /var/tmp/ccScDiSt.o /var/tmp/cc6bw31k.s
/usr/ccs/bin/as: WorkShop Compilers 4.2 dev 13 May 1996
 /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o tst /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/crt1.o /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/crti.o /usr/ccs/lib/values-Xa.o /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/crtbegin.o -L/home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03 -L/usr/ccs/bin -L/usr/ccs/lib -L/home/dann/build/egcs-1801/lib /var/tmp/ccScDiSt.o -lgcc -lc -lgcc /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/crtend.o /home/dann/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/crtn.o
ld: Software Generation Utilities - Solaris/ELF (3.0)
Undefined			first referenced
 symbol  			    in file
___bb_trace_ret                     /var/tmp/ccScDiSt.o
ld: fatal: Symbol referencing errors. No output written to tst
collect2: ld returned 1 exit status


adaptive:~> ~/build/egcs-1801/bin/gcc -g -ax -c bb-bug.c
adaptive:~> nm bb-bug.o


bb-bug.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[3]     |         0|       0|SECT |LOCL |0    |7      |
[4]     |         0|       0|SECT |LOCL |0    |4      |
[5]     |         0|       0|SECT |LOCL |0    |5      |
[6]     |         0|       0|SECT |LOCL |0    |3      |
[7]     |         0|       0|SECT |LOCL |0    |6      |
[8]     |         0|       0|SECT |LOCL |0    |2      |
[9]     |         0|       8|OBJT |LOCL |0    |5      |.LLPBX2
[2]     |        36|       0|NOTY |LOCL |0    |2      |LPY0
[12]    |         0|       0|NOTY |GLOB |0    |UNDEF  |___bb_trace_ret
[10]    |         0|       0|NOTY |GLOB |0    |UNDEF  |__bb_init_func
[1]     |         0|       0|FILE |LOCL |0    |ABS    |bb-bug.c
[11]    |         4|      92|FUNC |GLOB |0    |2      |main

adaptive:~> nm ~/build/egcs-1801/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.93.03/libgcc.a | grep bb

[81]    |         4|       8|OBJT |GLOB |0    |COMMON |__bbris2.5.1/egcs-2.93.0l
[76]    |       620|    1672|FUNC |GLOB |0    |2      |__bb_exit_funccs-2.93.03i
[2]     |      2392|    1500|FUNC |LOCL |0    |2      |__bb_exit_trace_func
[6]     |      5680|     308|FUNC |LOCL |0    |2      |__bb_init_file
[75]    |      2292|     100|FUNC |GLOB |0    |2      |__bb_init_funcgcs-2.93.0 
[3]     |      3892|     768|FUNC |LOCL |0    |2      |__bb_init_prg
[65]    |      6184|     468|FUNC |GLOB |0    |2      |__bb_init_trace_func
[82]    |      4660|     560|FUNC |GLOB |0    |2      |__bb_trace_func
[51]    |      5220|     460|FUNC |LOCL |0    |2      |__bb_trace_func_ret
[77]    |      5988|     196|FUNC |GLOB |0    |2      |__bb_trace_ret
[61]    |        20|       4|OBJT |LOCL |0    |4      |bb_callcount
[5]     |         4|       4|OBJT |LOCL |0    |4      |bb_dst
[58]    |        16|       4|OBJT |LOCL |0    |4      |bb_func_head
[18]    |        12|       4|OBJT |LOCL |0    |4      |bb_hashbuckets
[20]    |         0|       4|OBJT |LOCL |0    |5      |bb_head
[21]    |        24|       4|OBJT |LOCL |0    |4      |bb_mode
[4]     |         0|       4|OBJT |LOCL |0    |4      |bb_src
[52]    |        28|       4|OBJT |LOCL |0    |4      |bb_stack
[59]    |        32|       4|OBJT |LOCL |0    |4      |bb_stacksize
[60]    |         8|       4|OBJT |LOCL |0    |4      |bb_tracefile



More information about the Gcc-bugs mailing list