aboutsummaryrefslogtreecommitdiff
path: root/user/lib/ld-weenix/ldtypes.h
blob: c25c3b750f383702737201056b1f383bc7c69738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 *  File: ldtypes.h
 *  Date: 12 April 1998
 *  Acct: David Powell (dep)
 *  Desc:
 *
 *
 *  Acct: Sandy Harvie (charvie)
 *  Date: 26 March 2019
 *  Desc: Modified for x86-64
 */

#ifndef _ldtypes_h_
#define _ldtypes_h_

#include "elf.h"

#define LD_ERR_EXIT 13

typedef Elf64_auxv_t auxv_t; /* linux is funky */

typedef int (*ldfunc_t)();
typedef void *ldsym_t;
typedef void (*ldinit_t)(int argc, char **argv, char **envp, auxv_t *auxv);

typedef struct ldenv_t
{
    int ld_bind_now;
    int ld_debug;
    const char *ld_preload;
    const char *ld_library_path;
} ldenv_t;

extern ldenv_t _ldenv;

typedef struct module
{
    char *name;    /* the filename                 */
    char *runpath; /* the run path to use          */

    unsigned long base; /* base address of module       */
    Elf64_Word *hash;   /* the module's hash table      */
    Elf64_Sym *dynsym;  /* the dynamic symbol table     */
    char *dynstr;       /* the dynamic string table     */

    ldfunc_t init; /* module initialization fcn.   */
    ldfunc_t fini; /* module shutdown fcn.         */

    Elf64_Rela *pltreloc; /* PLT relocations              */
    Elf64_Rela *reloc;    /* normal relocations           */

    size_t nreloc;    /* number of relocation entries */
    size_t npltreloc; /* number of relocation entries */

    struct module *next;  /* the next module in the chain */
    struct module *first; /* the first module             */
    Elf64_Addr *pltgot;   /* base of plt                  */
} module_t;

#endif /* _ldtypes.h_ */