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