I have notice that elf image loaded using load_image fail to execute but the
same image loaded from gdb works. I'm trying to load a vmlinux image but I
believe the .notes segment is not getting loaded. Below is a readelf dump of
the program headers: mips-sde-elf-readelf.exe -l vmlinux
Elf file type is EXEC (Executable file)
Entry point 0x805bef00
There are 2 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x001000 0x80051000 0x80051000 0x70b380 0x76e900 RWE 0x1000
NOTE 0x58a0b0 0x805da0b0 0x805da0b0 0x00024 0x00024 R 0x4
Section to Segment mapping:
Segment Sections...
00 .text __ex_table .notes .rodata __ksymtab __ksymtab_gpl
__ksymtab_strings __param __modver .data .init.text .init.data .exit.text
.data..percpu .bss
01 .notes
Review of image_elf_read_headers in image.c, I see the test for "PT_LOAD" which
looks correct and ".notes" segment does not have it set. So the code looks to
doing the right thing but GDB does load the ".notes" section. Does anyone know
what flag GDB is using to determine if a section should be loaded or not?
Thanks for your help,
Kent
(gdb) load
Loading section .text, size 0x587450 lma 0x80051000
Loading section __ex_table, size 0x1c60 lma 0x805d8450
Loading section .notes, size 0x24 lma 0x805da0b0
Loading section .rodata, size 0xe74f0 lma 0x805db000
Loading section __ksymtab, size 0x6b70 lma 0x806c24f0
Loading section __ksymtab_gpl, size 0x4080 lma 0x806c9060
Loading section __ksymtab_strings, size 0x18bcb lma 0x806cd0e0
Loading section __param, size 0xb50 lma 0x806e5cac
Loading section __modver, size 0x804 lma 0x806e67fc
Loading section .data, size 0x3f140 lma 0x806e7000
Loading section .init.text, size 0x24b5c lma 0x80727000
Loading section .init.data, size 0xb55c lma 0x8074bb5c
Loading section .exit.text, size 0x2948 lma 0x807570b8
Loading section .data..percpu, size 0x2380 lma 0x8075a000
mips-sde-elf-readelf.exe -S vmlinux
There are 30 section headers, starting at offset 0x51d1c2c:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 80051000 001000 587450 00 AX 0 0
4096
[ 2] __ex_table PROGBITS 805d8450 588450 001c60 00 A 0 0 4
[ 3] .notes NOTE 805da0b0 58a0b0 000024 00 A 0 0 4
[ 4] .rodata PROGBITS 805db000 58b000 0e74f0 00 A 0 0 64
[ 5] __ksymtab PROGBITS 806c24f0 6724f0 006b70 00 A 0 0 4
[ 6] __ksymtab_gpl PROGBITS 806c9060 679060 004080 00 A 0 0 4
[ 7] __ksymtab_strings PROGBITS 806cd0e0 67d0e0 018bcb 00 A 0 0 1
[ 8] __param PROGBITS 806e5cac 695cac 000b50 00 A 0 0 4
[ 9] __modver PROGBITS 806e67fc 6967fc 000804 00 A 0 0 4
[10] .data PROGBITS 806e7000 697000 03f140 00 WA 0 0 64
[11] .init.text PROGBITS 80727000 6d7000 024b5c 00 AX 0 0 4
[12] .init.data PROGBITS 8074bb5c 6fbb5c 00b55c 00 WA 0 0 4
[13] .exit.text PROGBITS 807570b8 7070b8 002948 00 AX 0 0 4
[14] .data..percpu PROGBITS 8075a000 70a000 002380 00 WA 0 0 64
[15] .bss NOBITS 80760000 70c380 05f900 00 WA 0 0
4096
[16] .mdebug.abi32 PROGBITS 807bf900 70c380 000000 00 0 0 1
[17] .comment PROGBITS 00000000 70c380 000046 01 MS 0 0 1
[18] .gnu.attributes LOOS+ffffff5 00000000 70c3c6 000010 00 0 0 1
[19] .debug_aranges MIPS_DWARF 00000000 70c3d8 00d810 00 0 0 8
[20] .debug_info MIPS_DWARF 00000000 719be8 37d0e58 00 0 0
1
[21] .debug_abbrev MIPS_DWARF 00000000 3eeaa40 1c7af3 00 0 0
1
[22] .debug_line MIPS_DWARF 00000000 40b2533 42060d 00 0 0
1
[23] .debug_frame MIPS_DWARF 00000000 44d2b40 0cc578 00 0 0
4
[24] .debug_str MIPS_DWARF 00000000 459f0b8 14d31b 01 MS 0 0
1
[25] .debug_loc MIPS_DWARF 00000000 46ec3d3 9cc088 00 0 0
1
[26] .debug_ranges MIPS_DWARF 00000000 50b8460 119698 00 0 0
8
[27] .shstrtab STRTAB 00000000 51d1af8 000131 00 0 0
1
[28] .symtab SYMTAB 00000000 51d20dc 0a6020 10 29
30361 4
[29] .strtab STRTAB 00000000 52780fc 0d7f31 00 0 0
1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
O (extra OS processing required) o (OS specific), p (processor specific)
Results from OpenOCD load_image:
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel