public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: fnf@toadfish.ninemoons.com
To: binutils@sourceware.cygnus.com
Cc: fnf@cygnus.com
Subject: bfd client access to PT_NOTE program segment (patch included)
Date: Wed, 22 Sep 1999 20:04:00 -0000	[thread overview]
Message-ID: <199909230310.UAA15905@toadfish.ninemoons.com> (raw)
In-Reply-To: <199909210359.UAA09983@toadfish.ninemoons.com>

I didn't get any feedback, pro or con, to my previous email, so
I assume there are no real objections to making this change.
Would someone with access to the repository please apply this
patch?  It won't hurt my feelings if you see a need to tweak
it slightly for some reason.  :-)

-Fred

===================================================================

   1999-09-22  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.

Index: elf.c
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elf.c,v
retrieving revision 1.16
diff -c -p -r1.16 elf.c
*** elf.c	1999/09/04 17:07:46	1.16
--- elf.c	1999/09/23 02:57:39
*************** bfd_section_from_phdr (abfd, hdr, index)
*** 1394,1406 ****
  {
    asection *newsect;
    char *name;
    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);
    name = bfd_alloc (abfd, strlen (namebuf) + 1);
    if (!name)
      return false;
--- 1394,1418 ----
  {
    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));
!   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;
*************** bfd_section_from_phdr (abfd, hdr, index)
*** 1431,1437 ****
  
    if (split)
      {
!       sprintf (namebuf, "segment%db", index);
        name = bfd_alloc (abfd, strlen (namebuf) + 1);
        if (!name)
  	return false;
--- 1443,1449 ----
  
    if (split)
      {
!       sprintf (namebuf, "%s%db", typename, index);
        name = bfd_alloc (abfd, strlen (namebuf) + 1);
        if (!name)
  	return false;

  reply	other threads:[~1999-09-22 20:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-20 20:54 bfd client access to PT_NOTE program segment fnf
1999-09-22 20:04 ` fnf [this message]
1999-09-24 10:09   ` bfd client access to PT_NOTE program segment (patch included) Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199909230310.UAA15905@toadfish.ninemoons.com \
    --to=fnf@toadfish.ninemoons.com \
    --cc=binutils@sourceware.cygnus.com \
    --cc=fnf@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).