Make Position Independent Executables work for CloudABI.

- Set BI_CAN_EXEC_DYN, so we can execute ET_DYN ELF files in addition to
  regular ET_EXECs.
- Provide an AT_BASE entry in the auxiliary vector, so the executable
  knows at which address it got loaded and can apply relocations.
This commit is contained in:
Ed Schouten 2016-03-31 18:52:00 +00:00
parent 2054309b6a
commit 4a8b3b18cc
3 changed files with 3 additions and 0 deletions

View File

@ -156,5 +156,6 @@ Elf64_Brandinfo cloudabi64_brand = {
.brand = ELFOSABI_CLOUDABI,
.machine = EM_X86_64,
.sysvec = &cloudabi64_elf_sysvec,
.flags = BI_CAN_EXEC_DYN,
.compat_3_brand = "CloudABI",
};

View File

@ -157,5 +157,6 @@ Elf64_Brandinfo cloudabi64_brand = {
.brand = ELFOSABI_CLOUDABI,
.machine = EM_AARCH64,
.sysvec = &cloudabi64_elf_sysvec,
.flags = BI_CAN_EXEC_DYN,
.compat_3_brand = "CloudABI",
};

View File

@ -99,6 +99,7 @@ cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
#define PTR(type, ptr) { .a_type = (type), .a_ptr = (uintptr_t)(ptr) }
PTR(CLOUDABI_AT_ARGDATA, argdata),
VAL(CLOUDABI_AT_ARGDATALEN, argdatalen),
VAL(CLOUDABI_AT_BASE, args->base),
PTR(CLOUDABI_AT_CANARY, canary),
VAL(CLOUDABI_AT_CANARYLEN, sizeof(canarybuf)),
VAL(CLOUDABI_AT_NCPUS, mp_ncpus),