Page MenuHomePhabricator

[llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers.

Authored by grimar on Oct 14 2016, 6:53 AM.

Diff Detail


Event Timeline

grimar updated this revision to Diff 74678.Oct 14 2016, 6:53 AM
grimar retitled this revision from to [llvm-readobj] - Teach readobj to print PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers..
grimar updated this object.
grimar added reviewers: rafael, davide, echristo.
grimar added subscribers: llvm-commits, grimar, evgeny777, ruiu.
emaste added a subscriber: emaste.Oct 14 2016, 11:03 AM

For reference I have now also added them to ELF Tool Chain's readelf in r3496.

1157–1160 ↗(On Diff #74678)

The grouping seems a bit odd in this switch?

davide added inline comments.Oct 14 2016, 11:07 AM
9 ↗(On Diff #74678)

You should add a comment explaining how you're generating this code, so that if we need to regenerate in the future we don't have to randomly guess.

154 ↗(On Diff #74678)

Remove the (0x4), here and in other parts of the patch.

1157–1160 ↗(On Diff #74678)


grimar updated this revision to Diff 74820.Oct 17 2016, 2:07 AM
  • Addressed review comments.
9 ↗(On Diff #74678)


154 ↗(On Diff #74678)

Ok, though it is not consistent with other places in this file. I also removed all values checking, as
intention of testcase is to check string name of PHDR and nothing else.

1157–1160 ↗(On Diff #74678)

It is grouped (and sorted) at the same way as done in ELF.h:

PT_NULL    = 0, // Unused segment.
PT_LOAD    = 1, // Loadable segment.
PT_DYNAMIC = 2, // Dynamic linking information.
PT_INTERP  = 3, // Interpreter pathname.
PT_NOTE    = 4, // Auxiliary information.
PT_SHLIB   = 5, // Reserved.
PT_PHDR    = 6, // The program header table itself.
PT_TLS     = 7, // The thread-local storage template.
PT_LOOS    = 0x60000000, // Lowest operating system-specific pt entry type.
PT_HIOS    = 0x6fffffff, // Highest operating system-specific pt entry type.
PT_LOPROC  = 0x70000000, // Lowest processor-specific program hdr entry type.
PT_HIPROC  = 0x7fffffff, // Highest processor-specific program hdr entry type.

// x86-64 program header types.
// These all contain stack unwind tables.
PT_GNU_EH_FRAME  = 0x6474e550,
PT_SUNW_EH_FRAME = 0x6474e550,
PT_SUNW_UNWIND   = 0x6464e550,

PT_GNU_STACK = 0x6474e551, // Indicates stack executability.
PT_GNU_RELRO = 0x6474e552, // Read-only after relocation.

PT_OPENBSD_RANDOMIZE = 0x65a3dbe6, // Fill with random data.
PT_OPENBSD_WXNEEDED  = 0x65a3dbe7, // Program does W^X violations.
davide accepted this revision.Oct 17 2016, 7:46 PM
davide edited edge metadata.

LGTM modulo nit.

14 ↗(On Diff #74820)

test.s is an empty file.

154 ↗(On Diff #74678)


This revision is now accepted and ready to land.Oct 17 2016, 7:46 PM
This revision was automatically updated to reflect the committed changes.