This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Strip on mips

> So I've tried to do that, but then ran into problems with
> ldscript.[yc].  It doesn't seem to be using anything of the
> libraries.

That's part of the linker implementation, which is utterly incomplete,
never tested and never used (and probably it will never be finished).
So while it's always good not to regress anything, it doesn't really
matter much here.

> So I've changed the prototype to use (const char *name, const
> GElf_Shdr *shdr).  Do you think it makes sense that I pass a
> NULL as shdr in that case and only check the name in case it's

The ldscript.y uses are considering a section name rather than a section
that actually exists anywhere.  So it makes sense for them to pass NULL
for the shdr argument and for the function to ignore the shdr when it's
NULL.  Probably the best way to write the MIPS backend implementation

	mips_debugscn_p (const GElf_Shdr *shdr, const char *name)
	  if (shdr != NULL && shdr->sh_type == SHT_MIPS_DWARF)
	    return true;
	  return (*generic_debugscn_p) (shdr, name);

(See i386_{symbol,init}.c for setting up generic_debugscn_p.)  That
ensures a correct result when we're using this to override readelf's
SHT_PROGBITS check, but doesn't defeat the name-based logic, in case
some tools use the canonical sh_type even on MIPS.

I think the change that makes sense in readelf is just this:

--- a/src/readelf.c
+++ b/src/readelf.c
@@ -7273,7 +7273,10 @@ print_debug (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr)
       GElf_Shdr shdr_mem;
       GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
-      if (shdr != NULL && shdr->sh_type == SHT_PROGBITS)
+      if (shdr != NULL
+          && (shdr->sh_type == SHT_PROGBITS
+              || ebl_debugscn_p (ebl, shdr, elf_strptr (ebl->elf, shstrndx,
+                                                        shdr->sh_name))))
 	  static const struct

That is, use the hook to override the SHT_PROGBITS check, but don't
change any of the rest of the name-based logic.

Alternatively, we could just pass NULL for the name here and change the
existing debugscn_p implementations so they just return false when given
NULL for name.  Then this call is really just serving as the override
for the SHT_PROGBITS check with no other logic.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]