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

Werthmann Luca Luca.Werthmann@preh.de
Fri Aug 20 08:22:16 GMT 2021


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,













i.A.
Luca Werthmann
Trainee

Preh GmbH
Schweinfurter Straße 5-9| 97616Bad Neustadt a. d. Saale| Germany
Tel: +49 9771 92 3991
luca.werthmann@preh.de | www.preh.com

For legal and security reasons the information provided in this e-mail is not legally binding. Upon request we would be pleased to provide you with a legally binding confirmation in written form. Any form of unauthorised use, publication, reproduction, copying or disclosure of the content of this e-mail is not permitted. This message is exclusively for the person addressed or their representative. If you are not the intended recipient of this message and its contents, please notify the sender immediately. Preh GmbH; Vorsitzender des Aufsichtsrates: Jianfeng „Jeff“ Wang; Geschäftsführung: Zhengxin "Charlie" Cai (Vors.), Rui Marques Dias, Jochen Ehrenberg; Gesellschaft mit beschränkter Haftung mit Sitz in Bad Neustadt a. d. Saale; Registergericht Schweinfurt HRB 4491, UST-IdNr. DE 811147764

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pragma_section_group_iar.c
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20210820/1435cb9a/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pragma_section_group_gcc.c
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20210820/1435cb9a/attachment-0001.c>


More information about the Gcc-help mailing list