rizinorg / rz-ghidra

Deep ghidra decompiler and sleigh disassembler integration for rizin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build fails with `-mcrc32`

hamarituc opened this issue · comments

When compiling the project with -mcrc32 (or implicitly via -march=native on a machine supporting special instructions), the build fails with the following error:

FAILED: CMakeFiles/asm_ghidra.dir/src/SleighInstruction.cpp.o 
/usr/bin/x86_64-pc-linux-gnu-g++ -DRZ_GHIDRA_SLEIGHHOME_DEFAULT=\"/usr/lib64/rizin/plugins/rz_ghidra_sleigh\" -Dasm_ghidra_EXPORTS -I/var/tmp/portage/dev-util/rz-ghidra-0.5.0/work/rz-ghidra-0.5.0/ghidra/ghidra/Ghidra/Features/Decompiler/src/decompile/cpp -isystem /usr/include/librz -isystem /usr/include/librz/sdb  -march=native -O2 -pipe -fPIC -std=gnu++11 -MD -MT CMakeFiles/asm_ghidra.dir/src/SleighInstruction.cpp.o -MF CMakeFiles/asm_ghidra.dir/src/SleighInstruction.cpp.o.d -o CMakeFiles/asm_ghidra.dir/src/SleighInstruction.cpp.o -c /var/tmp/portage/dev-util/rz-ghidra-0.5.0/work/rz-ghidra-0.5.0/src/SleighInstruction.cpp
In file included from /var/tmp/portage/dev-util/rz-ghidra-0.5.0/work/rz-ghidra-0.5.0/src/SleighInstruction.cpp:5:
/var/tmp/portage/dev-util/rz-ghidra-0.5.0/work/rz-ghidra-0.5.0/src/SleighInstruction.h: In function ‘uint4 hashConstructState(ConstructState*, uint4)’:
/var/tmp/portage/dev-util/rz-ghidra-0.5.0/work/rz-ghidra-0.5.0/src/SleighInstruction.h:127:20: error: ‘crc_update’ was not declared in this scope
  127 |         hashCode = crc_update(hashCode, id >> 8);
      |                    ^~~~~~~~~~

In this case the compiler internally defines __CRC32__. This renders the file ghidra/ghidra/Ghidra/Features/Decompiler/src/decompile/cpp/crc32.hh effectively useless since it uses this preprocessor macro to detect include loops.

Renaming the preprocessor macro not clashing with compiler internals should be considered.

Duplicate of #284 . Sorry for the noise.