-
Notifications
You must be signed in to change notification settings - Fork 9
/
xfile.h
75 lines (68 loc) · 2.02 KB
/
xfile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* $VER: vlink xfile.h V0.16c (08.03.19)
*
* This file is part of vlink, a portable linker for multiple
* object formats.
* Copyright (c) 1997-2019 Frank Wille
*/
/* XFile program header, big endian */
typedef struct
{
uint8_t x_id[2]; /* 'H','U' - xfile identification */
uint8_t x_rsrvd1[2]; /* unused - always zero */
uint8_t x_baseaddr[4]; /* linker's base address */
uint8_t x_execaddr[4]; /* start address on base address */
uint8_t x_textsz[4]; /* .text size in bytes */
uint8_t x_datasz[4]; /* .data size in bytes */
uint8_t x_heapsz[4]; /* .bss and .stack size in bytes */
uint8_t x_relocsz[4]; /* relocation table size in bytes */
uint8_t x_syminfsz[4]; /* symbol info size in bytes */
uint8_t x_scdlinsz[4]; /* SCD line info size */
uint8_t x_scdsymsz[4]; /* SCD symbols size */
uint8_t x_scdstrsz[4]; /* SCD strings size */
uint8_t x_rsrvd2[20]; /* unused - always zero */
} XFile;
/* Xfile symbol table */
typedef struct
{
uint16_t type;
uint32_t value;
char name[1]; /* null-terminated symbol name, padded to even */
} XSym;
#define XSYM_ABS 0x0200
#define XSYM_TEXT 0x0201
#define XSYM_DATA 0x0202
#define XSYM_BSS 0x0203
#define XSYM_STACK 0x0204
/* default script */
static const char defaultscript[] =
"SECTIONS {\n"
" . = 0;\n"
" .text: {\n"
" *(.i* i* I*)\n"
" *(.t* t* T* .c* c* C*)\n"
" *(.f* f* F*)\n"
" PROVIDE(_etext = .);\n"
" PROVIDE(__etext = .);\n"
" . = ALIGN(2);\n"
" }\n"
" .data: {\n"
" PROVIDE(_LinkerDB = . + 0x8000);\n"
" PROVIDE(_SDA_BASE_ = . + 0x8000);\n"
" VBCC_CONSTRUCTORS\n"
" *(.rodata*)\n"
" *(.d* d* D*)\n"
" *(.sdata*)\n"
" *(__MERGED)\n"
" PROVIDE(_edata = .);\n"
" PROVIDE(__edata = .);\n"
" . = ALIGN(2);\n"
" }\n"
" .bss: {\n"
" *(.sbss*)\n"
" *(.scommon)\n"
" *(.b* b* B* .u* u* U*)\n"
" *(COMMON)\n"
" PROVIDE(_end = ALIGN(4));\n"
" PROVIDE(__end = ALIGN(4));\n"
" }\n"
"}\n";