X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Faout-arm.c;h=0ec5fcc51c31764a9c95ad6ee6da71b4d86491ee;hb=59441ccdbd5d74575ae0149c6cf7b4663b56ff6d;hp=d8834a4f331d20c1975947e844803eefd8a91616;hpb=3e110533652d0f94211681ab718b7471f8bd3493;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/aout-arm.c b/bfd/aout-arm.c index d8834a4f33..0ec5fcc51c 100644 --- a/bfd/aout-arm.c +++ b/bfd/aout-arm.c @@ -1,13 +1,12 @@ /* BFD back-end for raw ARM a.out binaries. - Copyright 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. + Copyright (C) 1994-2016 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) 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 + 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, @@ -19,8 +18,8 @@ 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" /* Avoid multiple definitions from aoutx if supporting standard a.out as well as our own. */ @@ -35,7 +34,7 @@ : ((N_MAGIC (x) != ZMAGIC) \ ? (bfd_vma) 0 \ : ((N_SHARED_LIB (x)) \ - ? ((x).a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ + ? ((x)->a_entry & ~(bfd_vma) (TARGET_PAGE_SIZE - 1)) \ : (bfd_vma) TEXT_START_ADDR))) #define TEXT_START_ADDR 0x8000 @@ -43,13 +42,14 @@ #define SEGMENT_SIZE TARGET_PAGE_SIZE #define DEFAULT_ARCH bfd_arch_arm -#define MY(OP) CONCAT2 (aoutarm_,OP) -#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \ - (((x).a_info & ~006000) != OMAGIC) && \ - ((x).a_info != NMAGIC)) -#define N_MAGIC(x) ((x).a_info & ~07200) +#define MY(OP) CONCAT2 (arm_aout_,OP) +#define N_BADMAG(x) ((((x)->a_info & ~007200) != ZMAGIC) && \ + (((x)->a_info & ~006000) != OMAGIC) && \ + ((x)->a_info != NMAGIC)) +#define N_MAGIC(x) ((x)->a_info & ~07200) -#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup +#define MY_bfd_reloc_type_lookup arm_aout_bfd_reloc_type_lookup +#define MY_bfd_reloc_name_lookup arm_aout_bfd_reloc_name_lookup #include "libaout.h" #include "aout/aout64.h" @@ -101,7 +101,7 @@ MY (reloc_howto) (bfd *abfd, unsigned int r_length; unsigned int r_pcrel_done; unsigned int r_neg; - int index; + int howto_index; *r_pcrel = 0; if (bfd_header_big_endian (abfd)) @@ -126,11 +126,11 @@ MY (reloc_howto) (bfd *abfd, r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE); } - index = r_length + 4 * r_pcrel_done + 8 * r_neg; - if (index == 3) + howto_index = r_length + 4 * r_pcrel_done + 8 * r_neg; + if (howto_index == 3) *r_pcrel = 1; - return MY (howto_table) + index; + return MY (howto_table) + howto_index; } #define MY_reloc_howto(BFD, REL, IN, EX, PC) \ @@ -246,7 +246,7 @@ MY (fix_pcrel_26) (bfd *abfd, bfd_reloc_status_type flag = bfd_reloc_ok; /* If this is an undefined symbol, return error. */ - if (symbol->section == &bfd_und_section + if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0) return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; @@ -295,7 +295,7 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, #define ASTD(i,j) case i: return & MY (howto_table)[j] if (code == BFD_RELOC_CTOR) - switch (bfd_get_arch_info (abfd)->bits_per_address) + switch (bfd_arch_bits_per_address (abfd)) { case 32: code = BFD_RELOC_32; @@ -317,6 +317,22 @@ MY (bfd_reloc_type_lookup) (bfd *abfd, } } +static reloc_howto_type * +MY (bfd_reloc_name_lookup) (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; + i < sizeof (MY (howto_table)) / sizeof (MY (howto_table)[0]); + i++) + if (MY (howto_table)[i].name != NULL + && strcasecmp (MY (howto_table)[i].name, r_name) == 0) + return &MY (howto_table)[i]; + + return NULL; +} + #define MY_swap_std_reloc_in MY (swap_std_reloc_in) #define MY_swap_std_reloc_out MY (swap_std_reloc_out) #define MY_get_section_contents _bfd_generic_get_section_contents @@ -392,10 +408,10 @@ MY_swap_std_reloc_out (bfd *abfd, check for that here. */ if (bfd_is_com_section (output_section) - || output_section == &bfd_abs_section - || output_section == &bfd_und_section) + || bfd_is_abs_section (output_section) + || bfd_is_und_section (output_section)) { - if (bfd_abs_section.symbol == sym) + if (bfd_abs_section_ptr->symbol == sym) { /* Whoops, looked like an abs symbol, but is really an offset from the abs section. */ @@ -445,9 +461,9 @@ MY_swap_std_reloc_out (bfd *abfd, #include "aout-target.h" -extern const bfd_target aout_arm_big_vec; +extern const bfd_target arm_aout_be_vec; -const bfd_target aout_arm_little_vec = +const bfd_target arm_aout_le_vec = { "a.out-arm-little", /* Name. */ bfd_target_aout_flavour, @@ -460,6 +476,7 @@ const bfd_target aout_arm_little_vec = MY_symbol_leading_char, AR_PAD_CHAR, /* AR_pad_char. */ 15, /* AR_max_namelen. */ + 0, /* match priority. */ bfd_getl64, bfd_getl_signed_64, bfd_putl64, bfd_getl32, bfd_getl_signed_32, bfd_putl32, bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ @@ -483,12 +500,12 @@ const bfd_target aout_arm_little_vec = BFD_JUMP_TABLE_LINK (MY), BFD_JUMP_TABLE_DYNAMIC (MY), - & aout_arm_big_vec, + & arm_aout_be_vec, (void *) MY_backend_data, }; -const bfd_target aout_arm_big_vec = +const bfd_target arm_aout_be_vec = { "a.out-arm-big", /* Name. */ bfd_target_aout_flavour, @@ -499,8 +516,9 @@ const bfd_target aout_arm_big_vec = HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED), (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA), MY_symbol_leading_char, - AR_PAD_CHAR, /* AR_pad_char. */ - 15, /* AR_max_namelen. */ + AR_PAD_CHAR, /* AR_pad_char. */ + 15, /* AR_max_namelen. */ + 0, /* match priority. */ bfd_getb64, bfd_getb_signed_64, bfd_putb64, bfd_getb32, bfd_getb_signed_32, bfd_putb32, bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ @@ -524,7 +542,7 @@ const bfd_target aout_arm_big_vec = BFD_JUMP_TABLE_LINK (MY), BFD_JUMP_TABLE_DYNAMIC (MY), - & aout_arm_little_vec, + & arm_aout_le_vec, (void *) MY_backend_data, };