Tool/software: TI C/C++ Compiler
Hello,
Below it an output of my resulted ELF file after compiling and linking with TI tools v16.9.2.LTS.
I am a bit confused with this output - why the different segments keep contain the same sections (why sections are mapped to several/all segments)? what is the mapping logic from sections to segments that makes this behavior?
How come the .text section is on the same segment as sections which is basically data (in this case uninitialized data but i have also seen a build in which .text and .data where on the same segment)?
Why does the stack section is NOT marked as allocated? how does the stack defined area is reserved?
.stack,.sysmem,.ocmc_common .sar .ocmc_global_info .imgArea .buffersArea,.ipu2 --> are NOLOAD type sections
.testsec -> a NOINIT type section which holds an initialized global variable (loaded with program load but does not go through C initialization routine)
Elf file type is EXEC (Executable file)
Entry point 0x9
There are 10 program headers, starting at offset 1209336
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000034 0x00000000 0x00000000 0x00050 0x00058 R E 0x4
LOAD 0x000084 0x00000058 0x00000058 0x001e4 0x001e4 R E 0x4
LOAD 0x000400 0x00001000 0x00001000 0x00000 0x00220 RW 0x400
LOAD 0x000400 0x00001220 0x00001220 0x00018 0x00018 R E 0x2
LOAD 0x000418 0x1fa04000 0x1fa04000 0x0aa1c 0x0aa1c R E 0x4
LOAD 0x00b000 0x1fc04000 0x1fc04000 0x00000 0x14328 RW 0x1000
LOAD 0x00b000 0x1fc18328 0x1fc18328 0x01e88 0x01e88 R 0x4
LOAD 0x00ce88 0x1fc1b1b0 0x1fc1b1b0 0x00000 0x00800 RW 0x4
LOAD 0x00ce88 0x1fc1b9b0 0x1fc1b9b0 0x00400 0x00400 RW 0x4
LOAD 0x00d288 0x1fc1bdb0 0x1fc1bdb0 0x00bd8 0x00bd8 R 0x8
Section to Segment mapping:
Segment Sections...
00 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu1 .ipu_c0_resetVec .ipu2 .rodata .phy_ram_sec .sysmem .stack .TI.persistent
01 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu_c1_resetVec .ipu2 .main_boot_area_sec .phy_ram_sec .sysmem .stack .TI.persistent
02 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .intvecs .phy_ram_sec .sysmem .stack .TI.persistent
03 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .vir_ram_sec .phy_ram_sec .sysmem .stack .TI.persistent
04 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .text .phy_ram_sec .sysmem .stack .TI.persistent
05 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .data .bss .phy_ram_sec .sysmem .stack .TI.persistent
06 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .const .phy_ram_sec .sysmem .stack .TI.persistent
07 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .TI.noinit .phy_ram_sec .sysmem .stack .TI.persistent
08 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .phy_ram_sec .sysmem .stack .testsec .TI.persistent
09 .ocmc_common .sar .ocmc_global_info .imgArea .buffersArea .ipu2 .cinit .phy_ram_sec .sysmem .stack .TI.persistent
------------------------------------
There are 38 section headers, starting at offset 0x127538:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .ocmc_common NOBITS 4037d000 00de60 000358 00 0 0 4
[ 2] .sar NOBITS 4ae26000 00de60 000018 00 0 0 4
[ 3] .ocmc_global_ NOBITS 4035d000 00de60 005b00 00 0 0 4
[ 4] .imgArea NOBITS f9600000 00de60 2000000 00 0 0 1
[ 5] .sblBuffersArea NOBITS 00000000 000000 000000 00 0 0 1
[ 6] .ipu1 PROGBITS 00000000 000034 000050 00 AX 0 0 4
[ 7] .ipu_c0_resetVec NOBITS 00000050 000084 000008 00 A 0 0 1
[ 8] .ipu_c1_resetVec PROGBITS 00000058 000084 000008 00 A 0 0 4
[ 9] .ipu2 NOBITS ffa00000 00de60 004000 00 0 0 1
[10] .main_boot_ar PROGBITS 00000060 00008c 0001dc 00 AX 0 0 4
[11] .intvecs NOBITS 00001000 000400 000220 00 WA 0 0 1024
[12] .vir_ram_sec PROGBITS 00001220 000400 000018 00 AX 0 0 2
[13] .text PROGBITS 1fa04000 000418 00aa1c 00 AX 0 0 4
[14] .data NOBITS 1fc15028 01c028 003300 00 WA 0 0 4
[15] .const PROGBITS 1fc18328 00b000 001e88 00 A 0 0 4
[16] .rodata NOBITS 00000000 00de60 000000 00 A 0 0 1
[17] .cinit PROGBITS 1fc1bdb0 00d288 000bd8 00 A 0 0 8
[18] .bss NOBITS 1fc04000 00b000 011028 00 WA 0 0 4096
[19] .TI.noinit NOBITS 1fc1b1b0 00ce88 000800 00 WA 0 0 4
[20] .phy_ram_sec NOBITS 00000000 000000 000000 00 0 0 1
[21] .sysmem NOBITS 1fc1a1b0 00de60 001000 00 0 0 8
[22] .stack NOBITS 55024000 00de60 001000 00 0 0 8
[23] .testsec PROGBITS 1fc1b9b0 00ce88 000400 00 WA 0 0 4
[24] .TI.persistent NOBITS 00000000 000000 000000 00 0 0 1
[25] .debug_info PROGBITS 00000000 00de60 07efc2 00 0 0 1
[26] .debug_line PROGBITS 00000000 08ce22 01a3cd 00 0 0 1
[27] .debug_frame PROGBITS 00000000 0a71ef 004c81 00 0 0 1
[28] .debug_abbrev PROGBITS 00000000 0abe70 012514 00 0 0 1
[29] .debug_str PROGBITS 00000000 0be384 018963 00 0 0 1
[30] .debug_aranges PROGBITS 00000000 0d6ce7 001fa8 00 0 0 1
[31] .debug_pubnames PROGBITS 00000000 0d8c8f 00d1f6 00 0 0 1
[32] .debug_pubtypes PROGBITS 00000000 0e5e85 005a60 00 0 0 1
[33] .ARM.attributes ARM_ATTRIBUTES 00000000 0eb8e5 000058 00 0 0 0
[34] .symtab SYMTAB 00000000 0eb940 0283c0 10 36 9153 0
[35] .TI.section.flags PROGBITS 00000000 113d00 00002e 00 0 0 0
[36] .strtab STRTAB 00000000 113d2e 0134f7 01 S 0 0 0
[37] .shstrtab STRTAB 00000000 127225 0001d1 01 S 0 0 0
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)
Thanks
Guy