am 8e2b0e55: am bb3b1303: Merge "Enable -Wold-style-cast warnings for linker"
* commit '8e2b0e550a8e64da23c95fe265dbea7c6701e7c1': Enable -Wold-style-cast warnings for linker
This commit is contained in:
commit
4d2dcb896a
@ -35,6 +35,7 @@ LOCAL_CONLYFLAGS += \
|
||||
|
||||
LOCAL_CPPFLAGS += \
|
||||
-std=gnu++11 \
|
||||
-Wold-style-cast \
|
||||
|
||||
ifeq ($(TARGET_IS_64_BIT),true)
|
||||
LOCAL_CPPFLAGS += -DTARGET_IS_64_BIT
|
||||
|
@ -151,7 +151,7 @@ static void log_signal_summary(int signum, const siginfo_t* info) {
|
||||
}
|
||||
|
||||
char thread_name[MAX_TASK_NAME_LEN + 1]; // one more for termination
|
||||
if (prctl(PR_GET_NAME, (unsigned long)thread_name, 0, 0, 0) != 0) {
|
||||
if (prctl(PR_GET_NAME, reinterpret_cast<unsigned long>(thread_name), 0, 0, 0) != 0) {
|
||||
strcpy(thread_name, "<name unknown>");
|
||||
} else {
|
||||
// short names are null terminated by prctl, but the man page
|
||||
|
@ -71,6 +71,10 @@
|
||||
* and NOEXEC
|
||||
*/
|
||||
|
||||
// Override macros to use C++ style casts
|
||||
#undef ELF_ST_TYPE
|
||||
#define ELF_ST_TYPE(x) (static_cast<uint32_t>(x) & 0xf)
|
||||
|
||||
#if defined(__LP64__)
|
||||
#define SEARCH_NAME(x) x
|
||||
#else
|
||||
@ -364,12 +368,12 @@ static void parse_LD_PRELOAD(const char* path) {
|
||||
//
|
||||
// This function is exposed via dlfcn.cpp and libdl.so.
|
||||
_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
|
||||
unsigned addr = (unsigned)pc;
|
||||
uintptr_t addr = reinterpret_cast<uintptr_t>(pc);
|
||||
|
||||
for (soinfo* si = solist; si != 0; si = si->next) {
|
||||
if ((addr >= si->base) && (addr < (si->base + si->size))) {
|
||||
*pcount = si->ARM_exidx_count;
|
||||
return (_Unwind_Ptr)si->ARM_exidx;
|
||||
return reinterpret_cast<_Unwind_Ptr>(si->ARM_exidx);
|
||||
}
|
||||
}
|
||||
*pcount = 0;
|
||||
@ -2090,7 +2094,7 @@ bool soinfo::prelink_image() {
|
||||
break;
|
||||
|
||||
case DT_INIT_ARRAYSZ:
|
||||
init_array_count_ = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
init_array_count_ = static_cast<uint32_t>(d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
break;
|
||||
|
||||
case DT_FINI_ARRAY:
|
||||
@ -2099,7 +2103,7 @@ bool soinfo::prelink_image() {
|
||||
break;
|
||||
|
||||
case DT_FINI_ARRAYSZ:
|
||||
fini_array_count_ = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
fini_array_count_ = static_cast<uint32_t>(d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
break;
|
||||
|
||||
case DT_PREINIT_ARRAY:
|
||||
@ -2108,7 +2112,7 @@ bool soinfo::prelink_image() {
|
||||
break;
|
||||
|
||||
case DT_PREINIT_ARRAYSZ:
|
||||
preinit_array_count_ = ((unsigned)d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
preinit_array_count_ = static_cast<uint32_t>(d->d_un.d_val) / sizeof(ElfW(Addr));
|
||||
break;
|
||||
|
||||
case DT_TEXTREL:
|
||||
|
@ -688,7 +688,7 @@ int phdr_table_map_gnu_relro(const ElfW(Phdr)* phdr_table, size_t phdr_count, El
|
||||
*/
|
||||
int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
||||
ElfW(Addr) load_bias,
|
||||
ElfW(Addr)** arm_exidx, unsigned* arm_exidx_count) {
|
||||
ElfW(Addr)** arm_exidx, size_t* arm_exidx_count) {
|
||||
const ElfW(Phdr)* phdr = phdr_table;
|
||||
const ElfW(Phdr)* phdr_limit = phdr + phdr_count;
|
||||
|
||||
@ -698,7 +698,7 @@ int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
||||
}
|
||||
|
||||
*arm_exidx = reinterpret_cast<ElfW(Addr)*>(load_bias + phdr->p_vaddr);
|
||||
*arm_exidx_count = (unsigned)(phdr->p_memsz / 8);
|
||||
*arm_exidx_count = phdr->p_memsz / 8;
|
||||
return 0;
|
||||
}
|
||||
*arm_exidx = nullptr;
|
||||
@ -757,7 +757,7 @@ bool ElfReader::FindPhdr() {
|
||||
ElfW(Addr) elf_addr = load_bias_ + phdr->p_vaddr;
|
||||
const ElfW(Ehdr)* ehdr = reinterpret_cast<const ElfW(Ehdr)*>(elf_addr);
|
||||
ElfW(Addr) offset = ehdr->e_phoff;
|
||||
return CheckPhdr((ElfW(Addr))ehdr + offset);
|
||||
return CheckPhdr(reinterpret_cast<ElfW(Addr)>(ehdr) + offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ int phdr_table_map_gnu_relro(const ElfW(Phdr)* phdr_table, size_t phdr_count, El
|
||||
|
||||
#if defined(__arm__)
|
||||
int phdr_table_get_arm_exidx(const ElfW(Phdr)* phdr_table, size_t phdr_count, ElfW(Addr) load_bias,
|
||||
ElfW(Addr)** arm_exidx, unsigned* arm_exidix_count);
|
||||
ElfW(Addr)** arm_exidx, size_t* arm_exidix_count);
|
||||
#endif
|
||||
|
||||
void phdr_table_get_dynamic_section(const ElfW(Phdr)* phdr_table, size_t phdr_count,
|
||||
|
Loading…
x
Reference in New Issue
Block a user