Re: section placement - grouping __attribute__((section (“NAME”))) statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/08/2021 10:22, Werthmann Luca via Gcc-help wrote:
> Hello,
> 
> I am writing to ask if there is a chance with the GNU GCC Compiler to group __attribute__((section (“NAME”))) statements.
> 
> IAR Supports for example the following commands:
> 
> # pragma default_function_attributes = @ ".MY_FUNC"                 /* start placing following functions in section .MY_FUNC */
> # pragma default_function_attributes =                                              /* stop placing functions in section*/
> 
> # pragma default_variable_attributes = @ ".MY_DATA"                  /* start placing following variables in section .MY_DATA */
> # pragma default_variable_attributes =                                               /* stop placing functions in section*/
> 
> An example how to use these pragma directives is attached. <pragma_section_group_iar.c>
> 
> If I compile this *.c code I got some warnings that the GNU GCC does not support these statements.
> After some research I found that the corresponding statement for GNU GCC is __attribute__((section (“.MY_FUNC”)))
> I tried compiling it with these and it worked. <pragma_section_group_gcc.c>
> 
> I have more than 5k lines in my code and need to replace the IAR statements for the corresponding GCC Commands.
> Is there a chance to group these statements like IAR supports or do I need to add __attribute__((section (“NAME”))) in each line
> 
> I look forward to hearing from you soon.
> 
> Best regards,
> 
 To the best of my knowledge, there is no way to do this in gcc - you
have to put the section attribute on each function.  (You can use a
macro to reduce the typing!)

If you are versed in linker files, it is possible to have a modified
linker setup to put the code or data from a specific file into
non-standard output sections.

I too would like to see this as a feature in gcc - it is one of the few
features that are common to most embedded compilers but missing from gcc.

David



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux