[PATCH v2] elf: Set p_align to the minimum page size if possible
Alan Modra
amodra@gmail.com
Sat Dec 25 03:58:41 GMT 2021
More information about the Binutils mailing list
Sat Dec 25 03:58:41 GMT 2021
- Previous message (by thread): [PATCH v2] elf: Set p_align to the minimum page size if possible
- Next message (by thread): PR28691, validate dwarf attribute form
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Dec 24, 2021 at 07:08:57PM -0800, H.J. Lu wrote: > On Fri, Dec 24, 2021 at 7:04 PM Alan Modra <amodra@gmail.com> wrote: > > > > On Fri, Dec 24, 2021 at 06:50:30PM -0800, H.J. Lu wrote: > > > On Fri, Dec 24, 2021 at 5:03 PM Alan Modra <amodra@gmail.com> wrote: > > > > I don't see a way to change DT_LOAD p_align that is backwards > > > > compatible, except perhaps using a p_align of zero if the required > > > > segment alignment (as calculated from section alignment) is less than > > > > maxpagesize. That horrible hack just happens to work for older glibc, > > > > but may break other loaders. > > > > > > Neither 0 nor 1 work for older glibc: > > > > > > if (__glibc_unlikely ((ph->p_align & (GLRO(dl_pagesize) - 1)) != 0)) > > > { > > > errstring = N_("ELF load command alignment not page-aligned"); > > > goto lose; > > > } > > > if (__glibc_unlikely (((ph->p_vaddr - ph->p_offset) > > > & (ph->p_align - 1)) != 0)) > > > { > > > errstring > > > = N_("ELF load command address/offset not properly aligned"); > > > goto lose; > > > } > > > > Zero in p_align triggers neither of these conditions. Binaries with > > zero p_align run. I checked. > > > > I tried setting p_align to 0 and got > > ELF load command address/offset not properly aligned Yeah, silly me. The binary I happened to test had p_offset equal to p_vaddr. So zero doesn't work. -- Alan Modra Australia Development Lab, IBM
- Previous message (by thread): [PATCH v2] elf: Set p_align to the minimum page size if possible
- Next message (by thread): PR28691, validate dwarf attribute form
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list