Pass NULL to only check the name. Signed-off-by: Kurt Roeckx <[email protected]> --- backends/ChangeLog | 5 +++++ backends/i386_symbol.c | 8 ++++---- backends/libebl_CPU.h | 2 +- libdwfl/ChangeLog | 4 ++++ libdwfl/relocate.c | 2 +- libebl/ChangeLog | 6 ++++++ libebl/ebl-hooks.h | 4 ++-- libebl/ebldebugscnp.c | 8 +++----- libebl/eblopenbackend.c | 4 ++-- libebl/eblsectionstripp.c | 4 ++-- libebl/libebl.h | 4 ++-- src/ChangeLog | 7 +++++++ src/ldgeneric.c | 5 +++-- src/ldscript.y | 4 ++-- src/readelf.c | 2 +- src/strip.c | 4 ++-- 16 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog index 744d1d5..dee3540 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2012-08-12 Kurt Roeckx <[email protected]> + + * libebl_CPU.h (generic_debugscn_p): Add shdr param + * i386_symbol.c (i386_debugscn_p): Add shdr param + 2011-03-09 Mark Wielaard <[email protected]> * alpha_init.c (alpha_init): Initialize check_st_other_bits hook. diff --git a/backends/i386_symbol.c b/backends/i386_symbol.c index 7dbf899..521325a 100644 --- a/backends/i386_symbol.c +++ b/backends/i386_symbol.c @@ -64,12 +64,12 @@ i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type) } } -/* Check section name for being that of a debug information section. */ -bool (*generic_debugscn_p) (const char *); +/* Check section for being a debug information section. */ +bool (*generic_debugscn_p) (const char *, const GElf_Shdr *); bool -i386_debugscn_p (const char *name) +i386_debugscn_p (const char *name, const GElf_Shdr *shdr) { - return (generic_debugscn_p (name) + return (generic_debugscn_p (name, shdr) || strcmp (name, ".stab") == 0 || strcmp (name, ".stabstr") == 0); } diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h index 36b3a4a..f887d4d 100644 --- a/backends/libebl_CPU.h +++ b/backends/libebl_CPU.h @@ -43,7 +43,7 @@ extern const char *EBLHOOK(init) (Elf *elf, GElf_Half machine, #define HOOK(eh, name) eh->name = EBLHOOK(name) -extern bool (*generic_debugscn_p) (const char *) attribute_hidden; +extern bool (*generic_debugscn_p) (const char *, const GElf_Shdr *shdr) attribute_hidden; #endif /* libebl_CPU.h */ diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 36db7a3..3b64552 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2012-08-12 Kurt Roeckx <[email protected]> + + * relocate.c (relocate_section): Update to call ebl_debugscn_p with shdr + 2012-08-01 Petr Machata <[email protected]> * offline.c (process_archive_member): Ignore entry "/SYM64/". diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c index 2c24bd5..35ae8ab 100644 --- a/libdwfl/relocate.c +++ b/libdwfl/relocate.c @@ -288,7 +288,7 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, /* No contents to relocate. */ return DWFL_E_NOERROR; - if (debugscn && ! ebl_debugscn_p (mod->ebl, tname)) + if (debugscn && ! ebl_debugscn_p (mod->ebl, tname, tshdr)) /* This relocation section is not for a debugging section. Nothing to do here. */ return DWFL_E_NOERROR; diff --git a/libebl/ChangeLog b/libebl/ChangeLog index 49c8540..3851a0a 100644 --- a/libebl/ChangeLog +++ b/libebl/ChangeLog @@ -1,6 +1,12 @@ 2012-08-12 Kurt Roeckx <[email protected]> * eblopenbackend.c (default_debugscn_p): Support compressed section + * ebl-hooks.h (debugscn_p): Add shdr as parameter + * libebl.h (ebl_debugscn_p): Add shdr as parameter + * ebldebugscnp.c (ebl_debugscn_p): Pass extra shdr parameter + * eblopenbackend.c (default_debugscn_p): Add shdr as parameter + * eblsectionstripp.c (ebl_section_strip_p): Call ebl_debugscn_p with + shdr param 2011-06-26 Mark Wielaard <[email protected]> diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index f629bce..84ffbd2 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -108,8 +108,8 @@ bool EBLHOOK(check_object_attribute) (Ebl *, const char *, int, uint64_t, /* Describe auxv element type. */ int EBLHOOK(auxv_info) (GElf_Xword, const char **, const char **); -/* Check section name for being that of a debug informatino section. */ -bool EBLHOOK(debugscn_p) (const char *); +/* Check section for being a debug information section. */ +bool EBLHOOK(debugscn_p) (const char *, const GElf_Shdr *shdr); /* Check whether given relocation is a copy relocation. */ bool EBLHOOK(copy_reloc_p) (int); diff --git a/libebl/ebldebugscnp.c b/libebl/ebldebugscnp.c index f2351e2..87b5b8d 100644 --- a/libebl/ebldebugscnp.c +++ b/libebl/ebldebugscnp.c @@ -1,4 +1,4 @@ -/* Check section name for being that of a debug informatino section. +/* Check section for being a debug information section. Copyright (C) 2002 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <[email protected]>, 2002. @@ -36,9 +36,7 @@ bool -ebl_debugscn_p (ebl, name) - Ebl *ebl; - const char *name; +ebl_debugscn_p (Ebl *ebl, const char *name, const GElf_Shdr *shdr) { - return ebl->debugscn_p (name); + return ebl->debugscn_p (name, shdr); } diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c index 251d7cc..86c00b5 100644 --- a/libebl/eblopenbackend.c +++ b/libebl/eblopenbackend.c @@ -173,7 +173,7 @@ static int default_auxv_info (GElf_Xword a_type, const char **name, const char **format); static bool default_object_note (const char *name, uint32_t type, uint32_t descsz, const char *desc); -static bool default_debugscn_p (const char *name); +static bool default_debugscn_p (const char *name, const GElf_Shdr *shdr); static bool default_copy_reloc_p (int reloc); static bool default_none_reloc_p (int reloc); static bool default_relative_reloc_p (int reloc); @@ -616,7 +616,7 @@ default_object_note (const char *name __attribute__ ((unused)), } static bool -default_debugscn_p (const char *name) +default_debugscn_p (const char *name, const GElf_Shdr *shdr) { /* We know by default only about the DWARF debug sections which have fixed names. */ diff --git a/libebl/eblsectionstripp.c b/libebl/eblsectionstripp.c index 9497068..15d0cb0 100644 --- a/libebl/eblsectionstripp.c +++ b/libebl/eblsectionstripp.c @@ -43,7 +43,7 @@ ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr, is unfortunately no other way. */ if (unlikely (only_remove_debug)) { - if (ebl_debugscn_p (ebl, name)) + if (ebl_debugscn_p (ebl, name, shdr)) return true; if (shdr->sh_type == SHT_RELA || shdr->sh_type == SHT_REL) @@ -55,7 +55,7 @@ ebl_section_strip_p (Ebl *ebl, const GElf_Ehdr *ehdr, const GElf_Shdr *shdr, { const char *s_l = elf_strptr (ebl->elf, ehdr->e_shstrndx, shdr_l->sh_name); - if (s_l != NULL && ebl_debugscn_p (ebl, s_l)) + if (s_l != NULL && ebl_debugscn_p (ebl, s_l, shdr)) return true; } } diff --git a/libebl/libebl.h b/libebl/libebl.h index 0d5621d..25aab77 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -180,8 +180,8 @@ extern bool ebl_check_object_attribute (Ebl *ebl, const char *vendor, const char **value_name); -/* Check section name for being that of a debug informatino section. */ -extern bool ebl_debugscn_p (Ebl *ebl, const char *name); +/* Check section for being a debug information section. */ +extern bool ebl_debugscn_p (Ebl *ebl, const char *name, const GElf_Shdr *shdr); /* Check whether given relocation is a copy relocation. */ extern bool ebl_copy_reloc_p (Ebl *ebl, int reloc); diff --git a/src/ChangeLog b/src/ChangeLog index 294e31b..e9c4b65 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2012-08-12 Kurt Roeckx <[email protected]> + + * ldgeneric.c (mark_section_group): Pass shdr to ebl_debugscn_p() + * ldscript.y: Pass shdr to ebl_debugscn_p() + * strip.c (handle_elf) Pass shdr to ebl_debugscn_p() + * readelf.c (print_debug): Pass shdr to ebl_debugscn_p() + 2012-06-27 Mark Wielaard <[email protected]> * readelf.c (dwarf_form_string): Handle DW_FORM_GNU_ref_alt and diff --git a/src/ldgeneric.c b/src/ldgeneric.c index 1b5d0f9..16bb838 100644 --- a/src/ldgeneric.c +++ b/src/ldgeneric.c @@ -881,13 +881,14 @@ mark_section_group (struct usedfiles *fileinfo, Elf32_Word shndx, /* If we are stripping, remove debug sections. */ || (!ebl_debugscn_p (ld_state.ebl, elf_strptr (fileinfo->elf, fileinfo->shstrndx, - shdr->sh_name)) + shdr->sh_name), shdr) /* And the relocation sections for the debug sections. */ && ((shdr->sh_type != SHT_RELA && shdr->sh_type != SHT_REL) || !ebl_debugscn_p (ld_state.ebl, elf_strptr (fileinfo->elf, fileinfo->shstrndx, - SCNINFO_SHDR (fileinfo->scninfo[shdr->sh_info].shdr).sh_name))))) + SCNINFO_SHDR (fileinfo->scninfo[shdr->sh_info].shdr).sh_name), + &SCNINFO_SHDR (fileinfo->scninfo[shdr->sh_info].shdr))))) { struct scninfo *ignore; diff --git a/src/ldscript.y b/src/ldscript.y index ec58e21..247dd16 100644 --- a/src/ldscript.y +++ b/src/ldscript.y @@ -212,7 +212,7 @@ outputsection: assignment ';' $$->val.section.name = $1; $$->val.section.input = $3->next; if (ld_state.strip == strip_debug - && ebl_debugscn_p (ld_state.ebl, $1)) + && ebl_debugscn_p (ld_state.ebl, $1, NULL)) $$->val.section.ignored = true; else $$->val.section.ignored = false; @@ -235,7 +235,7 @@ outputsection: assignment ';' new_input_section_name ($1, false); $$->val.section.input->val.section->keep_flag = false; if (ld_state.strip == strip_debug - && ebl_debugscn_p (ld_state.ebl, $1)) + && ebl_debugscn_p (ld_state.ebl, $1, NULL)) $$->val.section.ignored = true; else $$->val.section.ignored = false; diff --git a/src/readelf.c b/src/readelf.c index cba5717..d16fb3f 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -7788,7 +7788,7 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr) GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem); const char *name = elf_strptr (ebl->elf, shstrndx, shdr->sh_name); - if (ebl_debugscn_p(ebl, name) && shdr != NULL && shdr->sh_type == SHT_PROGBITS) + if (ebl_debugscn_p(ebl, name, shdr) && shdr != NULL && shdr->sh_type == SHT_PROGBITS) { static const struct { diff --git a/src/strip.c b/src/strip.c index 5e9c883..cf01031 100644 --- a/src/strip.c +++ b/src/strip.c @@ -1648,7 +1648,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, const char *tname = elf_strptr (debugelf, shstrndx, tshdr->sh_name); - if (! tname || ! ebl_debugscn_p (ebl, tname)) + if (! tname || ! ebl_debugscn_p (ebl, tname, tshdr)) continue; /* OK, lets relocate all trivial cross debug section @@ -1698,7 +1698,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, &xndx); Elf32_Word sec = (sym->st_shndx == SHN_XINDEX ? xndx : sym->st_shndx); - if (ebl_debugscn_p (ebl, shdr_info[sec].name)) + if (ebl_debugscn_p (ebl, shdr_info[sec].name, &shdr_info[sec].shdr)) { size_t size; -- 1.7.10.4 _______________________________________________ elfutils-devel mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/elfutils-devel
