Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

V8.1.2 Link Error in Eclipse with ARM GNU GCC ...defined in discarded section ....symbol from plugin....

Posted by mrichmond68 on December 11, 2014

I am working from the V8.1.2 GCC/ARMCM3 port. I have successfully built myself a demo in Eclipse(Kepler), my arm gcc is 48_2014q3, my hardware is an STM32F103RE processor based board. I'm also using gnuarmeclipse plugins.

When first building, I received the following link error. I've fixed it, but I suspect something else is wrong and I'm just masking my real problem with my "fix". Just putting this out there to see what folks think.

Here is the link error (-flto is being used in the compile/link process):


'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:\Users\mrichmon\AppData\Local\Temp\ccq0f0ed.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


V8.1.2 Link Error in Eclipse with ARM GNU GCC ...defined in discarded section ....symbol from plugin....

Posted by rtel on December 11, 2014

I have only ever come across this problem once, and it was not on an ARM architecture, and not using GCC - but then I have never used -flto - so I guess that is the cause.

On the occasion I did have such a problem it was, if I recall correctly, because a symbol was only used in an assembly file.

Regards.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists