fcfbf99e2653fb64fffa6276834de99200f40c3f
[musl] / arch / x32 / reloc.h
1 #include <stdint.h>
2 #include <string.h>
3 #include <elf.h>
4
5 #define LDSO_ARCH "x32"
6
7 /* FIXME: x32 is very strange in its use of 64-bit relocation types in
8  * a 32-bit environment. As long as the memory at reloc_addr is
9  * zero-filled prior to relocations, just treating 64-bit relocations
10  * as operating on 32-bit slots should be fine, but this should be
11  * checked. In particular, R_X86_64_64, R_X86_64_DTPOFF64, and
12  * R_X86_64_TPOFF64 may need checking. */
13
14 static int remap_rel(int type)
15 {
16         switch(type) {
17         case R_X86_64_64:
18         case R_X86_64_32:
19                 return REL_SYMBOLIC;
20         case R_X86_64_PC32:
21                 return REL_OFFSET;
22         case R_X86_64_GLOB_DAT:
23                 return REL_GOT;
24         case R_X86_64_JUMP_SLOT:
25                 return REL_PLT;
26         case R_X86_64_RELATIVE:
27                 return REL_RELATIVE;
28         case R_X86_64_COPY:
29                 return REL_COPY;
30         case R_X86_64_DTPMOD64:
31                 return REL_DTPMOD;
32         case R_X86_64_DTPOFF64:
33         case R_X86_64_DTPOFF32:
34                 return REL_DTPOFF;
35         case R_X86_64_TPOFF64:
36         case R_X86_64_TPOFF32:
37                 return REL_TPOFF;
38         }
39         return 0;
40 }