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]

[PATCH]: Fix ld crash on HC11/HC12


Hi!

Committed this patch to fix a crash when linking a program that needs trampoline
generation.  It was crashing because a local symbol is in common section and does
not have an input elf section (thus crashing when we dereference the null hdr).

Committed on mainline and 2_14 branch.

Stephane

2003-07-23 Stephane Carrez <stcarrez@nerim.fr>

	* elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Avoid crash when
	we have a local symbol in common section.
Index: elf32-m68hc1x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc1x.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 elf32-m68hc1x.c
--- elf32-m68hc1x.c	13 May 2003 18:56:06 -0000	1.1.2.1
+++ elf32-m68hc1x.c	23 Jul 2003 19:38:03 -0000
@@ -512,11 +512,12 @@ elf32_m68hc11_size_stubs (output_bfd, st
                   bfd_boolean is_far;
 
                   sym = local_syms + r_indx;
-                  hdr = elf_elfsections (input_bfd)[sym->st_shndx];
-                  sym_sec = hdr->bfd_section;
                   is_far = (sym && (sym->st_other & STO_M68HC12_FAR));
                   if (!is_far)
                     continue;
+
+                  hdr = elf_elfsections (input_bfd)[sym->st_shndx];
+                  sym_sec = hdr->bfd_section;
                   stub_name = (bfd_elf_string_from_elf_section
                                (input_bfd, symtab_hdr->sh_link,
                                 sym->st_name));

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