dwarf_loader: Fix the build on older systems
RHEL5 and Fedora 11 were not building due to the GNU attributes stuff, cope with that using a define we know is not present in both RHEL5 and Fedora 11 to #ifdef those parts. Ugly, but _ELFUTILS_PREREQ, i.e. elfutils/version.h is not present in RHEL5 either. Reported-by: Jon Stanley <jstanley@fedoraproject.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
c7fa6a9a40
commit
76f687bf49
8
dutil.h
8
dutil.h
|
@ -72,4 +72,12 @@ void *zalloc(const size_t size);
|
|||
Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
|
||||
GElf_Shdr *shp, const char *name, size_t *index);
|
||||
|
||||
#ifndef SHT_GNU_ATTRIBUTES
|
||||
/* Just a way to check if we're using an old elfutils version */
|
||||
static inline int elf_getshdrstrndx(Elf *elf, size_t *dst)
|
||||
{
|
||||
return elf_getshstrndx(elf, dst);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DUTIL_H_ */
|
||||
|
|
|
@ -38,9 +38,13 @@ struct strings *strings;
|
|||
|
||||
static void __tag__print_not_supported(uint32_t tag, const char *func)
|
||||
{
|
||||
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
static bool dwarf_tags_warned[DW_TAG_rvalue_reference_type];
|
||||
static bool dwarf_gnu_tags_warned[DW_TAG_GNU_formal_parameter_pack - DW_TAG_MIPS_loop];
|
||||
#else
|
||||
static bool dwarf_tags_warned[DW_TAG_shared_type];
|
||||
static bool dwarf_gnu_tags_warned[DW_TAG_class_template - DW_TAG_MIPS_loop];
|
||||
#endif
|
||||
|
||||
if (tag < DW_TAG_MIPS_loop) {
|
||||
if (dwarf_tags_warned[tag])
|
||||
|
@ -1201,8 +1205,10 @@ static int die__process_class(Dwarf_Die *die, struct type *class,
|
|||
{
|
||||
do {
|
||||
switch (dwarf_tag(die)) {
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
case DW_TAG_GNU_template_template_param:
|
||||
case DW_TAG_GNU_template_parameter_pack:
|
||||
#endif
|
||||
case DW_TAG_template_type_parameter:
|
||||
case DW_TAG_template_value_parameter:
|
||||
/* FIXME: probably we'll have to attach this as a list of
|
||||
|
|
|
@ -77,8 +77,10 @@ static const char *dwarf_tag_names[] = {
|
|||
[DW_TAG_mutable_type] = "mutable_type",
|
||||
[DW_TAG_condition] = "condition",
|
||||
[DW_TAG_shared_type] = "shared_type",
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
[DW_TAG_type_unit] = "type_unit",
|
||||
[DW_TAG_rvalue_reference_type] = "rvalue_reference_type",
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *dwarf_gnu_tag_names[] = {
|
||||
|
@ -86,18 +88,32 @@ static const char *dwarf_gnu_tag_names[] = {
|
|||
[DW_TAG_format_label - DW_TAG_MIPS_loop] = "format_label",
|
||||
[DW_TAG_function_template - DW_TAG_MIPS_loop] = "function_template",
|
||||
[DW_TAG_class_template - DW_TAG_MIPS_loop] = "class_template",
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
[DW_TAG_GNU_BINCL - DW_TAG_MIPS_loop] = "BINCL",
|
||||
[DW_TAG_GNU_EINCL - DW_TAG_MIPS_loop] = "EINCL",
|
||||
[DW_TAG_GNU_template_template_param - DW_TAG_MIPS_loop] = "template_template_param",
|
||||
[DW_TAG_GNU_template_parameter_pack - DW_TAG_MIPS_loop] = "template_parameter_pack",
|
||||
[DW_TAG_GNU_formal_parameter_pack - DW_TAG_MIPS_loop] = "formal_parameter_pack",
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *dwarf_tag_name(const uint32_t tag)
|
||||
{
|
||||
if (tag >= DW_TAG_array_type && tag <= DW_TAG_rvalue_reference_type)
|
||||
if (tag >= DW_TAG_array_type && tag <=
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
DW_TAG_rvalue_reference_type
|
||||
#else
|
||||
DW_TAG_shared_type
|
||||
#endif
|
||||
)
|
||||
return dwarf_tag_names[tag];
|
||||
else if (tag >= DW_TAG_MIPS_loop && tag <= DW_TAG_GNU_formal_parameter_pack)
|
||||
else if (tag >= DW_TAG_MIPS_loop && tag <=
|
||||
#ifdef STB_GNU_UNIQUE
|
||||
DW_TAG_GNU_formal_parameter_pack
|
||||
#else
|
||||
DW_TAG_class_template
|
||||
#endif
|
||||
)
|
||||
return dwarf_gnu_tag_names[tag - DW_TAG_MIPS_loop];
|
||||
return "INVALID";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue