| 1 |
/* |
| 2 |
Copyright (C) 2000,2002,2004 Silicon Graphics, Inc. All Rights Reserved. |
| 3 |
Portions Copyright 2002-2010 Sun Microsystems, Inc. All rights reserved. |
| 4 |
Portions Copyright 2008-2021 David Anderson. All rights reserved. |
| 5 |
Portions Copyright 2010-2012 SN Systems Ltd. All rights reserved. |
| 6 |
|
| 7 |
This program is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of version 2.1 of the |
| 9 |
GNU Lesser General Public License as published by the Free |
| 10 |
Software Foundation. |
| 11 |
|
| 12 |
This program is distributed in the hope that it would be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied |
| 14 |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 15 |
PURPOSE. |
| 16 |
|
| 17 |
Further, this software is distributed without any warranty |
| 18 |
that it is free of the rightful claim of any third person |
| 19 |
regarding infringement or the like. Any license provided |
| 20 |
herein, whether implied or otherwise, applies only to this |
| 21 |
software file. Patent licenses, if any, provided herein |
| 22 |
do not apply to combinations of this program with other |
| 23 |
software, or any other product whatsoever. |
| 24 |
|
| 25 |
You should have received a copy of the GNU Lesser General |
| 26 |
Public License along with this program; if not, write the |
| 27 |
Free Software Foundation, Inc., 51 Franklin Street - Fifth |
| 28 |
Floor, Boston MA 02110-1301, USA. |
| 29 |
*/ |
| 30 |
|
| 31 |
/* The target address is given: the place in the source integer |
| 32 |
is to be determined. |
| 33 |
*/ |
| 34 |
#ifdef WORDS_BIGENDIAN |
| 35 |
#define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ |
| 36 |
{ \ |
| 37 |
dbg->de_copy_word(dest, \ |
| 38 |
((const char *)source) +(srclength)-(len_out),\ |
| 39 |
(len_out)) ; \ |
| 40 |
} |
| 41 |
#else /* LITTLE ENDIAN */ |
| 42 |
#define WRITE_UNALIGNED(dbg,dest,source, srclength,len_out) \ |
| 43 |
{ \ |
| 44 |
dbg->de_copy_word( (dest) , \ |
| 45 |
((const char *)source) , \ |
| 46 |
(len_out)) ; \ |
| 47 |
} |
| 48 |
#endif /* BIG- LITTLE-ENDIAN */ |
| 49 |
|
| 50 |
#if defined(sparc) && defined(sun) |
| 51 |
#define REL32 Elf32_Rela |
| 52 |
#define REL64 Elf64_Rela |
| 53 |
#define REL_SEC_PREFIX ".rela" |
| 54 |
#else |
| 55 |
#define REL32 Elf32_Rel |
| 56 |
#define REL64 Elf64_Rel |
| 57 |
#define REL_SEC_PREFIX ".rel" |
| 58 |
#endif |
| 59 |
|
| 60 |
#ifndef SHT_REL |
| 61 |
#define SHT_REL 9 |
| 62 |
#endif /*SHT_REL */ |
| 63 |
#ifndef SHN_UNDEF |
| 64 |
#define SHN_UNDEF 0 |
| 65 |
#endif /* SHN_UNDEF */ |
| 66 |
|
| 67 |
#ifndef SHF_MIPS_NOSTRIP |
| 68 |
/* if this is not defined, we probably don't need it: just use 0 */ |
| 69 |
#define SHF_MIPS_NOSTRIP 0 |
| 70 |
#endif |
| 71 |
#ifndef R_MIPS_NONE |
| 72 |
#define R_MIPS_NONE 0 |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifdef WORDS_BIGENDIAN |
| 76 |
#define ASNOUT(t,s,l) \ |
| 77 |
do { \ |
| 78 |
unsigned sbyte = 0; \ |
| 79 |
const char *p = 0; \ |
| 80 |
if (l > sizeof(s)) { \ |
| 81 |
_dwarf_p_error(dbg, error, \ |
| 82 |
DW_DLE_DEBUG_FRAME_LENGTH_BAD);\ |
| 83 |
return DW_DLV_ERROR; \ |
| 84 |
} \ |
| 85 |
sbyte = sizeof(s) - l; \ |
| 86 |
p = (const char *)(&s); \ |
| 87 |
dbg->de_copy_word(t,(const void *)(p+sbyte),l);\ |
| 88 |
} while (0) |
| 89 |
#else /* LITTLEENDIAN */ |
| 90 |
#define ASNOUT(t,s,l) \ |
| 91 |
do { \ |
| 92 |
const char *p = 0; \ |
| 93 |
if (l > sizeof(s)) { \ |
| 94 |
_dwarf_p_error(dbg, error, \ |
| 95 |
DW_DLE_DEBUG_FRAME_LENGTH_BAD);\ |
| 96 |
return DW_DLV_ERROR; \ |
| 97 |
} \ |
| 98 |
p = (const char *)(&s); \ |
| 99 |
dbg->de_copy_word(t,(const void *)p,l); \ |
| 100 |
} while (0) |
| 101 |
#endif /* ENDIANNESS */ |
| 102 |
|
| 103 |
/* Indicates no relocation needed. */ |
| 104 |
#define NO_ELF_SYM_INDEX 0 |