[Cbe-oss-dev] MARS and SPU-GCC 4.6
Paul Keir
pkeir at dcs.gla.ac.uk
Fri Jan 28 03:55:50 EST 2011
> Can you look at the output of "spu-readelf -l" on the
> output of new vs. old compilers?
It looks like the new compiler adds a new, first program
header segment: .interrupt. I've put the full spu-readelf
output at the end.
I wired in task_map_elf from MARS into their hello example
to see exactly what's happening. There's a for loop within
task_map_elf which iterates the program segments. In
the new elf file, the Elf32_Phdr pointer fails a test at
line 84 of task.c:
phdr->p_vaddr != MARS_TASK_BASE_ADDR
MARS_TASK_BASE_ADDR is #defined to 0x4000. This
hex address is also seen in the 3rd of 5 commands called by
the "hello" example's makefile:
spu-gcc -Wall -O3 -funroll-loops -o mpu_task.task mpu_task.task_o -lmars_task -Wl,--section-start,.init=0x4000 -lmars_base -Wl,-gc-sections
Perhaps the new spu-gcc isn't correctly forwarding
the linker switches? Does spu-gcc actually invoke a
separate spu-ld executable?
I'm still not sure how to get round this, but it seems that this
spu-gcc command is only useful in that it invokes the linker. I'm
unsure of the spu-ld syntax (e.g. Should it be a comma that
follows --section-start?), but I'm working to replace that
call to spu-gcc with one to spu-ld. Or am I barking up the
wrong tree...?
Many thanks,
Paul
-bash-3.2# spu-readelf -l mpu_task.task.good
Elf file type is EXEC (Executable file)
Entry point 0x4028
There are 3 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000100 0x00004000 0x00004000 0x00ad0 0x00ad0 R E 0x80
LOAD 0x000c00 0x00004b00 0x00004b00 0x00350 0x00380 RW 0x80
NOTE 0x007c20 0x00000000 0x00000000 0x00024 0x00024 R 0x10
Section to Segment mapping:
Segment Sections...
00 .init .text .fini .rodata
01 .ctors .dtors .jcr .data .bss
02 .note.spu_name
-bash-3.2# spu-readelf -l mpu_task.task.bad
Elf file type is EXEC (Executable file)
Entry point 0x4020
There are 4 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000100 0x00000000 0x00000000 0x00010 0x00010 R E 0x80
LOAD 0x000180 0x00004000 0x00004000 0x009f0 0x009f0 R E 0x80
LOAD 0x000b80 0x00004a00 0x00004a00 0x00320 0x00360 RW 0x80
NOTE 0x008410 0x00000000 0x00000000 0x00024 0x00000 R 0x10
Section to Segment mapping:
Segment Sections...
00 .interrupt
01 .init .text .fini .rodata
02 .ctors .dtors .jcr .data .bss
03 .note.spu_name
The University of Glasgow, charity number SC004401
More information about the cbe-oss-dev
mailing list