aboutsummaryrefslogtreecommitdiff
path: root/ld/ldindr.c
diff options
context:
space:
mode:
authorSteve Chamberlain <steve@cygnus>1991-08-01 23:29:03 +0000
committerSteve Chamberlain <steve@cygnus>1991-08-01 23:29:03 +0000
commit812df84bc9a1e56f09663dc70a2725a643525d1d (patch)
tree778a713347a4de28ab2870f19dba1ea7d39e51b5 /ld/ldindr.c
parent7bfa94e296e984df8440f7af6d1764d27016bbc8 (diff)
downloadgdb-812df84bc9a1e56f09663dc70a2725a643525d1d.zip
gdb-812df84bc9a1e56f09663dc70a2725a643525d1d.tar.gz
gdb-812df84bc9a1e56f09663dc70a2725a643525d1d.tar.bz2
Initial revision
Diffstat (limited to 'ld/ldindr.c')
-rw-r--r--ld/ldindr.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/ld/ldindr.c b/ld/ldindr.c
new file mode 100644
index 0000000..8e19842
--- /dev/null
+++ b/ld/ldindr.c
@@ -0,0 +1,58 @@
+/* ldindr.c
+ Handle indirect symbols.
+
+ BFD supplies symbols to be indirected with the BFD_INDIRECT bit
+ set. Whenever the linker gets one of these, it calls add_indirect
+ with the symbol. We create an entry into the ldsym hash table as if it
+ were a normal symbol, but with the SYM_INDIRECT bit set in the
+ flags.
+
+ When it comes time to tie up the symbols at a later date, the flag
+ will be seen and a call made to do the right thing (tm)
+
+*/
+
+
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "ld.h"
+#include "ldsym.h"
+
+extern ld_config_type config;
+void
+DEFUN(add_indirect,(ptr),
+asymbol **ptr)
+{
+ if (config.relocateable_output == false) {
+ ldsym_type *sp = ldsym_get((*ptr)->name);
+ sp->flags |= SYM_INDIRECT;
+ sp->sdefs_chain = ptr;
+ }
+}
+
+
+
+void
+DEFUN(do_indirect,(ptr),
+ldsym_type *ptr)
+{
+if (config.relocateable_output == false) {
+ /* Dig out the symbol were indirecting to. It's held in the value
+ field.
+ */
+
+
+ CONST char *name = ((asymbol *)(*(ptr->sdefs_chain))->value)->name;
+
+ ldsym_type *new = ldsym_get(name);
+
+ /* We have to make a copy of the sdefs_chain item name, since
+ symbols will be clobbered on writing, and we want to write the
+ same string twice */
+
+
+ ptr->sdefs_chain[0][0] = new->sdefs_chain[0][0];
+ ptr->sdefs_chain[0][0].name = name;
+}
+}