elfhdr.h revision 50479
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 50479 1999-08-28 01:35:59Z peter $ 2748905Srnordier */ 2848905Srnordier 2948905Srnordier#include <elf.h> 3048905Srnordier#include "kgz.h" 3148905Srnordier 3248905Srnordier/* Section header indices */ 3348905Srnordier#define KGZ_SH_SYMTAB 1 3448905Srnordier#define KGZ_SH_SHSTRTAB 2 3548905Srnordier#define KGZ_SH_STRTAB 3 3648905Srnordier#define KGZ_SH_DATA 4 3748905Srnordier#define KGZ_SHNUM 5 3848905Srnordier 3948905Srnordier/* Section header strings */ 4048905Srnordier#define KGZ_SHSTR_ZERO "" 4148905Srnordier#define KGZ_SHSTR_SYMTAB ".symtab" 4248905Srnordier#define KGZ_SHSTR_SHSTRTAB ".shstrtab" 4348905Srnordier#define KGZ_SHSTR_STRTAB ".strtab" 4448905Srnordier#define KGZ_SHSTR_DATA ".data" 4548905Srnordier 4648905Srnordier/* Section header string table */ 4748905Srnordierstruct kgz_shstrtab { 4848905Srnordier char zero[sizeof(KGZ_SHSTR_ZERO)]; 4948905Srnordier char symtab[sizeof(KGZ_SHSTR_SYMTAB)]; 5048905Srnordier char shstrtab[sizeof(KGZ_SHSTR_SHSTRTAB)]; 5148905Srnordier char strtab[sizeof(KGZ_SHSTR_STRTAB)]; 5248905Srnordier char data[sizeof(KGZ_SHSTR_DATA)]; 5348905Srnordier}; 5448905Srnordier 5548905Srnordier/* Symbol table indices */ 5648905Srnordier#define KGZ_ST_KGZ 1 5748905Srnordier#define KGZ_ST_KGZ_NDATA 2 5848905Srnordier#define KGZ_STNUM 3 5948905Srnordier 6048905Srnordier/* Symbol table strings */ 6148905Srnordier#define KGZ_STR_ZERO "" 6248905Srnordier#define KGZ_STR_KGZ "kgz" 6348905Srnordier#define KGZ_STR_KGZ_NDATA "kgz_ndata" 6448905Srnordier 6548905Srnordier/* String table */ 6648905Srnordierstruct kgz_strtab { 6748905Srnordier char zero[sizeof(KGZ_STR_ZERO)]; 6848905Srnordier char kgz[sizeof(KGZ_STR_KGZ)]; 6948905Srnordier char kgz_ndata[sizeof(KGZ_STR_KGZ_NDATA)]; 7048905Srnordier}; 7148905Srnordier 7248905Srnordier/* Relocatable header format */ 7348905Srnordierstruct kgz_elfhdr { 7448905Srnordier Elf32_Ehdr e; 7548905Srnordier Elf32_Shdr sh[KGZ_SHNUM]; 7648905Srnordier Elf32_Sym st[KGZ_STNUM]; 7748905Srnordier struct kgz_shstrtab shstrtab; 7848905Srnordier struct kgz_strtab strtab; 7948905Srnordier}; 8048905Srnordier 8148905Srnordierextern const struct kgz_elfhdr elfhdr; 82