Reputation: 3331
I compiled my AVR C source-code to object files. These objects contain debug symbols:
~ avr-nm code.c.o:
00000000 T ClockInit32MhzXtal
00000000 T CopyDataToSensors
00000000 T FindSensors
U I2CInitMaster
00000000 T PC_UsartInit
00000000 T ReadFromSensorSettings
00000000 T ResetAndAlignSampleClock
00000000 T SampleClockTimerInit
00000000 T SendDataToPC
...
When linking all files into a single file, these symbols seem to be lost although I specified the -g option:
~ /usr/local/bin/avr-gcc -O1 -lm -Wall -Wstrict-prototypes -Wl,--gc-sections -Wl,-g -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names -DF_CPU=32000000 -mmcu=atxmega128a1u file1.c.o file2.c.o -o program.elf
/usr/local/opt/avr-binutils/bin/avr-ld: warning: cannot find entry symbol arch_paths_first; defaulting to 0000000000000000
~ avr-nm program.elf
avr-nm: program.elf: no symbols
How can this be? Shouldn't the linker create a new symbol table with debug info in the linked file?
avr-gcc: gcc version 4.9.3 (GCC)
avr-ld: GNU ld (GNU Binutils) 2.25
Upvotes: 1
Views: 1450
Reputation: 3331
-Wl,-search_paths_first
flag was added by CLion. It is however no valid avr-gcc flag but a typical OS X flag. The compiler tried to find the first existing match which was -Wl,-s
. I.e. Strip symbols.
Upvotes: 2