[llvm-bugs] [Bug 30541] New: lld's page size handling is inconsistent with Binutils linkers
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 27 08:30:09 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=30541
Bug ID: 30541
Summary: lld's page size handling is inconsistent with Binutils
linkers
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: phosek at chromium.org
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
The linkers in Binutils use two different page sizes: the maximum page size,
overridable by '-z max-page-size' and the usual page size, overridable by '-z
common-page-size'. Each segment is aligned to the maximum page size. The
linkers try to save a page on disk by offsetting the start of the data segment
so that the last page of the text segment and the first page of the data
segment can be on the same page of the executable (obviously that page gets
mapped twice in memory, once executable, once writable). When trying to save
this page, they use the usual page size, not the maximum page size.
On x86-64, for gold, the default maximum and usual page size are both 0x10000.
That is, gold does not support huge pages by default. For the BFD ld, the
default maximum page size is 0x200000 and the default usual page size is
0x1000.
For lld, on x86-64 the default maximum page size is 0x200000 and the default
usual page size is 0x1000. However, lld currently uses the default usual page
size when laying out segments rather than maximum page size and it's not trying
to save page on disk. The maximum page is only exposed to linker script but
being used anywhere. This is inconsistent with Binutils linkers.
There are multiple possible solutions here. One solution would be to ignore the
usual page size for now and set the maximum page size to 0x10000 (this would be
overridable by '-z max-page-size'). Another solution would be to implement the
logic for saving page on disk by offsetting the start of data segment as ld and
gold. In either case, we should be using maximum page size rather than usual
page size for segment alignment to match the behavior of existing linkers.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160927/adaac9ee/attachment.html>
More information about the llvm-bugs
mailing list