Function section

Jim Wilson wilson@specifixinc.com
Thu Feb 5 09:26:00 GMT 2004


Petar Penchev wrote:
> I am trying to make GCC to generate asm code for interupt handlers in a 
> different asm section.
> I defined EXTRA_SECTIONS and EXTRA_SECTION_FUNCTIONS, but it did 
> nothing. Do I have to define some additional macros ?

Defining these functions allows the compiler to put code in different 
sections, but by itself it does nothing.  TARGET_ASM_SELECT_SECTION and 
TARGET_ASM_SELECT_RTX_SECTION can decide what section to put a decl or 
rtx in.  However, this does not solve the problem by itself either, as 
you need some way to tell these macros where to put code if you want it 
in a non-standard section.  There are I think two main approaches to 
this problem. You can add target dependent attributes (which can then 
also be used by the end-user), and/or you can encode section info in the 
symbol name.  See TARGET_ENCODE_SECTION_INFO.

See existing ports for ideas.  There are lots of examples of this.  See 
for instance the v850 port.

Actually, it looks like the trick of encoding info in the symbol name 
has fallen out of favor.  So the attribute choice seems like the right 
one nowadays.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list