mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-03-07 13:39:43 +08:00
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:
parent
2d35e9f64f
commit
27ac83bfca
@ -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
|
||||
|
16
bfd/elf.c
16
bfd/elf.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user