链接的 ELF 文件不包含任何符号
linked ELF file contains no symbols
我将 AVR C 源代码编译为目标文件。这些对象包含调试符号:
~ 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
...
将所有文件链接到一个文件时,尽管我指定了 -g 选项,但这些符号似乎丢失了:
~ /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
怎么会这样?链接器不应该在链接文件中创建一个带有调试信息的新符号 table 吗?
avr-gcc: gcc version 4.9.3 (GCC)
avr-ld: GNU ld (GNU Binutils) 2.25
-Wl,-search_paths_first
标志由 CLion 添加。然而,它不是有效的 avr-gcc 标志,而是典型的 OS X 标志。编译器试图找到第一个现有匹配项 -Wl,-s
。 IE。剥离符号。
我将 AVR C 源代码编译为目标文件。这些对象包含调试符号:
~ 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
...
将所有文件链接到一个文件时,尽管我指定了 -g 选项,但这些符号似乎丢失了:
~ /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
怎么会这样?链接器不应该在链接文件中创建一个带有调试信息的新符号 table 吗?
avr-gcc: gcc version 4.9.3 (GCC)
avr-ld: GNU ld (GNU Binutils) 2.25
-Wl,-search_paths_first
标志由 CLion 添加。然而,它不是有效的 avr-gcc 标志,而是典型的 OS X 标志。编译器试图找到第一个现有匹配项 -Wl,-s
。 IE。剥离符号。