forked from StarWolf3000/vasm-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathelf_reloc_68k.h
108 lines (96 loc) · 3.01 KB
/
elf_reloc_68k.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* elf_reloc_68k.h ELF relocation types for M68k */
/* (c) in 2002 by Frank Wille */
#define R_68K_NONE 0 /* No reloc */
#define R_68K_32 1 /* Direct 32 bit */
#define R_68K_16 2 /* Direct 16 bit */
#define R_68K_8 3 /* Direct 8 bit */
#define R_68K_PC32 4 /* PC relative 32 bit */
#define R_68K_PC16 5 /* PC relative 16 bit */
#define R_68K_PC8 6 /* PC relative 8 bit */
#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
#define R_68K_GOT32O 10 /* 32 bit GOT offset */
#define R_68K_GOT16O 11 /* 16 bit GOT offset */
#define R_68K_GOT8O 12 /* 8 bit GOT offset */
#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
#define R_68K_PLT32O 16 /* 32 bit PLT offset */
#define R_68K_PLT16O 17 /* 16 bit PLT offset */
#define R_68K_PLT8O 18 /* 8 bit PLT offset */
#define R_68K_COPY 19 /* Copy symbol at runtime */
#define R_68K_GLOB_DAT 20 /* Create GOT entry */
#define R_68K_JMP_SLOT 21 /* Create PLT entry */
#define R_68K_RELATIVE 22 /* Adjust by program base */
if ((*rl)->type <= LAST_STANDARD_RELOC) {
nreloc *r = (nreloc *)(*rl)->reloc;
*refsym = r->sym;
*addend = r->addend;
pos = r->bitoffset;
size = r->size;
*roffset = r->byteoffset;
mask = r->mask;
switch ((*rl)->type) {
case REL_ABS:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_32;
else if (size == 16)
t = R_68K_16;
else if (size == 8)
t = R_68K_8;
}
break;
case REL_PC:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_PC32;
else if (size == 16)
t = R_68K_PC16;
else if (size == 8)
t = R_68K_PC8;
}
break;
case REL_GOTOFF:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_GOT32O;
else if (size == 16)
t = R_68K_GOT16O;
else if (size == 8)
t = R_68K_GOT8O;
}
break;
case REL_GOT:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_GOT32;
else if (size == 16)
t = R_68K_GOT16;
else if (size == 8)
t = R_68K_GOT8;
}
break;
case REL_PLTOFF:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_PLT32O;
else if (size == 16)
t = R_68K_PLT16O;
else if (size == 8)
t = R_68K_PLT8O;
}
break;
case REL_PLT:
if (pos==0 && mask==~0) {
if (size == 32)
t = R_68K_PLT32;
else if (size == 16)
t = R_68K_PLT16;
else if (size == 8)
t = R_68K_PLT8;
}
break;
}
}