<bionic/macros.h>: replace align_up()/align_down() with clang's builtins.
Change-Id: If39cf028e9a22fc2008ee9d1ba683a4d0d038325
diff --git a/linker/linker_phdr_16kib_compat.cpp b/linker/linker_phdr_16kib_compat.cpp
index bad20ba..d3783cf 100644
--- a/linker/linker_phdr_16kib_compat.cpp
+++ b/linker/linker_phdr_16kib_compat.cpp
@@ -158,7 +158,7 @@
}
if (!relro_phdr) {
- *vaddr = align_down(first_rw->p_vaddr, kCompatPageSize);
+ *vaddr = __builtin_align_down(first_rw->p_vaddr, kCompatPageSize);
return true;
}
@@ -175,7 +175,7 @@
return false;
}
- *vaddr = align_up(end, kCompatPageSize);
+ *vaddr = __builtin_align_up(end, kCompatPageSize);
return true;
}
@@ -227,11 +227,11 @@
// will lead to overwriting adjacent segments since the ELF's segment(s)
// are not 16KiB aligned.
- void* start = reinterpret_cast<void*>(align_down(phdr->p_vaddr + load_bias_, kCompatPageSize));
+ void* start = reinterpret_cast<void*>(__builtin_align_down(phdr->p_vaddr + load_bias_, kCompatPageSize));
// The ELF could be being loaded directly from a zipped APK,
// the zip offset must be added to find the segment offset.
- const ElfW(Addr) offset = file_offset_ + align_down(phdr->p_offset, kCompatPageSize);
+ const ElfW(Addr) offset = file_offset_ + __builtin_align_down(phdr->p_offset, kCompatPageSize);
CHECK(should_use_16kib_app_compat_);