AVR: when outputting generated assembly, it's not human readable

Relevant sections of my Makefile:

PLATFORMIO_BUILD_FLAGS=-DMCP2515_NO_CONTEXT -DMCP2515_CLOCK_XTAL_FREQ_MHZ=16 -save-temps -fverbose-asm

build: install-git-hooks PLATFORMIO_BUILD_FLAGS="$(PLATFORMIO_BUILD_FLAGS)" pio run --verbose

But the generated assembly file looks like this, which is not human readable:

	.section	.gnu.lto_readReg.175d2950bbd02957,"",@progbits
	.string	"x\234uRMk\023Q\024}g\356$\2314I\213\013\265h\026\335\224\322\215\351X\n\375\001\376\017\301\240\256\004\251\270\3163\021MP\244X\033\3330\213\250\330\b\021bQ[\343G\035c\353\007J(.TTlU\024[\322\"\022,\001\233x\337K\240U\352\300\314\2747\367\234{\316=\363\274B\210"
	.ascii	"\t\321\311\357\335|\203\004\214\341\262\020',\003P\013iA\304"
	.ascii	"\f\304p\226.\020FF\207\027\332{sR\306\245{\361\327\316k\311y"
	.ascii	"I\016\363\323\314\353\017\243/\254z\334D/CW\352\227&\203\264"
	.ascii	"\r\202\327\361\304\353\202\331sU\323^\356\223A\246\340\026h\203"
	.ascii	"\245z\3406"
	.string	"z\024\270\364\363F.x\206\333\002Jr\365\344\327\305\200\332\032\350\344m\276\272\376\302\244\355\272\355\365\245Z\016\335W\244+\245\373ma\327')\307\244\351\020\341N\263\3674\302\230\202\362$\024\374\363d}4\3445QD\2672\314\212w\341\025\340\267\372Tx\345qe\275qZ\272\037\367\227\253\263;\002\254\317\216\374\332\233H\362\203\343\220\256H\221\241V\tW,#^\375\376;\357Sm\270\375\345\362\033'dG\034\322\n\210h]\334\203\275y&\023\204\373l\211\271\031\377\326\304\276&\361\001\354\f\221\026\261Z\300\271\306\232\333\321L\306\340m\352\313\310\271\266\r\336LsR<\324\212\205J\261\026j*\n\270\\\252 \221]+x\364\314\\/\026+\357}\261ui9\344I\223\n\341\021b<\253\227\201\247\262\265\310\0268_\232G\027(1\216\013o\177Lg\003\\\340+\273\f\207,mB'\372\030\261\177"
	.string	"\023\306_\200Y\rH9\343y\237\262\310\307\016s\b;\344\327.\033\377s\251\016\311\223\226K\316ef)\271\242\303\317\220\177s:m:\235\211w\251\371\016\273\240\344\273\224\204\022\177\332\212\350\031lnP\372"
	.ascii	"\305V\025\306\217/\272\347=\203S2\311\2630\3749\006\305*\342"
	.ascii	"]\255\376B\237\001\250?\317\031\264\037\033\212F\216D\217\356"
	.ascii	"\035\260\007\366D\005\r\035<L\007\216\037\372\003\336f\3768"

platformio.ini

[platformio]
default_envs = attiny406

[env]
build_src_filter = +<*> -<hal_*> -<can_ref_code/*>

[env:attiny406]
platform = atmelmegaavr
build_unflags = -w
build_flags = -Werror -Wall
board = ATtiny406
build_src_filter = ${env.build_src_filter} +<hal_attiny406.c>
UPLOAD_PORT=/dev/ttyUSB0
upload_flags =
    --tool
    uart
    --device
    attiny406
    --uart
    $UPLOAD_PORT
    --clk
    $UPLOAD_SPEED

Then turn off LTO or use avr-objdump -d to generate the disassembly listing. PlatformIO’s builder script enables LTO by default

so the first try would be to add -flto to build_unflags.

@maxgerhardt

I found this independently by compiling by hand and adding the PIO build flags one-by-one.

Unfortunately, adding -flto to build_unflags results in:

avr-gcc -o .pio/build/attiny406/firmware.elf -mmcu=attiny406 -Os -Wl,--gc-sections -Wl,--section-start=.text=0x0 -fuse-linker-plugin .pio/build/attiny406/src/hal_attiny406.o .pio/build/attiny406/src/main.o .pio/build/attiny406/src/mcp2515.o .pio/build/attiny406/src/mcp2515_hal.o -L.pio/build/attiny406 -Wl,--start-group -lm -Wl,--end-group
/home/epoulsen/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/7.3.0/../../../../avr/lib/avrxmega3/short-calls/crtattiny406.o:../../../../../crt1/gcrt1.S:311:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol 'exit' defined in .fini9 section in /home/epoulsen/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/7.3.0/avrxmega3/short-calls/libgcc.a(_exit.o)

Okay, so doing build_type = debug seems to achieve what I want …