X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fcoff-ppc.c;h=2f979e990deac21ad0b1355df4bccde0faffabb2;hb=ef8e6722f2eaae6d65b360459451f57f1350d2af;hp=3c39afae7a86b2dad00ec42e8186ca9c7a1aeb0c;hpb=c72f2fb2bb6a3e1850b081dbfce4040970fae8e6;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index 3c39afae7a..2f979e990d 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -1,5 +1,5 @@ /* BFD back-end for PowerPC Microsoft Portable Executable files. - Copyright (C) 1990-2014 Free Software Foundation, Inc. + Copyright (C) 1990-2015 Free Software Foundation, Inc. Original version pieced together by Kim Knuttila (krk@cygnus.com) @@ -947,7 +947,7 @@ coff_ppc_relocate_section (bfd *output_bfd, /* If we are performing a relocatable link, we don't need to do a thing. The caller will take care of adjusting the reloc addresses and symbol indices. */ - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; rel = relocs; @@ -1073,10 +1073,11 @@ coff_ppc_relocate_section (bfd *output_bfd, { /* It is a file local symbol. */ int *local_toc_table; - const char *name; + char name[SYMNMLEN + 1]; sym = syms + symndx; - name = sym->_n._n_name; + strncpy (name, sym->_n._n_name, SYMNMLEN); + name[SYMNMLEN] = '\0'; local_toc_table = obj_coff_local_toc_table(input_bfd); our_toc_offset = local_toc_table[symndx]; @@ -1225,9 +1226,14 @@ coff_ppc_relocate_section (bfd *output_bfd, case IMAGE_REL_PPC_ABSOLUTE: { const char *my_name; + char buf[SYMNMLEN + 1]; if (h == 0) - my_name = (syms+symndx)->_n._n_name; + { + strncpy (buf, (syms+symndx)->_n._n_name, SYMNMLEN); + buf[SYMNMLEN] = '\0'; + my_name = buf; + } else my_name = h->root.root.root.string; @@ -1288,11 +1294,8 @@ coff_ppc_relocate_section (bfd *output_bfd, } if (h == 0) - { - /* It is a file local symbol. */ - sym = syms + symndx; - name = sym->_n._n_name; - } + /* It is a file local symbol. */ + sym = syms + symndx; else { char *target = 0; @@ -2040,7 +2043,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) || info->strip == strip_some) o->lineno_count += sec->lineno_count; - if (info->relocatable) + if (bfd_link_relocatable (info)) o->reloc_count += sec->reloc_count; if (sec->rawsize > max_contents_size) @@ -2052,7 +2055,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) if (sec->reloc_count > max_reloc_count) max_reloc_count = sec->reloc_count; } - else if (info->relocatable + else if (bfd_link_relocatable (info) && (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order)) ++o->reloc_count; @@ -2069,7 +2072,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) /* If doing a relocatable link, allocate space for the pointers we need to keep. */ - if (info->relocatable) + if (bfd_link_relocatable (info)) { unsigned int i; @@ -2120,7 +2123,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) memory until the end of the link. This wastes memory, but only when doing a relocatable link, which is not the common case. */ - BFD_ASSERT (info->relocatable); + BFD_ASSERT (bfd_link_relocatable (info)); amt = o->reloc_count; amt *= sizeof (struct internal_reloc); flaginfo.section_info[o->target_index].relocs = @@ -2172,7 +2175,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) flaginfo.linenos = (bfd_byte *) bfd_malloc (amt); flaginfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); flaginfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz); - if (! info->relocatable) + if (! bfd_link_relocatable (info)) { amt = max_reloc_count * sizeof (struct internal_reloc); flaginfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); @@ -2184,7 +2187,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) || (flaginfo.linenos == NULL && max_lineno_count > 0) || (flaginfo.contents == NULL && max_contents_size > 0) || (flaginfo.external_relocs == NULL && max_reloc_count > 0) - || (! info->relocatable + || (! bfd_link_relocatable (info) && flaginfo.internal_relocs == NULL && max_reloc_count > 0)) goto error_return; @@ -2318,7 +2321,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info) flaginfo.outsyms = NULL; } - if (info->relocatable) + if (bfd_link_relocatable (info)) { /* Now that we have written out all the global symbols, we know the symbol indices to use for relocs against them, and we can