I have a section setup in my linker script, and I want to place all code for a particular C++ class as well as all other classes that derive from it in that section. Is this possible?
I've tried this but got a warning:
class Test __attribute__ ((section ("ss"), aligned(0x40)));
class Test {
public:
void Foo(int a) {
printf("Hello\n");
}
};
Warning:
test.cpp:19:7: warning: attribute ignored in declaration of ‘class Test’ [-Wattributes]
class Test __attribute__ ((section ("ss"), aligned(0x40)));
You have to apply the section attribute to each individual method in the class unfortunately, e.g.:
class Test {
public:
__attribute__ ((section ("ss"), aligned(0x40))) void Foo(int a) {
printf("Hello\n");
}
};