1 /* On-demand PLT fixup for shared objects. Stub version.
2 Copyright (C) 1995 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
21 #include "dynamic-link.h"
23 /* This function is not called in the normal way. The PLT jumps here, not
26 _dl_runtime_resolve ()
28 struct link_map
*l
= ???;
29 Elf32_Word reloc_offset
= ???;
31 const Elf32_Sym
*const symtab
32 = (const Elf32_Sym
*) l
->l_info
[DT_SYMTAB
]->d_un
.d_ptr
;
34 = ((void *) l
->l_addr
+ l
->l_info
[DT_STRTAB
]->d_un
.d_ptr
);
36 const Elf32_Rel
*const reloc
= (void *) (l
->l_info
[DT_JMPREL
]->d_un
.d_ptr
39 const Elf32_Sym
*definer
;
41 struct link_map
*scope
, *real_next
;
43 /* Look up the symbol's run-time value. */
45 real_next
= l
->l_next
;
46 if (l
->l_info
[DT_SYMBOLIC
])
48 l
->l_prev
->l_next
= real_next
;
49 l
->l_next
= _dl_loaded
;
55 definer
= &symtab
[ELF32_R_SYM (reloc
->r_info
)];
56 loadbase
= _dl_lookup_symbol (strtab
+ definer
->st_name
, &definer
, scope
);
58 /* Restore list frobnication done above for DT_SYMBOLIC. */
59 l
->l_next
= real_next
;
60 l
->l_prev
->l_next
= l
;
62 /* Apply the relocation with that value. */
63 elf_machine_rel (l
->l_addr
, l
->l_info
, reloc
, loadbase
, definer
);