[PATCH v3] elf: Set image base address to the maximum page size
H.J. Lu
hjl.tools@gmail.com
Sat Jun 20 00:58:50 GMT 2026
On Fri, Jun 19, 2026 at 9:01 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 28.05.2026 09:16, H.J. Lu wrote:
> > On Thu, May 28, 2026 at 11:08 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> >>
> >> When generating Position Dependent Executable for ELF with the maximum
> >> page size set on command-line, if text-segment address is lower than the
> >> maximum page size, set text-segment address to the maximum page size.
> >>
> >> PR ld/34184
> >> * ldexp.c (fold_binary): Set text-segment address to the maximum
> >> page size for ELF PDE output with -z max-page-size=SIZE.
> >> * testsuite/ld-elf/elf.exp: Add ld/34184 test.
> >> * testsuite/ld-elf/pr34184.c: New file.
> >
> > Here is the v2 patch to add tests for PIE, static PDE and static PIE.
>
> Why is this special to text-segment? Doesn't something like this need
> doing either for all segments, or for whatever is the first segment?
>
> Jan
-Ttext-segment ADDRESS Set address of text segment
is kind of misleading. --image-base is a better name:
‘--image-base=ORG’
When using ELF, same as ‘-Ttext-segment’, with both options
effectively setting the base address of the ELF executable.
When using PE, use VALUE as the base address of your program or
dll. This is the lowest memory location that will be used when
your program or dll is loaded. To reduce the need to relocate and
improve performance of your dlls, each should have a unique base
address and not overlap any other dlls. The default is 0x400000
for executables, and 0x10000000 for dlls.
Here is the v3 patch to use image base address instead of text-segment
address.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-elf-Set-image-base-address-to-the-maximum-page-si.patch
Type: text/x-patch
Size: 3510 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260620/05904eb1/attachment.bin>
More information about the Binutils
mailing list