2 Handle indirect symbols.
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 look up the symbol which this one dereferneces,
7 and stop if they are the same. If they are not the same, copy all
8 the information from the current to the dereffed symbol. Set the
9 indirect bit in the flag. From now on the ldsym_get stuff will
10 perform the indirection for us, at no charge.
24 DEFUN(move_it,(a_list, b_list),
28 asymbol **head = a_list;
29 asymbol **cursor = head;
31 if (a_list == 0) return b_list;
32 if (b_list == 0) return a_list;
35 asymbol *ptr = cursor[0];
36 asymbol **next = (asymbol **)(ptr->udata);
38 ptr->udata = (PTR) b_list;
46 DEFUN(add_indirect,(ptr),
49 ldsym_type *lgs = ldsym_get((*ptr)->name);
50 ldsym_type *new = ldsym_get(((asymbol *)((*ptr)->value))->name);
52 /* If the mapping has already been done, stop now */
53 if (lgs == new) return;
54 lgs->flags |= SYM_INDIRECT;
56 new->scoms_chain = move_it(new->scoms_chain, lgs->scoms_chain);
58 new->srefs_chain = move_it(new->srefs_chain, lgs->srefs_chain);
60 new->sdefs_chain = move_it(new->sdefs_chain, lgs->sdefs_chain);
63 lgs->sdefs_chain = (asymbol **)new;