|
From: Wan M. F. W. I. <wan...@mc...> - 2011-05-03 15:05:16
|
Hi, x0152532@unx0152532:~/mydroid$ readelf -l ./linker Elf file type is EXEC (Executable file) Entry point 0xb0001000 There are 5 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x0000d4 0x00000000 0xb0000000 0x00000 0x00000 R 0x1000 LOAD 0x001000 0xb0001000 0xb0001000 0x073bc 0x073bc R E 0x1000 LOAD 0x009000 0xb0009000 0xb0009000 0x0068c 0x0969c RW 0x1000 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0 EXIDX 0x008004 0xb0008004 0xb0008004 0x003b8 0x003b8 R 0x4 Section to Segment mapping: Segment Sections... 00 01 .text .rodata .ARM.extab .ARM.exidx 02 .preinit_array .init_array .fini_array .ctors .data.rel.ro .got .data .bss 03 04 .ARM.exidx Here you are. Thanks. On Tue, May 3, 2011 at 3:22 PM, Tom Hughes <to...@co...> wrote: > On 03/05/11 14:07, Wan Mohd Fairuz Wan Ismail wrote: > > > The situation: > > The function load_ELF (elf.c) will try to load the executable and the > > interpreter to the memory. For android's /system/bin/linker, the > > calculated interp_size value is 2952865436. > > > > The formula end = (iph->p_vaddr - interp_addr) + iph->p_memsz; gives > > us 0xb001269c = (0xb0009000 - 0x0) + 0x969c so that's why we have > > interp_size as big as 2.9GB. So I tried to do interp_size = end & > > 0xFFFFF.. There is no more UME 22 Error but I got a Segmentation fault > > (the program works fine alone). > > Basically valgrind is trying to cheat, and instead of mapping each LOAD > segment in the ELF file separately it is trying to map one block of > contiguous memory and then load each segment at the correct offset in > that block. > > Unfortunately it seems that the Android interpreter is linked in such a > way that the load segments are a long way apart, so it winds up trying > to allocate a very large block of memory, most of which won't be used. > > If you can run readelf then try "readelf -l /system/bin/linker" and let > us see the output - you may have to copy the linker off onto a > conventional system and run readelf there. > > Tom > > -- > Tom Hughes (to...@co...) > http://compton.nu/ > -- Wan Mohd Fairuz WAN ISMAIL OMAP System Multimedia Integration Team (Trainee) Texas Instrument France f-w...@ti... +33 (0)4 93 22 20 16 +33 (0)6 43 46 13 39 15 Le Palais des Fleurs, 74 Boulevard Raymond Poincare, 06160 Juan les Pins, FRANCE. http://www.watt.com.my +6 017 2071591 |