Changeset 32197 in vbox for trunk/src/VBox
- Timestamp:
- Sep 2, 2010 1:22:21 PM (14 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/include/internal/ldrELF32.h
-
Property svn:keywords
changed from
Id
toAuthor Date Id Revision
r31964 r32197 1 /*- 2 * Copyright (c) 1996-1998 John D. Polstra. 3 * All rights reserved. 1 /* $Id$ */ 2 /** @file 3 * IPRT - ELF 32-bit header. 4 */ 5 6 /* 7 * Copyright (C) 2010 Oracle Corporation 4 8 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 9 * This file is part of VirtualBox Open Source Edition (OSE), as 10 * available from http://www.virtualbox.org. This file is free software; 11 * you can redistribute it and/or modify it under the terms of the GNU 12 * General Public License (GPL) as published by the Free Software 13 * Foundation, in version 2 as it comes in the "COPYING" file of the 14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 25 16 */ 26 17 … … 28 19 #define ___internal_ldrELF32_h 29 20 21 #include <iprt/assert.h> 22 30 23 #include "ldrELFCommon.h" 31 24 32 25 /* 33 * ELF definitions common to all 32-bit architectures.26 * ELF 32 standard types. 34 27 */ 28 typedef uint32_t Elf32_Addr; 29 typedef uint16_t Elf32_Half; 30 typedef uint32_t Elf32_Off; 31 typedef int32_t Elf32_Sword; 32 typedef uint32_t Elf32_Word; 35 33 36 typedef uint32_t Elf32_Addr; 37 typedef uint16_t Elf32_Half; 38 typedef uint32_t Elf32_Off; 39 typedef int32_t Elf32_Sword; 40 typedef uint32_t Elf32_Word; 41 typedef uint32_t Elf32_Size; 42 typedef Elf32_Off Elf32_Hashelt; 34 /* 35 * Ensure type size correctness in accordance to . 36 * Portable Format Specification (for ELF), Version 1.1, fig 1-2. . 37 */ 38 AssertCompileSize(Elf32_Addr, 4); 39 AssertCompileSize(Elf32_Half, 2); 40 AssertCompileSize(Elf32_Off, 4); 41 AssertCompileSize(Elf32_Sword, 4); 42 AssertCompileSize(Elf32_Word, 4); 43 44 /* 45 * ELF 32 non-standard types for convenience. 46 */ 47 typedef Elf32_Word Elf32_Size; 48 typedef Elf32_Word Elf32_Hashelt; 43 49 44 50 /* 45 51 * ELF header. 46 52 */ 47 48 typedef struct Elf32_Ehdr{49 unsigned char e_ident[EI_NIDENT]; /* Fileidentification. */50 Elf32_Half e_type; /* File type. */51 Elf32_Half e_machine; /* Machine architecture. */52 Elf32_Word e_version; /* ELF formatversion. */53 Elf32_Addr e_entry; /* Entry point. */54 Elf32_Off e_phoff; /* Program header fileoffset. */55 Elf32_Off e_shoff; /* Section header fileoffset. */56 Elf32_Word e_flags; /* Architecture-specific flags. */57 Elf32_Half e_ehsize; /* Size of ELF header in bytes. */58 Elf32_Half e_phentsize; /* Size of program header entry. */59 Elf32_Half e_phnum; /* Number of program header entries. */60 Elf32_Half e_shentsize; /* Size of section header entry. */61 Elf32_Half e_shnum; /* Number of section header entries. */62 Elf32_Half e_shstrndx; /* Section name strings section. */53 typedef struct 54 { 55 unsigned char e_ident[16]; /* ELF identification. */ 56 Elf32_Half e_type; /* Object file type. */ 57 Elf32_Half e_machine; /* Machine type. */ 58 Elf32_Word e_version; /* Object file version. */ 59 Elf32_Addr e_entry; /* Entry point address. */ 60 Elf32_Off e_phoff; /* Program header offset. */ 61 Elf32_Off e_shoff; /* Section header offset. */ 62 Elf32_Word e_flags; /* Processor-specific flags. */ 63 Elf32_Half e_ehsize; /* ELF header size. */ 64 Elf32_Half e_phentsize; /* Size of program header entries. */ 65 Elf32_Half e_phnum; /* Number of program headers. */ 66 Elf32_Half e_shentsize; /* Size of section header entries. */ 67 Elf32_Half e_shnum; /* Number of section headers. */ 68 Elf32_Half e_shstrndx; /* Section name string table index. */ 63 69 } Elf32_Ehdr; 64 70 … … 66 72 * Section header. 67 73 */ 74 typedef struct 75 { 76 Elf32_Word sh_name; /* Section name. */ 77 Elf32_Word sh_type; /* Section type. */ 78 Elf32_Word sh_flags; /* Section attributes. */ 79 Elf32_Addr sh_addr; /* Virtual address in memory. */ 80 Elf32_Off sh_offset; /* Offset in file. */ 81 Elf32_Word sh_size; /* Size of section. */ 82 Elf32_Word sh_link; /* Link to other section. */ 83 Elf32_Word sh_info; /* Miscellaneous information. */ 84 Elf32_Word sh_addralign; /* Address alignment boundary. */ 85 Elf32_Word sh_entsize; /* Size of entries, if section has table. */ 86 } Elf32_Shdr; 68 87 69 typedef struct {70 Elf32_Word sh_name; /* Section name (index into the71 section header string table). */72 Elf32_Word sh_type; /* Section type. */73 Elf32_Word sh_flags; /* Section flags. */74 Elf32_Addr sh_addr; /* Address in memory image. */75 Elf32_Off sh_offset; /* Offset in file. */76 Elf32_Size sh_size; /* Size in bytes. */77 Elf32_Word sh_link; /* Index of a related section. */78 Elf32_Word sh_info; /* Depends on section type. */79 Elf32_Size sh_addralign; /* Alignment in bytes. */80 Elf32_Size sh_entsize; /* Size of each entry in section. */81 } Elf32_Shdr;82 88 83 89 /* 84 90 * Program header. 85 91 */ 86 87 typedef struct{88 Elf32_Word p_type; /* Entry type. */89 Elf32_Off p_offset; /* File offset of contents. */90 Elf32_Addr p_vaddr; /* Virtual address in memory image. */91 Elf32_Addr p_paddr; /* Physical address (not used). */92 Elf32_Size p_filesz; /* Size of contentsin file. */93 Elf32_Size p_memsz; /* Size of contentsin memory. */94 Elf32_Word p_flags; /* Access permission flags. */95 Elf32_Size p_align; /* Alignment in memory and file. */92 typedef struct 93 { 94 Elf32_Word p_type; /* Type of segment. */ 95 Elf32_Off p_offset; /* Offset in file. */ 96 Elf32_Addr p_vaddr; /* Virtual address in memory. */ 97 Elf32_Addr p_paddr; /* Physical address (reserved). */ 98 Elf32_Word p_filesz; /* Size of segment in file. */ 99 Elf32_Word p_memsz; /* Size of segment in memory. */ 100 Elf32_Word p_flags; /* Segment attributes. */ 101 Elf32_Word p_align; /* Alignment of segment. */ 96 102 } Elf32_Phdr; 97 103 104 98 105 /* 99 * Note header. (added by Ramshankar)106 * Note header. 100 107 */ 101 102 typedef struct{103 Elf32_Word n_namesz; /* length of note's name*/104 Elf32_Word n_descsz; /* length of note's desc*/105 Elf32_Word n_type; /* type of note*/108 typedef struct 109 { 110 Elf32_Word n_namesz; /* Length of note's name. */ 111 Elf32_Word n_descsz; /* Length of note's description. */ 112 Elf32_Word n_type; /* Type of note. */ 106 113 } Elf32_Nhdr; 107 114 115 108 116 /* 109 * Dynamic structure. The ".dynamic" section contains an array of them.117 * Symbol table entry. 110 118 */ 119 typedef struct 120 { 121 Elf32_Word st_name; /* Symbol name. */ 122 Elf32_Addr st_value; /* Symbol value. */ 123 Elf32_Word st_size; /* Size associated with symbol. */ 124 unsigned char st_info; /* Type and binding attributes. */ 125 unsigned char st_other; /* Reserved. */ 126 Elf32_Half st_shndx; /* Section header table index. */ 127 } Elf32_Sym; 111 128 112 typedef struct { 113 Elf32_Sword d_tag; /* Entry type. */ 114 union { 115 Elf32_Size d_val; /* Integer value. */ 116 Elf32_Addr d_ptr; /* Address value. */ 117 } d_un; 129 130 /* 131 * Relocations. 132 */ 133 typedef struct 134 { 135 Elf32_Addr r_offset; /* Location to be relocated. */ 136 Elf32_Word r_info; /* Symbol index and type of relocation. */ 137 } Elf32_Rel; 138 139 typedef struct 140 { 141 Elf32_Addr r_offset; /* Location to be relocated. */ 142 Elf32_Word r_info; /* Symbol index and type of relocation. */ 143 Elf32_Sword r_addend; /* Constant part of expression. */ 144 } Elf32_Rela; 145 146 /* 147 * Dynamic section entry. 148 * ".dynamic" section contains an array of this. 149 */ 150 typedef struct 151 { 152 Elf32_Sword d_tag; /* Type of entry. */ 153 union 154 { 155 Elf32_Word d_val; /* Integer value. */ 156 Elf32_Addr d_ptr; /* Virtual address value. */ 157 } d_un; 118 158 } Elf32_Dyn; 119 159 120 160 /* 121 * Relocation entries.161 * Helper macros. 122 162 */ 163 /** The symbol's type. */ 164 #define ELF32_ST_TYPE(info) ((info) & 0xF) 165 /** The symbol's binding. */ 166 #define ELF32_ST_BIND(info) ((info) >> 4) 167 /** Make st_info. given binding and type. */ 168 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) 123 169 124 /* Relocations that don't need an addend field. */ 125 typedef struct { 126 Elf32_Addr r_offset; /* Location to be relocated. */ 127 Elf32_Word r_info; /* Relocation type and symbol index. */ 128 } Elf32_Rel; 170 /** Relocation type. */ 171 #define ELF32_R_TYPE(info) ((unsigned char)(info)) 172 /** Relocation symbol index. */ 173 #define ELF32_R_SYM(info) ((info) >> 8) 174 /** Make r_info given the symbol index and type. */ 175 #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type)) 129 176 130 /* Relocations that need an addend field. */131 typedef struct {132 Elf32_Addr r_offset; /* Location to be relocated. */133 Elf32_Word r_info; /* Relocation type and symbol index. */134 Elf32_Sword r_addend; /* Addend. */135 } Elf32_Rela;136 177 137 /* Macros for accessing the fields of r_info. */ 138 #define ELF32_R_SYM(info) ((info) >> 8) 139 #define ELF32_R_TYPE(info) ((unsigned char)(info)) 178 #endif /* ___internal_ldrELF32_h */ 140 179 141 /* Macro for constructing r_info from field values. */142 #define ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))143 144 /*145 * Symbol table entries.146 */147 148 typedef struct {149 Elf32_Word st_name; /* String table index of name. */150 Elf32_Addr st_value; /* Symbol value. */151 Elf32_Size st_size; /* Size of associated object. */152 unsigned char st_info; /* Type and binding information. */153 unsigned char st_other; /* Reserved (not used). */154 Elf32_Half st_shndx; /* Section index of symbol. */155 } Elf32_Sym;156 157 /* Macros for accessing the fields of st_info. */158 #define ELF32_ST_BIND(info) ((info) >> 4)159 #define ELF32_ST_TYPE(info) ((info) & 0xf)160 161 /* Macro for constructing st_info from field values. */162 #define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))163 164 #endif165 -
Property svn:keywords
changed from
-
trunk/src/VBox/Runtime/include/internal/ldrELF64.h
-
Property svn:keywords
changed from
Id
toAuthor Date Id Revision
r31964 r32197 1 /*- 2 * Copyright (c) 1996-1998 John D. Polstra. 3 * All rights reserved. 1 /* $Id$ */ 2 /** @file 3 * IPRT - ELF 64-bit header. 4 */ 5 6 /* 7 * Copyright (C) 2010 Oracle Corporation 4 8 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 9 * This file is part of VirtualBox Open Source Edition (OSE), as 10 * available from http://www.virtualbox.org. This file is free software; 11 * you can redistribute it and/or modify it under the terms of the GNU 12 * General Public License (GPL) as published by the Free Software 13 * Foundation, in version 2 as it comes in the "COPYING" file of the 14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 25 16 */ 26 17 … … 28 19 #define ___internal_ldrELF64_h 29 20 21 #include <iprt/assert.h> /* Added by Ramshankar */ 22 30 23 #include "ldrELFCommon.h" 31 24 32 25 /* 33 * ELF definitions common to all 64-bit architectures.26 * ELF 64 standard types. 34 27 */ 35 36 typedef uint64_t Elf64_Addr; 37 typedef uint32_t Elf64_Half; 38 typedef uint64_t Elf64_Off; 39 typedef int64_t Elf64_Sword; 40 typedef uint64_t Elf64_Word; 41 typedef uint64_t Elf64_Size; 42 typedef uint16_t Elf64_Quarter; 28 typedef uint64_t Elf64_Addr; 29 typedef uint64_t Elf64_Off; 30 typedef uint16_t Elf64_Half; 31 typedef uint32_t Elf64_Word; 32 typedef int32_t Elf64_Sword; 33 typedef uint64_t Elf64_Xword; 34 typedef int64_t Elf64_Sxword; 43 35 44 36 /* 45 * Types of dynamic symbol hash table bucket and chain elements. 46 * 47 * This is inconsistent among 64 bit architectures, so a machine dependent 48 * typedef is required. 37 * Ensure type size correctness in accordance to ELF-64 Object File Format, Version 1.5 Draft 2, p2. 49 38 */ 50 51 #ifdef __alpha__ 52 typedef Elf64_Off Elf64_Hashelt; 53 #else 54 typedef Elf64_Half Elf64_Hashelt; 55 #endif 39 AssertCompileSize(Elf64_Addr, 8); 40 AssertCompileSize(Elf64_Off, 8); 41 AssertCompileSize(Elf64_Half, 2); 42 AssertCompileSize(Elf64_Word, 4); 43 AssertCompileSize(Elf64_Sword, 4); 44 AssertCompileSize(Elf64_Xword, 8); 45 AssertCompileSize(Elf64_Sxword, 8); 56 46 57 47 /* 58 * ELF header.48 * ELF 64 non-standard types for convenience. 59 49 */ 50 typedef Elf64_Xword Elf64_Size; 51 typedef Elf64_Word Elf64_Hashelt; 60 52 61 typedef struct { 62 unsigned char e_ident[EI_NIDENT]; /* File identification. */ 63 Elf64_Quarter e_type; /* File type. */ 64 Elf64_Quarter e_machine; /* Machine architecture. */ 65 Elf64_Half e_version; /* ELF format version. */ 66 Elf64_Addr e_entry; /* Entry point. */ 67 Elf64_Off e_phoff; /* Program header file offset. */ 68 Elf64_Off e_shoff; /* Section header file offset. */ 69 Elf64_Half e_flags; /* Architecture-specific flags. */ 70 Elf64_Quarter e_ehsize; /* Size of ELF header in bytes. */ 71 Elf64_Quarter e_phentsize; /* Size of program header entry. */ 72 Elf64_Quarter e_phnum; /* Number of program header entries. */ 73 Elf64_Quarter e_shentsize; /* Size of section header entry. */ 74 Elf64_Quarter e_shnum; /* Number of section header entries. */ 75 Elf64_Quarter e_shstrndx; /* Section name strings section. */ 53 /* 54 * ELF Header. 55 */ 56 typedef struct 57 { 58 unsigned char e_ident[16]; /* ELF identification. */ 59 Elf64_Half e_type; /* Object file type. */ 60 Elf64_Half e_machine; /* Machine type. */ 61 Elf64_Word e_version; /* Object file version. */ 62 Elf64_Addr e_entry; /* Entry point address. */ 63 Elf64_Off e_phoff; /* Program header offset. */ 64 Elf64_Off e_shoff; /* Section header offset. */ 65 Elf64_Word e_flags; /* Processor-specific flags. */ 66 Elf64_Half e_ehsize; /* ELF header size. */ 67 Elf64_Half e_phentsize; /* Size of program header entry. */ 68 Elf64_Half e_phnum; /* Number of program header entries. */ 69 Elf64_Half e_shentsize; /* Size of section header entry. */ 70 Elf64_Half e_shnum; /* Number of section header entries. */ 71 Elf64_Half e_shstrndx; /* Section name string table index. */ 76 72 } Elf64_Ehdr; 77 73 … … 79 75 * Section header. 80 76 */ 81 82 typedef struct { 83 Elf64_Half sh_name; /* Section name (index into the 84 section header string table). */ 85 Elf64_Half sh_type; /* Section type. */ 86 Elf64_Size sh_flags; /* Section flags. */ 87 Elf64_Addr sh_addr; /* Address in memory image. */ 88 Elf64_Off sh_offset; /* Offset in file. */ 89 Elf64_Size sh_size; /* Size in bytes. */ 90 Elf64_Half sh_link; /* Index of a related section. */ 91 Elf64_Half sh_info; /* Depends on section type. */ 92 Elf64_Size sh_addralign; /* Alignment in bytes. */ 93 Elf64_Size sh_entsize; /* Size of each entry in section. */ 77 typedef struct 78 { 79 Elf64_Word sh_name; /* Section name. */ 80 Elf64_Word sh_type; /* Section type. */ 81 Elf64_Xword sh_flags; /* Section attributes. */ 82 Elf64_Addr sh_addr; /* Virtual address in memory. */ 83 Elf64_Off sh_offset; /* Offset in file. */ 84 Elf64_Xword sh_size; /* Size of section. */ 85 Elf64_Word sh_link; /* Link to other section. */ 86 Elf64_Word sh_info; /* Miscellaneous information. */ 87 Elf64_Xword sh_addralign; /* Address alignment boundary. */ 88 Elf64_Xword sh_entsize; /* Size of entries, if section has table. */ 94 89 } Elf64_Shdr; 95 90 … … 97 92 * Program header. 98 93 */ 99 100 typedef struct{101 Elf64_Half p_type; /* Entry type. */102 Elf64_Half p_flags; /* Access permission flags. */103 Elf64_Off p_offset; /* File offset of contents. */104 Elf64_Addr p_vaddr; /* Virtual address in memory image. */105 Elf64_Addr p_paddr; /* Physical address (not used). */106 Elf64_Size p_filesz; /* Size of contentsin file. */107 Elf64_Size p_memsz; /* Size of contentsin memory. */108 Elf64_Size p_align; /* Alignment in memory and file. */94 typedef struct 95 { 96 Elf64_Word p_type; /* Type of segment. */ 97 Elf64_Word p_flags; /* Segment attributes. */ 98 Elf64_Off p_offset; /* Offset in file. */ 99 Elf64_Addr p_vaddr; /* Virtual address in memory. */ 100 Elf64_Addr p_paddr; /* Physical address (reserved). */ 101 Elf64_Xword p_filesz; /* Size of segment in file. */ 102 Elf64_Xword p_memsz; /* Size of segment in memory. */ 103 Elf64_Xword p_align; /* Alignment of segment. */ 109 104 } Elf64_Phdr; 110 105 111 106 /* 112 * Note header. (added by Ramshankar)107 * Note header. 113 108 */ 114 115 typedef struct{116 Elf64_Word n_namesz; /* length of note's name*/117 Elf64_Word n_descsz; /* length of note's desc*/118 Elf64_Word n_type; /* type of note*/109 typedef struct 110 { 111 Elf64_Word n_namesz; /* Length of note's name. */ 112 Elf64_Word n_descsz; /* Length of note's description. */ 113 Elf64_Word n_type; /* Type of note. */ 119 114 } Elf64_Nhdr; 120 115 116 /* 117 * Symbol table entry. 118 */ 119 typedef struct 120 { 121 Elf64_Word st_name; /* Symbol name. */ 122 unsigned char st_info; /* Type and binding attributes. */ 123 unsigned char st_other; /* Reserved. */ 124 Elf64_Half st_shndx; /* Section header table index. */ 125 Elf64_Addr st_value; /* Symbol value. */ 126 Elf64_Xword st_size; /* Size associated with symbol. */ 127 } Elf64_Sym; 121 128 122 129 /* 123 * Dynamic structure. The ".dynamic" section contains an array of them.130 * Relocations. 124 131 */ 132 typedef struct 133 { 134 Elf64_Addr r_offset; /* Location to be relocated. */ 135 Elf64_Xword r_info; /* Symbol index and type of relocation. */ 136 } Elf64_Rel; 125 137 126 typedef struct { 127 Elf64_Size d_tag; /* Entry type. */ 128 union { 129 Elf64_Size d_val; /* Integer value. */ 130 Elf64_Addr d_ptr; /* Address value. */ 131 } d_un; 138 typedef struct 139 { 140 Elf64_Addr r_offset; /* Location to be relocated. */ 141 Elf64_Xword r_info; /* Symbol index and type of relocation. */ 142 Elf64_Sxword r_addend; /* Constant part of expression. */ 143 } Elf64_Rela; 144 145 /* 146 * Dynamic section entry. 147 * ".dynamic" section contains an array of this. 148 */ 149 typedef struct 150 { 151 Elf64_Sxword d_tag; /* Type of entry. */ 152 union 153 { 154 Elf64_Xword d_val; /* Integer value. */ 155 Elf64_Addr d_ptr; /* Virtual address value. */ 156 } d_un; 132 157 } Elf64_Dyn; 133 158 134 159 /* 135 * Relocation entries.160 * Helper macros. 136 161 */ 162 /** The symbol's type. */ 163 #define ELF64_ST_TYPE(info) ((info) & 0xF) 164 /** The symbol's binding. */ 165 #define ELF64_ST_BIND(info) ((info) >> 4) 166 /** Make st_info. given binding and type. */ 167 #define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) 137 168 138 /* Relocations that don't need an addend field. */ 139 typedef struct { 140 Elf64_Addr r_offset; /* Location to be relocated. */ 141 Elf64_Size r_info; /* Relocation type and symbol index. */ 142 } Elf64_Rel; 169 /** Relocation type. */ 170 #define ELF64_R_TYPE(info) ((unsigned char)(info)) 171 /** Relocation symbol index. */ 172 #define ELF64_R_SYM(info) ((info) >> 32) 173 /** Make r_info given the symbol index and type. */ 174 #define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type)) 143 175 144 /* Relocations that need an addend field. */145 typedef struct {146 Elf64_Addr r_offset; /* Location to be relocated. */147 Elf64_Size r_info; /* Relocation type and symbol index. */148 Elf64_Off r_addend; /* Addend. */149 } Elf64_Rela;150 176 151 /* Macros for accessing the fields of r_info. */ 152 #define ELF64_R_SYM(info) ((info) >> 32) 153 #define ELF64_R_TYPE(info) ((unsigned char)(info)) 177 #endif /* ___internal_ldrELF64_h */ 154 178 155 /* Macro for constructing r_info from field values. */156 #define ELF64_R_INFO(sym, type) (((sym) << 32) + (unsigned char)(type))157 158 /*159 * Symbol table entries.160 */161 162 typedef struct {163 Elf64_Half st_name; /* String table index of name. */164 unsigned char st_info; /* Type and binding information. */165 unsigned char st_other; /* Reserved (not used). */166 Elf64_Quarter st_shndx; /* Section index of symbol. */167 Elf64_Addr st_value; /* Symbol value. */168 Elf64_Size st_size; /* Size of associated object. */169 } Elf64_Sym;170 171 /* Macros for accessing the fields of st_info. */172 #define ELF64_ST_BIND(info) ((info) >> 4)173 #define ELF64_ST_TYPE(info) ((info) & 0xf)174 175 /* Macro for constructing st_info from field values. */176 #define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))177 178 #endif179 -
Property svn:keywords
changed from
-
trunk/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp
r32048 r32197 54 54 #endif /* RT_OS_SOLARIS */ 55 55 56 #include "internal/ldrElf.h" 56 #include "internal/ldrELF.h" 57 #include "internal/ldrELF64.h" 57 58 58 59 /******************************************************************************* … … 85 86 typedef struct ELFNOTEHDR 86 87 { 87 Elf _NhdrHdr; /* Header of NOTE section */88 Elf64_Nhdr Hdr; /* Header of NOTE section */ 88 89 char achName[8]; /* Name of NOTE section */ 89 90 } ELFNOTEHDR;
Note:
See TracChangeset
for help on using the changeset viewer.