[PATCH 3/5] [PowerPC] Relocate stinfo->main
Alan Modra
amodra@gmail.com
Mon Jan 24 06:51:30 GMT 2022
On Sun, Jan 23, 2022 at 08:48:44PM -0800, H.J. Lu wrote:
> On Sun, Jan 23, 2022 at 7:51 PM Alan Modra via Libc-alpha
> > + void *main = stinfo->main;
> > +#if ENABLE_STATIC_PIE && !defined SHARED
> > + struct link_map *map = _dl_get_dl_main_map ();
> > + if (!map->l_relocated)
> > + main = (char *) main + elf_machine_load_address ();
> > +#endif
>
> Can you use __ehdr_start t here, similar to
>
> https://gitlab.com/x86-glibc/glibc/-/commit/1df93c500d0f81d30d1b7e323153512a8768bb72#ffb950808032d5085fdf882753d7bf8889e6a3d7
That idea hadn't occurred to me. Yes, that likely would have worked
too. I used the old traditional way of calculating l_addr, which
happens to be quite cheap on powerpc64, but admittedly not so good on
powerpc32.
--
Alan Modra
Australia Development Lab, IBM
More information about the Libc-alpha
mailing list