More changes to bring FreeBSD in sync with Paul K's latest.
[unix-history] / gnu / usr.bin / ld / rtld / md-prologue.c
CommitLineData
1136f72d
PR
1/*
2 * rtld entry pseudo code - turn into assembler and tweak it
3 */
4
5#include <sys/types.h>
6#include <sys/types.h>
7#include <a.out.h>
8#include "link.h"
9#include "md.h"
10
11extern long _GOT_[];
12extern void (*rtld)();
13extern void (*binder())();
14
15void
16rtld_entry(version, crtp)
17int version;
18struct crt *crtp;
19{
20 register struct link_dynamic *dp;
21 register void (*f)();
22
23 /* __DYNAMIC is first entry in GOT */
24 dp = (struct link_dynamic *) (_GOT_[0]+crtp->crt_ba);
25
26 f = (void (*)())((long)rtld + crtp->crt_ba);
27 (*f)(version, crtp, dp);
28}
29
30void
31binder_entry()
32{
33 extern int PC;
34 struct jmpslot *sp;
35 void (*func)();
36
37 func = binder(PC, sp->reloc_index & 0x003fffff);
38 (*func)();
39}