| 1 | /* BFD back-end for Apple M68K COFF A/UX 3.x files. |
| 2 | Copyright 1996, 1997, 2000, 2002 Free Software Foundation, Inc. |
| 3 | Written by Richard Henderson <rth@tamu.edu>. |
| 4 | |
| 5 | This file is part of BFD, the Binary File Descriptor library. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ |
| 20 | |
| 21 | #define TARGET_SYM m68kaux_coff_vec |
| 22 | #define TARGET_NAME "coff-m68k-aux" |
| 23 | |
| 24 | #ifndef TARG_AUX |
| 25 | #define TARG_AUX |
| 26 | #endif |
| 27 | |
| 28 | #define COFF_LONG_FILENAMES |
| 29 | |
| 30 | /* 4k pages */ |
| 31 | #define COFF_PAGE_SIZE 0x1000 |
| 32 | |
| 33 | /* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */ |
| 34 | #define BSS_NOLOAD_IS_SHARED_LIBRARY |
| 35 | |
| 36 | #define STATIC_RELOCS |
| 37 | |
| 38 | #define COFF_COMMON_ADDEND |
| 39 | |
| 40 | #include "bfd.h" |
| 41 | #include "sysdep.h" |
| 42 | |
| 43 | static bfd_boolean coff_m68k_aux_link_add_one_symbol |
| 44 | PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, |
| 45 | asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean, |
| 46 | struct bfd_link_hash_entry **)); |
| 47 | |
| 48 | #define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol |
| 49 | |
| 50 | #include "coff/aux-coff.h" /* override coff/internal.h and coff/m68k.h */ |
| 51 | #include "coff-m68k.c" |
| 52 | |
| 53 | /* We need non-absolute symbols to override absolute symbols. This |
| 54 | mirrors Apple's "solution" to let a static library symbol override |
| 55 | a shared library symbol. On the whole not a good thing, given how |
| 56 | shared libraries work here, but can work if you are careful with |
| 57 | what you include in the shared object. */ |
| 58 | |
| 59 | static bfd_boolean |
| 60 | coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value, |
| 61 | string, copy, collect, hashp) |
| 62 | struct bfd_link_info *info; |
| 63 | bfd *abfd; |
| 64 | const char *name; |
| 65 | flagword flags; |
| 66 | asection *section; |
| 67 | bfd_vma value; |
| 68 | const char *string; |
| 69 | bfd_boolean copy; |
| 70 | bfd_boolean collect; |
| 71 | struct bfd_link_hash_entry **hashp; |
| 72 | { |
| 73 | struct bfd_link_hash_entry *h; |
| 74 | |
| 75 | if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 && |
| 76 | !bfd_is_und_section (section) && |
| 77 | !bfd_is_com_section (section)) |
| 78 | { |
| 79 | /* The new symbol is a definition or an indirect definition */ |
| 80 | |
| 81 | /* This bit copied from linker.c */ |
| 82 | if (hashp != NULL && *hashp != NULL) |
| 83 | { |
| 84 | h = *hashp; |
| 85 | BFD_ASSERT (strcmp (h->root.string, name) == 0); |
| 86 | } |
| 87 | else |
| 88 | { |
| 89 | h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE); |
| 90 | if (h == NULL) |
| 91 | { |
| 92 | if (hashp != NULL) |
| 93 | *hashp = NULL; |
| 94 | return FALSE; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | if (info->notice_hash != (struct bfd_hash_table *) NULL |
| 99 | && (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) |
| 100 | != (struct bfd_hash_entry *) NULL)) |
| 101 | { |
| 102 | if (! (*info->callbacks->notice) (info, name, abfd, section, value)) |
| 103 | return FALSE; |
| 104 | } |
| 105 | |
| 106 | if (hashp != (struct bfd_link_hash_entry **) NULL) |
| 107 | *hashp = h; |
| 108 | /* end duplication from linker.c */ |
| 109 | |
| 110 | if (h->type == bfd_link_hash_defined |
| 111 | || h->type == bfd_link_hash_indirect) |
| 112 | { |
| 113 | asection *msec; |
| 114 | |
| 115 | if (h->type == bfd_link_hash_defined) |
| 116 | msec = h->u.def.section; |
| 117 | else |
| 118 | msec = bfd_ind_section_ptr; |
| 119 | |
| 120 | if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section)) |
| 121 | { |
| 122 | h->u.def.section = section; |
| 123 | h->u.def.value = value; |
| 124 | return TRUE; |
| 125 | } |
| 126 | else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec)) |
| 127 | return TRUE; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /* If we didn't exit early, finish processing in the generic routine */ |
| 132 | return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, |
| 133 | value, string, copy, collect, |
| 134 | hashp); |
| 135 | } |