dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / elfwrap / common / _elfwrap.h
blobb53ffcf07af435195760e44ce2daffa1989ecd7e
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 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef __ELFWRAP_H
28 #define __ELFWRAP_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * Local include file for elfwrap.
35 #include <libelf.h>
36 #include <alist.h>
37 #include <_machelf.h>
40 * Define a target descriptor to hold target specific information.
42 typedef struct {
43 uchar_t td_class; /* target class (32-bit/64-bit) */
44 uchar_t td_data; /* target data (LSB/MSB) */
45 ushort_t td_mach; /* target machine (sparc, i386, etc.) */
46 size_t td_align; /* target data buffer alignment */
47 size_t td_symsz; /* target symbol table entry size */
48 } TargDesc_t;
51 * Define a descriptor for each ELF section being output to the new file.
53 typedef struct {
54 const char *os_name; /* section name */
55 Word os_type; /* section type */
56 Xword os_flags; /* section flags */
57 size_t os_ndx; /* section index (input file) */
58 off_t os_size; /* section size (input file) */
59 void *os_addr; /* section address (input file) */
60 Shdr *os_shdr; /* section header (output file) */
61 Elf_Data *os_data; /* section data (output file) */
62 } OutSec_t;
64 #define AL_CNT_WOSECS 10 /* default number of input sections */
67 * Define a standard section descriptor.
69 typedef struct {
70 const char *ss_name; /* section name */
71 Word ss_type; /* section type */
72 Xword ss_flags; /* section flags */
73 } StdSec_t;
76 * Define a descriptor to maintain section information.
78 typedef struct {
79 Alist *od_outsecs; /* list of output sections */
80 size_t od_symtabno; /* number of symbol table entries */
81 size_t od_strtabsz; /* string table size */
82 size_t od_shstrtabsz; /* section header string table size */
83 } ObjDesc_t;
86 * Define all external interfaces.
88 extern int input32(int, char **, const char *, const char *, ObjDesc_t *);
89 extern int input64(int, char **, const char *, const char *, ObjDesc_t *);
90 extern int output32(const char *, int, const char *, ushort_t,
91 ObjDesc_t *);
92 extern int output64(const char *, int, const char *, ushort_t,
93 ObjDesc_t *);
95 #if defined(lint)
96 extern void target_init(TargDesc_t *);
97 #else
98 extern void target_init_sparc(TargDesc_t *);
99 extern void target_init_sparcv9(TargDesc_t *);
100 extern void target_init_i386(TargDesc_t *);
101 extern void target_init_amd64(TargDesc_t *);
102 #endif
104 #ifdef __cplusplus
105 extern "C" {
106 #endif
108 #ifdef __cplusplus
110 #endif
112 #endif /* __ELFWRAP_H */