Do not pass --build-id to linker from gcc Do not pass --build-id to linker from gcc c c

Do not pass --build-id to linker from gcc


I think these options will do what you want:

-Wl,--build-id=none

Passing none for style disables the setting from any --build-id options earlier on the command line.

ld manual


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!