public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@cygnus.com>
To: binutils@sourceware.cygnus.com
Subject: name collision for ELF reloc sections
Date: Thu, 01 Jul 1999 00:00:00 -0000	[thread overview]
Message-ID: <199905101504.IAA16902@elmo.cygnus.com> (raw)

Hi Guys,

  What do you think of the following patch?  It is an attempt to fix a
  problem encountered with the ARM ecos toolchain assembling a file
  that contains a .section directive that looks like this:

	.section .release__10Cyg_Thread,"ax",@progbits

  This section has been derived from a C++ function declared like
  this: 

	void Cyg_Thread::release()

  with -ffunction-sections enabled.  The problem is that
  elf_fake_sections() thinks that the section is a REL section, since
  it starts with .rel, and so it does not assign a file position to
  it.  Later on, when a fixup inside the section is being processed an
  error occurs because BFD cannot seek to its location.

  The patch solves this problem by making elf_fake_section look for
  ".rel." as the start of a name of a REL section (and similarly
  ".rela." for the start of a name of a RELA section).  Looking for
  the extra period guarantees that the section name cannot have been
  generated from a real C/C++ function name, but I do not know if this
  is safe.  Is it possible to generate an ELF rel or rela section that
  starts with .rel{a} but which does not have a second period
  immediately following it ?

Cheers
	Nick


1999-05-10  Nick Clifton  <nickc@cygnus.com>

	* elf.c (elf_fake_sections): Check for .rel. as start of rel
	section, not just .rel.  Same for .rela.

Index: elf.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf.c,v
retrieving revision 1.228
diff -p -r1.228 elf.c
*** elf.c	1999/04/08 15:37:28	1.228
- --- elf.c	1999/05/10 14:37:12
*************** elf_fake_sections (abfd, asect, failedpt
*** 1490,1502 ****
        this_hdr->sh_type = SHT_DYNAMIC;
        this_hdr->sh_entsize = bed->s->sizeof_dyn;
      }
!   else if (strncmp (asect->name, ".rela", 5) == 0
  	   && get_elf_backend_data (abfd)->use_rela_p)
      {
        this_hdr->sh_type = SHT_RELA;
        this_hdr->sh_entsize = bed->s->sizeof_rela;
      }
!   else if (strncmp (asect->name, ".rel", 4) == 0
  	   && ! get_elf_backend_data (abfd)->use_rela_p)
      {
        this_hdr->sh_type = SHT_REL;
- --- 1490,1502 ----
        this_hdr->sh_type = SHT_DYNAMIC;
        this_hdr->sh_entsize = bed->s->sizeof_dyn;
      }
!   else if (strncmp (asect->name, ".rela.", 6) == 0
  	   && get_elf_backend_data (abfd)->use_rela_p)
      {
        this_hdr->sh_type = SHT_RELA;
        this_hdr->sh_entsize = bed->s->sizeof_rela;
      }
!   else if (strncmp (asect->name, ".rel.", 5) == 0
  	   && ! get_elf_backend_data (abfd)->use_rela_p)
      {
        this_hdr->sh_type = SHT_REL;

             reply	other threads:[~1999-07-01  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-01  0:00 Nick Clifton [this message]
1999-07-01  0:00 ` Ian Lance Taylor
1999-07-01  0:00 ` Andreas Schwab
  -- strict thread matches above, loose matches on Subject: below --
1999-07-01  0:00 Nick Clifton
1999-07-01  0:00 ` Andreas Schwab
1999-07-01  0:00 ` Ian Lance Taylor
1999-07-01  0:00 Nick Clifton

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=199905101504.IAA16902@elmo.cygnus.com \
    --to=nickc@cygnus.com \
    --cc=binutils@sourceware.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).