1 /* 2 3 Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. 4 5 This program is free software; you can redistribute it and/or modify it 6 under the terms of version 2.1 of the GNU Lesser General Public License 7 as published by the Free Software Foundation. 8 9 This program is distributed in the hope that it would be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 Further, this software is distributed without any warranty that it is 14 free of the rightful claim of any third person regarding infringement 15 or the like. Any license provided herein, whether implied or 16 otherwise, applies only to this software file. Patent licenses, if 17 any, provided herein do not apply to combinations of this program with 18 other software, or any other product whatsoever. 19 20 You should have received a copy of the GNU Lesser General Public 21 License along with this program; if not, write the Free Software 22 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 23 USA. 24 25 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 26 Mountain View, CA 94043, or: 27 28 http://www.sgi.com 29 30 For further information regarding this notice, see: 31 32 http://oss.sgi.com/projects/GenInfo/NoticeExplan 33 34 */ 35 36 37 38 39 #define IS_64BIT(dbg) ((dbg)->de_flags & DW_DLC_SIZE_64 ? 1 : 0) 40 #define ISA_IA64(dbg) ((dbg)->de_flags & DW_DLC_ISA_IA64 ? 1 : 0) 41 42 /* definition of sizes of types, given target machine */ 43 #define sizeof_sbyte(dbg) sizeof(Dwarf_Sbyte) 44 #define sizeof_ubyte(dbg) sizeof(Dwarf_Ubyte) 45 #define sizeof_uhalf(dbg) sizeof(Dwarf_Half) 46 /* certain sizes not defined here, but set in dbg record. 47 See pro_init.c 48 */ 49 50 /* Computes amount of padding necessary to align n to a k-boundary. */ 51 /* Important: Assumes n, k both GREATER than zero. */ 52 #define PADDING(n, k) ( (k)-1 - ((n)-1)%(k) ) 53 54 /* The following defines are only important for users of the 55 ** producer part of libdwarf, and such should have these 56 ** defined correctly (as necessary) 57 ** by the #include <elf.h> done in pro_incl.h 58 ** before the #include "pro_util.h". 59 ** For others producer macros do not matter so 0 is a usable value, and 60 ** zero values let compilation succeed on more non-MIPS architectures. 61 ** A better approach would be welcome. 62 */ 63 /* R_MIPS* are #define so #ifndef works */ 64 /* R_IA_64* are not necessarily #define (might be enum) so #ifndef 65 is useless, we use the configure script generating 66 HAVE_R_IA_64_DIR32LSB. 67 */ 68 #ifndef R_MIPS_64 69 #define R_MIPS_64 0 70 #endif 71 #ifndef R_MIPS_32 72 #define R_MIPS_32 0 73 #endif 74 #ifndef R_MIPS_SCN_DISP 75 #define R_MIPS_SCN_DISP 0 76 #endif 77 78 #ifndef HAVE_R_IA_64_DIR32LSB 79 #define R_IA_64_DIR32LSB 0 80 #define R_IA_64_DIR64LSB 0 81 #define R_IA_64_SEGREL64LSB 0 82 #define R_IA_64_SEGREL32LSB 0 83 #endif 84 85 #ifdef HAVE_SYS_IA64_ELF_H 86 #define Get_REL64_isa(dbg) (ISA_IA64(dbg) ? \ 87 R_IA_64_DIR64LSB : R_MIPS_64) 88 #define Get_REL32_isa(dbg) (ISA_IA64(dbg) ? \ 89 R_IA_64_DIR32LSB : R_MIPS_32) 90 91 92 /* ia64 uses 32bit dwarf offsets for sections */ 93 #define Get_REL_SEGREL_isa(dbg) (ISA_IA64(dbg) ? \ 94 R_IA_64_SEGREL32LSB : R_MIPS_SCN_DISP) 95 #else 96 97 #if !defined(linux) && !defined(__BEOS__) 98 #define Get_REL64_isa(dbg) (R_MIPS_64) 99 #define Get_REL32_isa(dbg) (R_MIPS_32) 100 #define Get_REL_SEGREL_isa(dbg) (R_MIPS_SCN_DISP) 101 #else 102 #define Get_REL64_isa(dbg) (R_IA_64_DIR64LSB) 103 #define Get_REL32_isa(dbg) (R_IA_64_DIR32LSB) 104 #define Get_REL_SEGREL_isa(dbg) (R_IA_64_SEGREL64LSB) 105 #endif 106 107 #endif 108