Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 May 2008 17:28:04 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Alexander Sack <pisymbol@gmail.com>
Cc:        Kostik Belousov <kostikbel@gmail.com>, "freebsd-net@freebsd.org" <freebsd-net@FreeBSD.org>, David Christensen <davidch@broadcom.com>
Subject:   Re: Not All Symbols Present in a Loadable Kernel Module
Message-ID:  <20080506164634.G10595@delplex.bde.org>
In-Reply-To: <3c0b01820805051106k5faf368etec0851e65de109f8@mail.gmail.com>
References:  <5D267A3F22FD854F8F48B3D2B523819324F09D65FA@IRVEXCHCCR01.corp.ad.broadcom.com> <3c0b01820805021315i482fe0acg3e9238a2f412770e@mail.gmail.com> <5D267A3F22FD854F8F48B3D2B523819324F09D6896@IRVEXCHCCR01.corp.ad.broadcom.com> <3c0b01820805030750k2fc389b0y500914c36069e6cf@mail.gmail.com> <5D267A3F22FD854F8F48B3D2B523819324F09D6A52@IRVEXCHCCR01.corp.ad.broadcom.com> <20080505163249.GU18958@deviant.kiev.zoral.com.ua> <3c0b01820805051106k5faf368etec0851e65de109f8@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080506164634.G10595>