On Sun, Jun 15, 2008 at 01:49:43PM +0000, Valeriy E. Ushakov wrote: > Peter Bex <Peter.Bex%xs4all.nl@localhost> wrote: > > > Where is __builtin_return_address implemented? I tried grepping > > src/gnu but I couldn't find a definition place. > > src/gnu/dist/gcc4/gcc/builtins.c (expand_builtin_return_addr) Another point of interest: When I run a rebuilt nonoptimized modular-xorg-server (CFLAGS=-O0), the server crashes later in the process. The screen actually goes black for a second and I see it switching resolutions. It also prints "xf86OpenConsole", followed by "RADEON(0): RADEONPreInit" and then the familiar segfault handling line. Trying to run gdb on it results in nothing useful, as the machine becomes unusable while in gdb, probably because the segfault handler isn't invoked to reset the display to a usable state. When looking at the code, I also noticed some interesting code in src/gnu/dist/gcc4/gcc/config/rs6000/rs6000.c:13282 (rs6000_return_addr) When you look at the code in builtins.c, you see that eventually it will drop through to this function (the code that calls RETURN_ADDR_RTX). When the 'if' branch is not taken, the link register is simply read out directly. Perhaps optimizations are messing up the link register, and -O0 is preventing it from doing that. Cheers, Peter -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth
Attachment:
pgprSp54dLEZv.pgp
Description: PGP signature