summaryrefslogtreecommitdiff
path: root/rts/linker/elf_plt.h
blob: 1995d51207cf36bb57a586200acd661466f9cbfe (plain)
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
#pragma once

#include "ghcplatform.h"
#include <LinkerInternals.h>

#if defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)

#include "elf_plt_arm.h"
#include "elf_plt_aarch64.h"

#if defined(OBJFORMAT_ELF)

#if defined(__x86_64__)
#define __suffix__ X86_64
#elif defined(__aarch64__)
#define __suffix__ Aarch64
#elif defined(__mips64__)
#define __suffix__ Mips64
#elif defined(__i386__)
#define __suffix__ X86
#elif defined(__arm__)
#define __suffix__ Arm
#elif defined(__mips__)
#define __suffix__ Mips
#else
#error "unknown architecture"
#endif

#define PASTE(x,y) x ## y
#define EVAL(x,y) PASTE(x,y)
#define ADD_SUFFIX(x) EVAL(PASTE(x,),__suffix__)

unsigned  numberOfStubsForSection( ObjectCode *oc, unsigned sectionIndex);

#define STUB_SIZE          ADD_SUFFIX(stubSize)

bool findStub(Section * section, void* * addr, uint8_t flags);
bool makeStub(Section * section, void* * addr, uint8_t flags);

void freeStubs(Section * section);

#endif // OBJECTFORMAT_ELF

#endif // arm/aarch64_HOST_ARCH