summaryrefslogtreecommitdiffstats
path: root/libc/bionic
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-01 15:23:44 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-10-01 15:23:44 +0000
commit693bd73fcdf1504e84aef314d1933f5efc2c817d (patch)
treec90eb16e2defbb6dde4e6c516338652e6e4cf557 /libc/bionic
parentf5ea738baa0ad5b32348f2ac42450d33d452ef31 (diff)
parentc620059479c47a78d57086d73726c9adc2f337ad (diff)
downloadbionic-693bd73fcdf1504e84aef314d1933f5efc2c817d.zip
bionic-693bd73fcdf1504e84aef314d1933f5efc2c817d.tar.gz
bionic-693bd73fcdf1504e84aef314d1933f5efc2c817d.tar.bz2
Merge "Remove 32-bit assumptions from the ELF code."
Diffstat (limited to 'libc/bionic')
-rw-r--r--libc/bionic/dl_iterate_phdr_static.c10
-rw-r--r--libc/bionic/getauxval.cpp4
-rw-r--r--libc/bionic/libc_init_static.cpp8
3 files changed, 11 insertions, 11 deletions
diff --git a/libc/bionic/dl_iterate_phdr_static.c b/libc/bionic/dl_iterate_phdr_static.c
index fc79ce5..d03d3d2 100644
--- a/libc/bionic/dl_iterate_phdr_static.c
+++ b/libc/bionic/dl_iterate_phdr_static.c
@@ -35,7 +35,7 @@
extern void* __executable_start;
int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data), void* data) {
- Elf32_Ehdr* ehdr = (Elf32_Ehdr*) &__executable_start;
+ Elf_Ehdr* ehdr = (Elf_Ehdr*) &__executable_start;
// TODO: again, copied from linker.c. Find a better home for this later.
if (ehdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
@@ -51,7 +51,7 @@ int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data
struct dl_phdr_info exe_info;
exe_info.dlpi_addr = 0;
exe_info.dlpi_name = NULL;
- exe_info.dlpi_phdr = (Elf32_Phdr*) ((unsigned long) ehdr + ehdr->e_phoff);
+ exe_info.dlpi_phdr = (Elf_Phdr*) ((unsigned long) ehdr + ehdr->e_phoff);
exe_info.dlpi_phnum = ehdr->e_phnum;
#ifdef AT_SYSINFO_EHDR
@@ -62,15 +62,15 @@ int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data
}
// Try the VDSO if that didn't work.
- Elf32_Ehdr* ehdr_vdso = (Elf32_Ehdr*) getauxval(AT_SYSINFO_EHDR);
+ Elf_Ehdr* ehdr_vdso = (Elf_Ehdr*) getauxval(AT_SYSINFO_EHDR);
struct dl_phdr_info vdso_info;
vdso_info.dlpi_addr = 0;
vdso_info.dlpi_name = NULL;
- vdso_info.dlpi_phdr = (Elf32_Phdr*) ((char*) ehdr_vdso + ehdr_vdso->e_phoff);
+ vdso_info.dlpi_phdr = (Elf_Phdr*) ((char*) ehdr_vdso + ehdr_vdso->e_phoff);
vdso_info.dlpi_phnum = ehdr_vdso->e_phnum;
for (size_t i = 0; i < vdso_info.dlpi_phnum; ++i) {
if (vdso_info.dlpi_phdr[i].p_type == PT_LOAD) {
- vdso_info.dlpi_addr = (Elf32_Addr) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr;
+ vdso_info.dlpi_addr = (Elf_Addr) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr;
break;
}
}
diff --git a/libc/bionic/getauxval.cpp b/libc/bionic/getauxval.cpp
index fd225e0..3ee31d6 100644
--- a/libc/bionic/getauxval.cpp
+++ b/libc/bionic/getauxval.cpp
@@ -32,10 +32,10 @@
#include <private/bionic_auxv.h>
#include <elf.h>
-__LIBC_HIDDEN__ Elf32_auxv_t* __libc_auxv = NULL;
+__LIBC_HIDDEN__ Elf_auxv_t* __libc_auxv = NULL;
extern "C" unsigned long int getauxval(unsigned long int type) {
- for (Elf32_auxv_t* v = __libc_auxv; v->a_type != AT_NULL; ++v) {
+ for (Elf_auxv_t* v = __libc_auxv; v->a_type != AT_NULL; ++v) {
if (v->a_type == type) {
return v->a_un.a_val;
}
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index a6b20eb..a60e414 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -67,16 +67,16 @@ static void call_array(void(**list)()) {
}
static void apply_gnu_relro() {
- Elf32_Phdr* phdr_start = reinterpret_cast<Elf32_Phdr*>(getauxval(AT_PHDR));
+ Elf_Phdr* phdr_start = reinterpret_cast<Elf_Phdr*>(getauxval(AT_PHDR));
unsigned long int phdr_ct = getauxval(AT_PHNUM);
- for (Elf32_Phdr* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
+ for (Elf_Phdr* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
if (phdr->p_type != PT_GNU_RELRO) {
continue;
}
- Elf32_Addr seg_page_start = PAGE_START(phdr->p_vaddr);
- Elf32_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz);
+ Elf_Addr seg_page_start = PAGE_START(phdr->p_vaddr);
+ Elf_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz);
// Check return value here? What do we do if we fail?
mprotect(reinterpret_cast<void*>(seg_page_start), seg_page_end - seg_page_start, PROT_READ);