The Elf32_Addr, are they actually pointers or am I mistaken the type? File offsets maybe? If they're addresses, how can I relocate them? What is gp used for?
There's lots of info out there on ELF files, including MIPS specific ELF. There's no reason for use to answer when a quick google will turn up the info. As stated many times before, we don't give beginner lessons here.
m0skit0 wrote:The Elf32_Addr, are they actually pointers or am I mistaken the type?
They're offsets from relocation.
m0skit0 wrote:What is gp used for?
As you know, usually you need to do a lui/ori to sore a memory address in a registry cause you can use only 16 bits of immediate value.
The compiler just uses a 32KB space for some data (not too big). the $gp is set as the address in the middle of the space. so, if you need to read some data from that space, you can just do an addi: you can move -16KB/+16KB.
@J.F.: PRXs are not standard ELF neither they have standard MIPS relocation entries. What I'm asking is PRX specific (thus PSP specific), no other ELFs have those entries. Try a Google search about PRX and please tell me if you find something. I didn't, except YAPSPD, which is outdated and sometimes erroneous.
@ab5000: thanks, but I still don't understand the GP thing :P
The Incredible Bill Gates wrote:The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
the compiler allocates a 128KB (not 32KB, i made a mistake) space in data section (or the bss section, don't remeber well now). then it set $gp to the adress in the middle of the space.
the compiler uses those 128KB for storing data. suppose it's at 0xABC00000.
so $gp will be at 0xABC0FFFF.
then if you want to get a word from offset 0 from the start of the space...
m0skit0 wrote:@J.F.: PRXs are not standard ELF neither they have standard MIPS relocation entries. What I'm asking is PRX specific (thus PSP specific), no other ELFs have those entries. Try a Google search about PRX and please tell me if you find something. I didn't, except YAPSPD, which is outdated and sometimes erroneous.
It's not THAT different. If you wish to know the difference, just look at the part of the toolchain that converts the ELF output of the linker into a PRX.