8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sgs / librtld / common / _librtld.h
blob3eba7af6297d18f068b31717c0806d65a0373716
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __LIBRTLD_H
28 #define __LIBRTLD_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <libelf.h>
33 #include <rtld.h>
34 #include <machdep.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
42 * Define a cache structure that is used to retain all elf section information.
44 typedef struct cache {
45 int c_flags;
46 Elf_Scn *c_scn;
47 Shdr *c_shdr;
48 Elf_Data *c_data;
49 char *c_name;
50 void *c_info;
51 } Cache;
53 #define FLG_C_EXCLUDE 1 /* exclude section from output image */
54 #define FLG_C_HEAP 2 /* heap section (addition) */
55 #define FLG_C_RELOC 3 /* relocation section requiring */
56 /* modification */
57 #define FLG_C_SHSTR 4 /* section header string table */
58 #define FLG_C_END 5 /* null terminating section marker */
62 * Define a structure for maintaining relocation information. During the first
63 * pass through an input files relocation records, counts are maintained of the
64 * number of relocations to recreate in the output image. The intent is to
65 * localize any remaining relocation records. The relocation structure
66 * indicates the actions that must be performed on the output images relocation
67 * information.
69 typedef struct reloc {
70 int r_flags;
71 Xword r_pltndx; /* pltndx if a JMP relocation */
72 Addr r_value; /* value to apply to relocation */
73 unsigned long r_size; /* size (used for copy relocations) */
74 const char *r_name; /* relocation symbol */
75 } Reloc;
77 #define FLG_R_UNDO 0x01 /* undo any relocation offset value */
78 #define FLG_R_CLR 0x02 /* clear the relocation record */
79 #define FLG_R_INC 0x04 /* increment the relocation offset */
80 /* (uses new fixed addr) */
81 #define FLG_R_APPLY 0x08 /* apply the relocation */
85 * Define any local prototypes.
87 extern void apply_reloc(void *, Reloc *, const char *, uchar_t *, Rt_map *);
88 extern void clear_reloc(void *);
89 extern int count_reloc(Cache *, Cache *, Rt_map *, int, Addr, Xword *,
90 Xword *, Xword *, Alist *);
91 extern void inc_reloc(void *, void *, Reloc *, uchar_t *, uchar_t *);
92 extern int syminfo(Cache *, Alist **);
93 extern void undo_reloc(void *, uchar_t *, uchar_t *, Reloc *);
94 extern int update_dynamic(Cache *, Cache *, Rt_map *, int, Addr, Off,
95 const char *, Xword, Xword, Xword, Xword, Xword);
96 extern void update_reloc(Cache *, Cache *, Cache *, const char *,
97 Rt_map *, Rel **, Rel **, Rel **);
98 extern void update_sym(Cache *, Cache *, Addr, Half, Addr);
100 #ifdef __cplusplus
102 #endif
104 #endif /* __LIBRTLD_H */