Skip to content

Why iopmod-link is not adding .iopmod section it-sellf? #12

@fjtrujy

Description

@fjtrujy

Hello,

I was trying to go deeper using your marvelous tool, because it is a waste of effort and time to keep using the modified binutils/gcc version for the IOP CPU (speaking about the PS2DEV env).

We have been working separately, @rickgaiser, @uyjulian, myself, and probably more people, into trying to achieve something similar, using several approaches.

I honestly think that the best way is the way you are doing it, creating a tinny C app that makes the necessary changes to the ELF to adjust to the IOP requirements.

The first thing that I have found is that the iopmod-link is not creating the .iopmod section.
I was expecting that having _irx_id symbol in the binary, should be enough to have all the needed information for creating the .iopmod section, or maybe I'm confused....

Having the next example

#include <stdint.h>

struct irx_id {
	const char *n;
	uint16_t v;
};

#define IRX_VER(major, minor)	((((major) & 0xff) << 8) + ((minor) & 0xff))

struct irx_id _irx_id = {
    "DUMMY", 
    IRX_VER(2, 1)
};

int _start(int argc, char *argv[]) {
    return 0;
}

And compile it using:

mipsel-ps2-elf-gcc -D_IOP -fno-builtin -G0 -Wall  -I/Users/fjtrujy/toolchains/ps2/ps2dev/ps2sdk/iop/include -DDEBUG -O0 -g -msoft-float -mno-explicit-relocs -c main.c -o obj/main.o
mipsel-ps2-elf-gcc -D_IOP -fno-builtin -G0 -Wall  -I/Users/fjtrujy/toolchains/ps2/ps2dev/ps2sdk/iop/include -DDEBUG -O0 -g -msoft-float -mno-explicit-relocs -o dummy.elf obj/main.o -nostdlib

Then if we execute:

mipsel-ps2-elf-readelf -Ws dummy.elf | grep _irx_id
    20: 001000cc     8 OBJECT  GLOBAL DEFAULT    5 _irx_id

We have from there the offset where the information about the IRX_ID it is on the binary.

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions