ElfReader: use powerof2() for consistency and grepability.
Change-Id: Ieb9330d42acd21e4faaa5a577ac9e8c35c86f7c9
diff --git a/linker/linker_phdr.cpp b/linker/linker_phdr.cpp
index 5f40617..a905a9c 100644
--- a/linker/linker_phdr.cpp
+++ b/linker/linker_phdr.cpp
@@ -31,6 +31,7 @@
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
+#include <sys/param.h>
#include <sys/prctl.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -552,7 +553,7 @@
// or a positive, integral power of two.
// The kernel ignores loadable segments with other values,
// so we just warn rather than reject them.
- if ((phdr->p_align & (phdr->p_align - 1)) != 0) {
+ if (!powerof2(phdr->p_align)) {
DL_WARN("\"%s\" has invalid p_align %zx in phdr %zu", name_.c_str(),
static_cast<size_t>(phdr->p_align), i);
continue;