summaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2001-08-08 13:09:33 +0000
committerAlan Modra <amodra@bigpond.net.au>2001-08-08 13:09:33 +0000
commit4418671b0dc1d2f0ebe877fa99e124a4a1d7b686 (patch)
tree46780526f7fca7ec18dea9a7cbe6426dedbfab98 /bfd/elflink.c
parent4c18db9ddd9de813c07552e95908bcafe05cf7e2 (diff)
downloadgdb-4418671b0dc1d2f0ebe877fa99e124a4a1d7b686.tar.gz
* elf-bfd.h (struct elf_backend_data): Add want_got_sym.
* elfxx-target.h (elf_backend_want_got_sym): Define. (elfNN_bed): Add elf_backend_want_got_sym. * elflink.c (_bfd_elf_create_got_section): Define _GLOBAL_OFFSET_TABLE_ only if bed->want_got_sym.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index b971311d155..f06a49b2efa 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -73,24 +73,27 @@ _bfd_elf_create_got_section (abfd, info)
return false;
}
- /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
- (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. */
- h = NULL;
- if (!(_bfd_generic_link_add_one_symbol
- (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
- bed->got_symbol_offset, (const char *) NULL, false,
- bed->collect, (struct bfd_link_hash_entry **) &h)))
- return false;
- h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
- h->type = STT_OBJECT;
+ if (bed->want_got_sym)
+ {
+ /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got
+ (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. */
+ h = NULL;
+ if (!(_bfd_generic_link_add_one_symbol
+ (info, abfd, "_GLOBAL_OFFSET_TABLE_", BSF_GLOBAL, s,
+ bed->got_symbol_offset, (const char *) NULL, false,
+ bed->collect, (struct bfd_link_hash_entry **) &h)))
+ return false;
+ h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR;
+ h->type = STT_OBJECT;
- if (info->shared
- && ! _bfd_elf_link_record_dynamic_symbol (info, h))
- return false;
+ if (info->shared
+ && ! _bfd_elf_link_record_dynamic_symbol (info, h))
+ return false;
- elf_hash_table (info)->hgot = h;
+ elf_hash_table (info)->hgot = h;
+ }
/* The first bit of the global offset table is the header. */
s->_raw_size += bed->got_header_size + bed->got_symbol_offset;