X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fcoff-rs6000.c;h=d2d443f9f313ab36273b6a0173d96a845e8d9bec;hb=4969ffd9c92f6d95a24c6b4ac563b0a65569bf6b;hp=951587f99b1e77168a0773b7dbdf2053e4a240ab;hpb=f05742e6724d73e0f4ae70e366eef82d6d763124;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 951587f99b..d2d443f9f3 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,33 +1,29 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. - FIXME: Can someone provide a transliteration of this name into ASCII? - Using the following chars caused a compiler warning on HIUX (so I replaced - them with octal escapes), and isn't useful without an understanding of what - character set it is. - Written by Metin G. Ozisik, Mimi Ph\373\364ng-Th\345o V\365, - and John Gilmore. + Written by Metin G. Ozisik, Mimi Phuong-Thao Vo, and John Gilmore. Archive support from Damon A. Permezel. Contributed by IBM Corporation and Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" #include "bfdlink.h" #include "libbfd.h" #include "coff/internal.h" @@ -59,7 +55,7 @@ extern bfd_boolean _bfd_xcoff_write_armap extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); extern int _bfd_xcoff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out @@ -98,6 +94,7 @@ void xcoff_rtype2howto #define coff_bfd_copy_private_bfd_data _bfd_xcoff_copy_private_bfd_data #define coff_bfd_is_local_label_name _bfd_xcoff_is_local_label_name #define coff_bfd_reloc_type_lookup _bfd_xcoff_reloc_type_lookup +#define coff_bfd_reloc_name_lookup _bfd_xcoff_reloc_name_lookup #ifdef AIX_CORE extern const bfd_target * rs6000coff_core_p PARAMS ((bfd *abfd)); @@ -1051,6 +1048,21 @@ _bfd_xcoff_reloc_type_lookup (abfd, code) } } +static reloc_howto_type * +_bfd_xcoff_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (xcoff_howto_table) / sizeof (xcoff_howto_table[0]); + i++) + if (xcoff_howto_table[i].name != NULL + && strcasecmp (xcoff_howto_table[i].name, r_name) == 0) + return &xcoff_howto_table[i]; + + return NULL; +} /* XCOFF archive support. The original version of this code was by Damon A. Permezel. It was enhanced to permit cross support, and @@ -1638,7 +1650,7 @@ xcoff_write_armap_old (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (sub)); fileoff = (fileoff + 1) &~ 1; - sub = sub->next; + sub = sub->archive_next; } for (i = 0; i < orl_count; i++) @@ -1809,7 +1821,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -1913,7 +1925,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (current_bfd)); fileoff += fileoff & 1; - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -1934,7 +1946,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2009,7 +2021,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + SXCOFFARFMAG + arelt_size (current_bfd)); fileoff += fileoff & 1; - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2030,7 +2042,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) } i++; } - current_bfd = current_bfd->next; + current_bfd = current_bfd->archive_next; if (current_bfd != NULL) arch_info = bfd_get_arch_info (current_bfd); } @@ -2089,7 +2101,7 @@ xcoff_write_archive_contents_old (abfd) count = 0; total_namlen = 0; - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) + for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next) { ++count; total_namlen += strlen (normalize_filename (sub)) + 1; @@ -2105,7 +2117,9 @@ xcoff_write_archive_contents_old (abfd) hasobjects = FALSE; prevoff = 0; nextoff = SIZEOF_AR_FILE_HDR; - for (sub = abfd->archive_head, i = 0; sub != NULL; sub = sub->next, i++) + for (sub = abfd->archive_head, i = 0; + sub != NULL; + sub = sub->archive_next, i++) { const char *name; bfd_size_type namlen; @@ -2253,7 +2267,7 @@ xcoff_write_archive_contents_old (abfd) abfd) != XCOFFARMAG_ELEMENT_SIZE) return FALSE; } - for (sub = abfd->archive_head; sub != NULL; sub = sub->next) + for (sub = abfd->archive_head; sub != NULL; sub = sub->archive_next) { const char *name; bfd_size_type namlen; @@ -2323,7 +2337,7 @@ xcoff_write_archive_contents_big (abfd) hasobjects = FALSE; for (current_bfd = abfd->archive_head, count = 0, total_namlen = 0; current_bfd != NULL; - current_bfd = current_bfd->next, count++) + current_bfd = current_bfd->archive_next, count++) { total_namlen += strlen (normalize_filename (current_bfd)) + 1; @@ -2345,7 +2359,7 @@ xcoff_write_archive_contents_big (abfd) nextoff = SIZEOF_AR_FILE_HDR_BIG; for (current_bfd = abfd->archive_head, i = 0; current_bfd != NULL; - current_bfd = current_bfd->next, i++) + current_bfd = current_bfd->archive_next, i++) { const char *name; bfd_size_type namlen; @@ -2512,8 +2526,9 @@ xcoff_write_archive_contents_big (abfd) offsets = NULL; } - for (current_bfd = abfd->archive_head; current_bfd != NULL; - current_bfd = current_bfd->next) + for (current_bfd = abfd->archive_head; + current_bfd != NULL; + current_bfd = current_bfd->archive_next) { const char *name; size_t namlen; @@ -2573,9 +2588,8 @@ _bfd_xcoff_write_archive_contents (abfd) always uses an a.out header. */ int -_bfd_xcoff_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +_bfd_xcoff_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { int size; @@ -4179,6 +4193,7 @@ const bfd_target rs6000coff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach, @@ -4429,6 +4444,7 @@ const bfd_target pmac_xcoff_vec = coff_get_reloc_upper_bound, coff_canonicalize_reloc, _bfd_xcoff_reloc_type_lookup, + _bfd_xcoff_reloc_name_lookup, /* Write */ coff_set_arch_mach,