| 1 |
24 |
jeremybenn |
/* BFD back-end for Apple M68K COFF A/UX 3.x files.
|
| 2 |
225 |
jeremybenn |
Copyright 1996, 1997, 2000, 2002, 2005, 2007, 2008
|
| 3 |
|
|
Free Software Foundation, Inc.
|
| 4 |
24 |
jeremybenn |
Written by Richard Henderson <rth@tamu.edu>.
|
| 5 |
|
|
|
| 6 |
|
|
This file is part of BFD, the Binary File Descriptor library.
|
| 7 |
|
|
|
| 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.
|
| 12 |
|
|
|
| 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.
|
| 17 |
|
|
|
| 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. */
|
| 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 |
|
|
|
| 35 |
|
|
/* On AUX, a STYP_NOLOAD|STYP_BSS section is part of a shared library. */
|
| 36 |
|
|
#define BSS_NOLOAD_IS_SHARED_LIBRARY
|
| 37 |
|
|
|
| 38 |
|
|
#define STATIC_RELOCS
|
| 39 |
|
|
|
| 40 |
|
|
#define COFF_COMMON_ADDEND
|
| 41 |
|
|
|
| 42 |
|
|
#include "sysdep.h"
|
| 43 |
|
|
#include "bfd.h"
|
| 44 |
|
|
|
| 45 |
|
|
static bfd_boolean coff_m68k_aux_link_add_one_symbol
|
| 46 |
|
|
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword,
|
| 47 |
|
|
asection *, bfd_vma, const char *, bfd_boolean, bfd_boolean,
|
| 48 |
|
|
struct bfd_link_hash_entry **));
|
| 49 |
|
|
|
| 50 |
|
|
#define coff_link_add_one_symbol coff_m68k_aux_link_add_one_symbol
|
| 51 |
|
|
|
| 52 |
225 |
jeremybenn |
#ifndef bfd_pe_print_pdata
|
| 53 |
|
|
#define bfd_pe_print_pdata NULL
|
| 54 |
|
|
#endif
|
| 55 |
|
|
|
| 56 |
24 |
jeremybenn |
#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
|
| 63 |
|
|
what you include in the shared object. */
|
| 64 |
|
|
|
| 65 |
|
|
static bfd_boolean
|
| 66 |
|
|
coff_m68k_aux_link_add_one_symbol (info, abfd, name, flags, section, value,
|
| 67 |
|
|
string, copy, collect, hashp)
|
| 68 |
|
|
struct bfd_link_info *info;
|
| 69 |
|
|
bfd *abfd;
|
| 70 |
|
|
const char *name;
|
| 71 |
|
|
flagword flags;
|
| 72 |
|
|
asection *section;
|
| 73 |
|
|
bfd_vma value;
|
| 74 |
|
|
const char *string;
|
| 75 |
|
|
bfd_boolean copy;
|
| 76 |
|
|
bfd_boolean collect;
|
| 77 |
|
|
struct bfd_link_hash_entry **hashp;
|
| 78 |
|
|
{
|
| 79 |
|
|
struct bfd_link_hash_entry *h;
|
| 80 |
|
|
|
| 81 |
|
|
if ((flags & (BSF_WARNING | BSF_CONSTRUCTOR | BSF_WEAK)) == 0 &&
|
| 82 |
|
|
!bfd_is_und_section (section) &&
|
| 83 |
|
|
!bfd_is_com_section (section))
|
| 84 |
|
|
{
|
| 85 |
|
|
/* The new symbol is a definition or an indirect definition */
|
| 86 |
|
|
|
| 87 |
|
|
/* This bit copied from linker.c */
|
| 88 |
|
|
if (hashp != NULL && *hashp != NULL)
|
| 89 |
|
|
{
|
| 90 |
|
|
h = *hashp;
|
| 91 |
|
|
BFD_ASSERT (strcmp (h->root.string, name) == 0);
|
| 92 |
|
|
}
|
| 93 |
|
|
else
|
| 94 |
|
|
{
|
| 95 |
|
|
h = bfd_link_hash_lookup (info->hash, name, TRUE, copy, FALSE);
|
| 96 |
|
|
if (h == NULL)
|
| 97 |
|
|
{
|
| 98 |
|
|
if (hashp != NULL)
|
| 99 |
|
|
*hashp = NULL;
|
| 100 |
|
|
return FALSE;
|
| 101 |
|
|
}
|
| 102 |
|
|
}
|
| 103 |
|
|
|
| 104 |
|
|
if (info->notice_hash != (struct bfd_hash_table *) NULL
|
| 105 |
|
|
&& (bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE)
|
| 106 |
|
|
!= (struct bfd_hash_entry *) NULL))
|
| 107 |
|
|
{
|
| 108 |
|
|
if (! (*info->callbacks->notice) (info, name, abfd, section, value))
|
| 109 |
|
|
return FALSE;
|
| 110 |
|
|
}
|
| 111 |
|
|
|
| 112 |
|
|
if (hashp != (struct bfd_link_hash_entry **) NULL)
|
| 113 |
|
|
*hashp = h;
|
| 114 |
|
|
/* end duplication from linker.c */
|
| 115 |
|
|
|
| 116 |
|
|
if (h->type == bfd_link_hash_defined
|
| 117 |
|
|
|| h->type == bfd_link_hash_indirect)
|
| 118 |
|
|
{
|
| 119 |
|
|
asection *msec;
|
| 120 |
|
|
|
| 121 |
|
|
if (h->type == bfd_link_hash_defined)
|
| 122 |
|
|
msec = h->u.def.section;
|
| 123 |
|
|
else
|
| 124 |
|
|
msec = bfd_ind_section_ptr;
|
| 125 |
|
|
|
| 126 |
|
|
if (bfd_is_abs_section (msec) && !bfd_is_abs_section (section))
|
| 127 |
|
|
{
|
| 128 |
|
|
h->u.def.section = section;
|
| 129 |
|
|
h->u.def.value = value;
|
| 130 |
|
|
return TRUE;
|
| 131 |
|
|
}
|
| 132 |
|
|
else if (bfd_is_abs_section (section) && !bfd_is_abs_section (msec))
|
| 133 |
|
|
return TRUE;
|
| 134 |
|
|
}
|
| 135 |
|
|
}
|
| 136 |
|
|
|
| 137 |
|
|
/* If we didn't exit early, finish processing in the generic routine */
|
| 138 |
|
|
return _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
|
| 139 |
|
|
value, string, copy, collect,
|
| 140 |
|
|
hashp);
|
| 141 |
|
|
}
|