This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: PPC sdata problems


On Thu, Jun 17, 2004 at 10:22:35AM +0930, Alan Modra wrote:
> On Wed, Jun 16, 2004 at 03:09:22PM -0400, Daniel Jacobowitz wrote:
> > There's a number of possible fixes for this.  My favorite is to not check
> > the flags; just use the provided .sdata and .sdata2 sections in dynobj if
> > there are any.  Thoughts?
> 
> No, that won't work.  You can't extent an input section without copying
> the existing contents.  Create the _SDA_BASE_ symbol relative to the
> existing section, if any, and also create a new linker section.

Like this?

-- 
Daniel Jacobowitz

2004-06-16  Daniel Jacobowitz  <dan@debian.org>

	* elf32-ppc.c (ppc_elf_create_linker_section): Create symbols in
	the pre-existing section.

Index: elf32-ppc.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/bfd/elf32-ppc.c,v
retrieving revision 1.119
diff -u -p -r1.119 elf32-ppc.c
--- elf32-ppc.c	22 May 2004 01:56:30 -0000	1.119
+++ elf32-ppc.c	17 Jun 2004 01:25:29 -0000
@@ -2593,7 +2593,7 @@ ppc_elf_create_linker_section (bfd *abfd
 {
   elf_linker_section_t *lsect;
   struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
-  asection *s;
+  asection *s, *sym_sec;
   bfd_size_type amt;
   flagword flags;
   const char *name;
@@ -2642,13 +2642,15 @@ ppc_elf_create_linker_section (bfd *abfd
   lsect->sym_offset = sym_offset;
 
   /* See if the sections already exist.  */
-  s = bfd_get_section_by_name (htab->elf.dynobj, name);
+  sym_sec = s = bfd_get_section_by_name (htab->elf.dynobj, name);
   if (s == NULL || (s->flags & flags) != flags)
     {
       s = bfd_make_section_anyway (htab->elf.dynobj, name);
       if (s == NULL
 	  || !bfd_set_section_flags (htab->elf.dynobj, s, flags))
 	return NULL;
+      if (sym_sec == NULL)
+	sym_sec = s;
     }
   lsect->section = s;
 
@@ -2676,7 +2678,7 @@ ppc_elf_create_linker_section (bfd *abfd
 
       if ((bh == NULL || bh->type == bfd_link_hash_undefined)
 	  && !(_bfd_generic_link_add_one_symbol
-	       (info, abfd, sym_name, BSF_GLOBAL, s, sym_offset, NULL,
+	       (info, abfd, sym_name, BSF_GLOBAL, sym_sec, sym_offset, NULL,
 		FALSE, get_elf_backend_data (abfd)->collect, &bh)))
 	return NULL;
       h = (struct elf_link_hash_entry *) bh;


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