OSDN Git Service

bionic: Do not use magic number for portability
authorQiming Shi <qiming.shi@intel.com>
Sun, 26 Jan 2014 08:49:39 +0000 (16:49 +0800)
committerElliott Hughes <enh@google.com>
Mon, 27 Jan 2014 22:51:07 +0000 (14:51 -0800)
Do not use the magic number 0xFFFFFFFFU to represent the max value of an address
as it's not correct on 64bit platform. We should use UINTPTR_MAX instead.

Change-Id: I1fc6f5864a651b2eddea2333cb0788f9d9223270
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Signed-off-by: Weiwu Chen <weiwu.chen@intel.com>
linker/linker_phdr.cpp

index b4d72b2..3101511 100644 (file)
@@ -252,8 +252,8 @@ bool ElfReader::ReadProgramHeader() {
 size_t phdr_table_get_load_size(const Elf_Phdr* phdr_table, size_t phdr_count,
                                 Elf_Addr* out_min_vaddr,
                                 Elf_Addr* out_max_vaddr) {
-    Elf_Addr min_vaddr = 0xFFFFFFFFU;
-    Elf_Addr max_vaddr = 0x00000000U;
+    Elf_Addr min_vaddr = UINTPTR_MAX;
+    Elf_Addr max_vaddr = 0;
 
     bool found_pt_load = false;
     for (size_t i = 0; i < phdr_count; ++i) {
@@ -273,7 +273,7 @@ size_t phdr_table_get_load_size(const Elf_Phdr* phdr_table, size_t phdr_count,
         }
     }
     if (!found_pt_load) {
-        min_vaddr = 0x00000000U;
+        min_vaddr = 0;
     }
 
     min_vaddr = PAGE_START(min_vaddr);