OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [posix/] [mm0/] [include/] [lib/] [elf/] [elfsym.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Definitions for ELF Symbol tables, symbols
3
 * Based on Portable Formats Specification v1.1
4
 *
5
 * Copyright (C) 2008 Bahadir Balban
6
 */
7
#ifndef __ELFSYM_H__
8
#define __ELFSYM_H__
9
 
10
#include <l4/types.h>
11
 
12
struct elf_symbol_entry {
13
        u32     st_name;        /* Index into string table */
14
        u32     st_value;       /* Symbol value; address, aboslute etc. */
15
        u32     st_size;        /* Number of bytes contained in object */
16
        u8      st_info;        /* Type and binding attributes */
17
        u8      st_other;       /* Unused, 0 */
18
        u16     st_shndx;       /* Section header index associated with entry */
19
} __attribute__((__packed__));
20
 
21
/* To manipulate binding and type attributes on st_info field */
22
#define ELF32_ST_BIND(i)        ((i) >> 4)
23
#define ELF32_ST_TYPE(i)        ((i) & 0xF)
24
#define ELF32_ST_INFO(b, t)     (((b) << 4) + ((t) & 0xF))
25
 
26
/* Symbol binding codes */
27
#define STB_LOCAL               0
28
#define STB_GLOBAL              1
29
#define STB_WEAK                2
30
#define STB_LOPROC              13
31
#define STB_HIPROC              15
32
 
33
/* Symbol types */
34
#define STT_NOTYPE              0
35
#define STT_OBJECT              1
36
#define STT_FUNC                2
37
#define STT_SECTION             3
38
#define STT_FILE                4
39
#define STT_LOPROC              13
40
#define STT_HIPROC              15
41
 
42
/* Relocation structures */
43
struct elf_rel {
44
        u32     r_offset;
45
        u32     r_info;
46
} __attribute__((__packed__));
47
 
48
struct elf_rela {
49
        u32     r_offset;
50
        u32     r_info;
51
        s32     r_addend;
52
} __attribute__((__packed__));
53
 
54
/* Macros to manipulate r_info field */
55
#define ELF32_R_SYM(i)                  ((i) >> 8)
56
#define ELF32_R_TYPE(i)                 ((u8)(i))
57
#define ELF32_R_INFO(s,t)               (((s) << 8) + (u8)(t))
58
 
59
#endif /* __ELFSYM_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.