aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-03-23 04:14:46 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-03-23 04:14:46 +0000
commit81e1b023da77edb3576be645e73332a03407346c (patch)
treeb42b489d2b926754e85a31a187d72b3290975897 /bfd/elflink.c
parent1ec0126d51dac1afdf19ef609cf1b35864d73247 (diff)
downloadgdb-81e1b023da77edb3576be645e73332a03407346c.zip
gdb-81e1b023da77edb3576be645e73332a03407346c.tar.gz
gdb-81e1b023da77edb3576be645e73332a03407346c.tar.bz2
bfd/
2005-03-22 H.J. Lu <hongjiu.lu@intel.com> * bfd-in.h (_bfd_elf_provide_symbol): New. * bfd-in2.h: Regenerated. * elf32-ppc.c (set_linker_sym): Moved to elflink.c. (ppc_elf_set_sdata_syms): Call _bfd_elf_provide_symbol instead of set_linker_sym. * elflink.c (_bfd_elf_provide_symbol): New. Moved and renamed from elf32-ppc.c. ld/ 2005-03-22 H.J. Lu <hongjiu.lu@intel.com> * emultempl/elf32.em (gld${EMULATION_NAME}_provide_bound_symbols): New (gld${EMULATION_NAME}_finish): Call gld${EMULATION_NAME}_provide_bound_symbols to provide __preinit_array_start, __preinit_array_end, __init_array_start, __init_array_end, __fini_array_start and __fini_array_end. * scripttempl/elf.sc: Don't provide __preinit_array_start, __preinit_array_end, __init_array_start, __init_array_end, __fini_array_start nor __fini_array_end.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 783d9b9..9792137 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -9754,3 +9754,24 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec)
/* This is the first section with this name. Record it. */
bfd_section_already_linked_table_insert (already_linked_list, sec);
}
+
+/* Set NAME to VAL if the symbol exists and is undefined. */
+
+void
+_bfd_elf_provide_symbol (struct bfd_link_info *info, const char *name,
+ bfd_vma val)
+{
+ struct elf_link_hash_entry *h;
+ h = elf_link_hash_lookup (elf_hash_table (info), name, FALSE, FALSE,
+ FALSE);
+ if (h != NULL && h->root.type == bfd_link_hash_undefined)
+ {
+ h->root.type = bfd_link_hash_defined;
+ h->root.u.def.section = bfd_abs_section_ptr;
+ h->root.u.def.value = val;
+ h->def_regular = 1;
+ h->type = STT_OBJECT;
+ h->other = STV_HIDDEN | (h->other & ~ ELF_ST_VISIBILITY (-1));
+ h->forced_local = 1;
+ }
+}