From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21020 invoked by alias); 1 Apr 2005 14:05:11 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 20907 invoked from network); 1 Apr 2005 14:05:04 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 1 Apr 2005 14:05:04 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j31E54Dn002736 for ; Fri, 1 Apr 2005 09:05:04 -0500 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j31E4wO09764; Fri, 1 Apr 2005 09:04:58 -0500 Received: from [172.31.0.98] (vpnuser2.surrey.redhat.com [172.16.9.2]) by pobox.surrey.redhat.com (8.12.8/8.12.8) with ESMTP id j31E4spH028372; Fri, 1 Apr 2005 15:04:55 +0100 Message-ID: <424D545F.70203@redhat.com> Date: Fri, 01 Apr 2005 14:05:00 -0000 From: Nick Clifton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) MIME-Version: 1.0 To: Vincent Rubiolo CC: Pieter Arnout , grigory.zagorodnev@intel.com, binutils@sources.redhat.com Subject: Re: HELP with linker script!!! References: <13ab0c503312082c7af572c83f523f4f@powerescape.com> <424BE5A7.5060902@redhat.com> <29c1ff0410ff9cc2b88a3ad82d1938aa@powerescape.com> <424D2F42.5070508@redhat.com> <424D4412.4020700@windriver.com> In-Reply-To: <424D4412.4020700@windriver.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-04/txt/msg00029.txt.bz2 Hi Vincent, > Thanks for this informative reply. There is something I am wondering > about using the gcc attributes to put variables or functions : how to > control the section flags of these new sections? One way is by pre-declaring the section's name and attributes before using it. Like this: asm (".section .cached_bss, \"w\",@nobits"); int foo __attribute__((section (".cached_bss"))); The problem with this approach is that (with GCC 4.1 at least) you will get warning messages from the assembler: Warning: ignoring changed section type for .cached_bss Warning: ignoring changed section attributes for .cached_bss This is because GCC does not know that the asm() statement has already defined the .cached_bss section and so it issues its own .section directive. If you can live with the assembler warning that this method will work. The other way is hackier, but it avoids the warnings: int foo __attribute__((section (".cached_bss,\"w\",@nobits#"))); This assumes that the hash character (#) is the start-of-line-comment character for the particular instruction set you are using. If you have a look at the assembler emitted by GCC you can see why: .section .cached_bss,"w",@nobits#,"aw",@progbits The hash stops GAS from interpreting the ,"aw",@probits which gcc has appended to the name of the section... Cheers Nick