[PATCH] ld: Estimate output section layout before sizing dynamic sections
Alan Modra
amodra@gmail.com
Mon Feb 3 00:05:51 GMT 2025
More information about the Binutils mailing list
Mon Feb 3 00:05:51 GMT 2025
- Previous message (by thread): [PATCH] ld: Estimate output section layout before sizing dynamic sections
- Next message (by thread): [PATCH] ld: Estimate output section layout before sizing dynamic sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Feb 03, 2025 at 07:34:01AM +0800, H.J. Lu wrote: > On Mon, Feb 3, 2025 at 6:29 AM Alan Modra <amodra@gmail.com> wrote: > > > > On Sat, Feb 01, 2025 at 04:53:30PM +0800, H.J. Lu wrote: > > > When sizing dynamic sections, elf_x86_64_scan_relocs converts GOTPCREL > > > relocations to R_X86_64_PC32, R_X86_64_32S or R_X86_64_32 for local > > > symbols. But at that time, since the output section layout is unknown, > > > the local symbol values can't be determined. Later linker issues an > > > error if the converted relocation overflows when resolving relocations > > > against these local symbols. Update the linker so that an ELF target > > > can opt-in to estimate output section layout before sizing dynamic > > > sections. > > > > I think that is the wrong way to go. A single backend_data bit > > controlling prelim sizing is likely not flexible enough. It's far > > better I think to implement an x86 before_allocation override hook > > rather than trying to put the code in ldelf_before_allocation. > > This means that the x86_64 backend needs to duplicate the whole > function so that it can do prelim sizing just before sizing dynamic sections. > It can be easily out of sync when ldelf_before_allocation is changed. > Is there a way to avoid it? Why would you need to duplicate the whole function? Just call it. See emultemp/ppc64elf.em. > > > The linker created sections are excluded when estimating > > > output section layout as sizing dynamic sections may change linker > > > created sections. > > > > This logic also ought to go in the x86 backend to handle whatever > > peculiarities are necessary for x86 linker created sections. > > I will drop this change. > > > -- > > Alan Modra > > > > -- > H.J. -- Alan Modra
- Previous message (by thread): [PATCH] ld: Estimate output section layout before sizing dynamic sections
- Next message (by thread): [PATCH] ld: Estimate output section layout before sizing dynamic sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list