HomeFreeBSD

rtld: set obj->textsize correctly

Description

rtld: set obj->textsize correctly

With lld-generated binaries the first PT_LOAD will usually be a read-only
segment unless you pass --no-rosegment. For those binaries the textsize is
determined by the next PT_LOAD. To allow both LLD and bfd 2.17 binaries to
be parsed correctly use the end of the last PT_LOAD that is marked as
executable instead.

I noticed that the value was wrong while adding some debug prints for some rtld
changes for CHERI binaries. obj->textsize only seems to be used by PPC so the
effect is untested. However, the value before was definitely wrong and the new
result matches the phdrs.

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17117

Details

Provenance
arichardsonAuthored on
Reviewer
kib
Differential Revision
D17117: rtld: set obj->textsize correctly
Parents
rS339875: Pass _BRANCH in the reldoc target to ensure the correct
Branches
Unknown
Tags
Unknown