This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Use MaxPageSize for aligning PT_LOAD
ClosedPublic

Authored by phosek on Sep 27 2016, 2:32 PM.

Details

Summary

This matches the behavior of Binutils linkers. We also change the default MaxPageSize on x86-64 to 0x1000 to preserve the current behavior, which is the same as the behavior implemented by gold.

https://llvm.org/bugs/show_bug.cgi?id=30541

Diff Detail

Repository
rL LLVM

Event Timeline

phosek updated this revision to Diff 72710.Sep 27 2016, 2:32 PM
phosek retitled this revision from to [ELF] Use MaxPageSize for aligning PT_LOAD.
phosek updated this object.
phosek added reviewers: ruiu, rafael.
phosek added a project: lld.
phosek added a subscriber: llvm-commits.

The question is whether it wouldn't also make more sense to rename MaxPageSize and PageSize to something more descriptive/less confusing, e.g. gold uses abi_pagesize (for MaxPageSize) and common_pagesize (for PageSize) which IMHO makes more sense.

rafael accepted this revision.Sep 27 2016, 3:12 PM
rafael edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 27 2016, 3:12 PM
This revision was automatically updated to reflect the committed changes.
emaste added a subscriber: emaste.Nov 2 2016, 2:17 PM

This change broke linking the FreeBSD kernel with lld, which relies on MAXPAGESIZE to set the kernel's phys addr. See https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=303442&view=markup#l9

emaste added a comment.Nov 2 2016, 3:34 PM

I'm not sure what's the best solution here; we could add -zmax-page-size to the FreeBSD kernel build, but I'm not sure we want to diverge from ld.bfd. For now I'm testing with a change to set x86 MaxPageSize back to 0x200000.

The FreeBSD kernel build breakage after this change is tracked in http://llvm.org/pr30891.

grimar added a subscriber: grimar.Nov 22 2016, 11:05 PM