This is the mail archive of the
mailing list for the binutils project.
Re: HELP with linker script!!!
- From: Nick Clifton <nickc at redhat dot com>
- To: Vincent Rubiolo <vincent dot rubiolo at windriver dot com>
- Cc: Pieter Arnout <pieter at powerescape dot com>, grigory dot zagorodnev at intel dot com, binutils at sources dot redhat dot com
- Date: Fri, 01 Apr 2005 15:02:07 +0100
- Subject: Re: HELP with linker script!!!
- References: <firstname.lastname@example.org> <424BE5A7.email@example.com> <firstname.lastname@example.org> <424D2F42.email@example.com> <424D4412.firstname.lastname@example.org>
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
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:
The hash stops GAS from interpreting the
which gcc has appended to the name of the section...