Fred Fish <fnf@cygnus.com>

* elf.c (bfd_section_from_phdr): Add typename variable.  Use p_type
        to initialize it to something meaningful.  Then use it to generate
        more useful segment names.
This commit is contained in:
Richard Henderson 1999-09-24 17:06:35 +00:00
parent 2d35e9f64f
commit 27ac83bfca
2 changed files with 198 additions and 180 deletions

View File

@ -1,3 +1,9 @@
1999-09-24 Fred Fish <fnf@cygnus.com>
* elf.c (bfd_section_from_phdr): Add typename variable. Use p_type
to initialize it to something meaningful. Then use it to generate
more useful segment names.
Sun Sep 19 12:16:47 1999 Jeffrey A Law (law@cygnus.com)
* som.c (NO_PCREL_MODES): Define if the system does not define

View File

@ -1394,13 +1394,25 @@ bfd_section_from_phdr (abfd, hdr, index)
{
asection *newsect;
char *name;
char *typename;
char namebuf[64];
int split;
split = ((hdr->p_memsz > 0)
&& (hdr->p_filesz > 0)
&& (hdr->p_memsz > hdr->p_filesz));
sprintf (namebuf, split ? "segment%da" : "segment%d", index);
switch (hdr->p_type)
{
case PT_NULL: typename = "null"; break;
case PT_LOAD: typename = "load"; break;
case PT_DYNAMIC: typename = "dynamic"; break;
case PT_INTERP: typename = "interp"; break;
case PT_NOTE: typename = "note"; break;
case PT_SHLIB: typename = "shlib"; break;
case PT_PHDR: typename = "phdr"; break;
default: typename = "segment"; break;
}
sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : "");
name = bfd_alloc (abfd, strlen (namebuf) + 1);
if (!name)
return false;
@ -1431,7 +1443,7 @@ bfd_section_from_phdr (abfd, hdr, index)
if (split)
{
sprintf (namebuf, "segment%db", index);
sprintf (namebuf, "%s%db", typename, index);
name = bfd_alloc (abfd, strlen (namebuf) + 1);
if (!name)
return false;