We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everyone,
Can anyone help me how do I combine function attributes?
I need to use __attribute__(used) and __attribute__(section("xuz")) function attributes while defining a function.
Thanks in advance!
Any of the following three styles should work:
__attribute__((used)) __attribute__((section("xyz"))) int foo(void) { return 42; } __attribute__((used,section("abc"))) int bar(void) { return 43; } int toto(void) __attribute__((used,section("def"))); int toto(void) { return 44; }
Further details of the __attribute__ syntax are available here: https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html
Simon.
Thank you.