- Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1992, 1993, 1994, 1995, 1996, 1997, 2001, 2002, 2003
+ Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#define MY(OP) CAT(i386linux_,OP)
+
+/* Do not "beautify" the CONCAT* macro args. Traditional C will not
+ remove whitespace added here, and thus will fail to concatenate
+ the tokens. */
+#define MY(OP) CONCAT2 (i386linux_,OP)
/* We always generate QMAGIC files in preference to ZMAGIC files. It
would be possible to make this a linker option, if that ever
becomes important. */
static void MY_final_link_callback
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
/* We always generate QMAGIC files in preference to ZMAGIC files. It
would be possible to make this a linker option, if that ever
becomes important. */
static void MY_final_link_callback
PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *));
i386linux_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
i386linux_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
linked file. The linker generated fixup table should also be added
to the list, and it should always appear in the second slot (the
first one is a dummy with a magic number that is defined in
linked file. The linker generated fixup table should also be added
to the list, and it should always appear in the second slot (the
first one is a dummy with a magic number that is defined in
static struct fixup *new_fixup
PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
bfd_vma, int));
static struct fixup *new_fixup
PARAMS ((struct bfd_link_info *, struct linux_link_hash_entry *,
bfd_vma, int));
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *,
- bfd_vma, const char *, boolean, boolean,
+ bfd_vma, const char *, bfd_boolean, bfd_boolean,
PARAMS ((bfd *, struct bfd_link_info *));
/* Routine to create an entry in an Linux link hash table. */
PARAMS ((bfd *, struct bfd_link_info *));
/* Routine to create an entry in an Linux link hash table. */
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
linux_link_hash_newfunc))
{
if (! NAME(aout,link_hash_table_init) (&ret->root, abfd,
linux_link_hash_newfunc))
{
#define linux_link_hash_traverse(table, func, info) \
(aout_link_hash_traverse \
(&(table)->root, \
#define linux_link_hash_traverse(table, func, info) \
(aout_link_hash_traverse \
(&(table)->root, \
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
}
/* Function to add a single symbol to the linker hash table. This is
a wrapper around _bfd_generic_link_add_one_symbol which handles the
tweaking needed for dynamic linking support. */
}
/* Function to add a single symbol to the linker hash table. This is
a wrapper around _bfd_generic_link_add_one_symbol which handles the
tweaking needed for dynamic linking support. */
linux_add_one_symbol (info, abfd, name, flags, section, value, string,
copy, collect, hashp)
struct bfd_link_info *info;
linux_add_one_symbol (info, abfd, name, flags, section, value, string,
copy, collect, hashp)
struct bfd_link_info *info;
/* Look up and see if we already have this symbol in the hash table.
If we do, and the defining entry is from a shared library, we
/* Look up and see if we already have this symbol in the hash table.
If we do, and the defining entry is from a shared library, we
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
{
if (! linux_link_create_dynamic_sections (abfd, info))
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
{
if (! linux_link_create_dynamic_sections (abfd, info))
- h = linux_link_hash_lookup (linux_hash_table (info), name, false,
- false, false);
+ h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
+ FALSE, FALSE);
f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
if (f == NULL)
f = new_fixup (info, h, value, ! IS_PLT_SYM (name));
if (f == NULL)
if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
value, string, copy, collect,
hashp))
if (! _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section,
value, string, copy, collect,
hashp))
if (! (_bfd_generic_link_add_one_symbol
(info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
if (! (_bfd_generic_link_add_one_symbol
(info, linux_hash_table (info)->dynobj, SHARABLE_CONFLICTS,
- BSF_GLOBAL | BSF_CONSTRUCTOR, s, 0, NULL, false, false, NULL)))
- return false;
+ BSF_GLOBAL | BSF_CONSTRUCTOR, s, (bfd_vma) 0, NULL,
+ FALSE, FALSE, NULL)))
+ return FALSE;
linux_tally_symbols (h, data)
struct linux_link_hash_entry *h;
PTR data;
linux_tally_symbols (h, data)
struct linux_link_hash_entry *h;
PTR data;
if (h->root.root.type == bfd_link_hash_undefined
&& strncmp (h->root.root.root.string, NEEDS_SHRLIB,
if (h->root.root.type == bfd_link_hash_undefined
&& strncmp (h->root.root.root.string, NEEDS_SHRLIB,
h1 = linux_link_hash_lookup (linux_hash_table (info),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
h1 = linux_link_hash_lookup (linux_hash_table (info),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
(h->root.root.root.string
+ sizeof PLT_REF_PREFIX - 1),
/* The real symbol must exist but if it is also an ABS symbol,
there is no need to have a fixup. This is because they both
/* The real symbol must exist but if it is also an ABS symbol,
there is no need to have a fixup. This is because they both
involving this symbol. If so, convert it to a regular
fixup. In the end, this relaxes some of the requirements
about the order of performing fixups. */
involving this symbol. If so, convert it to a regular
fixup. In the end, this relaxes some of the requirements
about the order of performing fixups. */
/* Quick and dirty way of stripping these symbols from the
symtab. */
if (bfd_is_abs_section (h->root.root.u.def.section))
/* Quick and dirty way of stripping these symbols from the
symtab. */
if (bfd_is_abs_section (h->root.root.u.def.section))
/* First find the fixups... */
linux_link_hash_traverse (linux_hash_table (info),
linux_tally_symbols,
/* First find the fixups... */
linux_link_hash_traverse (linux_hash_table (info),
linux_tally_symbols,
- s->_raw_size = 8 + linux_hash_table (info)->fixup_count * 8;
- s->contents = (bfd_byte *) bfd_alloc (output_bfd, s->_raw_size);
+ s->_raw_size = linux_hash_table (info)->fixup_count + 1;
+ s->_raw_size *= 8;
+ s->contents = (bfd_byte *) bfd_zalloc (output_bfd, s->_raw_size);
}
/* We come here once we are ready to actually write the fixup table to
the output file. Scan the fixup tables and so forth and generate
the stuff we need. */
}
/* We come here once we are ready to actually write the fixup table to
the output file. Scan the fixup tables and so forth and generate
the stuff we need. */
linux_finish_dynamic_link (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
linux_finish_dynamic_link (output_bfd, info)
bfd *output_bfd;
struct bfd_link_info *info;
os->filepos + s->output_offset,
os->vma + s->output_offset);
#endif
fixup_table = s->contents;
os->filepos + s->output_offset,
os->vma + s->output_offset);
#endif
fixup_table = s->contents;
- bfd_put_32 (output_bfd, linux_hash_table (info)->fixup_count, fixup_table);
+ bfd_put_32 (output_bfd,
+ (bfd_vma) linux_hash_table (info)->fixup_count, fixup_table);
- /* FIXME! */
- fprintf (stderr,
- "Symbol %s not defined for fixups\n",
- f->h->root.root.root.string);
+ (*_bfd_error_handler)
+ (_("Symbol %s not defined for fixups\n"),
+ f->h->root.root.root.string);
- new_addr = new_addr - (f->value + 5);
- bfd_put_32 (output_bfd, new_addr, fixup_table);
+ new_addr = new_addr - (f->value + 5);
+ bfd_put_32 (output_bfd, (bfd_vma) new_addr, fixup_table);
if (linux_hash_table (info)->local_builtins != 0)
{
/* Special marker so we know to switch to the other type of fixup */
if (linux_hash_table (info)->local_builtins != 0)
{
/* Special marker so we know to switch to the other type of fixup */
- /* FIXME! */
- fprintf (stderr,
- "Symbol %s not defined for fixups\n",
- f->h->root.root.root.string);
+ (*_bfd_error_handler)
+ (_("Symbol %s not defined for fixups\n"),
+ f->h->root.root.root.string);
- if (bfd_write ((PTR) s->contents, 1, s->_raw_size, output_bfd)
- != s->_raw_size)
- return false;
+ if (bfd_bwrite ((PTR) s->contents, s->_raw_size, output_bfd) != s->_raw_size)
+ return FALSE;