Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD back-end for Apple M68K COFF A/UX 3.x files. |
b90efa5b | 2 | Copyright (C) 1996-2015 Free Software Foundation, Inc. |
252b5132 RH |
3 | Written by Richard Henderson <rth@tamu.edu>. |
4 | ||
cd123cb7 | 5 | This file is part of BFD, the Binary File Descriptor library. |
252b5132 | 6 | |
cd123cb7 NC |
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 3 of the License, or | |
10 | (at your option) any later version. | |
252b5132 | 11 | |
cd123cb7 NC |
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. | |
252b5132 | 16 | |
cd123cb7 NC |
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, | |
20 | MA 02110-1301, USA. */ | |
252b5132 | 21 | |
6d00b590 | 22 | #define TARGET_SYM m68k_coff_aux_vec |
252b5132 RH |
23 | #define TARGET_NAME "coff-m68k-aux" |
24 | ||
25 | #ifndef TARG_AUX | |
26 | #define TARG_AUX | |
27 | #endif | |
28 | ||
29 | #define COFF_LONG_FILENAMES | |
30 | ||
31 | /* 4k pages */ | |
32 | #define COFF_PAGE_SIZE 0x1000 | |
33 | ||
346ceb11 | 34 | /* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */ |
252b5132 RH |
35 | #define BSS_NOLOAD_IS_SHARED_LIBRARY |
36 | ||
37 | #define STATIC_RELOCS | |
38 | ||
39 | #define COFF_COMMON_ADDEND | |
40 | ||
252b5132 | 41 | #include "sysdep.h" |
3db64b00 | 42 | #include "bfd.h" |
252b5132 | 43 | |
252b5132 | 44 | #define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol |
2c3fc389 NC |
45 | static bfd_boolean |
46 | coff_m68k_aux_link_add_one_symbol | |
47 | (struct bfd_link_info *, bfd *, const char *, flagword, asection *, | |
48 | bfd_vma, const char *, bfd_boolean, bfd_boolean, | |
49 | struct bfd_link_hash_entry **); | |
252b5132 | 50 | |
2b5c217d NC |
51 | #ifndef bfd_pe_print_pdata |
52 | #define bfd_pe_print_pdata NULL | |
53 | #endif | |
54 | ||
252b5132 RH |
55 | #include "coff/aux-coff.h" /* override coff/internal.h and coff/m68k.h */ |
56 | #include "coff-m68k.c" | |
57 | ||
58 | /* We need non-absolute symbols to override absolute symbols. This | |
59 | mirrors Apple's "solution" to let a static library symbol override | |
60 | a shared library symbol. On the whole not a good thing, given how | |
61 | shared libraries work here, but can work if you are careful with | |
346ceb11 | 62 | what you include in the shared object. */ |
252b5132 | 63 | |
b34976b6 | 64 | static bfd_boolean |
2c3fc389 NC |
65 | coff_m68k_aux_link_add_one_symbol (struct bfd_link_info *info, |
66 | bfd *abfd, | |
67 | const char *name, | |
68 | flagword flags, | |
69 | asection *section, | |
70 | bfd_vma value, | |
71 | const char *string, | |
72 | bfd_boolean copy, | |
73 | bfd_boolean collect, | |
74 | struct bfd_link_hash_entry **hashp) | |
252b5132 | 75 | { |
46135103 | 76 | struct bfd_link_hash_entry *h, *inh, *t; |
252b5132 | 77 | |
46135103 AM |
78 | if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 |
79 | && !bfd_is_und_section (section) | |
80 | && !bfd_is_com_section (section)) | |
252b5132 RH |
81 | { |
82 | /* The new symbol is a definition or an indirect definition */ | |
83 | ||
84 | /* This bit copied from linker.c */ | |
85 | if (hashp != NULL && *hashp != NULL) | |
46135103 | 86 | h = *hashp; |
252b5132 RH |
87 | else |
88 | { | |
b34976b6 | 89 | h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE); |
252b5132 RH |
90 | if (h == NULL) |
91 | { | |
92 | if (hashp != NULL) | |
93 | *hashp = NULL; | |
b34976b6 | 94 | return FALSE; |
252b5132 RH |
95 | } |
96 | } | |
97 | ||
252b5132 RH |
98 | if (hashp != (struct bfd_link_hash_entry **) NULL) |
99 | *hashp = h; | |
100 | /* end duplication from linker.c */ | |
101 | ||
46135103 AM |
102 | t = h; |
103 | inh = NULL; | |
104 | if (h->type == bfd_link_hash_indirect) | |
252b5132 | 105 | { |
46135103 AM |
106 | inh = h->u.i.link; |
107 | t = inh; | |
108 | } | |
252b5132 | 109 | |
46135103 AM |
110 | if (t->type == bfd_link_hash_defined) |
111 | { | |
112 | asection *msec = t->u.def.section; | |
113 | bfd_boolean special = FALSE; | |
252b5132 RH |
114 | |
115 | if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section)) | |
116 | { | |
46135103 AM |
117 | t->u.def.section = section; |
118 | t->u.def.value = value; | |
119 | special = TRUE; | |
252b5132 RH |
120 | } |
121 | else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec)) | |
46135103 AM |
122 | special = TRUE; |
123 | ||
124 | if (special) | |
125 | { | |
126 | if (info->notice_all | |
127 | || (info->notice_hash != NULL | |
128 | && bfd_hash_lookup (info->notice_hash, name, | |
129 | FALSE, FALSE) != NULL)) | |
130 | { | |
131 | if (!(*info->callbacks->notice) (info, h, inh, | |
132 | abfd, section, value, flags)) | |
133 | return FALSE; | |
134 | } | |
135 | ||
136 | return TRUE; | |
137 | } | |
252b5132 RH |
138 | } |
139 | } | |
140 | ||
141 | /* If we didn't exit early, finish processing in the generic routine */ | |
142 | return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, | |
143 | value, string, copy, collect, | |
144 | hashp); | |
145 | } |