xref: /third_party/musl/arch/x32/reloc.h (revision 570af302)
1570af302Sopenharmony_ci#define LDSO_ARCH "x32"
2570af302Sopenharmony_ci
3570af302Sopenharmony_ci/* FIXME: x32 is very strange in its use of 64-bit relocation types in
4570af302Sopenharmony_ci * a 32-bit environment. As long as the memory at reloc_addr is
5570af302Sopenharmony_ci * zero-filled prior to relocations, just treating 64-bit relocations
6570af302Sopenharmony_ci * as operating on 32-bit slots should be fine, but this should be
7570af302Sopenharmony_ci * checked. In particular, R_X86_64_64, R_X86_64_DTPOFF64, and
8570af302Sopenharmony_ci * R_X86_64_TPOFF64 may need checking. */
9570af302Sopenharmony_ci
10570af302Sopenharmony_ci/* The R_X86_64_64, R_X86_64_DTPOFF32, and R_X86_64_TPOFF32 reloc types
11570af302Sopenharmony_ci * were previously mapped in the switch table form of this file; however,
12570af302Sopenharmony_ci * they do not seem to be used/usable for anything. If needed, new
13570af302Sopenharmony_ci * mappings will have to be added. */
14570af302Sopenharmony_ci
15570af302Sopenharmony_ci#define REL_SYMBOLIC    R_X86_64_32
16570af302Sopenharmony_ci#define REL_OFFSET      R_X86_64_PC32
17570af302Sopenharmony_ci#define REL_GOT         R_X86_64_GLOB_DAT
18570af302Sopenharmony_ci#define REL_PLT         R_X86_64_JUMP_SLOT
19570af302Sopenharmony_ci#define REL_RELATIVE    R_X86_64_RELATIVE
20570af302Sopenharmony_ci#define REL_COPY        R_X86_64_COPY
21570af302Sopenharmony_ci#define REL_DTPMOD      R_X86_64_DTPMOD64
22570af302Sopenharmony_ci#define REL_DTPOFF      R_X86_64_DTPOFF64
23570af302Sopenharmony_ci#define REL_TPOFF       R_X86_64_TPOFF64
24570af302Sopenharmony_ci
25570af302Sopenharmony_ci#define CRTJMP(pc,sp) __asm__ __volatile__( \
26570af302Sopenharmony_ci	"mov %1,%%esp ; jmp *%0" : : "r"((uint64_t)(uintptr_t)pc), "r"(sp) : "memory" )
27570af302Sopenharmony_ci
28570af302Sopenharmony_ci#define GETFUNCSYM(fp, sym, got) __asm__ ( \
29570af302Sopenharmony_ci	".hidden " #sym "\n" \
30570af302Sopenharmony_ci	"	lea " #sym "(%%rip),%0\n" \
31570af302Sopenharmony_ci	: "=r"(*fp) : : "memory" )
32