‘C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o’vTaskSwitchContext' referenced in section
.text.PendSVHandler.4125′ of C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o: defined in discarded section.text' of ./FreeRTOS_Source/source/tasks.o (symbol from plugin)
pxCurrentTCB’ referenced in section.text.PendSV_Handler.4125' of C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o: defined in discarded section
.text’ of ./FreeRTOSSource/source/tasks.o (symbol from plugin)pxCurrentTCB' referenced in section
.text.SVCHandler.4140′ of C:UsersmrichmonAppDataLocalTempccq0f0ed.ltrans0.ltrans.o: defined in discarded section `.text’ of ./FreeRTOSSource/source/tasks.o (symbol from plugin) collect2.exe: error: ld returned 1 exit status
I tracked down the two resources being unceremoniously “discarded” during the the linking process: vTaskSwitchContext() pxCurrentTCBG I fixed the problem by adding the attribute “used” to both resources (yes, I modified source code —icky right?). Defined in FreeRTOSConfig.h with a big juicy note:
#define KEEP_ME __attribute__((used))
Modified in tasks.c
void KEEP_ME vTaskSwitchContext( void )
{ . . . }
PRIVILEGED_DATA TCB_t * volatile pxCurrentTCB KEEP_ME = NULL;
So maybe -flto is the problem — but maybe I’ll want to use it for my app. Are my only two options to avoid -flto or use the “used” attribute? Does either choice represent a good practice?
Thanks!!
mjr