About .note.gnu.build-id section

NIIBE Yutaka gniibe at fsij.org
Thu Jan 23 07:56:53 CET 2020


When GCC is built with --enable-linker-build-id, gcc generates the
.note.gnu.build-id section.

I think that having .note.gnu.build-id section for an image of embedded
system doesn't make much sense.  I believe that it is common practice
not-enabling this option for GCC for embedded.

If you have such a compiler for some reasons, for now, please put a line
in your gnuk/src/gnuk.ld.in:

	/DISCARD/ : { *(.note.gnu.build-id) }

(and/or gnuk/src/stdaln-sys.ld.in)

I'm not sure if having the line in gnuk/src/gnuk.ld.in of the source is
good or not.  I think that including the section to an image is not
good, because it's just a waste of space.  So, even having something for
.note.gnu.build-id, it should be /DISCARD/.

If we want to identify an image by such an ID, we should do it right.
Currently, the image for Gnuk consists of two parts: the first 4KB and
the rest.  By firmware update, only the latter is used.  In this
situation, perhaps, we need to generate an ID for the latter (not for
entire image).

FWIW, I leaned about the build ID by reading:


With this support, every binary has .note.gnu.build-id section and we
can connect a binary to its debug information.

In my Debian GNU/Linux system, I have /usr/lib/debug/.build-id/
directory to have debug information.

More information about the Gnuk-users mailing list