From owner-freebsd-net@FreeBSD.ORG Tue May 6 07:28:15 2008 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DFB8106567B for ; Tue, 6 May 2008 07:28:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail11.syd.optusnet.com.au (mail11.syd.optusnet.com.au [211.29.132.192]) by mx1.freebsd.org (Postfix) with ESMTP id DCB708FC2B for ; Tue, 6 May 2008 07:28:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c220-239-252-11.carlnfd3.nsw.optusnet.com.au (c220-239-252-11.carlnfd3.nsw.optusnet.com.au [220.239.252.11]) by mail11.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id m467S5ti005186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 6 May 2008 17:28:09 +1000 Date: Tue, 6 May 2008 17:28:04 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Alexander Sack In-Reply-To: <3c0b01820805051106k5faf368etec0851e65de109f8@mail.gmail.com> Message-ID: <20080506164634.G10595@delplex.bde.org> 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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , "freebsd-net@freebsd.org" , David Christensen Subject: Re: Not All Symbols Present in a Loadable Kernel Module X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 May 2008 07:28:15 -0000 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