mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
895c542076
Since https://github.com/tinygo-org/tinygo/pull/3200, `-no-debug` would ignore debug info for some linkers. Example: $ tinygo build -o test.elf -target=arduino -no-debug examples/blinky1 $ objdump -h test.elf test.elf: file format elf32-avr Sections: Idx Name Size VMA LMA Type 0 00000000 00000000 00000000 1 .text 000004e0 00000000 00000000 TEXT 2 .trampolines 00000000 000004e0 000004e0 TEXT 3 .stack 00000200 00800100 00800100 BSS 4 .data 0000004c 00800300 000004e0 DATA 5 .bss 000000a9 0080034c 0000052c BSS 6 .debug_loc 00001bf0 00000000 00000000 DEBUG 7 .debug_abbrev 000004ed 00000000 00000000 DEBUG 8 .debug_info 00004176 00000000 00000000 DEBUG 9 .debug_ranges 00000150 00000000 00000000 DEBUG 10 .debug_str 0000206e 00000000 00000000 DEBUG 11 .debug_pubnames 000024bf 00000000 00000000 DEBUG 12 .debug_pubtypes 000004ca 00000000 00000000 DEBUG 13 .debug_line 0000193c 00000000 00000000 DEBUG 14 .debug_aranges 0000002c 00000000 00000000 DEBUG 15 .debug_rnglists 00000015 00000000 00000000 DEBUG 16 .debug_line_str 00000082 00000000 00000000 DEBUG 17 .shstrtab 000000d9 00000000 00000000 18 .symtab 000006d0 00000000 00000000 19 .strtab 00000607 00000000 00000000 This shows that even though `-no-debug` is supplied, debug information is emitted in the ELF file. With this change, debug information is not stripped when TinyGo doesn't know how to do it: $ tinygo build -o test.elf -target=arduino -no-debug examples/blinky1 error: cannot remove debug information: unknown linker: avr-gcc (This issue will eventually be fixed by moving to `ld.lld`).