VirtualBox

Changeset 32197 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 2, 2010 1:22:21 PM (14 years ago)
Author:
vboxsync
Message:

Runtime: Our own ldrELF32,64.h headers. Renamed ldrElf.h->ldrELF.h.

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 to Author 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
    48 *
    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.
    2516 */
    2617
     
    2819#define ___internal_ldrELF32_h
    2920
     21#include <iprt/assert.h>
     22
    3023#include "ldrELFCommon.h"
    3124
    3225/*
    33  * ELF definitions common to all 32-bit architectures.
     26 * ELF 32 standard types.
    3427 */
     28typedef uint32_t        Elf32_Addr;
     29typedef uint16_t        Elf32_Half;
     30typedef uint32_t        Elf32_Off;
     31typedef int32_t         Elf32_Sword;
     32typedef uint32_t        Elf32_Word;
    3533
    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 */
     38AssertCompileSize(Elf32_Addr,   4);
     39AssertCompileSize(Elf32_Half,   2);
     40AssertCompileSize(Elf32_Off,    4);
     41AssertCompileSize(Elf32_Sword,  4);
     42AssertCompileSize(Elf32_Word,   4);
     43
     44/*
     45 * ELF 32 non-standard types for convenience.
     46 */
     47typedef Elf32_Word      Elf32_Size;
     48typedef Elf32_Word      Elf32_Hashelt;
    4349
    4450/*
    4551 * ELF header.
    4652 */
    47 
    48 typedef struct Elf32_Ehdr {
    49         unsigned char   e_ident[EI_NIDENT];     /* File identification. */
    50         Elf32_Half      e_type;         /* File type. */
    51         Elf32_Half      e_machine;      /* Machine architecture. */
    52         Elf32_Word      e_version;      /* ELF format version. */
    53         Elf32_Addr      e_entry;        /* Entry point. */
    54         Elf32_Off       e_phoff;        /* Program header file offset. */
    55         Elf32_Off       e_shoff;        /* Section header file offset. */
    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. */
     53typedef 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. */
    6369} Elf32_Ehdr;
    6470
     
    6672 * Section header.
    6773 */
     74typedef 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;
    6887
    69 typedef struct {
    70         Elf32_Word      sh_name;        /* Section name (index into the
    71                                            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;
    8288
    8389/*
    8490 * Program header.
    8591 */
    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 contents in file. */
    93         Elf32_Size      p_memsz;        /* Size of contents in memory. */
    94         Elf32_Word      p_flags;        /* Access permission flags. */
    95         Elf32_Size      p_align;        /* Alignment in memory and file. */
     92typedef 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. */
    96102} Elf32_Phdr;
    97103
     104
    98105/*
    99  * Note header. (added by Ramshankar)
     106 * Note header.
    100107 */
    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 */
     108typedef 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. */
    106113} Elf32_Nhdr;
    107114
     115
    108116/*
    109  * Dynamic structure.  The ".dynamic" section contains an array of them.
     117 * Symbol table entry.
    110118 */
     119typedef 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;
    111128
    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 */
     133typedef 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
     139typedef 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 */
     150typedef 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;
    118158} Elf32_Dyn;
    119159
    120160/*
    121  * Relocation entries.
     161 * Helper macros.
    122162 */
     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))
    123169
    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))
    129176
    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;
    136177
    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 */
    140179
    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 #endif
    165 
  • trunk/src/VBox/Runtime/include/internal/ldrELF64.h

    • Property svn:keywords changed from Id to Author 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
    48 *
    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.
    2516 */
    2617
     
    2819#define ___internal_ldrELF64_h
    2920
     21#include <iprt/assert.h>            /* Added by Ramshankar */
     22
    3023#include "ldrELFCommon.h"
    3124
    3225/*
    33  * ELF definitions common to all 64-bit architectures.
     26 * ELF 64 standard types.
    3427 */
    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;
     28typedef uint64_t        Elf64_Addr;
     29typedef uint64_t        Elf64_Off;
     30typedef uint16_t        Elf64_Half;
     31typedef uint32_t        Elf64_Word;
     32typedef int32_t         Elf64_Sword;
     33typedef uint64_t        Elf64_Xword;
     34typedef int64_t         Elf64_Sxword;
    4335
    4436/*
    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.
    4938 */
    50 
    51 #ifdef __alpha__
    52 typedef Elf64_Off       Elf64_Hashelt;
    53 #else
    54 typedef Elf64_Half      Elf64_Hashelt;
    55 #endif
     39AssertCompileSize(Elf64_Addr,    8);
     40AssertCompileSize(Elf64_Off,     8);
     41AssertCompileSize(Elf64_Half,    2);
     42AssertCompileSize(Elf64_Word,    4);
     43AssertCompileSize(Elf64_Sword,   4);
     44AssertCompileSize(Elf64_Xword,   8);
     45AssertCompileSize(Elf64_Sxword,  8);
    5646
    5747/*
    58  * ELF header.
     48 * ELF 64 non-standard types for convenience.
    5949 */
     50typedef Elf64_Xword     Elf64_Size;
     51typedef Elf64_Word      Elf64_Hashelt;
    6052
    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 */
     56typedef 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. */
    7672} Elf64_Ehdr;
    7773
     
    7975 * Section header.
    8076 */
    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. */
     77typedef 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. */
    9489} Elf64_Shdr;
    9590
     
    9792 * Program header.
    9893 */
    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 contents in file. */
    107         Elf64_Size      p_memsz;        /* Size of contents in memory. */
    108         Elf64_Size      p_align;        /* Alignment in memory and file. */
     94typedef 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. */
    109104} Elf64_Phdr;
    110105
    111106/*
    112  * Note header. (added by Ramshankar)
     107 * Note header.
    113108 */
    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 */
     109typedef 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. */
    119114} Elf64_Nhdr;
    120115
     116/*
     117 * Symbol table entry.
     118 */
     119typedef 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;
    121128
    122129/*
    123  * Dynamic structure.  The ".dynamic" section contains an array of them.
     130 * Relocations.
    124131 */
     132typedef 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;
    125137
    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;
     138typedef 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 */
     149typedef 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;
    132157} Elf64_Dyn;
    133158
    134159/*
    135  * Relocation entries.
     160 * Helper macros.
    136161 */
     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))
    137168
    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))
    143175
    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;
    150176
    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 */
    154178
    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 #endif
    179 
  • trunk/src/VBox/Runtime/r3/solaris/coredumper-solaris.cpp

    r32048 r32197  
    5454#endif  /* RT_OS_SOLARIS */
    5555
    56 #include "internal/ldrElf.h"
     56#include "internal/ldrELF.h"
     57#include "internal/ldrELF64.h"
    5758
    5859/*******************************************************************************
     
    8586typedef struct ELFNOTEHDR
    8687{
    87     Elf_Nhdr                        Hdr;                        /* Header of NOTE section */
     88    Elf64_Nhdr                      Hdr;                        /* Header of NOTE section */
    8889    char                            achName[8];                 /* Name of NOTE section */
    8990} ELFNOTEHDR;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette