00001 /* 00002 * Copyright 2005 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU Lesser General Public 00025 License along with this program; if not, write the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00027 USA. 00028 00029 Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane, 00030 Mountain View, CA 94043, or: 00031 00032 http://www.sgi.com 00033 00034 For further information regarding this notice, see: 00035 00036 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00037 00038 */ 00039 00040 00041 00042 00043 00044 /* relocation section names */ 00045 extern char *_dwarf_rel_section_names[]; 00046 00047 /* section names */ 00048 extern char *_dwarf_sectnames[]; 00049 00050 /* struct to hold relocation entries. Its mantained as a linked 00051 list of relocation structs, and will then be written at as a 00052 whole into the relocation section. Whether its 32 bit or 00053 64 bit will be obtained from Dwarf_Debug pointer. 00054 */ 00055 00056 00057 00058 00059 00060 /* 00061 struct stores a chunk of data pertaining to a section 00062 */ 00063 struct Dwarf_P_Section_Data_s { 00064 int ds_elf_sect_no; /* elf section number */ 00065 char *ds_data; /* data contained in section */ 00066 unsigned long ds_nbytes; /* bytes of data used so far */ 00067 unsigned long ds_orig_alloc; /* bytes allocated originally */ 00068 Dwarf_P_Section_Data ds_next; /* next on the list */ 00069 }; 00070 00071 /* Used to allow a dummy initial struct (which we 00072 drop before it gets used 00073 This must not match any legitimate 'section' number. 00074 */ 00075 #define MAGIC_SECT_NO -3 00076 00077 /* Size of chunk of data allocated in one alloc 00078 Not clear if this is the best size. 00079 Used to be just 4096 for user data, the section data struct 00080 was a separate malloc. 00081 */ 00082 #define CHUNK_SIZE (4096 - sizeof (struct Dwarf_P_Section_Data_s)) 00083 00084 /* 00085 chunk alloc routine - 00086 if chunk->ds_data is nil, it will alloc CHUNK_SIZE bytes, 00087 and return pointer to the beginning. If chunk is not nil, 00088 it will see if there's enoungh space for nbytes in current 00089 chunk, if not, add new chunk to linked list, and return 00090 a char * pointer to it. Return null if unsuccessful. 00091 */ 00092 Dwarf_Small *_dwarf_pro_buffer(Dwarf_P_Debug dbg, int sectno, 00093 unsigned long nbytes); 00094 00095 #define GET_CHUNK(dbg,sectno,ptr,nbytes,error) \ 00096 { \ 00097 (ptr) = _dwarf_pro_buffer((dbg),(sectno),(nbytes)); \ 00098 if ((ptr) == NULL) { \ 00099 DWARF_P_DBG_ERROR(dbg,DW_DLE_CHUNK_ALLOC,-1); \ 00100 } \ 00101 } 00102 00103 00104 00105 int 00106 _dwarf_transform_arange_to_disk(Dwarf_P_Debug dbg, 00107 Dwarf_Error * error); 00108 00109 /* These are for creating ELF section type codes. 00110 */ 00111 #if defined(linux) || defined(__BEOS__) || !defined(SHT_MIPS_DWARF) 00112 /* Intel's SoftSdv accepts only this */ 00113 #define SECTION_TYPE SHT_PROGBITS 00114 #else 00115 #ifdef KEY 00116 #define SECTION_TYPE SHT_PROGBITS 00117 #else 00118 #define SECTION_TYPE SHT_MIPS_DWARF 00119 #endif 00120 #endif
1.5.6