On Mon, 5 May 2008, Alexander Sack wrote:

For my own edification, unless you specifically mark a function
inline, will gcc really optimize them out?  That seems a little
overboard unless there is some compiler option that says its okay to
do that.  I guess that would be very easy to test if you do as you
say, just sock away the function address pointer somewhere and you
should be okay...

This is a regression in gcc-4.  The -O option says it.  -O implies
-funit-at-a-time, which allows inlining of functions irrespective of
their order within a file and implies -finline-functions-called-once.
Thus even plain -O removes most static functions that are only called
once.

This doesn't seem to be the problem with the bce functions, since some
of the missing ones are called more than once.

-O2 seems to remove even more functions, but I'm not sure of the details.

It is a regression in FreeBSD-5(?) to use -O2 by default for kernels.
This used to give mainly bloat, but it now breaks debugging (including
stack traces) and profiling unless full debugging symbols are available
and used.  Only gdb uses full debugging symbols AFAIK, and at least for
old versions of gdb on objects generated with -g -O2, it doesn't handle
even explicit inline functions quite right (both explicit and inline
functions get replaced by non-call instructions instructions and by
symbols to say where the function call was, and debuggers have a hard
time making this look like a function call so that stepping over the
function call works, especially when -O2 reorders everything).

[Context lost to top posting.]

Bruce
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to