This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
mn10300: crash/bug-fix with linker relaxations
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: 12 Feb 2002 07:23:13 -0200
- Subject: mn10300: crash/bug-fix with linker relaxations
- Organization: GCC Team, Red Hat
I've run into a problem with linker relaxations on AM33. Some
sections whose contents were requested for had section->contents ==
NULL. I'm not sure whether this can happen in GNU binutils (the Red
Hat internal version on which I've observed the problem has a number
of yet-to-be-contributed changes), but still, this change may be a
significant optimization, so I'm contributing it earlier. Eric
Christopher has already approved this patch, so I'm checking it in the
branch and mainline.
Index: bfd/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* elf-m10300.c (mn10300_elf_relax_section): Skip section before
loading its contents if there's nothing to do in it.
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.20
diff -u -p -r1.20 elf-m10300.c
--- bfd/elf-m10300.c 2001/12/17 00:52:34 1.20
+++ bfd/elf-m10300.c 2002/02/12 09:18:11
@@ -1,5 +1,5 @@
/* Matsushita 10300 specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -873,6 +873,12 @@ mn10300_elf_relax_section (abfd, sec, li
asection *sym_sec = NULL;
const char *sym_name;
char *new_name;
+
+ /* If there's nothing to do in this section, skip it. */
+ if (! (((section->flags & SEC_RELOC) != 0
+ && section->reloc_count != 0)
+ || (section->flags & SEC_CODE) != 0))
+ continue;
/* Get cached copy of section contents if it exists. */
if (elf_section_data (section)->this_hdr.contents != NULL)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer