]> git.ipfire.org Git - thirdparty/elfutils.git/commit
Handle GNU Build Attribute ELF Notes.
authorMark Wielaard <mark@klomp.org>
Mon, 12 Nov 2018 22:34:24 +0000 (23:34 +0100)
committerMark Wielaard <mark@klomp.org>
Tue, 13 Nov 2018 12:46:40 +0000 (13:46 +0100)
commit72e30c2e0cb49a9a300667fdd5ff09082f717950
treed8aa22a90873f98e00df21f33c0ae40c520f0de5
parent7a3f6fe60b8519b5372f5a5521ccbac59411f33f
Handle GNU Build Attribute ELF Notes.

GNU Build Attribute ELF Notes are generated by the GCC annobin plugin
and described at https://fedoraproject.org/wiki/Toolchain/Watermark

Unfortunately the constants aren't yet described in the standard glibc
elf.h so they have been added to the elfutils specific elf-knowledge.h.

The notes abuse the name owner field to encode some data not in the
description. This makes it a bit hard to parse. We have to match the
note owner name prefix (to "GA") to be sure the type is valid. We also
cannot rely on the owner name being a valid C string since the attribute
name and value can contain zero (terminators). So pass around namesz
to the ebl note parsing functions.

eu-elflint will recognize and eu-readelf -n will now show the notes:

Note section [27] '.gnu.build.attributes' of 56080 bytes at offset 0x114564:
  Owner          Data size  Type
  GA                    16  GNU Build Attribute OPEN
    Address Range: 0x2f30f - 0x2f30f
    VERSION: "3p8"
  GA                     0  GNU Build Attribute OPEN
    TOOL: "gcc 8.2.1 20180801"
  GA                     0  GNU Build Attribute OPEN
    "GOW": 45
  GA                     0  GNU Build Attribute OPEN
    STACK_PROT: 0
  GA                     0  GNU Build Attribute OPEN
    "stack_clash": TRUE
  GA                     0  GNU Build Attribute OPEN
    "cf_protection": 0
  GA                     0  GNU Build Attribute OPEN
    "GLIBCXX_ASSERTIONS": TRUE
  GA                     0  GNU Build Attribute OPEN
    "FORTIFY": 0
  GA                     0  GNU Build Attribute OPEN
    PIC: 3
  GA                     0  GNU Build Attribute OPEN
    SHORT_ENUM: FALSE
  GA                     0  GNU Build Attribute OPEN
    ABI: c001100000012
  GA                     0  GNU Build Attribute OPEN
    "stack_realign": FALSE

A new test was added to run-readelf -n for the existing annobin file.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libebl/ChangeLog
libebl/eblobjnote.c
libebl/eblobjnotetypename.c
libebl/libebl.h
libelf/ChangeLog
libelf/elf-knowledge.h
src/ChangeLog
src/elflint.c
src/readelf.c
tests/ChangeLog
tests/run-readelf-n.sh