aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-m10300.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-08-15 15:39:08 +0000
committerAlan Modra <amodra@gmail.com>2005-08-15 15:39:08 +0000
commitd98685ac81121ad2dc5acec4300d9f0833b7bd0f (patch)
treebfaa6c7f226d474b0f9176770a92d7c46795a8c2 /bfd/elf-m10300.c
parent36ae0db314931725feb8bd6958e40c46919ee6ae (diff)
downloadgdb-d98685ac81121ad2dc5acec4300d9f0833b7bd0f.zip
gdb-d98685ac81121ad2dc5acec4300d9f0833b7bd0f.tar.gz
gdb-d98685ac81121ad2dc5acec4300d9f0833b7bd0f.tar.bz2
* elf-bfd.h (_bfd_elf_define_linkage_sym): Declare.
* elflink.c (_bfd_elf_define_linkage_sym): New function, extracted from.. (_bfd_elf_create_got_section): ..here. (_bfd_elf_link_create_dynamic_sections): Call it for _DYNAMIC. (_bfd_elf_create_dynamic_sections): ..and _PROCEDURE_LINKAGE_TABLE_. * elf-m10300.c (_bfd_mn10300_elf_create_got_section): Use _bfd_elf_define_linkage_sym. * elf32-frv.c (_frv_create_got_section): Likewise. * elf64-alpha.c (elf64_alpha_create_dynamic_sections): Likewise.
Diffstat (limited to 'bfd/elf-m10300.c')
-rw-r--r--bfd/elf-m10300.c41
1 files changed, 9 insertions, 32 deletions
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 030af7e..b3f8044 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -542,7 +542,6 @@ _bfd_mn10300_elf_create_got_section (abfd, info)
flagword flags;
flagword pltflags;
asection * s;
- struct bfd_link_hash_entry * bh;
struct elf_link_hash_entry * h;
const struct elf_backend_data * bed = get_elf_backend_data (abfd);
int ptralign;
@@ -581,24 +580,12 @@ _bfd_mn10300_elf_create_got_section (abfd, info)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
- if (bed->want_plt_sym)
- {
- /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
- .plt section. */
- bh = NULL;
- if (! (_bfd_generic_link_add_one_symbol
- (info, abfd, "_PROCEDURE_LINKAGE_TABLE_", BSF_GLOBAL, s,
- (bfd_vma) 0, (const char *) NULL, FALSE,
- get_elf_backend_data (abfd)->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->def_regular = 1;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
- }
+ /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the
+ .plt section. */
+ if (bed->want_plt_sym
+ && !_bfd_elf_define_linkage_sym (abfd, info, s,
+ "_PROCEDURE_LINKAGE_TABLE_"))
+ return FALSE;
s = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL
@@ -617,20 +604,10 @@ _bfd_mn10300_elf_create_got_section (abfd, info)
(or .got.plt) section. We don't do this in the linker script
because we don't want to define the symbol if we are not creating
a global offset table. */
- bh = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- 0, (const char *) NULL, FALSE, bed->collect, &bh)))
- return FALSE;
- h = (struct elf_link_hash_entry *) bh;
- h->def_regular = 1;
- h->type = STT_OBJECT;
-
- if (info->shared
- && ! bfd_elf_link_record_dynamic_symbol (info, h))
- return FALSE;
-
+ h = _bfd_elf_define_linkage_sym (abfd, info, s, "_GLOBAL_OFFSET_TABLE_");
elf_hash_table (info)->hgot = h;
+ if (h == NULL)
+ return FALSE;
/* The first bit of the global offset table is the header. */
s->size += bed->got_header_size;