gcc/diab: keep unused function / sections

Viewed 1573

I have a project in which I would like to keep certain functions / sections in the linking phase.

I tried:

static void stub_enforcer(void) __attribute__ ((used))

But this is for the compiler, and not for the linker.

Now that the linker takes charge and -gc-sections is used, the function I wanted to keep is "gone" :(

Removing unused section '.text.func2' in file './src/func2.o'

How can I instruct the linker not to remove the functions I need.

The reason I want to do this is a post build usage of the function, by changing stuff on the binary.

1 Answers
Related