Page 1 of 1

Force linking of application-specific components

Posted: Mon Feb 18, 2019 4:45 am
by apuder
Hi,

I have an application-specific component that is not referenced from anywhere else. Because of that the linker is not including the module. While this behavior is OK for the vast library of ESP-specific components, it causes issues for my app. Of course I can add an artificial dependency to that application-specific component but I wonder if there are any flags/parameters where I can tell the linker to always include my components.

Thanks,
AP

Re: Force linking of application-specific components

Posted: Tue Feb 19, 2019 5:46 am
by apuder
answering my own question: in component.mk, add:

Code: Select all

COMPONENT_ADD_LDFLAGS=-Wl,--whole-archive build/$(COMPONENT_NAME)/lib$(COMPONENT_NAME).a -Wl,--no-whole-archive