diff options
author | Rich Felker <dalias@aerifal.cx> | 2016-01-22 00:02:21 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2016-01-22 00:02:21 +0000 |
commit | e617b9eea9d45b170eabadf5ca96ca0536c538be (patch) | |
tree | a06d433fd4219466e4b27f248e332f9e0482dd5d /src/ldso | |
parent | 397f0a6a7d798b0e3f636fe053cad9c483e011fb (diff) | |
download | musl-e617b9eea9d45b170eabadf5ca96ca0536c538be.tar.gz musl-e617b9eea9d45b170eabadf5ca96ca0536c538be.tar.bz2 musl-e617b9eea9d45b170eabadf5ca96ca0536c538be.tar.xz musl-e617b9eea9d45b170eabadf5ca96ca0536c538be.zip |
move arm-specific translation units out of arch/arm/src, to src/*/arm
this is possible with the new build system that allows src/*/$(ARCH)/*
files which do not shadow a file in the parent directory, and yields a
more logical organization. eventually it will be possible to remove
arch/*/src from the build system.
Diffstat (limited to 'src/ldso')
-rw-r--r-- | src/ldso/arm/find_exidx.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ldso/arm/find_exidx.c b/src/ldso/arm/find_exidx.c new file mode 100644 index 00000000..77c4472b --- /dev/null +++ b/src/ldso/arm/find_exidx.c @@ -0,0 +1,42 @@ +#define _GNU_SOURCE +#include <link.h> +#include <stdint.h> + +struct find_exidx_data { + uintptr_t pc, exidx_start; + int exidx_len; +}; + +static int find_exidx(struct dl_phdr_info *info, size_t size, void *ptr) +{ + struct find_exidx_data *data = ptr; + const ElfW(Phdr) *phdr = info->dlpi_phdr; + uintptr_t addr, exidx_start = 0; + int i, match = 0, exidx_len = 0; + + for (i = info->dlpi_phnum; i > 0; i--, phdr++) { + addr = info->dlpi_addr + phdr->p_vaddr; + switch (phdr->p_type) { + case PT_LOAD: + match |= data->pc >= addr && data->pc < addr + phdr->p_memsz; + break; + case PT_ARM_EXIDX: + exidx_start = addr; + exidx_len = phdr->p_memsz; + break; + } + } + data->exidx_start = exidx_start; + data->exidx_len = exidx_len; + return match; +} + +uintptr_t __gnu_Unwind_Find_exidx(uintptr_t pc, int *pcount) +{ + struct find_exidx_data data; + data.pc = pc; + if (dl_iterate_phdr(find_exidx, &data) <= 0) + return 0; + *pcount = data.exidx_len / 8; + return data.exidx_start; +} |