[PATCH] elf: Add -z [dt-debugsz|nodt-debugsz] to emit DT_DEBUGSZ

H.J. Lu hjl.tools@gmail.com
Sun Aug 15 13:11:02 GMT 2021


On Sun, Aug 15, 2021 at 5:50 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Sun, Aug 15, 2021 at 4:55 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >
> > * H. J. Lu via Gdb-patches:
> >
> > > Add -z [dt-debugsz|nodt-debugsz] to emit a DT_DEBUGSZ dynamic tag so
> > > that the dynamic linker can set its value to the size of the structure
> > > of debugger interface, whose address is stored in the DT_DEBUG dynamic
> > > tag, used by the dynamic linker.
> >
> > I do not think this is necessary.  We can increase the version number
> > in the existing DT_DEBUG structure.
>
> Some debuggers expect r_version == 1.

GDB has

         if (linux_read_memory (priv->r_debug + lmo->r_version_offset,
                                 (unsigned char *) &r_version,
                                 sizeof (r_version)) != 0
              || r_version != 1)
            {
              warning ("unexpected r_debug version %d", r_version);
            }
          else if (read_one_ptr (priv->r_debug + lmo->r_map_offset,
                                 &lm_addr, ptr_size) != 0)
            {
              warning ("unable to read r_map from 0x%lx",
                       (long) priv->r_debug + lmo->r_map_offset);
            }

-- 
H.J.


More information about the Binutils mailing list