Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22045

Link errors when using -flto and -g3 (arm-none-eabi)

$
0
0

I'm trying to compile some code for an Cortex M4 using LTO and -g3

$ arm-none-eabi-gcc --versionarm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
MCU = -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hardCFLAGS = $(MCU) -Os -g3 -flto -fdata-sections -ffunction-sectionsLDFLAGS = $(MCU) -flto -specs=nano.specs -Wl,--gc-sections

This produces:

...`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4._types.h.125.5cf8a495f1f7ef36777ad868a1e32068]' of /tmp/ccsUuxWo.debug.temp.o`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.stddef.h.155.3588ebfdd1e8c7ede80509bb9c3b8009]' of /tmp/ccsUuxWo.debug.temp.o`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4._types.h.184.03611d4f6b5bec9997bcf4279eceba07]' of /tmp/ccsUuxWo.debug.temp.o`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.reent.h.17.90c2574d4acdcfce933db5cb09ff35fe]' of /tmp/ccsUuxWo.debug.temp.o`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.cdefs.h.49.6260d97adb8d27534cbdc0f868b8ea87]' of /tmp/ccsUuxWo.debug.temp.o`.gnu.debuglto_.debug_macro' referenced in section `.gnu.debuglto_.debug_macro' of /tmp/ccsUuxWo.debug.temp.o: defined in discarded section `.gnu.debuglto_.debug_macro[wm4.math.h.13.cc998d7e0eff0587fd028fd98ed8bf4e]' of /tmp/ccsUuxWo.debug.temp.ocollect2: error: ld returned 1 exit status

If I compile with -flto and -g (NOT -g3) it works fine.If I compile without -flto and with -g3 it works fine.

The errors lead me to believe I need to keep a section in my linker script, so I tried both of:KEEP(*(.gnu.debuglto*))*(.gnu.debuglto_.debug_macro*) with no success


Viewing all articles
Browse latest Browse all 22045

Trending Articles