1bc1f688bSRobert Mustacchi /* 2bc1f688bSRobert Mustacchi 3bc1f688bSRobert Mustacchi Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved. 4bc1f688bSRobert Mustacchi Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved. 5*4d9fdb46SRobert Mustacchi Portions Copyright 2008-2012 David Anderson. All rights reserved. 6*4d9fdb46SRobert Mustacchi Portions Copyright 2010-2012 SN Systems Ltd. All rights reserved. 7bc1f688bSRobert Mustacchi 8bc1f688bSRobert Mustacchi This program is free software; you can redistribute it and/or modify it 9bc1f688bSRobert Mustacchi under the terms of version 2.1 of the GNU Lesser General Public License 10bc1f688bSRobert Mustacchi as published by the Free Software Foundation. 11bc1f688bSRobert Mustacchi 12bc1f688bSRobert Mustacchi This program is distributed in the hope that it would be useful, but 13bc1f688bSRobert Mustacchi WITHOUT ANY WARRANTY; without even the implied warranty of 14bc1f688bSRobert Mustacchi MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15bc1f688bSRobert Mustacchi 16bc1f688bSRobert Mustacchi Further, this software is distributed without any warranty that it is 17bc1f688bSRobert Mustacchi free of the rightful claim of any third person regarding infringement 18bc1f688bSRobert Mustacchi or the like. Any license provided herein, whether implied or 19bc1f688bSRobert Mustacchi otherwise, applies only to this software file. Patent licenses, if 20bc1f688bSRobert Mustacchi any, provided herein do not apply to combinations of this program with 21bc1f688bSRobert Mustacchi other software, or any other product whatsoever. 22bc1f688bSRobert Mustacchi 23bc1f688bSRobert Mustacchi You should have received a copy of the GNU Lesser General Public 24bc1f688bSRobert Mustacchi License along with this program; if not, write the Free Software 25bc1f688bSRobert Mustacchi Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301, 26bc1f688bSRobert Mustacchi USA. 27bc1f688bSRobert Mustacchi 28bc1f688bSRobert Mustacchi */ 29bc1f688bSRobert Mustacchi 30*4d9fdb46SRobert Mustacchi /* Windows specific header files */ 31*4d9fdb46SRobert Mustacchi #if defined(_WIN32) && defined(HAVE_STDAFX_H) 32*4d9fdb46SRobert Mustacchi #include "stdafx.h" 33*4d9fdb46SRobert Mustacchi #endif /* HAVE_STDAFX_H */ 34bc1f688bSRobert Mustacchi 35*4d9fdb46SRobert Mustacchi #ifdef DWARF_WITH_LIBELF 36*4d9fdb46SRobert Mustacchi #ifdef HAVE_ELF_H /* does includes of elf.h libelf.h here. */ 37bc1f688bSRobert Mustacchi #include <elf.h> 38bc1f688bSRobert Mustacchi #elif defined(HAVE_LIBELF_H) 39bc1f688bSRobert Mustacchi /* On one platform without elf.h this gets Elf32_Rel 40bc1f688bSRobert Mustacchi type defined (a required type). */ 41bc1f688bSRobert Mustacchi #include <libelf.h> 42*4d9fdb46SRobert Mustacchi /* Consider the other known directory too */ 43*4d9fdb46SRobert Mustacchi #elif defined(HAVE_LIBELF_LIBELF_H) 44*4d9fdb46SRobert Mustacchi #include <libelf/libelf.h> 45*4d9fdb46SRobert Mustacchi #endif /* HAVE_ELF_H or HAVE_LIBELF*H */ 46*4d9fdb46SRobert Mustacchi #endif /* DWARF_WITH_LIBELF */ 47bc1f688bSRobert Mustacchi 48bc1f688bSRobert Mustacchi #if defined(sun) 49bc1f688bSRobert Mustacchi #include <sys/elf_SPARC.h> 50bc1f688bSRobert Mustacchi #include <sys/elf_386.h> 51bc1f688bSRobert Mustacchi #endif 52bc1f688bSRobert Mustacchi 53bc1f688bSRobert Mustacchi /* The target address is given: the place in the source integer 54bc1f688bSRobert Mustacchi is to be determined. 55bc1f688bSRobert Mustacchi */ 56bc1f688bSRobert Mustacchi #ifdef WORDS_BIGENDIAN 57bc1f688bSRobert Mustacchi #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ 58bc1f688bSRobert Mustacchi { \ 59bc1f688bSRobert Mustacchi dbg->de_copy_word(dest, \ 60*4d9fdb46SRobert Mustacchi ((const char *)source) +(srclength)-(len_out),\ 61*4d9fdb46SRobert Mustacchi (len_out)) ; \ 62bc1f688bSRobert Mustacchi } 63bc1f688bSRobert Mustacchi #else /* LITTLE ENDIAN */ 64bc1f688bSRobert Mustacchi #define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ 65bc1f688bSRobert Mustacchi { \ 66bc1f688bSRobert Mustacchi dbg->de_copy_word( (dest) , \ 67*4d9fdb46SRobert Mustacchi ((const char *)source) , \ 68*4d9fdb46SRobert Mustacchi (len_out)) ; \ 69bc1f688bSRobert Mustacchi } 70*4d9fdb46SRobert Mustacchi #endif /* BIG- LITTLE-ENDIAN */ 71bc1f688bSRobert Mustacchi 72bc1f688bSRobert Mustacchi 73bc1f688bSRobert Mustacchi #if defined(sparc) && defined(sun) 74bc1f688bSRobert Mustacchi #define REL32 Elf32_Rela 75bc1f688bSRobert Mustacchi #define REL64 Elf64_Rela 76bc1f688bSRobert Mustacchi #define REL_SEC_PREFIX ".rela" 77bc1f688bSRobert Mustacchi #else 78bc1f688bSRobert Mustacchi #define REL32 Elf32_Rel 79bc1f688bSRobert Mustacchi #define REL64 Elf64_Rel 80bc1f688bSRobert Mustacchi #define REL_SEC_PREFIX ".rel" 81bc1f688bSRobert Mustacchi #endif 82