Skip to content

Add OpenBSD program headers to elfdump #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from

Conversation

csjayp
Copy link

@csjayp csjayp commented Jun 7, 2019

Add support to decode program headers for:

  • WXNEEDED
  • BOOTDATA
  • RANDOMIZE

emaste and others added 5 commits May 29, 2019 07:29
Due to missing relocation support in libdwarf for powerpc64, handling of
dwarf info on unlinked objects was bogus.

Examining raw dwarf data on objects compiled on ppc64 with a modern
compiler, one would find that the dwarf data appeared corrupt, with
repeated references to the compiler version where things like types and
function names should appear.

This happenend because the 0 offset of .debug_str contains the compiler
version, and without applying the relocations, *all* indirect strings in
.dwarf_info end up pointing to it.

However, examining the dwarf data on a compiled executable appeared
correct because during final link the relocations get applied and baked
in by the linker.

On FreeBSD this corruption then propogated to CTF data, as ctfconvert
relies on libdwarf to read the dwarf info, for every compiled object
(when building a kernel).

FreeBSD's older in-tree gcc tends to hide the issue, since it only rarely
generates relocations in .debug_info and uses DW_FORM_str instead of
DW_FORM_strp for everything.

Submitted by:	Brandon Bergren, via Justin Hibbits
Obtained from:	FreeBSD r348347
Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

Submitted by Bora Ozarslan <[email protected]>, with subsequent
refactoring by me.

Obtained from:	FreeBSD r343592, r343593, r343665, r345646
Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Add specific decoding for NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and
NT_FREEBSD_FEATURE_CTL.

Obtained from:	FreeBSD r343614, r343669
Add support to decode program headers for:
 - WXNEEDED
 - BOOTDATA
 - RANDOMIZE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants