From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4901 invoked by alias); 23 Mar 2010 12:55:30 -0000 Received: (qmail 4889 invoked by uid 22791); 23 Mar 2010 12:55:29 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org Received: from mail-pz0-f201.google.com (HELO mail-pz0-f201.google.com) (209.85.222.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Mar 2010 12:55:25 +0000 Received: by pzk39 with SMTP id 39so2742634pzk.15 for ; Tue, 23 Mar 2010 05:55:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.87.4 with SMTP id p4mr223443wfl.272.1269348923649; Tue, 23 Mar 2010 05:55:23 -0700 (PDT) Date: Tue, 23 Mar 2010 17:56:00 -0000 Message-ID: <714984df1003230555l61261442ubdfdea009254a5b9@mail.gmail.com> Subject: About "STARTING_FRAME_OFFSET" definition From: redriver jiang To: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2010-03/txt/msg00354.txt.bz2 Hi all, Can this "STARTING_FRAME_OFFSET" macro be defined to be a non-constant value ( changes with the "current_function_args_size")? As the target process has "FP+offset" with postive "offset"( stack grows upward, and parameters in stack grows downward), for example, call foo( arg1, arg2, arg3,arg4), after foo's prologue, the stack is like this: <---- low address |--------------------------------| | Incoming arg4 | <-------------FP |--------------------------------| | Incoming arg3 | |--------------------------------| | Incoming arg2 | |--------------------------------| | Incoming arg1 | <---------------ARG |--------------------------------| | return PC of foo | |--------------------------------| | saved regs | |--------------------------------| | old FP | |--------------------------------| | local var0 | |--------------------------------| <---- high address "STARTING_FRAME_OFFSET" means the offset between FP and the first local variable, in this situation, STARTING_FRAME_OFFSE = current_function_args_size+ size(PC in stack) + size(saved regs) + size(old FP). so, "STARTING_FRAME_OFFSET" depends on the "current_function_args_size", which is a GCC internal variable. Is this stack layout suitable? Thanks! redriver