1ca0154bcSJohn Polstra /*- 2ca0154bcSJohn Polstra * Copyright (c) 1998 John D. Polstra. 3ca0154bcSJohn Polstra * All rights reserved. 4ca0154bcSJohn Polstra * 5ca0154bcSJohn Polstra * Redistribution and use in source and binary forms, with or without 6ca0154bcSJohn Polstra * modification, are permitted provided that the following conditions 7ca0154bcSJohn Polstra * are met: 8ca0154bcSJohn Polstra * 1. Redistributions of source code must retain the above copyright 9ca0154bcSJohn Polstra * notice, this list of conditions and the following disclaimer. 10ca0154bcSJohn Polstra * 2. Redistributions in binary form must reproduce the above copyright 11ca0154bcSJohn Polstra * notice, this list of conditions and the following disclaimer in the 12ca0154bcSJohn Polstra * documentation and/or other materials provided with the distribution. 13ca0154bcSJohn Polstra * 14ca0154bcSJohn Polstra * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15ca0154bcSJohn Polstra * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16ca0154bcSJohn Polstra * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17ca0154bcSJohn Polstra * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18ca0154bcSJohn Polstra * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19ca0154bcSJohn Polstra * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20ca0154bcSJohn Polstra * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21ca0154bcSJohn Polstra * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22ca0154bcSJohn Polstra * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23ca0154bcSJohn Polstra * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24ca0154bcSJohn Polstra * SUCH DAMAGE. 25ca0154bcSJohn Polstra * 26ca0154bcSJohn Polstra * $Id$ 27ca0154bcSJohn Polstra */ 28ca0154bcSJohn Polstra 29ca0154bcSJohn Polstra #ifndef _SYS_ELF_GENERIC_H_ 30ca0154bcSJohn Polstra #define _SYS_ELF_GENERIC_H_ 1 31ca0154bcSJohn Polstra 32ca0154bcSJohn Polstra #include <sys/cdefs.h> 33ca0154bcSJohn Polstra 34ca0154bcSJohn Polstra /* 35ca0154bcSJohn Polstra * Definitions of generic ELF names which relieve applications from 36ca0154bcSJohn Polstra * needing to know the word size. 37ca0154bcSJohn Polstra */ 38ca0154bcSJohn Polstra 39ca0154bcSJohn Polstra #if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64 40ca0154bcSJohn Polstra #error "__ELF_WORD_SIZE must be defined as 32 or 64" 41ca0154bcSJohn Polstra #endif 42ca0154bcSJohn Polstra 43ca0154bcSJohn Polstra #define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) 44ca0154bcSJohn Polstra #define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x) 45ca0154bcSJohn Polstra #define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x) 46ca0154bcSJohn Polstra 47ca0154bcSJohn Polstra __ElfType(Addr); 48ca0154bcSJohn Polstra __ElfType(Half); 49ca0154bcSJohn Polstra __ElfType(Off); 50ca0154bcSJohn Polstra __ElfType(Sword); 51ca0154bcSJohn Polstra __ElfType(Word); 52ca0154bcSJohn Polstra __ElfType(Size); 53ca0154bcSJohn Polstra __ElfType(Ehdr); 54ca0154bcSJohn Polstra __ElfType(Shdr); 55ca0154bcSJohn Polstra __ElfType(Phdr); 56ca0154bcSJohn Polstra __ElfType(Dyn); 57ca0154bcSJohn Polstra __ElfType(Rel); 58ca0154bcSJohn Polstra __ElfType(Rela); 59ca0154bcSJohn Polstra __ElfType(Sym); 60ca0154bcSJohn Polstra 61ca0154bcSJohn Polstra #define ELF_R_SYM __ELFN(R_SYM) 62ca0154bcSJohn Polstra #define ELF_R_TYPE __ELFN(R_TYPE) 63ca0154bcSJohn Polstra #define ELF_R_INFO __ELFN(R_INFO) 64ca0154bcSJohn Polstra #define ELF_ST_BIND __ELFN(ST_BIND) 65ca0154bcSJohn Polstra #define ELF_ST_TYPE __ELFN(ST_TYPE) 66ca0154bcSJohn Polstra #define ELF_ST_INFO __ELFN(ST_INFO) 67ca0154bcSJohn Polstra 68ca0154bcSJohn Polstra #endif /* !_SYS_ELF_GENERIC_H_ */ 69