aboutsummaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-10-26 16:32:34 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-26 16:32:55 -0700
commit7b7e7f1da28585cfa49cbced50dbbd75a143cd20 (patch)
tree92bc4519ea2dc65f76bd4d2d8280c3857ef55d42 /bfd/linker.c
parent0fde2c536bc483baa4baa2990ebebfb3a7c00415 (diff)
downloadgdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.zip
gdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.tar.gz
gdb-7b7e7f1da28585cfa49cbced50dbbd75a143cd20.tar.bz2
Check symbol defined by assignment in linker script
Symbol symbol defined by an assignment in a linker script has type bfd_link_hash_new. elf_i386_convert_load and elf_x86_64_convert_load should check bfd_link_hash_new to see if a symbol is defined by a linker script. bfd/ PR ld/19175 * elf32-i386.c (elf_i386_convert_load): Check bfd_link_hash_new instead of calling bfd_link_get_defined_symbol. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. Skip relocation overflow for bfd_link_hash_new. * linker.c (bfd_link_get_defined_symbol): Removed. * bfd-in2.h: Regenerated. ld/testsuite/ PR ld/19175 * ld-i386/i386.exp: Run pr19175. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pr19175.d: New file. * ld-i386/pr19175.s: Likewise. * ld-i386/pr19175.t: Likewise. * ld-x86-64/pr19175.d: Likewise. * ld-x86-64/pr19175.s: Likewise. * ld-x86-64/pr19175.t: Likewise.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c89
1 files changed, 0 insertions, 89 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index f2290e0..86a7a19 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3303,92 +3303,3 @@ bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs,
bfd_find_version_for_sym (verdefs, sym_name, &hidden);
return hidden;
}
-
-/*
-FUNCTION
- bfd_link_get_defined_symbol
-
-SYNOPSIS
- bfd_boolean bfd_link_get_defined_symbol
- (struct bfd_link_info *info, struct bfd_link_hash_entry *h,
- asection **sec, bfd_vma *value);
-
-DESCRIPTION
- Return TRUE, store symbol section and value in @var{*sec} and
- @var{*value} if symbol @var{h} is defined during a final link.
-*/
-
-bfd_boolean
-bfd_link_get_defined_symbol (struct bfd_link_info *info,
- struct bfd_link_hash_entry *h,
- asection **sec, bfd_vma *value)
-{
- if (h->type == bfd_link_hash_defined
- || h->type == bfd_link_hash_defweak)
- {
- if (sec)
- *sec = h->u.def.section;
- if (value)
- *value = h->u.def.value;
- return TRUE;
- }
-
- if (h->type == bfd_link_hash_new
- || h->type == bfd_link_hash_undefined
- || h->type == bfd_link_hash_undefweak)
- {
- /* Check yet undefined reference to __start_XXX or __stop_XXX
- symbols. The linker will later define such symbols for output
- sections that have a name representable as a C identifier. */
- const char *sec_name;
- if (strncmp (h->root.string, "__start_", 8) == 0)
- sec_name = h->root.string + 8;
- else if (strncmp (h->root.string, "__stop_", 7) == 0)
- sec_name = h->root.string + 7;
- else
- sec_name = NULL;
-
- if (sec_name != NULL && *sec_name != '\0')
- {
- bfd *i;
-
- for (i = info->input_bfds; i != NULL; i = i->link.next)
- {
- asection *s = bfd_get_section_by_name (i, sec_name);
- if (s != NULL)
- {
- asection *asect;
- bfd_vma size;
-
- if (sec)
- *sec = s;
-
- if (!value)
- return TRUE;
- if (sec_name == (h->root.string + 8))
- {
- /* Set __start_XXX symbol value. */
- *value = 0;
- return TRUE;
- }
-
- /* Get the size of the output XXX section for
- __stop_XXX symbol value. */
- size = 0;
- for (asect = s->output_section->map_head.s;
- asect != NULL;
- asect = asect->map_head.s)
- {
- size = align_power (size, asect->alignment_power);
- size += asect->size;
- }
-
- *value = size;
- return TRUE;
- }
- }
- }
- }
-
- return FALSE;
-}