From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19422 invoked by alias); 10 Apr 2008 21:46:56 -0000 Received: (qmail 19414 invoked by uid 22791); 10 Apr 2008 21:46:55 -0000 X-Spam-Check-By: sourceware.org Received: from dessent.net (HELO dessent.net) (69.60.119.225) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Apr 2008 21:46:38 +0000 Received: from localhost ([127.0.0.1] helo=dessent.net) by dessent.net with esmtp (Exim 4.50) id 1Jk4bH-0002VR-VX; Thu, 10 Apr 2008 21:46:32 +0000 Message-ID: <47FE8AB6.979D0821@dessent.net> Date: Fri, 11 Apr 2008 11:57:00 -0000 From: Brian Dessent Reply-To: gcc-help@gcc.gnu.org X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) MIME-Version: 1.0 To: John Fine CC: VM , gcc-help@gcc.gnu.org Subject: Re: how to pass params to inline functions by reference or value? References: <1207801566.12695.8.camel@vm-laptop> <47FE27E0.1020205@verizon.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg00163.txt.bz2 John Fine wrote: > All that assumes the compiler really does take your suggestion of > "inline". As someone else already mentioned, "inline" is just a > suggestion. If the code weren't inlined then the optimizer could not > avoid the copy operation. That is what "static inline" or "__attribute__((always_inline))" is for. Tony Wetmore wrote: > I have used the following command-line in the past to generate assembly > alisting files (with integrated source): > > gcc -c -g -O3 -Wa,-adhls=func.list func.c > > As part of the assembly process, the "func.list" file is generated, > containing the source and assembly, like so: That is one way, you can also use objdump: objdump -drwS func.o This of course requires that func.o was compiled with debug info (-g), otherwise there's no source line information. Note that when looking at the disassembly output of an unlinked object it's easy to get confused if you don't pay attention to relocs, as e.g. jump targets and function calls are all encoded as zero in the opcode, as the linker has not run yet. But the actual symbolic location is encoded in the reloc, and with -r objdump should make this clear enough. Brian