summaryrefslogtreecommitdiff
path: root/kc/dynamic_x86_64.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-03-18 12:24:48 +0000
committerAda Christine <adachristine18@gmail.com>2022-03-18 12:24:48 +0000
commit51cfcb98bde7e78b4817a9060885b25b6c3d354c (patch)
treea7ba8214cdfbc170dceded6e8deb883efd100ae4 /kc/dynamic_x86_64.c
parent5826f2045cca28b7c9ba8a5b65b4b4928eb6b461 (diff)
now using clang, native PE UEFI loader image. made an ugly hack to get
into the shim. it's probably ok.
Diffstat (limited to 'kc/dynamic_x86_64.c')
-rw-r--r--kc/dynamic_x86_64.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/kc/dynamic_x86_64.c b/kc/dynamic_x86_64.c
index 6b7abd7..a573283 100644
--- a/kc/dynamic_x86_64.c
+++ b/kc/dynamic_x86_64.c
@@ -9,10 +9,10 @@ void kc_dynamic_init(void *base, Elf64_Dyn *dyn)
size_t entsize;
};
- struct rela reladyn = {NULL,};
- struct rela relaplt = {NULL,};
+ struct rela reladyn = {NULL, 0, 0};
+ struct rela relaplt = {NULL, 0, 0};
- Elf64_Addr *gotplt;
+ Elf64_Addr *gotplt = NULL;
while (dyn && dyn->d_tag != DT_NULL)
{
@@ -46,8 +46,11 @@ void kc_dynamic_init(void *base, Elf64_Dyn *dyn)
// peform relocations
//
- gotplt[1] = (uintptr_t)NULL;
- gotplt[2] = (uintptr_t)kc_resolve_symbol;
+ if (gotplt)
+ {
+ gotplt[1] = (uintptr_t)NULL;
+ gotplt[2] = (uintptr_t)kc_resolve_symbol;
+ }
kc_reloc(base, relaplt.entries, relaplt.size, relaplt.entsize);
kc_reloc(base, reladyn.entries, reladyn.size, reladyn.entsize);
}