fixup exports error...

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

fixup exports error...

Post by ne0h »

Hi,
I'm trying to integrate a 3.xx exception handler in a kernel prx, and export the function, but I got this error:

Code: Select all

Error, could not fixup imports, stubs out of order.

Ensure the SDK libraries are linked in last to correct this error

C:\pspsdk\bin\make.exe: *** [ne0h_sdk.elf] Error 1
What it means?
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

It means the link order is "wrong". You'll have to try shuffling things around and hoping you find the magic order that makes that error go away. Please note that sometimes it is just impossible to make that error go away.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well it shouldn't be possible for that error not to go away as you can always ensure that the SDK libs are linked last :)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Not always! There was a music playing prx I was trying work on, and it WOULD NOT work without linking pspkernel FIRST, but then you'd get that error. Trying to move pspkernel in the link order made three or four other libs fail to link. I tried every possible order and nothing would work. I thought about looking into updating the program that does that linking (I even started a thread on it), but it was too much hassle and I had more pressing issues. The fact of the matter is that sometimes you get those import errors and nothing you can do will fix them. :(
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I've tryied to change the order, but the results is the same!
But I have this error only if I link exception_asm.o...
Here is my makefile:

Code: Select all

TARGET = name
OBJS = main.o exception_asm.o scePower_driver.o pspDecrypt_imports.o

BUILD_PRX = 1
PRX_EXPORTS = exports.exp

CFLAGS = -Os -G0 -Wall  -nostartfiles
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR = lib
LIBS = -lpspmodulemgr_kernel -lpspdisplay_driver -lpspsemaphore -lpspmesgd_driver -lpsputilsforkernel -lpspsystemctrl_kernel -lpsploadexec_kernel
LDFLAGS = -mno-crt0 -nostartfiles

include $(PSPSDK)/lib/build.mak

all:
	psp-build-exports -s exports.exp
	rm -f *.o
	rm -f $(TARGET).elf
	makeall.bat $(TARGET)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

J.F. trust me on this, there is _always_ a way of getting it to work. I just guess you didn't understand the ramifications of how the linker does its job. Of course it is a limitation on the import system (I take responsibility) and its mechanism to handle stripped down imports, but it is better to get that error (and then you can fix it, trust me, even if you have to play with link orders) then before when it didn't check and it just created broken elfs :)

As for why it isn't working for ne0h I would assume some of it is down to the fact that you are using scePower_driver.o pspDecrypt_imports.o which I assume are import libraries which can cause weirdness with the import linker. You could try adding those to the end of the LIBS link, although what is it in scePower_drive.o which you need which isn't in the one in the SDK?
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

The reboot function, I haven't found it in the SDK...
Anyway this is the function:

Code: Select all

0x0442D852
scePower_driver_0442D852
And another question:
I'm using the sceDisplaySetHoldMode for fadeout effect when launching something, but I haven't found this function prototipe in a library header, why? Or where I can find it?
Last edited by ne0h on Sun Oct 19, 2008 12:14 am, edited 1 time in total.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

is the NID 0x0442D852 for 4.xx kernel?
Did it change from 4.xx to 5.xx or didn't you check?

sceDisplaySetHoldMode is not in the sdk probably because no one added it yet :P
Image
Upgrade your PSP
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I didn't check for the NID but a person have sent me an e-mail to inform me that Xplora works great on cfw 5.00, so I think that the NID is not changed!
Pirata Nervo wrote: sceDisplaySetHoldMode is not in the sdk probably because no one added it yet :P
Oh, thanks! Very good explanation! :P
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

TyRaNiD, another new question:
I'm using psplink to debug apps, but when a try to exit ( type reset or exit with sceKernelExitGame for main app) PSPLink won't reset!
I've see that it is because there's a module ( started by the main app ) that won't be onloaded, or something like this, I've try to do it by the pspsh, but for all the op I've have error "0xDEADBEEF" or similar ( I don't remember )!
Can I resolve this "error"?
Is not very comfortable to have to shutdown the PSP everytime...
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Is the module it is starting a kernel one with its own thread? The usual cause of reset locking is down to some kernel thread which doesn't handle correctly a wait state returning an error and causing an infinite loop to occur.

If it is then about the only way to fix it is to try and suspend the thread, if it has its own unique name then thsusp @thread_name is good enough, if it doesn't then you might need to do it manually.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Sorry, I haven't understand...
I've the main module ( PBP ) in VSH mode ( 0x800 ) linked without ctr0, so at the startup it create a user thread, so it load two module, only one give me problems!
This have to do nothing ( only export some functions ), so I've writed some initialization of variables, because I cannot leave module_start black, and finally return...
Anyway this is the code:

Code: Select all

int module_start(SceSize args, void *argp)
{
    KL3E_Function = 0;
    KL4E_Function = 0;
    LZR2_Function = 0;
    
    return 0;
}
I've also tryed to launch a new thread and get it sleep ( sceKernelSleepThread ) but PSPlink will not reset correctly...

P.S: Sorry for my english
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I've tryed to leave module start black ( only return 0; ) and I've no errors...
Anyway the module loaded have 0x1007 attrib
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

ne0h wrote:I didn't check for the NID but a person have sent me an e-mail to inform me that Xplora works great on cfw 5.00, so I think that the NID is not changed!
Pirata Nervo wrote: sceDisplaySetHoldMode is not in the sdk probably because no one added it yet :P
Oh, thanks! Very good explanation! :P
Thanks, that's good to know :)
Image
Upgrade your PSP
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

ne0h wrote:Anyway the module loaded have 0x1007 attrib
0x1007 means not allowed to be stopped and unloaded i think.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

I committed some changes to revision 2434 that updated pspmoduleinfo.h.

The missing flags have been added and they can be OR'd together.

Code: Select all

enum PspModuleInfoAttr
{
	PSP_MODULE_USER			= 0,
	PSP_MODULE_NO_STOP		= 0x0001,
	PSP_MODULE_SINGLE_LOAD	= 0x0002,
	PSP_MODULE_SINGLE_START	= 0x0004,
	PSP_MODULE_KERNEL		= 0x1000,
};
0x1007 would be kernel mode, unable to stop, single load and single start (which just means that the module can only be loaded and started once).
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Thanks, I've resolved!
When I try to reset pspLink it doesn't do anything, I've to unload manually the prx, but is not a problem!
Thanks!
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Insert_witty_name wrote:I committed some changes to revision 2434 that updated pspmoduleinfo.h.

The missing flags have been added and they can be OR'd together.

Code: Select all

enum PspModuleInfoAttr
{
	PSP_MODULE_USER			= 0,
	PSP_MODULE_NO_STOP		= 0x0001,
	PSP_MODULE_SINGLE_LOAD	= 0x0002,
	PSP_MODULE_SINGLE_START	= 0x0004,
	PSP_MODULE_KERNEL		= 0x1000,
};
0x1007 would be kernel mode, unable to stop, single load and single start (which just means that the module can only be loaded and started once).
Is there some use in loading a module and not starting it? Suppose you give only SINGLE_START, then you can load, start and unload it, and then only load it a second time but not start it right?
Onii
Posts: 40
Joined: Sun Oct 05, 2008 1:07 pm

Post by Onii »

If I were to guess, I would think that SINGLE_START refers to a singleton. i.e. Only one running in memory at one time. NOT only allowing the module to be run only one time.
Post Reply