/* linker.c -- BFD linker routines
- Copyright (C) 1993-2018 Free Software Foundation, Inc.
+ Copyright (C) 1993-2019 Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
This file is part of BFD, the Binary File Descriptor library.
/* Look up a symbol in a link hash table. If follow is TRUE, we
follow bfd_link_hash_indirect and bfd_link_hash_warning links to
- the real symbol. */
+ the real symbol.
+
+.{* Return TRUE if the symbol described by a linker hash entry H
+. is going to be absolute. Linker-script defined symbols can be
+. converted from absolute to section-relative ones late in the
+. link. Use this macro to correctly determine whether the symbol
+. will actually end up absolute in output. *}
+.#define bfd_is_abs_symbol(H) \
+. (((H)->type == bfd_link_hash_defined \
+. || (H)->type == bfd_link_hash_defweak) \
+. && bfd_is_abs_section ((H)->u.def.section) \
+. && !(H)->rel_from_abs)
+.
+*/
struct bfd_link_hash_entry *
bfd_link_hash_lookup (struct bfd_link_hash_table *table,
{
struct bfd_link_hash_entry *ret;
+ if (table == NULL || string == NULL)
+ return NULL;
+
ret = ((struct bfd_link_hash_entry *)
bfd_hash_lookup (&table->table, string, create, copy));
continue;
}
+ if (arsym->name == NULL)
+ goto error_return;
+
h = bfd_link_hash_lookup (info->hash, arsym->name,
FALSE, FALSE, TRUE);
&& name[1] == '_'
&& strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
_bfd_error_handler
- (_("%B: plugin needed to handle lto object"), abfd);
+ (_("%pB: plugin needed to handle lto object"), abfd);
}
else
row = DEF_ROW;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%B: indirect symbol `%s' to `%s' is a loop"),
+ (_("%pB: indirect symbol `%s' to `%s' is a loop"),
abfd, name, string);
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
difficult, and sometimes impossible. */
_bfd_error_handler
/* xgettext:c-format */
- (_("Attempt to do relocatable link with %s input and %s output"),
+ (_("attempt to do relocatable link with %s input and %s output"),
bfd_get_target (input_bfd), bfd_get_target (output_bfd));
bfd_set_error (bfd_error_wrong_format);
return FALSE;
case SEC_LINK_DUPLICATES_ONE_ONLY:
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: ignoring duplicate section `%A'\n"),
+ (_("%pB: ignoring duplicate section `%pA'\n"),
sec->owner, sec);
break;
else if (sec->size != l->sec->size)
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: duplicate section `%A' has different size\n"),
+ (_("%pB: duplicate section `%pA' has different size\n"),
sec->owner, sec);
break;
else if (sec->size != l->sec->size)
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: duplicate section `%A' has different size\n"),
+ (_("%pB: duplicate section `%pA' has different size\n"),
sec->owner, sec);
else if (sec->size != 0)
{
if (!bfd_malloc_and_get_section (sec->owner, sec, &sec_contents))
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: could not read contents of section `%A'\n"),
+ (_("%pB: could not read contents of section `%pA'\n"),
sec->owner, sec);
else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
&l_sec_contents))
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: could not read contents of section `%A'\n"),
+ (_("%pB: could not read contents of section `%pA'\n"),
l->sec->owner, l->sec);
else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
info->callbacks->einfo
/* xgettext:c-format */
- (_("%B: duplicate section `%A' has different contents\n"),
+ (_("%pB: duplicate section `%pA' has different contents\n"),
sec->owner, sec);
if (sec_contents)
/* Make sure the section is allocated in memory, and make sure that
it is no longer a common section. */
section->flags |= SEC_ALLOC;
- section->flags &= ~SEC_IS_COMMON;
+ section->flags &= ~(SEC_IS_COMMON | SEC_HAS_CONTENTS);
return TRUE;
}
+/*
+FUNCTION
+ _bfd_generic_link_hide_symbol
+
+SYNOPSIS
+ void _bfd_generic_link_hide_symbol
+ (bfd *output_bfd, struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h);
+
+DESCRIPTION
+ Hide symbol @var{h}.
+ This is an internal function. It should not be called from
+ outside the BFD library.
+
+.#define bfd_link_hide_symbol(output_bfd, info, h) \
+. BFD_SEND (output_bfd, _bfd_link_hide_symbol, (output_bfd, info, h))
+.
+*/
+
+void
+_bfd_generic_link_hide_symbol (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ struct bfd_link_hash_entry *h ATTRIBUTE_UNUSED)
+{
+}
+
/*
FUNCTION
bfd_generic_define_start_stop
&& obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
{
if (bfd_big_endian (ibfd))
- _bfd_error_handler (_("%B: compiled for a big endian system "
+ _bfd_error_handler (_("%pB: compiled for a big endian system "
"and target is little endian"), ibfd);
else
- _bfd_error_handler (_("%B: compiled for a little endian system "
+ _bfd_error_handler (_("%pB: compiled for a little endian system "
"and target is big endian"), ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;