1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build linux
6// +build 386 arm
7
8package runtime
9
10// ELF32 structure definitions for use by the vDSO loader
11
12type elfSym struct {
13	st_name  uint32
14	st_value uint32
15	st_size  uint32
16	st_info  byte
17	st_other byte
18	st_shndx uint16
19}
20
21type elfVerdef struct {
22	vd_version uint16 /* Version revision */
23	vd_flags   uint16 /* Version information */
24	vd_ndx     uint16 /* Version Index */
25	vd_cnt     uint16 /* Number of associated aux entries */
26	vd_hash    uint32 /* Version name hash value */
27	vd_aux     uint32 /* Offset in bytes to verdaux array */
28	vd_next    uint32 /* Offset in bytes to next verdef entry */
29}
30
31type elfEhdr struct {
32	e_ident     [_EI_NIDENT]byte /* Magic number and other info */
33	e_type      uint16           /* Object file type */
34	e_machine   uint16           /* Architecture */
35	e_version   uint32           /* Object file version */
36	e_entry     uint32           /* Entry point virtual address */
37	e_phoff     uint32           /* Program header table file offset */
38	e_shoff     uint32           /* Section header table file offset */
39	e_flags     uint32           /* Processor-specific flags */
40	e_ehsize    uint16           /* ELF header size in bytes */
41	e_phentsize uint16           /* Program header table entry size */
42	e_phnum     uint16           /* Program header table entry count */
43	e_shentsize uint16           /* Section header table entry size */
44	e_shnum     uint16           /* Section header table entry count */
45	e_shstrndx  uint16           /* Section header string table index */
46}
47
48type elfPhdr struct {
49	p_type   uint32 /* Segment type */
50	p_offset uint32 /* Segment file offset */
51	p_vaddr  uint32 /* Segment virtual address */
52	p_paddr  uint32 /* Segment physical address */
53	p_filesz uint32 /* Segment size in file */
54	p_memsz  uint32 /* Segment size in memory */
55	p_flags  uint32 /* Segment flags */
56	p_align  uint32 /* Segment alignment */
57}
58
59type elfShdr struct {
60	sh_name      uint32 /* Section name (string tbl index) */
61	sh_type      uint32 /* Section type */
62	sh_flags     uint32 /* Section flags */
63	sh_addr      uint32 /* Section virtual addr at execution */
64	sh_offset    uint32 /* Section file offset */
65	sh_size      uint32 /* Section size in bytes */
66	sh_link      uint32 /* Link to another section */
67	sh_info      uint32 /* Additional section information */
68	sh_addralign uint32 /* Section alignment */
69	sh_entsize   uint32 /* Entry size if section holds table */
70}
71
72type elfDyn struct {
73	d_tag int32  /* Dynamic entry type */
74	d_val uint32 /* Integer value */
75}
76
77type elfVerdaux struct {
78	vda_name uint32 /* Version or dependency names */
79	vda_next uint32 /* Offset in bytes to next verdaux entry */
80}
81