[PATCH] D74393: [llvm-readobj] Add support for decoding FreeBSD ELF notes

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 03:25:37 PST 2020


arichardson created this revision.
arichardson added reviewers: rupprecht, jhenderson, MaskRay, bsdjhb, emaste.
Herald added subscribers: llvm-commits, s.egerton, simoncook, krytarowski.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
arichardson added a parent revision: D74367: [llvm-readelf] Print raw ELF note contents if we can't parse it.

The current support only printed coredump notes, but most binaries also
contain notes.

This change adds names for four FreeBSD-specific notes and pretty-prints
two of them:

- NT_FREEBSD_ABI_TAG: This note holds a 32-bit (decimal) integer containing the value of the __FreeBSD_version macro, which is defined in crt1.o and will hold a value such as 1300076 for a binary build on a FreeBSD 13 system.
- NT_FREEBSD_FEATURE_CTL: A 32-bit flag that indicates to the kernel that the binary wants certain bevahiour. Examples include setting NT_FREEBSD_FCTL_ASLR_DISABLE which tells the kernel to disable ASLR.

After this change llvm-readobj also no longer decodes coredump-only FreeBSD
notes in non-coredump files.

Depends on https://reviews.llvm.org/D74367


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74393

Files:
  llvm/include/llvm/BinaryFormat/ELF.h
  llvm/test/tools/llvm-readobj/ELF/note-freebsd-core.test
  llvm/test/tools/llvm-readobj/ELF/note-freebsd.s
  llvm/test/tools/llvm-readobj/ELF/note-freebsd.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74393.243787.patch
Type: text/x-patch
Size: 18801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200211/21c7d3fe/attachment.bin>


More information about the llvm-commits mailing list