[PATCH 2/2] ld.so: Hide _r_debug to support DT_DEBUG [BZ #28130]

H.J. Lu hjl.tools@gmail.com
Mon Aug 2 23:06:21 GMT 2021


On Mon, Aug 2, 2021 at 2:46 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Aug 2, 2021 at 2:20 PM Florian Weimer via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > * Andreas Schwab:
> >
> > > On Aug 01 2021, H.J. Lu via Libc-alpha wrote:
> > >
> > >> 1. Add a function, __r_debug_location, which returns the address of
> > >> _r_debug:
> > >>
> > >> /* Return the address of that structure used by the dynamic linker.  */
> > >> extern struct r_debug * __r_debug_location (void) __attribute_const__;
> > >>
> > >> It has a special glibc version, GLIBC_DEBUG.
> > >>
> > >> 2. Hide _r_debug in ld.so by defining _r_debug with __r_debug_location:
> > >>
> > >>  #define _r_debug (*__r_debug_location ())
> > >
> > > There is no need for that.  Nobody should be using _r_debug.
> >
> > It's declared in a public header.  GNAT and Spindle use it.  Maybe this
>
> It is wrong to use it to begin with.

We need to support usages of _r_debug for some applications.

extern struct r_debug * __r_debug_location (void) __attribute_const__;
#define _r_debug (*__r_debug_location ())

works here.

> > needs to be deprecated first before it can be removed.
>
> My v2 patch includes an alternative in libsupport.
>
> --
> H.J.



-- 
H.J.


More information about the Libc-alpha mailing list