"Fossies" - the Fresh Open Source Software Archive

Member "dmd2/src/druntime/import/core/sys/netbsd/sys/elf64.d" (20 Nov 2020, 4067 Bytes) of package /linux/misc/dmd.2.094.2.linux.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) D source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /**
    2  * D header file for NetBSD.
    3  *
    4  * http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/sys/exec_elf.h
    5  */
    6 module core.sys.netbsd.sys.elf64;
    7 
    8 version (NetBSD):
    9 extern (C):
   10 pure:
   11 nothrow:
   12 
   13 import core.stdc.stdint;
   14 public import core.sys.netbsd.sys.elf_common;
   15 
   16 alias uint16_t Elf64_Half;
   17 alias uint32_t Elf64_Word;
   18 alias int32_t  Elf64_Sword;
   19 alias uint64_t Elf64_Lword;
   20 alias uint64_t Elf64_Xword;
   21 alias int64_t  Elf64_Sxword;
   22 alias uint64_t Elf64_Addr;
   23 alias uint64_t Elf64_Off;
   24 alias Elf64_Word Elf64_Hashelt;
   25 alias Elf64_Xword Elf64_Size;
   26 alias Elf64_Sxword Elf64_Ssize;
   27 
   28 struct Elf64_Ehdr
   29 {
   30     char[EI_NIDENT] e_ident = 0;
   31     Elf64_Half    e_type;
   32     Elf64_Half    e_machine;
   33     Elf64_Word    e_version;
   34     Elf64_Addr    e_entry;
   35     Elf64_Off     e_phoff;
   36     Elf64_Off     e_shoff;
   37     Elf64_Word    e_flags;
   38     Elf64_Half    e_ehsize;
   39     Elf64_Half    e_phentsize;
   40     Elf64_Half    e_phnum;
   41     Elf64_Half    e_shentsize;
   42     Elf64_Half    e_shnum;
   43     Elf64_Half    e_shstrndx;
   44 }
   45 
   46 struct Elf64_Shdr
   47 {
   48     Elf64_Word    sh_name;
   49     Elf64_Word    sh_type;
   50     Elf64_Xword   sh_flags;
   51     Elf64_Addr    sh_addr;
   52     Elf64_Off     sh_offset;
   53     Elf64_Xword   sh_size;
   54     Elf64_Word    sh_link;
   55     Elf64_Word    sh_info;
   56     Elf64_Xword   sh_addralign;
   57     Elf64_Xword   sh_entsize;
   58 }
   59 
   60 struct Elf64_Phdr
   61 {
   62     Elf64_Word    p_type;
   63     Elf64_Word    p_flags;
   64     Elf64_Off     p_offset;
   65     Elf64_Addr    p_vaddr;
   66     Elf64_Addr    p_paddr;
   67     Elf64_Xword   p_filesz;
   68     Elf64_Xword   p_memsz;
   69     Elf64_Xword   p_align;
   70 }
   71 
   72 struct Elf64_Dyn
   73 {
   74   Elf64_Sxword  d_tag;
   75   union _d_un
   76   {
   77       Elf64_Xword d_val;
   78       Elf64_Addr d_ptr;
   79   } _d_un d_un;
   80 }
   81 
   82 struct Elf64_Rel
   83 {
   84     Elf64_Addr    r_offset;
   85     Elf64_Xword   r_info;
   86 }
   87 
   88 struct Elf64_Rela
   89 {
   90     Elf64_Addr    r_offset;
   91     Elf64_Xword   r_info;
   92     Elf64_Sxword  r_addend;
   93 }
   94 
   95 extern (D)
   96 {
   97     auto ELF64_R_SYM(I)(I i) { return i >> 32; }
   98     auto ELF64_R_TYPE(I)(I i) { return i & 0xffffffff; }
   99     auto ELF64_R_INFO(S, T)(S sym, T type) { return (sym << 32) + (type & 0xffffffff); }
  100 
  101     auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; }
  102     auto ELF64_R_TYPE_ID(I)(I i) { return (cast(Elf64_Xword) i << 56 ) >> 56; }
  103     auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; }
  104 }
  105 
  106 alias Elf_Note Elf64_Nhdr;
  107 
  108 struct Elf64_Move
  109 {
  110     Elf64_Lword   m_value;
  111     Elf64_Xword   m_info;
  112     Elf64_Xword   m_poffset;
  113     Elf64_Half    m_repeat;
  114     Elf64_Half    m_stride;
  115 }
  116 
  117 extern (D)
  118 {
  119     auto ELF64_M_SYM(I)(I info) { return info >> 8; }
  120     auto ELF64_M_SIZE(I)(I info) { return cast(ubyte)info; }
  121     auto ELF64_M_INFO(S, SZ)(S sym, SZ size) { return (sym << 8) + cast(ubye)size; }
  122 }
  123 
  124 struct Elf64_Cap
  125 {
  126     Elf64_Xword   c_tag;
  127     union _c_un
  128     {
  129         Elf64_Xword     c_val;
  130         Elf64_Addr      c_ptr;
  131     } _c_un c_un;
  132 }
  133 
  134 struct Elf64_Sym
  135 {
  136     Elf64_Word    st_name;
  137     ubyte st_info;
  138     ubyte st_other;
  139     Elf64_Half st_shndx;
  140     Elf64_Addr    st_value;
  141     Elf64_Xword   st_size;
  142 }
  143 
  144 extern (D)
  145 {
  146     auto ELF64_ST_BIND(T)(T val) { return cast(ubyte)val >> 4; }
  147     auto ELF64_ST_TYPE(T)(T val) { return val & 0xf; }
  148     auto ELF64_ST_INFO(B, T)(B bind, T type) { return (bind << 4) + (type & 0xf); }
  149     auto ELF64_ST_VISIBILITY(O)(O o) { return o & 0x03; }
  150 }
  151 
  152 struct Elf64_Verdef
  153 {
  154     Elf64_Half    vd_version;
  155     Elf64_Half    vd_flags;
  156     Elf64_Half    vd_ndx;
  157     Elf64_Half    vd_cnt;
  158     Elf64_Word    vd_hash;
  159     Elf64_Word    vd_aux;
  160     Elf64_Word    vd_next;
  161 }
  162 
  163 struct Elf64_Verdaux
  164 {
  165     Elf64_Word    vda_name;
  166     Elf64_Word    vda_next;
  167 }
  168 
  169 struct Elf64_Verneed
  170 {
  171     Elf64_Half    vn_version;
  172     Elf64_Half    vn_cnt;
  173     Elf64_Word    vn_file;
  174     Elf64_Word    vn_aux;
  175     Elf64_Word    vn_next;
  176 }
  177 
  178 struct Elf64_Vernaux
  179 {
  180     Elf64_Word    vna_hash;
  181     Elf64_Half    vna_flags;
  182     Elf64_Half    vna_other;
  183     Elf64_Word    vna_name;
  184     Elf64_Word    vna_next;
  185 }
  186 
  187 alias Elf64_Half Elf64_Versym;
  188 
  189 struct Elf64_Syminfo
  190 {
  191     Elf64_Half si_boundto;
  192     Elf64_Half si_flags;
  193 }