Initial revision
[deliverable/binutils-gdb.git] / ld / ldindr.c
1 /* ldindr.c
2 Handle indirect symbols.
3
4 BFD supplies symbols to be indirected with the BFD_INDIRECT bit
5 set. Whenever the linker gets one of these, it calls add_indirect
6 with the symbol. We create an entry into the ldsym hash table as if it
7 were a normal symbol, but with the SYM_INDIRECT bit set in the
8 flags.
9
10 When it comes time to tie up the symbols at a later date, the flag
11 will be seen and a call made to do the right thing (tm)
12
13 */
14
15
16
17 #include "sysdep.h"
18 #include "bfd.h"
19 #include "ld.h"
20 #include "ldsym.h"
21
22 extern ld_config_type config;
23 void
24 DEFUN(add_indirect,(ptr),
25 asymbol **ptr)
26 {
27 if (config.relocateable_output == false) {
28 ldsym_type *sp = ldsym_get((*ptr)->name);
29 sp->flags |= SYM_INDIRECT;
30 sp->sdefs_chain = ptr;
31 }
32 }
33
34
35
36 void
37 DEFUN(do_indirect,(ptr),
38 ldsym_type *ptr)
39 {
40 if (config.relocateable_output == false) {
41 /* Dig out the symbol were indirecting to. It's held in the value
42 field.
43 */
44
45
46 CONST char *name = ((asymbol *)(*(ptr->sdefs_chain))->value)->name;
47
48 ldsym_type *new = ldsym_get(name);
49
50 /* We have to make a copy of the sdefs_chain item name, since
51 symbols will be clobbered on writing, and we want to write the
52 same string twice */
53
54
55 ptr->sdefs_chain[0][0] = new->sdefs_chain[0][0];
56 ptr->sdefs_chain[0][0].name = name;
57 }
58 }
This page took 0.031077 seconds and 5 git commands to generate.