From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8745 invoked by alias); 10 Jul 2009 22:20:52 -0000 Received: (qmail 8737 invoked by uid 22791); 10 Jul 2009 22:20:51 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-yx0-f189.google.com (HELO mail-yx0-f189.google.com) (209.85.210.189) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 10 Jul 2009 22:20:45 +0000 Received: by yxe27 with SMTP id 27so2563137yxe.0 for ; Fri, 10 Jul 2009 15:20:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.150.20 with SMTP id c20mr4053863ybo.223.1247264443576; Fri, 10 Jul 2009 15:20:43 -0700 (PDT) In-Reply-To: References: Date: Fri, 10 Jul 2009 22:20:00 -0000 Message-ID: Subject: Fwd: CONSTANT_POOL_BEFORE_FUNCTION has no effect in tm.h? From: Trevor Scroggins To: Ian Lance Taylor Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2009-07/txt/msg00190.txt.bz2 Rather, a safe ref distance. Apologies for the duplicate message. Trev ---------- Forwarded message ---------- From: Trevor Scroggins Date: Fri, Jul 10, 2009 at 3:19 PM Subject: Re: CONSTANT_POOL_BEFORE_FUNCTION has no effect in tm.h? To: Ian Lance Taylor Cc: gcc@gcc.gnu.org While I still think the choice is arbitrary (why the front and not the back--and mine's a lay opinion, I know), what's the generally accepted method for reorganizing string literals and other constants to appear after the function asm rather than before it? Some targets appear to do something similar in TARGET_MACHINE_DEPENDENT_REORG to relocate read-only data to a safe jump distance. Where should I begin looking in source/documentation to gain an understanding of the process? Also, I don't really grok your example, which probably belies a lack of deep understanding of C or GCC or both. In every case I tried, 'const int ai[] =3D { 1 };' (and volatile ...) was translated to an immediate value of 1. Trev On Mon, Jul 6, 2009 at 11:45 AM, Ian Lance Taylor wrote: > Trevor Scroggins writes: > >> No, that won't work. The assembler only recognizes .text, .data, and >> .bss and doesn't support .section. Surely there's a simple hook that >> instructs that compiler to print locals after a function instead of >> before it? > > No. =A0Why should there be? =A0Even if you fix the case of string constan= ts, > you will run into trouble as soon as somebody writes > =A0 =A0const int ai[] =3D { 1 }; > > Most systems require some sort of startup code to run before main, > anyhow. =A0If you have no such requirement, then I recommend simply being > disciplined in how you write the "main" function, or paying the cost of > two or four initial bytes to branch to the main function from the start > of the .text section. > > Ian