Bug 229708 - Don't require the program header for ELF files fit in the first page
Summary: Don't require the program header for ELF files fit in the first page
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2018-07-11 20:33 UTC by Alex Arslan
Modified: 2019-05-18 07:33 UTC (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Alex Arslan 2018-07-11 20:33:48 UTC
According to a comment in libexec/rtld-elf/map_object.c,

"We rely on the program header being in the first page. This is not strictly required by the ABI specification, but it seems to always true in practice. And, it simplifies things considerably."

This assumption is quickly violated when using tools such as patchelf, which often relocates the program header to the end of the ELF header, causing it to no longer fit within the first page. While perhaps not the most ideal behavior, it doesn't appear to violate any ABI specifications.

The build system for the Julia language (https://julialang.org), which supports FreeBSD, and our new dependency cross-compilation system (https://github.com/JuliaPackaging/BinaryBuilder.jl), which supports building for FreeBSD, make heavy use of patchelf for setting RPATHs. That has caused a number of issues for us on FreeBSD though, because we run into FreeBSD's incomplete implementation of the ABI specification, making shared libraries unloadable.