[PATCH] mips: fix elf/tst-dlmopen4
Xi Ruoyao
xry111@mengyan1223.wang
Fri Jan 28 21:23:42 GMT 2022
On Fri, 2022-01-28 at 15:49 -0500, Carlos O'Donell wrote:
> On 1/28/22 15:41, H.J. Lu wrote:
> > On Fri, Jan 28, 2022 at 11:04 AM Carlos O'Donell via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> > >
> > > On 1/28/22 13:54, Xi Ruoyao via Libc-alpha wrote:
> > > > MIPS uses DT_MIPS_RLD_MAP and DT_MIPS_RLD_MAP_REL instead of
> > > > DT_DEBUG,
> > > > to provide access to r_debug.
> > >
> > > This looks correct to me. OK for glibc 2.35.
> > >
> > > I'm going to push this today if there are no other objections.
> > >
> > > Reviewed-by: Carlos O'Donell <carlos@redhat.com>
> > >
> > > > ---
> > > > elf/tst-dlmopen4.c | 29 +++++++++++++++++++----------
> > > > 1 file changed, 19 insertions(+), 10 deletions(-)
> > > >
> > > > diff --git a/elf/tst-dlmopen4.c b/elf/tst-dlmopen4.c
> > > > index d8bcf7e9d5..de67a30a4b 100644
> > > > --- a/elf/tst-dlmopen4.c
> > > > +++ b/elf/tst-dlmopen4.c
> > > > @@ -25,17 +25,26 @@
> > > > #include <support/check.h>
> > > > #include <support/test-driver.h>
> > > >
> > > > -#ifndef ELF_MACHINE_GET_R_DEBUG
> > > > -# define ELF_MACHINE_GET_R_DEBUG(d) \
> > > > - (__extension__
> > > > ({ \
> > > > - struct r_debug_extended
> > > > *debug; \
> > > > - if ((d)->d_tag == DT_DEBUG) \
> > > > - debug = (struct r_debug_extended *) (d)->d_un.d_ptr; \
> > > > - else \
> > > > - debug = NULL; \
> > > > - debug; }))
> > > > +static struct r_debug_extended *
> > > > +elf_get_r_debug (ElfW(Dyn) *d)
> > > > +{
> > > > +#ifdef __mips__
> >
> > Shouldn't MIPS simply define a proper ELF_MACHINE_GET_R_DEBUG?
> > It can be done with a header file.
>
> The only use of ELF_MACHINE_GET_R_DEBUG is in the test, and the static
> function
> is easier to read, edit, and debug, all of which is better for a test?
I don't want to add a new header for a test. And among the existing
headers, it seems the alternative definition can only go in
sysdeps/mips/bits/link.h, which is a part of the public API.
(And I'm really not a fan of "macros" like "{...; retval;}" :).
--
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University
More information about the Libc-alpha
mailing list