elfhdr.h revision 76224
1273380Sbr/*
2273380Sbr * Copyright (c) 1999 Global Technology Associates, Inc.
3273380Sbr * All rights reserved.
4273380Sbr *
5273380Sbr * Redistribution and use in source and binary forms, with or without
6273380Sbr * modification, are permitted provided that the following conditions
7273380Sbr * are met:
8273380Sbr * 1. Redistributions of source code must retain the above copyright
9273380Sbr *    notice, this list of conditions and the following disclaimer.
10273380Sbr * 2. Redistributions in binary form must reproduce the above copyright
11273380Sbr *    notice, this list of conditions and the following disclaimer in the
12273380Sbr *    documentation and/or other materials provided with the distribution.
13273380Sbr *
14273380Sbr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND
15273380Sbr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16273380Sbr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17273380Sbr * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
18273380Sbr * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
19273380Sbr * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
20273380Sbr * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21273380Sbr * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22273380Sbr * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23273380Sbr * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24273380Sbr * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25273380Sbr *
26273380Sbr * $FreeBSD: head/usr.sbin/kgzip/elfhdr.h 76224 2001-05-02 23:56:21Z obrien $
27273380Sbr */
28273380Sbr
29273380Sbr#include <sys/types.h>
30273380Sbr#include <machine/elf.h>
31273380Sbr#include "kgz.h"
32273380Sbr
33273380Sbr/* Section header indices */
34273380Sbr#define KGZ_SH_SYMTAB		1
35273380Sbr#define KGZ_SH_SHSTRTAB 	2
36273380Sbr#define KGZ_SH_STRTAB		3
37273380Sbr#define KGZ_SH_DATA		4
38273380Sbr#define KGZ_SHNUM		5
39273380Sbr
40273380Sbr/* Section header strings */
41273380Sbr#define KGZ_SHSTR_ZERO		""
42273380Sbr#define KGZ_SHSTR_SYMTAB	".symtab"
43273380Sbr#define KGZ_SHSTR_SHSTRTAB	".shstrtab"
44273380Sbr#define KGZ_SHSTR_STRTAB	".strtab"
45273380Sbr#define KGZ_SHSTR_DATA		".data"
46273380Sbr
47273380Sbr/* Section header string table */
48273380Sbrstruct kgz_shstrtab {
49273380Sbr    char zero[sizeof(KGZ_SHSTR_ZERO)];
50273380Sbr    char symtab[sizeof(KGZ_SHSTR_SYMTAB)];
51273380Sbr    char shstrtab[sizeof(KGZ_SHSTR_SHSTRTAB)];
52273380Sbr    char strtab[sizeof(KGZ_SHSTR_STRTAB)];
53273380Sbr    char data[sizeof(KGZ_SHSTR_DATA)];
54273380Sbr};
55273380Sbr
56273380Sbr/* Symbol table indices */
57273380Sbr#define KGZ_ST_KGZ		1
58273380Sbr#define KGZ_ST_KGZ_NDATA	2
59273380Sbr#define KGZ_STNUM		3
60273380Sbr
61273380Sbr/* Symbol table strings */
62273380Sbr#define KGZ_STR_ZERO		""
63273380Sbr#define KGZ_STR_KGZ		"kgz"
64273380Sbr#define KGZ_STR_KGZ_NDATA	"kgz_ndata"
65273380Sbr
66273380Sbr/* String table */
67273380Sbrstruct kgz_strtab {
68273380Sbr    char zero[sizeof(KGZ_STR_ZERO)];
69273380Sbr    char kgz[sizeof(KGZ_STR_KGZ)];
70273380Sbr    char kgz_ndata[sizeof(KGZ_STR_KGZ_NDATA)];
71275676Sbr};
72273380Sbr
73273380Sbr/* Relocatable header format */
74273380Sbrstruct kgz_elfhdr {
75273380Sbr    Elf32_Ehdr e;
76273380Sbr    Elf32_Shdr sh[KGZ_SHNUM];
77273380Sbr    Elf32_Sym st[KGZ_STNUM];
78273380Sbr    struct kgz_shstrtab shstrtab;
79273380Sbr    struct kgz_strtab strtab;
80273380Sbr};
81273380Sbr
82273380Sbrextern const struct kgz_elfhdr elfhdr;
83273380Sbr