elfhdr.h revision 76224
148905Srnordier/* 248905Srnordier * Copyright (c) 1999 Global Technology Associates, Inc. 348905Srnordier * All rights reserved. 448905Srnordier * 548905Srnordier * Redistribution and use in source and binary forms, with or without 648905Srnordier * modification, are permitted provided that the following conditions 748905Srnordier * are met: 848905Srnordier * 1. Redistributions of source code must retain the above copyright 948905Srnordier * notice, this list of conditions and the following disclaimer. 1048905Srnordier * 2. Redistributions in binary form must reproduce the above copyright 1148905Srnordier * notice, this list of conditions and the following disclaimer in the 1248905Srnordier * documentation and/or other materials provided with the distribution. 1348905Srnordier * 1448905Srnordier * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND 1548905Srnordier * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1648905Srnordier * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1748905Srnordier * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 1848905Srnordier * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 1948905Srnordier * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 2048905Srnordier * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 2148905Srnordier * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 2248905Srnordier * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 2348905Srnordier * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 2448905Srnordier * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2548905Srnordier * 2650479Speter * $FreeBSD: head/usr.sbin/kgzip/elfhdr.h 76224 2001-05-02 23:56:21Z obrien $ 2748905Srnordier */ 2848905Srnordier 2976224Sobrien#include <sys/types.h> 3076224Sobrien#include <machine/elf.h> 3148905Srnordier#include "kgz.h" 3248905Srnordier 3348905Srnordier/* Section header indices */ 3448905Srnordier#define KGZ_SH_SYMTAB 1 3548905Srnordier#define KGZ_SH_SHSTRTAB 2 3648905Srnordier#define KGZ_SH_STRTAB 3 3748905Srnordier#define KGZ_SH_DATA 4 3848905Srnordier#define KGZ_SHNUM 5 3948905Srnordier 4048905Srnordier/* Section header strings */ 4148905Srnordier#define KGZ_SHSTR_ZERO "" 4248905Srnordier#define KGZ_SHSTR_SYMTAB ".symtab" 4348905Srnordier#define KGZ_SHSTR_SHSTRTAB ".shstrtab" 4448905Srnordier#define KGZ_SHSTR_STRTAB ".strtab" 4548905Srnordier#define KGZ_SHSTR_DATA ".data" 4648905Srnordier 4748905Srnordier/* Section header string table */ 4848905Srnordierstruct kgz_shstrtab { 4948905Srnordier char zero[sizeof(KGZ_SHSTR_ZERO)]; 5048905Srnordier char symtab[sizeof(KGZ_SHSTR_SYMTAB)]; 5148905Srnordier char shstrtab[sizeof(KGZ_SHSTR_SHSTRTAB)]; 5248905Srnordier char strtab[sizeof(KGZ_SHSTR_STRTAB)]; 5348905Srnordier char data[sizeof(KGZ_SHSTR_DATA)]; 5448905Srnordier}; 5548905Srnordier 5648905Srnordier/* Symbol table indices */ 5748905Srnordier#define KGZ_ST_KGZ 1 5848905Srnordier#define KGZ_ST_KGZ_NDATA 2 5948905Srnordier#define KGZ_STNUM 3 6048905Srnordier 6148905Srnordier/* Symbol table strings */ 6248905Srnordier#define KGZ_STR_ZERO "" 6348905Srnordier#define KGZ_STR_KGZ "kgz" 6448905Srnordier#define KGZ_STR_KGZ_NDATA "kgz_ndata" 6548905Srnordier 6648905Srnordier/* String table */ 6748905Srnordierstruct kgz_strtab { 6848905Srnordier char zero[sizeof(KGZ_STR_ZERO)]; 6948905Srnordier char kgz[sizeof(KGZ_STR_KGZ)]; 7048905Srnordier char kgz_ndata[sizeof(KGZ_STR_KGZ_NDATA)]; 7148905Srnordier}; 7248905Srnordier 7348905Srnordier/* Relocatable header format */ 7448905Srnordierstruct kgz_elfhdr { 7548905Srnordier Elf32_Ehdr e; 7648905Srnordier Elf32_Shdr sh[KGZ_SHNUM]; 7748905Srnordier Elf32_Sym st[KGZ_STNUM]; 7848905Srnordier struct kgz_shstrtab shstrtab; 7948905Srnordier struct kgz_strtab strtab; 8048905Srnordier}; 8148905Srnordier 8248905Srnordierextern const struct kgz_elfhdr elfhdr; 83