Do not pass --build-id to linker from gcc
This is an old post, but it's worth stating for posterity that you don't have to discard the build ID. Your alternative is to move it to another area of flash by editing your linker script.
Simply move the build ID to somewhere after your vector table in your text section:
.text : { . = ALIGN(4); _stext = .; KEEP(*(.vectors .vectors.*)) KEEP(*(.note.gnu.build-id)) *(.text .text.*) *(.rodata .rodata*) . = ALIGN(4); _etext = .; } > rom
This will keep your vector table at address 0x0 (your MCU likely requires this), but will also allow you to read the build ID from code, which could come in handy!