Skip to content

Conversation

justanormaldev
Copy link

@justanormaldev justanormaldev commented Jul 10, 2018

When running make for the different libs I got warnings for implicit declaration of functions.
I am not an expert on C/C++, but I understand these are because the source code is not including the declaration of the functions.
So, I searched for the proper header files and modified the source code to include them.

Used dependencies

firmware505 branch of https://github.com/psxdev/ps4sdk (at commit df03b9fd274ec5dabf105a07e6cb9f0bf6685801).

Solved implicit declarations

For libelfloader:

source/elfloader.c:690:3: warning: implicit declaration of function 'munmap' is invalid in C99 [-Wimplicit-function-declaration]
                munmap(elf->data,elf->size);
                ^

For libps4link:

source/jailbreak.c:119:2: warning: implicit declaration of function 'debugNetPrintf' is invalid in C99 [-Wimplicit-function-declaration]
        debugNetPrintf(3,"td %x",td);
        ^
source/jailbreak.c:126:6: warning: implicit declaration of function 'syscall' is invalid in C99 [-Wimplicit-function-declaration]
        ret=syscall(11,jailbreak,td,dump);
            ^

For liborbisAudio:

source/orbisAudio.c:381:3: warning: implicit declaration of function 'sleep' is invalid in C99 [-Wimplicit-function-declaration]
                sleep(2);
                ^

For liborbisKeyboard:

source/orbisKeyboard.c:619:2: warning: implicit declaration of function 'sleep' is invalid in C99 [-Wimplicit-function-declaration]
        sleep(1);
        ^

Pending implicit declarations

There are two pending implicit declarations that I don't know how to solve properly. These are not solved by this PR:
For libps4link:

source/commands.c:679:6: warning: implicit declaration of function 'sysctl' is invalid in C99 [-Wimplicit-function-declaration]
                if(sysctl(mib,4,NULL,&len,NULL,0)!=-1) 
                   ^
source/commands.c:732:6: warning: implicit declaration of function 'ptrace' is invalid in C99 [-Wimplicit-function-declaration]
        ret=ptrace(PT_ATTACH,i,NULL,NULL);
            ^

In my attempts of solving these, I figured:

Based on this I conclude that including ps4/kernel.h before sys/sysctl.h and sys/ptrace.h makes sysctl and ptrace to not be defined.

I tried moving the #include <sys/sysctl.h> before the #include <ps4/kernel.h>. This seems to work for sysctl.
I also tried moving the #include <sys/ptrace.h> before the #include <ps4/kernel.h>. But this resulted in 4 errors:

source/commands.c:500:10: error: use of undeclared identifier 'TRUE'
                return TRUE;
                       ^
source/commands.c:505:10: error: use of undeclared identifier 'FALSE'
                return FALSE;
                       ^
source/commands.c:524:13: error: use of undeclared identifier 'TRUE'
                                        return TRUE;
                                               ^
source/commands.c:529:9: error: use of undeclared identifier 'FALSE'
        return FALSE;
               ^

For this I figured:

Based on this I conclude that including sys/ptrace.h before ps4/kernel.h makes TRUE and FALSE to not be defined.

I don't see a solution to this problem without modifying sys/ptrace.h or ps4/kernel.h.
Any ideas?

@psxdev
Copy link
Contributor

psxdev commented Jul 14, 2018

source/jailbreak.c is deprecated is old stuff for dlopen for 1.76 and it is not used. Many fuctions used on libraries are resolved on linking time against kernel and sce stubs libraries so dont worry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants