summaryrefslogtreecommitdiffstats
path: root/libc/bionic/libc_init_static.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-02-10 17:46:57 -0800
committerElliott Hughes <enh@google.com>2014-02-10 18:22:24 -0800
commit0266ae5f884d72da58f33a072e865ba131234a5e (patch)
tree48763b706806f544b1dec0ef98261bed6f21dee2 /libc/bionic/libc_init_static.cpp
parenteeb9a9f59a58a2f042e8f6fd1a4911ae92ac5493 (diff)
downloadbionic-0266ae5f884d72da58f33a072e865ba131234a5e.zip
bionic-0266ae5f884d72da58f33a072e865ba131234a5e.tar.gz
bionic-0266ae5f884d72da58f33a072e865ba131234a5e.tar.bz2
Switch <elf.h> over to linux uapi under the covers.
Remove the linker's reliance on BSD cruft and use the glibc-style ElfW macro. (Other code too, but the linker contains the majority of the code that needs to work for Elf32 and Elf64.) All platforms need dl_iterate_phdr_static, so it doesn't make sense to have that part of the per-architecture configuration. Bug: 12476126 Change-Id: I1d7f918f1303a392794a6cd8b3512ff56bd6e487
Diffstat (limited to 'libc/bionic/libc_init_static.cpp')
-rw-r--r--libc/bionic/libc_init_static.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 1825167..e45422e 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -68,16 +68,16 @@ static void call_array(void(**list)()) {
}
static void apply_gnu_relro() {
- Elf_Phdr* phdr_start = reinterpret_cast<Elf_Phdr*>(getauxval(AT_PHDR));
+ ElfW(Phdr)* phdr_start = reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR));
unsigned long int phdr_ct = getauxval(AT_PHNUM);
- for (Elf_Phdr* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
+ for (ElfW(Phdr)* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) {
if (phdr->p_type != PT_GNU_RELRO) {
continue;
}
- Elf_Addr seg_page_start = PAGE_START(phdr->p_vaddr);
- Elf_Addr seg_page_end = PAGE_END(phdr->p_vaddr + phdr->p_memsz);
+ ElfW(Addr) seg_page_start = PAGE_START(phdr->p_vaddr);
+ ElfW(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);