rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.55k stars 343 forks source link

PowerPC Linux build warnings #1803

Open XVilka opened 2 years ago

XVilka commented 2 years ago
../librz/debug/p/debug_native.c: In function ‘rz_debug_native_bp’:

../librz/debug/p/debug_native.c:1427:11: warning: unused variable ‘dbg’ [-Wunused-variable]

 1427 |  RzDebug *dbg = bp->user;

      |           ^~~

[1410/1704] Compiling C object librz/main/librz_main.so.0.3.0-git.p/rz-run.c.o

[1411/1704] Compiling C object librz/debug/librz_debug.so.0.3.0-git.p/p_native_linux_linux_debug.c.o

../librz/debug/p/native/linux/linux_debug.c: In function ‘print_fpu’:

../librz/debug/p/native/linux/linux_debug.c:1060:2: warning: #warning print_fpu not implemented for this platform [-Wcpp]

 1060 | #warning print_fpu not implemented for this platform

      |  ^~~~~~~

../librz/debug/p/native/linux/linux_debug.c: In function ‘linux_reg_read’:

../librz/debug/p/native/linux/linux_debug.c:1065:7: warning: variable ‘showfpu’ set but not used [-Wunused-but-set-variable]

 1065 |  bool showfpu = false;

      |       ^~~~~~~

../librz/debug/p/native/linux/linux_debug.c: In function ‘linux_reg_write’:

../librz/debug/p/native/linux/linux_debug.c:1270:55: warning: passing argument 4 of ‘rz_debug_ptrace’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

 1270 |   int ret = rz_debug_ptrace(dbg, PTRACE_SETREGS, pid, buf, NULL);

      |                                                       ^~~

In file included from ../librz/debug/p/native/linux/linux_debug.c:7:

../librz/include/rz_debug.h:611:96: note: expected ‘void *’ but argument is of type ‘const unsigned char *’

  611 | static inline long rz_debug_ptrace(RzDebug *dbg, rz_ptrace_request_t request, pid_t pid, void *addr, rz_ptrace_data_t data) {

      |                                                                                          ~~~~~~^~~~

At top level:

../librz/debug/p/native/linux/linux_debug.c:969:13: warning: ‘print_fpu’ defined but not used [-Wunused-function]

  969 | static void print_fpu(void *f) {

      |             ^~~~~~~~~
abhimnc commented 2 years ago

Hi, I am a newbie here and want to contribute to rizin. forked the repo. Compiled and install it. Please give me a headstart on how to resolve this issue?

ret2libc commented 2 years ago

Hi @abhimnc . This is about compiling Rizin on powerpc, so the best would be to setup a ppc cross-compilation toolchain or a VM. On fedora, for example, there is gcc-ppc64-linux-gnu which I think can be used to cross-compile for ppc64. You can read on https://mesonbuild.com/Cross-compilation.html how to cross compile with meson.

After you are able to compile it for ppc, you should be able to see the warnings mentioned in this issue and you can start trying to fix them. Likely, some functions just need to be guarded with the right #if/#else/#ifdef .

XVilka commented 2 years ago

@Rot127 since you will compare the PPC uplifting results with the debugger anyway, I am assigning this to you, could be done easily in that process.