aboutsummaryrefslogtreecommitdiff
path: root/src/backend/port/dynloader/ultrix4.h
blob: 5cd9754d2d27ac8ce208252b70faf48c835bc38b (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*-------------------------------------------------------------------------
 *
 * dl.h
 *
 *
 *
 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/backend/port/dynloader/ultrix4.h
 *
 *-------------------------------------------------------------------------
 */
/*
 *	Ultrix 4.x Dynamic Loader Library Version 1.0
 *
 *	dl.h
 *		header file for the Dynamic Loader Library
 */
#ifndef _DL_HEADER_
#define _DL_HEADER_

#include <stdio.h>
#include "filehdr.h"
#include "syms.h"
#include "ldfcn.h"
#include "reloc.h"
#include "scnhdr.h"


typedef long CoreAddr;


typedef struct ScnInfo
{
	CoreAddr	addr;			/* starting address of the section */
	SCNHDR		hdr;			/* section header */
	RELOC	   *relocEntries;	/* relocation entries */
}	ScnInfo;

typedef enum
{
	DL_NEEDRELOC,				/* still need relocation */
	DL_RELOCATED,				/* no relocation necessary */
	DL_INPROG					/* relocation in progress */
}	dlRStatus;

typedef struct JmpTbl
{
	char	   *block;			/* the jump table memory block */
	struct JmpTbl *next;		/* next block */
}	JmpTbl;

typedef struct dlFile
{
	char	   *filename;		/* file name of the object file */

	int			textSize;		/* used by mprotect */
	CoreAddr	textAddress;	/* start addr of text section */
	long		textVaddr;		/* vaddr of text section in obj file */
	CoreAddr	rdataAddress;	/* start addr of rdata section */
	long		rdataVaddr;		/* vaddr of text section in obj file */
	CoreAddr	dataAddress;	/* start addr of data section */
	long		dataVaddr;		/* vaddr of text section in obj file */
	CoreAddr	bssAddress;		/* start addr of bss section */
	long		bssVaddr;		/* vaddr of text section in obj file */

	int			nsect;			/* number of sections */
	ScnInfo    *sect;			/* details of each section (array) */

	int			issExtMax;		/* size of string space */
	char	   *extss;			/* extern sym string space (in core) */
	int			iextMax;		/* maximum number of Symbols */
	pEXTR		extsyms;		/* extern syms */

	dlRStatus	relocStatus;	/* what relocation needed? */
	int			needReloc;

	JmpTbl	   *jmptable;		/* the jump table for R_JMPADDR */

	struct dlFile *next;		/* next member of the archive */
}	dlFile;

typedef struct dlSymbol
{
	char	   *name;			/* name of the symbol */
	long		addr;			/* address of the symbol */
	dlFile	   *objFile;		/* from which file */
}	dlSymbol;

/*
 * prototypes for the dl* interface
 */
extern void *dl_open( /* char *filename, int mode */ );
extern void *dl_sym( /* void *handle, char *name */ );
extern void dl_close( /* void *handle */ );
extern char *dl_error( /* void */ );

#define   DL_LAZY		0		/* lazy resolution */
#define   DL_NOW		1		/* immediate resolution */

/*
 * Miscellaneous utility routines:
 */
extern char **dl_undefinedSymbols( /* int *count */ );
extern void dl_printAllSymbols( /* void *handle */ );
extern void dl_setLibraries( /* char *libs */ );

#endif   /* _DL_HEADER_ */