mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-21 07:45:27 -04:00
dwarf_elf_begin: Add .gnu_debugaltlink to the sectiondata array
And use it if DWZ mode is enabled. Signed-off-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
committed by
Mark Wielaard
parent
9380297e13
commit
efa72a02de
@@ -1,3 +1,11 @@
|
||||
2014-04-15 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* libdwP.h (enum IDX_gnu_debugaltlink): New.
|
||||
* dwarf_begin_elf.c (dwarf_scnnames): Increase string size and add
|
||||
.gnu_debugaltlink.
|
||||
(check_section): Obtain .gnu_debugaltlink section from the
|
||||
setiondata array.
|
||||
|
||||
2014-04-11 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* libdw.map (ELFUTILS_0.159): New. Add dwelf_elf_gnu_debuglink.
|
||||
|
||||
+15
-18
@@ -54,7 +54,7 @@
|
||||
|
||||
|
||||
/* Section names. */
|
||||
static const char dwarf_scnnames[IDX_last][17] =
|
||||
static const char dwarf_scnnames[IDX_last][18] =
|
||||
{
|
||||
[IDX_debug_info] = ".debug_info",
|
||||
[IDX_debug_types] = ".debug_types",
|
||||
@@ -67,7 +67,8 @@ static const char dwarf_scnnames[IDX_last][17] =
|
||||
[IDX_debug_str] = ".debug_str",
|
||||
[IDX_debug_macinfo] = ".debug_macinfo",
|
||||
[IDX_debug_macro] = ".debug_macro",
|
||||
[IDX_debug_ranges] = ".debug_ranges"
|
||||
[IDX_debug_ranges] = ".debug_ranges",
|
||||
[IDX_gnu_debugaltlink] = ".gnu_debugaltlink"
|
||||
};
|
||||
#define ndwarf_scnnames (sizeof (dwarf_scnnames) / sizeof (dwarf_scnnames[0]))
|
||||
|
||||
@@ -223,22 +224,6 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_DWZ
|
||||
/* For dwz multifile support, ignore if it looks wrong. */
|
||||
if (strcmp (scnname, ".gnu_debugaltlink") == 0)
|
||||
{
|
||||
Elf_Data *data = elf_getdata (scn, NULL);
|
||||
if (data != NULL && data->d_size != 0)
|
||||
{
|
||||
const char *alt_name = data->d_buf;
|
||||
const void *build_id = memchr (data->d_buf, '\0', data->d_size);
|
||||
const int id_len = data->d_size - (build_id - data->d_buf + 1);
|
||||
if (alt_name && build_id && id_len > 0)
|
||||
return open_debugaltlink (result, alt_name, build_id + 1, id_len);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_DWZ */
|
||||
|
||||
/* Recognize the various sections. Most names start with .debug_. */
|
||||
size_t cnt;
|
||||
for (cnt = 0; cnt < ndwarf_scnnames; ++cnt)
|
||||
@@ -334,6 +319,18 @@ check_section (Dwarf *result, GElf_Ehdr *ehdr, Elf_Scn *scn, bool inscngrp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DWZ
|
||||
Elf_Data *data = result->sectiondata[IDX_gnu_debugaltlink];
|
||||
if (data != NULL && data->d_size != 0)
|
||||
{
|
||||
const char *alt_name = data->d_buf;
|
||||
const void *build_id = memchr (data->d_buf, '\0', data->d_size);
|
||||
const int id_len = data->d_size - (build_id - data->d_buf + 1);
|
||||
if (alt_name && build_id && id_len > 0)
|
||||
return open_debugaltlink (result, alt_name, build_id + 1, id_len);
|
||||
}
|
||||
#endif /* ENABLE_DWZ */
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ enum
|
||||
IDX_debug_macinfo,
|
||||
IDX_debug_macro,
|
||||
IDX_debug_ranges,
|
||||
IDX_gnu_debugaltlink,
|
||||
IDX_last
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user