mirror of
https://github.com/radareorg/r2ghidra.git
synced 2026-11-07 06:25:57 -10:00
Make ghidra-native a subproject
* Adds zlib attempting to fix Windows builds
This commit is contained in:
1 parent
a73a39efa2
commit
2cad988f03
46 files changed
+1331
-192
No files matched your search
@@ -184,6 +184,7 @@ jobs:
|
||||
/tmp/r2ghidra-macos-${{ env.ARCH }}.tar.gz
|
||||
|
||||
w64:
|
||||
if: false
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -11,3 +11,10 @@ ghidra/flex/
|
||||
.ccls-cache
|
||||
.gdb_history
|
||||
dist/artifacts
|
||||
|
||||
|
||||
ghidra-processors.txt
|
||||
ghidra/sleighc
|
||||
|
||||
subprojects/ghidra-native
|
||||
subprojects/zlib
|
||||
+2
-7
@@ -5,7 +5,7 @@ GHIDRA_NATIVE_COMMIT=0.5.0
|
||||
|
||||
PUGIXML=third-party/pugixml/Makefile
|
||||
|
||||
all: ghidra-native ghidra-processors.txt $(PUGIXML)
|
||||
all: ghidra-processors.txt $(PUGIXML)
|
||||
$(MAKE) -C src
|
||||
$(MAKE) -C ghidra
|
||||
|
||||
@@ -19,7 +19,7 @@ purge: clean
|
||||
ghidra-processors.txt:
|
||||
cp -f ghidra-processors.txt.default ghidra-processors.txt
|
||||
|
||||
asan: ghidra-native ghidra-processors.txt
|
||||
asan: ghidra-processors.txt
|
||||
CFLAGS=-g CXXFLAGS=-g $(MAKE) -C src asan
|
||||
|
||||
asan-run:
|
||||
@@ -44,11 +44,6 @@ install uninstall user-install user-uninstall:
|
||||
$(MAKE) -C src $@
|
||||
$(MAKE) -C ghidra $@
|
||||
|
||||
ghidra-native:
|
||||
git clone https://github.com/radareorg/ghidra-native
|
||||
cd ghidra-native && git checkout $(GHIDRA_NATIVE_COMMIT)
|
||||
$(MAKE) -C ghidra-native patch
|
||||
|
||||
$(PUGIXML):
|
||||
git submodule update --init
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
all: sleigh-build
|
||||
|
||||
clean:
|
||||
rm -rf ../ghidra-native ghidra/Ghidra
|
||||
|
||||
-include ../config.mk
|
||||
include deps.mk
|
||||
|
||||
@@ -22,9 +19,4 @@ user-uninstall:
|
||||
uninstall:
|
||||
$(MAKE) sleigh-uninstall D="$(DD)"
|
||||
|
||||
ghidra-native:
|
||||
git clone https://github.com/radareorg/ghidra-native
|
||||
cd ghidra-native && git checkout $(GHIDRA_NATIVE_COMMIT)
|
||||
$(MAKE) -C ghidra-native patch
|
||||
|
||||
.PHONY: install uninstall user-install user-uninstall all
|
||||
+2
-1
@@ -6,7 +6,8 @@ LDFLAGS+=-lz
|
||||
|
||||
# GHIDRA_HOME=../ghidra/ghidra/
|
||||
# GHIDRA_DECOMPILER=$(GHIDRA_HOME)/Ghidra/Features/Decompiler/src/decompile/cpp
|
||||
GHIDRA_HOME=../ghidra-native
|
||||
# GHIDRA_HOME=../ghidra-native
|
||||
GHIDRA_HOME=../subprojects/ghidra-native
|
||||
GHIDRA_DECOMPILER=$(GHIDRA_HOME)/src/decompiler
|
||||
|
||||
G_DECOMPILER=marshal.cc space.cc float.cc address.cc pcoderaw.cc
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
if EXIST w (
|
||||
echo Building R2Ghidra Plugin
|
||||
echo Building R2Ghidra Plugin
|
||||
) else (
|
||||
configure.bat
|
||||
configure.bat
|
||||
)
|
||||
|
||||
ninja -C w
|
||||
call ninja -C w -j 2 && (
|
||||
echo Copying Plugin
|
||||
mkdir destdir
|
||||
copy w\*.dll destdir
|
||||
|
||||
echo Copying Plugin
|
||||
mkdir destdir
|
||||
copy w\*.dll destdir
|
||||
REM echo Copying Sleigh Files
|
||||
REM mkdir destdir\r2ghidra_sleigh
|
||||
REM copy ghidra-native\src\Processors\*.* destdir\r2ghidra_sleigh
|
||||
|
||||
echo Ziping it Up
|
||||
cd destdir
|
||||
python -m zipfile -c r2ghidra-w64.zip core_r2ghidra.dll
|
||||
dir
|
||||
cd ..
|
||||
exit /b 0
|
||||
) || (
|
||||
echo Ninja compilation has failed
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM echo Copying Sleigh Files
|
||||
REM mkdir destdir\r2ghidra_sleigh
|
||||
REM copy ghidra-native\src\Processors\*.* destdir\r2ghidra_sleigh
|
||||
|
||||
echo Ziping it Up
|
||||
cd destdir
|
||||
python -m zipfile -c r2ghidra-w64.zip core_r2ghidra.dll
|
||||
dir
|
||||
cd ..
|
||||
+28
-120
@@ -30,7 +30,7 @@ r2ghidra_sources = [
|
||||
incdirs = [
|
||||
'src',
|
||||
'third-party/pugixml/src/',
|
||||
'ghidra-native/src/decompiler/',
|
||||
# 'ghidra-native/src/decompiler/',
|
||||
]
|
||||
|
||||
res = run_command(['radare2','-HR2_LIBR_PLUGINS'], capture:true, check:false)
|
||||
@@ -48,6 +48,8 @@ if cpp.get_id() == 'msvc'
|
||||
'radare2/include/libr/sdb',
|
||||
]
|
||||
add_global_arguments('-D_WINDOWS', language:'cpp')
|
||||
add_global_arguments('-D_WIN32', language:'cpp')
|
||||
add_global_arguments('-DZLIB_WINAPI', language:'cpp')
|
||||
r2libdir = [
|
||||
meson.current_source_dir() + '\\radare2\\lib',
|
||||
'C:\\radare2\\lib'
|
||||
@@ -70,6 +72,13 @@ else
|
||||
r_core = dependency('r_core')
|
||||
endif
|
||||
|
||||
zlib = dependency('zlib', version : '>=1.2.8', required: false)
|
||||
if not zlib.found()
|
||||
zlib_proj = subproject('zlib', default_options: ['default_library=static', 'werror=false'])
|
||||
zlib = zlib_proj.get_variable('zlib_dep')
|
||||
meson.override_dependency('zlib', zlib)
|
||||
endif
|
||||
|
||||
r2ghidra_version = meson.project_version()
|
||||
versionconf = configuration_data()
|
||||
versionconf.set('R2GHIDRA_VERSION', r2ghidra_version)
|
||||
@@ -81,121 +90,20 @@ r_version_h = configure_file(
|
||||
|
||||
r2ghidra_incdirs = include_directories(incdirs)
|
||||
|
||||
ghidra_decompiler_sources = [
|
||||
'ghidra-native/src/decompiler/action.cc',
|
||||
'ghidra-native/src/decompiler/address.cc',
|
||||
'ghidra-native/src/decompiler/architecture.cc',
|
||||
# 'ghidra-native/src/decompiler/bfd_arch.cc',
|
||||
'ghidra-native/src/decompiler/block.cc',
|
||||
'ghidra-native/src/decompiler/blockaction.cc',
|
||||
'ghidra-native/src/decompiler/callgraph.cc',
|
||||
'ghidra-native/src/decompiler/capability.cc',
|
||||
'ghidra-native/src/decompiler/cast.cc',
|
||||
# 'ghidra-native/src/decompiler/codedata.cc',
|
||||
'ghidra-native/src/decompiler/comment.cc',
|
||||
'ghidra-native/src/decompiler/comment_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/condexe.cc',
|
||||
# 'ghidra-native/src/decompiler/consolemain.cc',
|
||||
'ghidra-native/src/decompiler/context.cc',
|
||||
'ghidra-native/src/decompiler/coreaction.cc',
|
||||
'ghidra-native/src/decompiler/cover.cc',
|
||||
'ghidra-native/src/decompiler/cpool.cc',
|
||||
'ghidra-native/src/decompiler/cpool_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/crc32.cc',
|
||||
'ghidra-native/src/decompiler/database.cc',
|
||||
'ghidra-native/src/decompiler/database_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/double.cc',
|
||||
'ghidra-native/src/decompiler/dynamic.cc',
|
||||
'ghidra-native/src/decompiler/emulate.cc',
|
||||
'ghidra-native/src/decompiler/emulateutil.cc',
|
||||
'ghidra-native/src/decompiler/filemanage.cc',
|
||||
'ghidra-native/src/decompiler/float.cc',
|
||||
'ghidra-native/src/decompiler/flow.cc',
|
||||
'ghidra-native/src/decompiler/fspec.cc',
|
||||
'ghidra-native/src/decompiler/multiprecision.cc',
|
||||
'ghidra-native/src/decompiler/funcdata.cc',
|
||||
'ghidra-native/src/decompiler/funcdata_block.cc',
|
||||
'ghidra-native/src/decompiler/funcdata_op.cc',
|
||||
'ghidra-native/src/decompiler/funcdata_varnode.cc',
|
||||
'ghidra-native/src/decompiler/unionresolve.cc',
|
||||
'ghidra-native/src/decompiler/ghidra_arch.cc',
|
||||
'ghidra-native/src/decompiler/ghidra_context.cc',
|
||||
# 'ghidra-native/src/decompiler/ghidra_process.cc',
|
||||
'ghidra-native/src/decompiler/ghidra_translate.cc',
|
||||
'ghidra-native/src/decompiler/globalcontext.cc',
|
||||
'ghidra-native/src/decompiler/grammar.cc',
|
||||
'ghidra-native/src/decompiler/graph.cc',
|
||||
'ghidra-native/src/decompiler/heritage.cc',
|
||||
'ghidra-native/src/decompiler/ifacedecomp.cc',
|
||||
'ghidra-native/src/decompiler/testfunction.cc',
|
||||
'ghidra-native/src/decompiler/ifaceterm.cc',
|
||||
'ghidra-native/src/decompiler/inject_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/inject_sleigh.cc',
|
||||
'ghidra-native/src/decompiler/interface.cc',
|
||||
'ghidra-native/src/decompiler/jumptable.cc',
|
||||
'ghidra-native/src/decompiler/libdecomp.cc',
|
||||
'ghidra-native/src/decompiler/loadimage.cc',
|
||||
# 'ghidra-native/src/decompiler/loadimage_bfd.cc',
|
||||
'ghidra-native/src/decompiler/loadimage_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/loadimage_xml.cc',
|
||||
'ghidra-native/src/decompiler/memstate.cc',
|
||||
'ghidra-native/src/decompiler/merge.cc',
|
||||
'ghidra-native/src/decompiler/op.cc',
|
||||
'ghidra-native/src/decompiler/opbehavior.cc',
|
||||
'ghidra-native/src/decompiler/opcodes.cc',
|
||||
'ghidra-native/src/decompiler/options.cc',
|
||||
'ghidra-native/src/decompiler/override.cc',
|
||||
'ghidra-native/src/decompiler/paramid.cc',
|
||||
'ghidra-native/src/decompiler/pcodecompile.cc',
|
||||
'ghidra-native/src/decompiler/pcodeinject.cc',
|
||||
'ghidra-native/src/decompiler/pcodeparse.cc',
|
||||
'ghidra-native/src/decompiler/pcoderaw.cc',
|
||||
'ghidra-native/src/decompiler/prefersplit.cc',
|
||||
'ghidra-native/src/decompiler/prettyprint.cc',
|
||||
'ghidra-native/src/decompiler/printc.cc',
|
||||
'ghidra-native/src/decompiler/printjava.cc',
|
||||
'ghidra-native/src/decompiler/printlanguage.cc',
|
||||
'ghidra-native/src/decompiler/rangeutil.cc',
|
||||
'ghidra-native/src/decompiler/raw_arch.cc',
|
||||
'ghidra-native/src/decompiler/ruleaction.cc',
|
||||
'ghidra-native/src/decompiler/rulecompile.cc',
|
||||
'ghidra-native/src/decompiler/compression.cc',
|
||||
'ghidra-native/src/decompiler/slaformat.cc',
|
||||
'ghidra-native/src/decompiler/semantics.cc',
|
||||
'ghidra-native/src/decompiler/sleigh.cc',
|
||||
'ghidra-native/src/decompiler/sleigh_arch.cc',
|
||||
'ghidra-native/src/decompiler/sleighbase.cc',
|
||||
# 'ghidra-native/src/decompiler/sleighexample.cc',
|
||||
# 'ghidra-native/src/decompiler/slgh_compile.cc',
|
||||
# 'ghidra-native/src/decompiler/slghparse.cc',
|
||||
'ghidra-native/src/decompiler/slghpatexpress.cc',
|
||||
'ghidra-native/src/decompiler/slghpattern.cc',
|
||||
# 'ghidra-native/src/decompiler/slghscan.cc',
|
||||
'ghidra-native/src/decompiler/slghsymbol.cc',
|
||||
'ghidra-native/src/decompiler/marshal.cc',
|
||||
'ghidra-native/src/decompiler/space.cc',
|
||||
'ghidra-native/src/decompiler/string_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/stringmanage.cc',
|
||||
'ghidra-native/src/decompiler/modelrules.cc',
|
||||
'ghidra-native/src/decompiler/subflow.cc',
|
||||
'ghidra-native/src/decompiler/transform.cc',
|
||||
'ghidra-native/src/decompiler/translate.cc',
|
||||
'ghidra-native/src/decompiler/type.cc',
|
||||
'ghidra-native/src/decompiler/typegrp_ghidra.cc',
|
||||
'ghidra-native/src/decompiler/typeop.cc',
|
||||
'ghidra-native/src/decompiler/unify.cc',
|
||||
'ghidra-native/src/decompiler/userop.cc',
|
||||
'ghidra-native/src/decompiler/variable.cc',
|
||||
'ghidra-native/src/decompiler/varmap.cc',
|
||||
'ghidra-native/src/decompiler/varnode.cc',
|
||||
'ghidra-native/src/decompiler/xml.cc',
|
||||
'ghidra-native/src/decompiler/xml_arch.cc',
|
||||
]
|
||||
ghidra = subproject('ghidra-native', default_options: ['default_library=static', 'werror=false'])
|
||||
# ghidra_decompiler_sources = ghidra.get_variable('sources')
|
||||
# ghidra_slgh_sources = ghidra.get_variable('slgh_sources')
|
||||
ghidra_incs = ghidra.get_variable('incs')
|
||||
ghidra_static = ghidra.get_variable('ghidra_static')
|
||||
slgh_static = ghidra.get_variable('slgh_static')
|
||||
|
||||
|
||||
# r2ghidra_incdirs += ghidra_incs
|
||||
|
||||
r2ghidra_core_sources = [
|
||||
r2ghidra_sources,
|
||||
pugixml_sources,
|
||||
ghidra_decompiler_sources,
|
||||
# ghidra_decompiler_sources,
|
||||
'src/anal_ghidra_plugin.c',
|
||||
'src/anal_ghidra.cpp',
|
||||
'src/core_ghidra_plugin.c',
|
||||
@@ -205,24 +113,24 @@ r2ghidra_core_sources = [
|
||||
sleighc_sources = [
|
||||
r2ghidra_sources,
|
||||
pugixml_sources,
|
||||
'ghidra-native/src/decompiler/slgh_compile.cc',
|
||||
'ghidra-native/src/decompiler/slghparse.cc',
|
||||
'ghidra-native/src/decompiler/slghscan.cc',
|
||||
ghidra_decompiler_sources,
|
||||
# ghidra_slgh_sources,
|
||||
# ghidra_decompiler_sources,
|
||||
]
|
||||
|
||||
r2ghidra_core_plugin = library('core_r2ghidra',
|
||||
r2ghidra_core_sources,
|
||||
dependencies: [r_core],
|
||||
dependencies: [r_core, zlib],
|
||||
link_with: ghidra_static,
|
||||
override_options : ['c_std=c11', 'cpp_std=c++11'],
|
||||
include_directories: r2ghidra_incdirs,
|
||||
include_directories: [ghidra_incs, r2ghidra_incdirs],
|
||||
install: true,
|
||||
install_dir: r2_plugdir
|
||||
)
|
||||
|
||||
sleighc_exe = executable('sleighc', sleighc_sources,
|
||||
include_directories: r2ghidra_incdirs,
|
||||
dependencies: [r_core, zlib],
|
||||
link_with: slgh_static,
|
||||
include_directories: [ghidra_incs, r2ghidra_incdirs],
|
||||
override_options : ['c_std=c11', 'cpp_std=c++11'],
|
||||
dependencies: [r_core],
|
||||
install: true
|
||||
)
|
||||
+11
-1
@@ -4,4 +4,14 @@ MAKE=make
|
||||
./configure
|
||||
gmake --version > /dev/null 2>&1
|
||||
[ $? = 0 ] && MAKE=gmake
|
||||
${MAKE} ghidra-native
|
||||
|
||||
export NEED_ZLIB=1
|
||||
pkg-config --cflags zlib > /dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
NEED_ZLIB=0
|
||||
else
|
||||
echo "Warning: Cannot find system wide zlib"
|
||||
fi
|
||||
echo "[*] Checking subprojects... "
|
||||
${MAKE} -C subprojects # > /dev/null
|
||||
# ${MAKE} ghidra-native
|
||||
+21
-41
@@ -1,58 +1,38 @@
|
||||
@echo off
|
||||
|
||||
set PKG_CONFIG_PATH=%CD%\radare2\lib\pkgconfig
|
||||
set PATH=%CD%\radare2\bin;%PATH%
|
||||
set VSARCH=x64
|
||||
|
||||
git submodule update --init
|
||||
set GNV=0.5.0
|
||||
|
||||
python -m wget https://github.com/radareorg/ghidra-native/releases/download/%GNV%/ghidra-native-%GNV%.zip
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
ECHO NOT FOUND
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
unzip -q ghidra-native-%GNV%.zip
|
||||
if %ERRORLEVEL% NEQ 0 (
|
||||
powershell "Expand-Archive -LiteralPath ghidra-native-%GNV%.zip -DestinationPath ."
|
||||
)
|
||||
ren ghidra-native-%GNV% ghidra-native
|
||||
|
||||
REM call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
echo === Finding Visual Studio...
|
||||
cl --help > NUL 2> NUL
|
||||
cl > NUL 2> NUL
|
||||
if %ERRORLEVEL% == 0 (
|
||||
echo FOUND
|
||||
) else (
|
||||
if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" (
|
||||
echo "Found 2022 Enterprise edition"
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community" (
|
||||
echo "Found 2022 Community edition"
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" (
|
||||
echo "Found 2019 community edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 Enterprise edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 Professional edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 BuildTools"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
if EXIST "C:\Program Files\Microsoft Visual Studio\2022\Community" (
|
||||
echo "Found 2022 Community edition"
|
||||
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" (
|
||||
echo "Found 2019 community edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 Enterprise edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 Professional edition"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
if EXIST "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
echo "Found 2019 BuildTools"
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" %VSARCH%
|
||||
) else (
|
||||
echo "Not Found"
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
echo Error: Could not find Visual Studio. Run the script with VS Developer Console.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
DEPS=ghidra-native
|
||||
|
||||
ifeq ($(NEED_ZLIB),1)
|
||||
DEPS += zlib
|
||||
endif
|
||||
|
||||
all: $(DEPS)
|
||||
|
||||
clean:
|
||||
rm -rf $(DEPS)
|
||||
|
||||
include ghidra-native.mk
|
||||
ifeq ($(NEED_ZLIB),1)
|
||||
include zlib.mk
|
||||
endif
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
ACR_WRAP=acr-wrap
|
||||
|
||||
for i in *.wrap ; do
|
||||
o=`echo $i | sed -e 's,.wrap,.mk,'`
|
||||
echo "[ACR] Wrapping $i"
|
||||
${ACR_WRAP} $i > $o
|
||||
done
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# This file is autogenerated by acr-wrap
|
||||
|
||||
WRAP_wrap_git_url:=https://github.com/radareorg/ghidra-native
|
||||
WRAP_wrap_git_revision:=7c1f8b6975a685f785d4801b794715d9a6a55b19
|
||||
WRAP_wrap_git_directory:=ghidra-native
|
||||
WRAP_wrap_git_patch_directory:=ghidra-native
|
||||
WRAP_wrap_git_diff_files:=ghidra-native/patches/0001-space-after-comma.patch,ghidra-native/patches/0002-make-sleigharch-public.patch,ghidra-native/patches/0004-public-fields.patch,ghidra-native/patches/0006-readonly-warning.patch,ghidra-native/patches/0010-null-subflow.patch,ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch,ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch,ghidra-native/patches/0024-ignore-symbol-beyond-space.patch,ghidra-native/patches/0030-fix-infinite-loop.patch,ghidra-native/patches/0044-bad-unicode-codepoint.patch,ghidra-native/patches/0055-datatype-clone.patch,ghidra-native/patches/0056-nullderef-workaround.patch,ghidra-native/patches/0080-getparent-flow.patch,ghidra-native/patches/0090-nocasts-warnings.patch,ghidra-native/patches/0091-decompiler-xml-packer.patch,ghidra-native/patches/0092-badvar-segfault.patch
|
||||
WRAP_wrap_git_depth:=1
|
||||
|
||||
ghidra-native_all: ghidra-native
|
||||
@echo "Nothing to do"
|
||||
|
||||
ghidra-native:
|
||||
git clone --no-checkout --depth=1 https://github.com/radareorg/ghidra-native ghidra-native
|
||||
cd ghidra-native && git fetch --depth=1 origin 7c1f8b6975a685f785d4801b794715d9a6a55b19
|
||||
cd ghidra-native && git checkout FETCH_HEAD
|
||||
cp -rf packagefiles/ghidra-native/* ghidra-native
|
||||
for a in ghidra-native/patches/0001-space-after-comma.patch ghidra-native/patches/0002-make-sleigharch-public.patch ghidra-native/patches/0004-public-fields.patch ghidra-native/patches/0006-readonly-warning.patch ghidra-native/patches/0010-null-subflow.patch ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch ghidra-native/patches/0024-ignore-symbol-beyond-space.patch ghidra-native/patches/0030-fix-infinite-loop.patch ghidra-native/patches/0044-bad-unicode-codepoint.patch ghidra-native/patches/0055-datatype-clone.patch ghidra-native/patches/0056-nullderef-workaround.patch ghidra-native/patches/0080-getparent-flow.patch ghidra-native/patches/0090-nocasts-warnings.patch ghidra-native/patches/0091-decompiler-xml-packer.patch ghidra-native/patches/0092-badvar-segfault.patch ; do echo "patch -d ghidra-native -p1 < $$a" ; patch -d ghidra-native -p1 < $$a ; done
|
||||
|
||||
ghidra-native_clean:
|
||||
rm -rf ghidra-native
|
||||
@@ -0,0 +1,7 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/radareorg/ghidra-native
|
||||
revision = 7c1f8b6975a685f785d4801b794715d9a6a55b19
|
||||
directory = ghidra-native
|
||||
patch_directory = ghidra-native
|
||||
diff_files = ghidra-native/patches/0001-space-after-comma.patch, ghidra-native/patches/0002-make-sleigharch-public.patch, ghidra-native/patches/0004-public-fields.patch, ghidra-native/patches/0006-readonly-warning.patch, ghidra-native/patches/0010-null-subflow.patch, ghidra-native/patches/0020-Fix-double-free-crash-when-deinitializing-multiple-X.patch, ghidra-native/patches/0023-Undef-LoadImage-for-windows.patch, ghidra-native/patches/0024-ignore-symbol-beyond-space.patch, ghidra-native/patches/0030-fix-infinite-loop.patch, ghidra-native/patches/0044-bad-unicode-codepoint.patch, ghidra-native/patches/0055-datatype-clone.patch, ghidra-native/patches/0056-nullderef-workaround.patch, ghidra-native/patches/0080-getparent-flow.patch, ghidra-native/patches/0090-nocasts-warnings.patch, ghidra-native/patches/0091-decompiler-xml-packer.patch, ghidra-native/patches/0092-badvar-segfault.patch
|
||||
depth = 1
|
||||
@@ -0,0 +1,141 @@
|
||||
project('ghidra-native', 'cpp', meson_version : '>=0.60.0', version : '7c1f8b6975a685f785d4801b794715d9a6a55b19')
|
||||
|
||||
sources = [
|
||||
'src/decompiler/action.cc',
|
||||
'src/decompiler/address.cc',
|
||||
'src/decompiler/architecture.cc',
|
||||
#e/src/decompiler/bfd_arch.cc',
|
||||
'src/decompiler/block.cc',
|
||||
'src/decompiler/blockaction.cc',
|
||||
# 'src/decompiler/callgraph.cc', # debug
|
||||
'src/decompiler/capability.cc',
|
||||
'src/decompiler/cast.cc',
|
||||
#e/src/decompiler/codedata.cc',
|
||||
'src/decompiler/comment.cc',
|
||||
'src/decompiler/comment_ghidra.cc',
|
||||
'src/decompiler/condexe.cc',
|
||||
#e/src/decompiler/consolemain.cc',
|
||||
'src/decompiler/context.cc',
|
||||
'src/decompiler/coreaction.cc',
|
||||
'src/decompiler/cover.cc',
|
||||
'src/decompiler/cpool.cc',
|
||||
'src/decompiler/cpool_ghidra.cc',
|
||||
'src/decompiler/crc32.cc',
|
||||
'src/decompiler/database.cc',
|
||||
'src/decompiler/database_ghidra.cc',
|
||||
'src/decompiler/double.cc',
|
||||
'src/decompiler/dynamic.cc',
|
||||
'src/decompiler/emulate.cc',
|
||||
'src/decompiler/emulateutil.cc',
|
||||
'src/decompiler/filemanage.cc',
|
||||
'src/decompiler/float.cc',
|
||||
'src/decompiler/flow.cc',
|
||||
'src/decompiler/fspec.cc',
|
||||
'src/decompiler/multiprecision.cc',
|
||||
'src/decompiler/funcdata.cc',
|
||||
'src/decompiler/funcdata_block.cc',
|
||||
'src/decompiler/funcdata_op.cc',
|
||||
'src/decompiler/funcdata_varnode.cc',
|
||||
'src/decompiler/unionresolve.cc',
|
||||
'src/decompiler/ghidra_arch.cc',
|
||||
'src/decompiler/ghidra_context.cc',
|
||||
#e/src/decompiler/ghidra_process.cc',
|
||||
'src/decompiler/ghidra_translate.cc',
|
||||
'src/decompiler/globalcontext.cc',
|
||||
# 'src/decompiler/grammar.cc', # used by diagnostic mode
|
||||
'src/decompiler/graph.cc',
|
||||
'src/decompiler/heritage.cc',
|
||||
# 'src/decompiler/ifacedecomp.cc', # debug
|
||||
#'src/decompiler/testfunction.cc',
|
||||
# 'src/decompiler/ifaceterm.cc',
|
||||
'src/decompiler/inject_ghidra.cc',
|
||||
'src/decompiler/inject_sleigh.cc',
|
||||
# 'src/decompiler/interface.cc', # debug
|
||||
'src/decompiler/jumptable.cc',
|
||||
'src/decompiler/libdecomp.cc',
|
||||
'src/decompiler/loadimage.cc',
|
||||
#e/src/decompiler/loadimage_bfd.cc',
|
||||
'src/decompiler/loadimage_ghidra.cc',
|
||||
'src/decompiler/loadimage_xml.cc',
|
||||
'src/decompiler/memstate.cc',
|
||||
'src/decompiler/merge.cc',
|
||||
'src/decompiler/op.cc',
|
||||
'src/decompiler/opbehavior.cc',
|
||||
'src/decompiler/opcodes.cc',
|
||||
'src/decompiler/options.cc',
|
||||
'src/decompiler/override.cc',
|
||||
'src/decompiler/paramid.cc',
|
||||
'src/decompiler/pcodecompile.cc',
|
||||
'src/decompiler/pcodeinject.cc',
|
||||
'src/decompiler/pcodeparse.cc',
|
||||
'src/decompiler/pcoderaw.cc',
|
||||
'src/decompiler/prefersplit.cc',
|
||||
'src/decompiler/prettyprint.cc',
|
||||
'src/decompiler/printc.cc',
|
||||
'src/decompiler/printjava.cc',
|
||||
'src/decompiler/printlanguage.cc',
|
||||
'src/decompiler/rangeutil.cc',
|
||||
'src/decompiler/raw_arch.cc',
|
||||
'src/decompiler/ruleaction.cc',
|
||||
'src/decompiler/rulecompile.cc',
|
||||
'src/decompiler/compression.cc',
|
||||
'src/decompiler/slaformat.cc',
|
||||
'src/decompiler/semantics.cc',
|
||||
'src/decompiler/sleigh.cc',
|
||||
'src/decompiler/sleigh_arch.cc',
|
||||
'src/decompiler/sleighbase.cc',
|
||||
#e/src/decompiler/sleighexample.cc',
|
||||
#e/src/decompiler/slgh_compile.cc',
|
||||
#e/src/decompiler/slghparse.cc',
|
||||
'src/decompiler/slghpatexpress.cc',
|
||||
'src/decompiler/slghpattern.cc',
|
||||
#e/src/decompiler/slghscan.cc',
|
||||
'src/decompiler/slghsymbol.cc',
|
||||
'src/decompiler/marshal.cc',
|
||||
'src/decompiler/space.cc',
|
||||
'src/decompiler/string_ghidra.cc',
|
||||
'src/decompiler/stringmanage.cc',
|
||||
'src/decompiler/modelrules.cc',
|
||||
'src/decompiler/subflow.cc',
|
||||
'src/decompiler/transform.cc',
|
||||
'src/decompiler/translate.cc',
|
||||
'src/decompiler/type.cc',
|
||||
'src/decompiler/typegrp_ghidra.cc',
|
||||
'src/decompiler/typeop.cc',
|
||||
'src/decompiler/unify.cc',
|
||||
'src/decompiler/userop.cc',
|
||||
'src/decompiler/variable.cc',
|
||||
'src/decompiler/varmap.cc',
|
||||
'src/decompiler/varnode.cc',
|
||||
'src/decompiler/xml.cc',
|
||||
'src/decompiler/xml_arch.cc',
|
||||
]
|
||||
|
||||
slgh_sources = [
|
||||
'src/decompiler/slgh_compile.cc',
|
||||
'src/decompiler/slghparse.cc',
|
||||
'src/decompiler/slghscan.cc',
|
||||
]
|
||||
|
||||
zlib = dependency('zlib', version : '>=1.2.8', required: false)
|
||||
if not zlib.found()
|
||||
zlib_proj = subproject('zlib', default_options: ['default_library=static', 'werror=false'])
|
||||
zlib = zlib_proj.get_variable('zlib_dep')
|
||||
meson.override_dependency('zlib', zlib)
|
||||
endif
|
||||
|
||||
incs = include_directories('src/decompiler')
|
||||
|
||||
ghidra_static = static_library(
|
||||
'ghidra', sources,
|
||||
dependencies: zlib,
|
||||
include_directories: incs
|
||||
)
|
||||
|
||||
slgh_static = static_library(
|
||||
'slgh', sources + slgh_sources,
|
||||
dependencies: zlib,
|
||||
include_directories: incs
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/src/decompiler/printc.cc b/src/decompiler/printc.cc
|
||||
index b2637c1..eac56f7 100644
|
||||
--- a/src/decompiler/printc.cc
|
||||
+++ b/src/decompiler/printc.cc
|
||||
@@ -54,7 +54,7 @@ OpToken PrintC::boolean_and = { "&&", "", 2, 22, false, OpToken::binary, 1, 0, (
|
||||
OpToken PrintC::boolean_xor = { "^^", "", 2, 20, false, OpToken::binary, 1, 0, (OpToken *)0 };
|
||||
OpToken PrintC::boolean_or = { "||", "", 2, 18, false, OpToken::binary, 1, 0, (OpToken *)0 };
|
||||
OpToken PrintC::assignment = { "=", "", 2, 14, false, OpToken::binary, 1, 5, (OpToken *)0 };
|
||||
-OpToken PrintC::comma = { ",", "", 2, 2, true, OpToken::binary, 0, 0, (OpToken *)0 };
|
||||
+OpToken PrintC::comma = { ", ", "", 2, 2, true, OpToken::binary, 0, 0, (OpToken *)0 };
|
||||
OpToken PrintC::new_op = { "", "", 2, 62, false, OpToken::space, 1, 0, (OpToken *)0 };
|
||||
|
||||
// Inplace assignment operators
|
||||
@@ -82,7 +82,7 @@ const string PrintC::CLOSE_CURLY = "}";
|
||||
const string PrintC::SEMICOLON = ";";
|
||||
const string PrintC::COLON = ":";
|
||||
const string PrintC::EQUALSIGN = "=";
|
||||
-const string PrintC::COMMA = ",";
|
||||
+const string PrintC::COMMA = ", ";
|
||||
const string PrintC::DOTDOTDOT = "...";
|
||||
const string PrintC::KEYWORD_VOID = "void";
|
||||
const string PrintC::KEYWORD_TRUE = "true";
|
||||
@@ -0,0 +1,21 @@
|
||||
diff --git a/src/decompiler/sleigh_arch.hh b/src/decompiler/sleigh_arch.hh
|
||||
index 695622e..1bccbef 100644
|
||||
--- a/src/decompiler/sleigh_arch.hh
|
||||
+++ b/src/decompiler/sleigh_arch.hh
|
||||
@@ -116,7 +116,6 @@ class SleighArchitecture : public Architecture {
|
||||
protected:
|
||||
ostream *errorstream; ///< Error stream associated with \b this SleighArchitecture
|
||||
// buildLoader must be filled in by derived class
|
||||
- static void collectSpecFiles(ostream &errs); ///< Gather specification files in normal locations
|
||||
virtual Translate *buildTranslator(DocumentStorage &store);
|
||||
virtual PcodeInjectLibrary *buildPcodeInjectLibrary(void);
|
||||
virtual void buildTypegrp(DocumentStorage &store);
|
||||
@@ -138,6 +137,8 @@ public:
|
||||
virtual ~SleighArchitecture(void);
|
||||
virtual string getDescription(void) const;
|
||||
|
||||
+ static void collectSpecFiles(ostream &errs); ///< Gather specification files in normal locations
|
||||
+ static const vector<LanguageDescription> &getLanguageDescriptions() { return description; }
|
||||
static string normalizeProcessor(const string &nm); ///< Try to recover a \e language \e id processor field
|
||||
static string normalizeEndian(const string &nm); ///< Try to recover a \e language \e id endianess field
|
||||
static string normalizeSize(const string &nm); ///< Try to recover a \e language \e id size field
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --git a/src/decompiler/context.hh b/src/decompiler/context.hh
|
||||
index 3372e5a..5d2e108 100644
|
||||
--- a/src/decompiler/context.hh
|
||||
+++ b/src/decompiler/context.hh
|
||||
@@ -89,6 +89,8 @@ private:
|
||||
ConstructState *base_state;
|
||||
int4 alloc; // Number of ConstructState's allocated
|
||||
int4 delayslot; // delayslot depth
|
||||
+protected:
|
||||
+ ConstructState **getBaseState(void) { return &base_state; }
|
||||
public:
|
||||
ParserContext(ContextCache *ccache);
|
||||
~ParserContext(void) { if (context != (uintm *)0) delete [] context; }
|
||||
diff --git a/src/decompiler/sleigh.hh b/src/decompiler/sleigh.hh
|
||||
index 1a758a4..1e96c2c 100644
|
||||
--- a/src/decompiler/sleigh.hh
|
||||
+++ b/src/decompiler/sleigh.hh
|
||||
@@ -166,6 +166,7 @@ protected:
|
||||
ParserContext *obtainContext(const Address &addr,int4 state) const;
|
||||
void resolve(ParserContext &pos) const; ///< Generate a parse tree suitable for disassembly
|
||||
void resolveHandles(ParserContext &pos) const; ///< Prepare the parse tree for p-code generation
|
||||
+ ContextCache *getContextCache(void) { return cache; }
|
||||
public:
|
||||
Sleigh(LoadImage *ld,ContextDatabase *c_db); ///< Constructor
|
||||
virtual ~Sleigh(void); ///< Destructor
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/src/decompiler/funcdata_varnode.cc b/src/decompiler/funcdata_varnode.cc
|
||||
index dad2994..5a43b1d 100644
|
||||
--- a/src/decompiler/funcdata_varnode.cc
|
||||
+++ b/src/decompiler/funcdata_varnode.cc
|
||||
@@ -516,6 +516,7 @@ void Funcdata::transferVarnodeProperties(Varnode *vn,Varnode *newVn,int4 lsbOffs
|
||||
bool Funcdata::fillinReadOnly(Varnode *vn)
|
||||
|
||||
{
|
||||
+/*
|
||||
if (vn->isWritten()) { // Can't replace output with constant
|
||||
PcodeOp *defop = vn->getDef();
|
||||
if (defop->isMarker())
|
||||
@@ -534,6 +535,7 @@ bool Funcdata::fillinReadOnly(Varnode *vn)
|
||||
}
|
||||
return false; // No change was made
|
||||
}
|
||||
+*/
|
||||
|
||||
if (vn->getSize() > sizeof(uintb))
|
||||
return false; // Constant will exceed precision
|
||||
@@ -0,0 +1,14 @@
|
||||
diff --git a/src/decompiler/subflow.cc b/src/decompiler/subflow.cc
|
||||
index 0c42b50..522c435 100644
|
||||
--- a/src/decompiler/subflow.cc
|
||||
+++ b/src/decompiler/subflow.cc
|
||||
@@ -66,6 +66,9 @@ SubvariableFlow::ReplaceVarnode *SubvariableFlow::setReplacement(Varnode *vn,uin
|
||||
|
||||
{
|
||||
ReplaceVarnode *res;
|
||||
+ if (vn == nullptr) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
if (vn->isMark()) { // Already seen before
|
||||
map<Varnode *,ReplaceVarnode>::iterator iter;
|
||||
iter = varmap.find(vn);
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
diff --git a/src/decompiler/xml.cc b/src/decompiler/xml.cc
|
||||
index 51fb587..3a064d4 100644
|
||||
--- a/src/decompiler/xml.cc
|
||||
+++ b/src/decompiler/xml.cc
|
||||
@@ -98,8 +98,6 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
-string Attributes::bogus_uri("http://unused.uri");
|
||||
-
|
||||
/// \brief The XML character scanner
|
||||
///
|
||||
/// Tokenize a byte stream suitably for the main XML parser. The scanner expects an ASCII or UTF-8
|
||||
diff --git a/src/decompiler/xml.hh b/src/decompiler/xml.hh
|
||||
index 75e7dd9..93f6278 100644
|
||||
--- a/src/decompiler/xml.hh
|
||||
+++ b/src/decompiler/xml.hh
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
+#define bogus_uri "http://unused.uri"
|
||||
/// \brief The \e attributes for a single XML element
|
||||
///
|
||||
/// A container for name/value pairs (of strings) for the formal attributes, as collected during parsing.
|
||||
@@ -34,7 +35,6 @@ using namespace std;
|
||||
/// This also holds other properties of the element that are unused in this implementation,
|
||||
/// including the \e namespace URI.
|
||||
class Attributes {
|
||||
- static string bogus_uri; ///< A placeholder for the namespace URI that should be attached to the element
|
||||
// static string prefix;
|
||||
string *elementname; ///< The name of the XML element
|
||||
vector<string *> name; ///< List of names for each formal XML attribute
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
diff --git a/src/decompiler/prettyprint.cc b/src/decompiler/prettyprint.cc
|
||||
index 3e8d18a..6b98d02 100644
|
||||
--- a/src/decompiler/prettyprint.cc
|
||||
+++ b/src/decompiler/prettyprint.cc
|
||||
@@ -174,6 +174,14 @@ void EmitMarkup::tagOp(const string &name,syntax_highlight hl,const PcodeOp *op)
|
||||
encoder->closeElement(ELEM_OP);
|
||||
}
|
||||
|
||||
+/// \brief Emit a function noreturn identifier
|
||||
+///
|
||||
+/// An identifier string representing noreturn information of the function is emitted
|
||||
+void EmitMarkup::tagNoreturn(void)
|
||||
+{
|
||||
+ *s << "<noreturn " << highlight[(int4)no_color] << '>' << " noreturn </noreturn>";
|
||||
+}
|
||||
+
|
||||
void EmitMarkup::tagFuncName(const string &name,syntax_highlight hl,const Funcdata *fd,const PcodeOp *op)
|
||||
|
||||
{
|
||||
@@ -343,6 +351,9 @@ void TokenSplit::print(Emit *emit) const
|
||||
case fnam_t: // tagFuncName
|
||||
emit->tagFuncName(tok,hl,ptr_second.fd,op);
|
||||
break;
|
||||
+ case noret_t:
|
||||
+ emit->tagNoreturn();
|
||||
+ break;
|
||||
case type_t: // tagType
|
||||
emit->tagType(tok,hl,ptr_second.ct);
|
||||
break;
|
||||
@@ -973,6 +984,14 @@ void EmitPrettyPrint::tagFuncName(const string &name,syntax_highlight hl,const F
|
||||
scan();
|
||||
}
|
||||
|
||||
+void EmitPrettyPrint::tagNoreturn(void)
|
||||
+{
|
||||
+ checkstring();
|
||||
+ TokenSplit &tok( tokqueue.push() );
|
||||
+ tok.tagNoreturn();
|
||||
+ scan();
|
||||
+}
|
||||
+
|
||||
void EmitPrettyPrint::tagType(const string &name,syntax_highlight hl,const Datatype *ct)
|
||||
|
||||
{
|
||||
diff --git a/src/decompiler/prettyprint.hh b/src/decompiler/prettyprint.hh
|
||||
index 6e7124c..21f2fdf 100644
|
||||
--- a/src/decompiler/prettyprint.hh
|
||||
+++ b/src/decompiler/prettyprint.hh
|
||||
@@ -469,6 +469,7 @@ public:
|
||||
virtual void tagVariable(const string &name,syntax_highlight hl,const Varnode *vn,const PcodeOp *op);
|
||||
virtual void tagOp(const string &name,syntax_highlight hl,const PcodeOp *op);
|
||||
virtual void tagFuncName(const string &name,syntax_highlight hl,const Funcdata *fd,const PcodeOp *op);
|
||||
+ virtual void tagNoreturn(void);
|
||||
virtual void tagType(const string &name,syntax_highlight hl,const Datatype *ct);
|
||||
virtual void tagField(const string &name,syntax_highlight hl,const Datatype *ct,int4 off,const PcodeOp *op);
|
||||
virtual void tagComment(const string &name,syntax_highlight hl,const AddrSpace *spc,uintb off);
|
||||
@@ -514,6 +515,8 @@ public:
|
||||
*s << name; }
|
||||
virtual void tagFuncName(const string &name,syntax_highlight hl,const Funcdata *fd,const PcodeOp *op) {
|
||||
*s << name; }
|
||||
+ virtual void tagNoreturn(void) {
|
||||
+ *s << " noreturn ";}
|
||||
virtual void tagType(const string &name,syntax_highlight hl,const Datatype *ct) {
|
||||
*s << name; }
|
||||
virtual void tagField(const string &name,syntax_highlight hl,const Datatype *ct,int4 off,const PcodeOp *op) {
|
||||
@@ -580,6 +583,7 @@ public:
|
||||
vari_t, ///< A variable identifier
|
||||
op_t, ///< An operator
|
||||
fnam_t, ///< A function identifier
|
||||
+ noret_t, ///< A function noreturn identifier
|
||||
type_t, ///< A data-type identifier
|
||||
field_t, ///< A field name for a structured data-type
|
||||
comm_t, ///< Part of a comment block
|
||||
@@ -734,6 +738,10 @@ public:
|
||||
tok = name; size = tok.size();
|
||||
tagtype=fnam_t; delimtype=tokenstring; hl=h; ptr_second.fd=f; op=o; }
|
||||
|
||||
+ /// \brief Create a function noreturn identifiertoken
|
||||
+ void tagNoreturn(void) {
|
||||
+ tagtype=noret_t; delimtype=tokenstring; }
|
||||
+
|
||||
/// \brief Create a data-type identifier token
|
||||
///
|
||||
/// \param name is the character data for the identifier
|
||||
@@ -1015,6 +1023,7 @@ public:
|
||||
virtual void tagVariable(const string &name,syntax_highlight hl,const Varnode *vn,const PcodeOp *op);
|
||||
virtual void tagOp(const string &name,syntax_highlight hl,const PcodeOp *op);
|
||||
virtual void tagFuncName(const string &name,syntax_highlight hl,const Funcdata *fd,const PcodeOp *op);
|
||||
+ virtual void tagNoreturn(void);
|
||||
virtual void tagType(const string &name,syntax_highlight hl,const Datatype *ct);
|
||||
virtual void tagField(const string &name,syntax_highlight hl,const Datatype *ct,int4 off,const PcodeOp *op);
|
||||
virtual void tagComment(const string &name,syntax_highlight hl,const AddrSpace *spc,uintb off);
|
||||
diff --git a/src/decompiler/printc.cc b/src/decompiler/printc.cc
|
||||
index b2637c1..d7a680c 100644
|
||||
--- a/src/decompiler/printc.cc
|
||||
+++ b/src/decompiler/printc.cc
|
||||
@@ -2512,6 +2512,9 @@ void PrintC::emitFunctionDeclaration(const Funcdata *fd)
|
||||
emitSymbolScope(fd->getSymbol());
|
||||
emit->tagFuncName(fd->getDisplayName(),EmitMarkup::funcname_color,fd,(PcodeOp *)0);
|
||||
|
||||
+ if (proto->isNoReturn()) {
|
||||
+ emit->tagNoreturn();
|
||||
+ }
|
||||
emit->spaces(function_call.spacing,function_call.bump);
|
||||
int4 id2 = emit->openParen(OPEN_PAREN);
|
||||
emit->spaces(0,function_call.bump);
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/src/decompiler/loadimage.hh b/src/decompiler/loadimage.hh
|
||||
index 59d4c9a..3557744 100644
|
||||
--- a/src/decompiler/loadimage.hh
|
||||
+++ b/src/decompiler/loadimage.hh
|
||||
@@ -21,6 +21,10 @@
|
||||
|
||||
#include "address.hh"
|
||||
|
||||
+#ifdef LoadImage
|
||||
+#undef LoadImage
|
||||
+#endif
|
||||
+
|
||||
/// \brief Exception indicating data was not available
|
||||
///
|
||||
/// This exception is thrown when a request for load image
|
||||
@@ -0,0 +1,17 @@
|
||||
diff --git a/src/decompiler/database.cc b/src/decompiler/database.cc
|
||||
index 6eab457..8d17f38 100644
|
||||
--- a/src/decompiler/database.cc
|
||||
+++ b/src/decompiler/database.cc
|
||||
@@ -1805,9 +1805,10 @@ SymbolEntry *ScopeInternal::addMapInternal(Symbol *sym,uint4 exfl,const Address
|
||||
string msg = "Symbol ";
|
||||
msg += sym->getName();
|
||||
msg += " extends beyond the end of the address space";
|
||||
- throw LowlevelError(msg);
|
||||
+ fprintf (stderr, "%s\n", msg.c_str());
|
||||
+ //throw LowlevelError(msg);
|
||||
}
|
||||
-
|
||||
+
|
||||
list<SymbolEntry>::iterator iter = rangemap->insert(initdata,addr.getOffset(),lastaddress.getOffset());
|
||||
// Store reference to map in symbol
|
||||
sym->mapentry.push_back(iter);
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/src/decompiler/ruleaction.cc b/src/decompiler/ruleaction.cc
|
||||
index 55a3bdd..c8cba80 100644
|
||||
--- a/src/decompiler/ruleaction.cc
|
||||
+++ b/src/decompiler/ruleaction.cc
|
||||
@@ -3605,6 +3605,8 @@ int4 RulePropagateCopy::applyOp(PcodeOp *op,Funcdata &data)
|
||||
Varnode *vn,*invn;
|
||||
|
||||
if (op->stopsCopyPropagation()) return 0;
|
||||
+ // op->setStopTypePropagation();
|
||||
+ op->setStopCopyPropagation();
|
||||
for(i=0;i<op->numInput();++i) {
|
||||
vn = op->getIn(i);
|
||||
if (!vn->isWritten()) continue; // Varnode must be written to
|
||||
@@ -0,0 +1,21 @@
|
||||
diff --git a/src/decompiler/stringmanage.cc b/src/decompiler/stringmanage.cc
|
||||
index 6e60b4f..fb7e2eb 100644
|
||||
--- a/src/decompiler/stringmanage.cc
|
||||
+++ b/src/decompiler/stringmanage.cc
|
||||
@@ -40,14 +40,14 @@ void StringManager::writeUtf8(ostream &s,int4 codepoint)
|
||||
int4 size;
|
||||
|
||||
if (codepoint < 0)
|
||||
- throw LowlevelError("Negative unicode codepoint");
|
||||
+ return; // throw LowlevelError("Negative unicode codepoint");
|
||||
if (codepoint < 128) {
|
||||
s.put((uint1)codepoint);
|
||||
return;
|
||||
}
|
||||
int4 bits = mostsigbit_set(codepoint) + 1;
|
||||
if (bits > 21)
|
||||
- throw LowlevelError("Bad unicode codepoint");
|
||||
+ return; // throw LowlevelError("Bad unicode codepoint");
|
||||
if (bits < 12) { // Encode with two bytes
|
||||
bytes[0] = 0xc0 ^ ((codepoint >> 6)&0x1f);
|
||||
bytes[1] = 0x80 ^ (codepoint & 0x3f);
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/src/decompiler/type.hh b/src/decompiler/type.hh
|
||||
index 76710b3..b26868a 100644
|
||||
--- a/src/decompiler/type.hh
|
||||
+++ b/src/decompiler/type.hh
|
||||
@@ -197,10 +197,10 @@ protected:
|
||||
void markComplete(void) { flags &= ~(uint4)type_incomplete; } ///< Mark \b this data-type as completely defined
|
||||
void setDisplayFormat(uint4 format); ///< Set a specific display format
|
||||
void calcAlignSize(void); ///< Calculate aligned size, assuming alignment is known
|
||||
- virtual Datatype *clone(void) const=0; ///< Clone the data-type
|
||||
static uint8 hashName(const string &nm); ///< Produce a data-type id by hashing the type name
|
||||
static uint8 hashSize(uint8 id,int4 size); ///< Reversibly hash size into id
|
||||
public:
|
||||
+ virtual Datatype *clone(void) const=0; ///< Clone the data-type
|
||||
/// Construct the base data-type copying low-level properties of another
|
||||
Datatype(const Datatype &op) { size = op.size; name=op.name; displayName=op.displayName; metatype=op.metatype;
|
||||
submeta=op.submeta; flags=op.flags; id=op.id; typedefImm=op.typedefImm; alignment=op.alignment; alignSize=op.alignSize; }
|
||||
@@ -0,0 +1,12 @@
|
||||
diff --git a/src/decompiler/merge.hh b/src/decompiler/merge.hh
|
||||
index bcce463..c965f86 100644
|
||||
--- a/src/decompiler/merge.hh
|
||||
+++ b/src/decompiler/merge.hh
|
||||
@@ -137,6 +137,7 @@ public:
|
||||
inline bool Merge::compareHighByBlock(const HighVariable *a,const HighVariable *b)
|
||||
|
||||
{
|
||||
+ if (!a || !b) return false;
|
||||
int4 result = a->getCover().compareTo(b->getCover());
|
||||
if ( result == 0 ) {
|
||||
Varnode *v1 = a->getInstance( 0 );
|
||||
@@ -0,0 +1,17 @@
|
||||
diff --git a/src/decompiler/flow.cc b/src/decompiler/flow.cc
|
||||
index 178047f..78565eb 100644
|
||||
--- a/src/decompiler/flow.cc
|
||||
+++ b/src/decompiler/flow.cc
|
||||
@@ -1006,8 +1006,10 @@ void FlowInfo::connectBasic(void)
|
||||
op = *iter++;
|
||||
targ_op = *iter2++;
|
||||
bs = op->getParent();
|
||||
- targ_bs = targ_op->getParent();
|
||||
- bblocks.addEdge(bs,targ_bs);
|
||||
+ if (targ_op != nullptr) {
|
||||
+ targ_bs = targ_op->getParent();
|
||||
+ bblocks.addEdge(bs,targ_bs);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
diff --git a/src/decompiler/printc.cc b/src/decompiler/printc.cc
|
||||
index 64ecda1..a02ca74 100644
|
||||
--- a/src/decompiler/printc.cc
|
||||
+++ b/src/decompiler/printc.cc
|
||||
@@ -3095,6 +3097,7 @@ void PrintC::emitCommentFuncHeader(const Funcdata *fd)
|
||||
emitLineComment(1,comm);
|
||||
}
|
||||
}
|
||||
+/*
|
||||
if (option_nocasts) {
|
||||
if (extralinebreak)
|
||||
emit->tagLine();
|
||||
@@ -3103,6 +3106,7 @@ void PrintC::emitCommentFuncHeader(const Funcdata *fd)
|
||||
emitLineComment(0,&comm);
|
||||
extralinebreak = true;
|
||||
}
|
||||
+*/
|
||||
if (extralinebreak)
|
||||
emit->tagLine(); // Extra linebreak if comment exists
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/src/decompiler/prettyprint.cc b/src/decompiler/prettyprint.cc
|
||||
index 3e8d18a..4d48bf8 100644
|
||||
--- a/src/decompiler/prettyprint.cc
|
||||
+++ b/src/decompiler/prettyprint.cc
|
||||
@@ -279,7 +279,7 @@ void EmitMarkup::setOutputStream(ostream *t)
|
||||
if (encoder != (Encoder *)0)
|
||||
delete encoder;
|
||||
s = t;
|
||||
- encoder = new PackedEncode(*s);
|
||||
+ encoder = new XmlEncode(*s);
|
||||
}
|
||||
|
||||
int4 TokenSplit::countbase = 0;
|
||||
@@ -0,0 +1,26 @@
|
||||
diff --git a/src/decompiler/varmap.cc b/src/decompiler/varmap.cc
|
||||
index ce1660b..4928ad0 100644
|
||||
--- a/src/decompiler/varmap.cc
|
||||
+++ b/src/decompiler/varmap.cc
|
||||
@@ -1198,7 +1198,7 @@ void ScopeLocal::markUnaliased(const vector<uintb> &alias)
|
||||
// NOTE: this is primarily to reset aliasing between
|
||||
// stack parameters and stack locals
|
||||
if (aliason && (curoff - curalias > 0xffff)) aliason = false;
|
||||
- if (!aliason) symbol->getScope()->setAttribute(symbol,Varnode::nolocalalias);
|
||||
+ if (!aliason && symbol->getName().length () > 0) symbol->getScope()->setAttribute(symbol,Varnode::nolocalalias);
|
||||
if (symbol->isTypeLocked() && alias_block_level != 0) {
|
||||
if (alias_block_level == 3)
|
||||
aliason = false; // For this level, all locked data-types block aliases
|
||||
diff --git a/src/decompiler/database.cc b/src/decompiler/database.cc
|
||||
index 5544616..ec1a036 100644
|
||||
--- a/src/decompiler/database.cc
|
||||
+++ b/src/decompiler/database.cc
|
||||
@@ -158,6 +158,8 @@ Datatype *SymbolEntry::getSizedType(const Address &inaddr,int4 sz) const
|
||||
else
|
||||
off = (int4)(inaddr.getOffset() - addr.getOffset()) + offset;
|
||||
Datatype *cur = symbol->getType();
|
||||
+ if (symbol->getName().length() == 0)
|
||||
+ return nullptr;
|
||||
return symbol->getScope()->getArch()->types->getExactPiece(cur, off, sz);
|
||||
}
|
||||
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
From ce0bda47d99042322af318ecb425453279e8c7a4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Thu, 25 Jul 2019 12:31:44 +0200
|
||||
Subject: [PATCH 07/23] Add some Formatting Options
|
||||
|
||||
---
|
||||
.../Decompiler/src/decompile/cpp/printc.cc | 60 +++++++++++++++----
|
||||
.../Decompiler/src/decompile/cpp/printc.hh | 7 +++
|
||||
2 files changed, 55 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
index 79da4cfa3..c7e290fe8 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
@@ -353,8 +353,9 @@ void PrintC::opFunc(const PcodeOp *op)
|
||||
string nm = op->getOpcode()->getOperatorName(op);
|
||||
pushAtom(Atom(nm,optoken,EmitXml::no_color,op));
|
||||
if (op->numInput() > 0) {
|
||||
- for(int4 i=0;i<op->numInput()-1;++i)
|
||||
- pushOp(&comma,op);
|
||||
+ for(int4 i=0;i<op->numInput()-1;++i) {
|
||||
+ pushOp(&comma,op);
|
||||
+ }
|
||||
// implied vn's pushed on in reverse order for efficiency
|
||||
// see PrintLanguage::pushVnImplied
|
||||
for(int4 i=op->numInput()-1;i>=0;--i)
|
||||
@@ -1386,6 +1387,10 @@ void PrintC::resetDefaultsPrintC(void)
|
||||
option_nocasts = false;
|
||||
option_NULL = false;
|
||||
option_unplaced = false;
|
||||
+ option_space_after_comma = false;
|
||||
+ option_newline_before_else = true;
|
||||
+ option_newline_before_opening_brace = false;
|
||||
+ option_newline_after_prototype = true;
|
||||
setCStyleComments();
|
||||
}
|
||||
|
||||
@@ -1838,6 +1843,9 @@ void PrintC::emitStructDefinition(const TypeStruct *ct)
|
||||
iter++;
|
||||
if (iter != ct->endField()) {
|
||||
emit->print(","); // Print comma separator
|
||||
+ if (option_space_after_comma) {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
emit->tagLine();
|
||||
}
|
||||
}
|
||||
@@ -1935,8 +1943,12 @@ void PrintC::emitPrototypeInputs(const FuncProto *proto)
|
||||
else {
|
||||
bool printComma = false;
|
||||
for(int4 i=0;i<sz;++i) {
|
||||
- if (printComma)
|
||||
- emit->print(",");
|
||||
+ if (printComma) {
|
||||
+ emit->print(",");
|
||||
+ if (option_space_after_comma) {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
+ }
|
||||
ProtoParameter *param = proto->getParam(i);
|
||||
if (isSet(hide_thisparam) && param->isThisPointer())
|
||||
continue;
|
||||
@@ -1954,8 +1966,12 @@ void PrintC::emitPrototypeInputs(const FuncProto *proto)
|
||||
}
|
||||
}
|
||||
if (proto->isDotdotdot()) {
|
||||
- if (sz != 0)
|
||||
- emit->print(",");
|
||||
+ if (sz != 0) {
|
||||
+ emit->print(",");
|
||||
+ if (option_space_after_comma) {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
+ }
|
||||
emit->print("...");
|
||||
}
|
||||
}
|
||||
@@ -2351,7 +2367,9 @@ void PrintC::docFunction(const Funcdata *fd)
|
||||
emit->tagLine();
|
||||
emitFunctionDeclaration(fd); // Causes us to enter function's scope
|
||||
emit->tagLine();
|
||||
- emit->tagLine();
|
||||
+ if (option_newline_after_prototype) {
|
||||
+ emit->tagLine();
|
||||
+ }
|
||||
int4 id = emit->startIndent();
|
||||
emit->print("{");
|
||||
emitLocalVarDecls(fd);
|
||||
@@ -2606,7 +2624,11 @@ void PrintC::emitBlockIf(const BlockIf *bl)
|
||||
}
|
||||
|
||||
setMod(no_branch);
|
||||
- emit->spaces(1);
|
||||
+ if (!option_newline_before_opening_brace) {
|
||||
+ emit->spaces(1);
|
||||
+ } else {
|
||||
+ emit->tagLine();
|
||||
+ }
|
||||
int4 id = emit->startIndent();
|
||||
emit->print("{");
|
||||
int4 id1 = emit->beginBlock(bl->getBlock(1));
|
||||
@@ -2616,9 +2638,15 @@ void PrintC::emitBlockIf(const BlockIf *bl)
|
||||
emit->tagLine();
|
||||
emit->print("}");
|
||||
if (bl->getSize()==3) {
|
||||
- emit->tagLine();
|
||||
+ if (option_newline_before_else) {
|
||||
+ emit->tagLine();
|
||||
+ }
|
||||
emit->print("else",EmitXml::keyword_color);
|
||||
- emit->spaces(1);
|
||||
+ if (option_newline_before_else) {
|
||||
+ emit->tagLine();
|
||||
+ } else {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
int4 id = emit->startIndent();
|
||||
emit->print("{");
|
||||
int4 id2 = emit->beginBlock(bl->getBlock(2));
|
||||
@@ -2769,7 +2797,11 @@ void PrintC::emitBlockDoWhile(const BlockDoWhile *bl)
|
||||
emitAnyLabelStatement(bl);
|
||||
emit->tagLine();
|
||||
emit->print("do",EmitXml::keyword_color);
|
||||
- emit->spaces(1);
|
||||
+ if (option_newline_before_opening_brace) {
|
||||
+ emit->tagLine();
|
||||
+ } else {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
int4 id = emit->startIndent();
|
||||
emit->print("{");
|
||||
pushMod();
|
||||
@@ -2801,7 +2833,11 @@ void PrintC::emitBlockInfLoop(const BlockInfLoop *bl)
|
||||
emitAnyLabelStatement(bl);
|
||||
emit->tagLine();
|
||||
emit->print("do",EmitXml::keyword_color);
|
||||
- emit->spaces(1);
|
||||
+ if (option_newline_before_opening_brace) {
|
||||
+ emit->tagLine();
|
||||
+ } else {
|
||||
+ emit->spaces(1);
|
||||
+ }
|
||||
int4 id = emit->startIndent();
|
||||
emit->print("{");
|
||||
int4 id1 = emit->beginBlock(bl->getBlock(0));
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
index 92afe1ee1..f315d7023 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
@@ -119,6 +119,10 @@ protected:
|
||||
bool option_nocasts; ///< Don't print a cast if \b true
|
||||
bool option_unplaced; ///< Set to \b true if we should display unplaced comments
|
||||
bool option_hide_exts; ///< Set to \b true if we should hide implied extension operations
|
||||
+ bool option_space_after_comma;
|
||||
+ bool option_newline_before_else;
|
||||
+ bool option_newline_before_opening_brace;
|
||||
+ bool option_newline_after_prototype;
|
||||
string nullToken; ///< Token to use for 'null'
|
||||
CommentSorter commsorter; ///< Container/organizer for comments in the current function
|
||||
|
||||
@@ -205,6 +209,9 @@ public:
|
||||
void setCPlusPlusStyleComments(void) { setCommentDelimeter("// ","",true); } ///< Set c++-style "//" comment delimiters
|
||||
void setDisplayUnplaced(bool val) { option_unplaced = val; } ///< Toggle whether \e unplaced comments are displayed in the header
|
||||
void setHideImpliedExts(bool val) { option_hide_exts = val; } ///< Toggle whether implied extensions are hidden
|
||||
+ void setSpaceAfterComma(bool val) { option_space_after_comma = val; }
|
||||
+ void setNewlineBeforeOpeningBrace(bool val) { option_newline_before_opening_brace = val; }
|
||||
+ void setNewlineAfterPrototype(bool val) { option_newline_after_prototype = val; }
|
||||
virtual ~PrintC(void) {}
|
||||
virtual void resetDefaults(void);
|
||||
virtual void adjustTypeOperators(void);
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
From 30eade046424dc86966d09d4ec6b26e43640ce89 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Sat, 3 Aug 2019 15:21:59 +0200
|
||||
Subject: [PATCH 09/23] Make some PrintC methods virtual
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
index f315d7023..9301678ee 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
@@ -152,9 +152,9 @@ protected:
|
||||
void emitPrototypeInputs(const FuncProto *proto); ///< Emit the input data-types of a function prototype
|
||||
void emitGlobalVarDeclsRecursive(Scope *scope); ///< Emit variable declarations for all global symbols under given scope
|
||||
void emitLocalVarDecls(const Funcdata *fd); ///< Emit variable declarations for a function
|
||||
- void emitStatement(const PcodeOp *inst); ///< Emit a statement in the body of a function
|
||||
+ virtual void emitStatement(const PcodeOp *inst); ///< Emit a statement in the body of a function
|
||||
bool emitInplaceOp(const PcodeOp *op); ///< Attempt to emit an expression rooted at an \e in-place operator
|
||||
- void emitGotoStatement(const FlowBlock *bl,const FlowBlock *exp_bl,uint4 type);
|
||||
+ virtual void emitGotoStatement(const FlowBlock *bl,const FlowBlock *exp_bl,uint4 type);
|
||||
void emitSwitchCase(int4 casenum,const BlockSwitch *switchbl); ///< Emit labels for a \e case block
|
||||
void emitLabel(const FlowBlock *bl); ///< Emit a formal label for a given control-flow block
|
||||
void emitLabelStatement(const FlowBlock *bl); ///< Emit any required label statement for a given basic block
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
From 87d83f509ba66f1b41bb5306da19d3f04f455d78 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Fri, 23 Aug 2019 18:45:22 +0200
|
||||
Subject: [PATCH 10/23] Add Setter for NL before else
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc | 8 +++++---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh | 1 +
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
index 19acbfaf0..56c37e783 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
@@ -2638,11 +2638,13 @@ void PrintC::emitBlockIf(const BlockIf *bl)
|
||||
emit->tagLine();
|
||||
emit->print("}");
|
||||
if (bl->getSize()==3) {
|
||||
- if (option_newline_before_else) {
|
||||
- emit->tagLine();
|
||||
+ if (option_newline_before_else) {
|
||||
+ emit->tagLine();
|
||||
+ } else {
|
||||
+ emit->spaces(1);
|
||||
}
|
||||
emit->print("else",EmitXml::keyword_color);
|
||||
- if (option_newline_before_else) {
|
||||
+ if (option_newline_before_opening_brace) {
|
||||
emit->tagLine();
|
||||
} else {
|
||||
emit->spaces(1);
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
index 9301678ee..86d4e47d2 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.hh
|
||||
@@ -211,6 +211,7 @@ public:
|
||||
void setHideImpliedExts(bool val) { option_hide_exts = val; } ///< Toggle whether implied extensions are hidden
|
||||
void setSpaceAfterComma(bool val) { option_space_after_comma = val; }
|
||||
void setNewlineBeforeOpeningBrace(bool val) { option_newline_before_opening_brace = val; }
|
||||
+ void setNewlineBeforeElse(bool val) { option_newline_before_else = val; }
|
||||
void setNewlineAfterPrototype(bool val) { option_newline_after_prototype = val; }
|
||||
virtual ~PrintC(void) {}
|
||||
virtual void resetDefaults(void);
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
From 8ae5683e2342ec67c0b4efd2cf2d6913b56e62b8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Sun, 25 Aug 2019 18:23:23 +0200
|
||||
Subject: [PATCH 11/23] Clean Sleigh Descriptions on Shutdown
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
|
||||
index 038bc379e..7cd004b4b 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.cc
|
||||
@@ -467,5 +467,5 @@ void SleighArchitecture::shutdown(void)
|
||||
delete last_sleigh;
|
||||
last_sleigh = (Sleigh *)0;
|
||||
}
|
||||
- // description.clear(); // static vector is destroyed by the normal exit handler
|
||||
+ description.clear();
|
||||
}
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
From ca94da1513658a208f32ccff11ed28ff9a9fafb3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Tue, 12 May 2020 21:17:00 +0200
|
||||
Subject: [PATCH 13/23] Fix Build with G++ 4.9.2
|
||||
|
||||
---
|
||||
.../Decompiler/src/decompile/cpp/float.cc | 32 +++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
|
||||
index 1af9b5d79..9b044d0c1 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/float.cc
|
||||
@@ -19,6 +19,38 @@
|
||||
#include <cmath>
|
||||
#include "address.hh"
|
||||
|
||||
+#if defined(_WINDOWS) && !defined(INFINITY)
|
||||
+
|
||||
+// Some definitions for Windows floating point stuff
|
||||
+#include <cfloat>
|
||||
+
|
||||
+inline int4 signbit(double x) {
|
||||
+ return (((_fpclass(x)& (_FPCLASS_NINF | _FPCLASS_NN
|
||||
+ | _FPCLASS_ND | _FPCLASS_NZ))!=0) ? 1 : 0);
|
||||
+}
|
||||
+
|
||||
+inline int4 isnan(double x) {
|
||||
+ return (((_fpclass(x)& (_FPCLASS_SNAN | _FPCLASS_QNAN))!=0) ? 1 : 0);
|
||||
+}
|
||||
+
|
||||
+inline int4 isinf(double x) {
|
||||
+ int4 classify = _fpclass(x);
|
||||
+ if (classify == _FPCLASS_NINF) return -1;
|
||||
+ if (classify == _FPCLASS_PINF) return 1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define INFINITY HUGE_VAL
|
||||
+#define NAN (INFINITY/INFINITY)
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891
|
||||
+#define isnan std::isnan
|
||||
+#define isinf std::isinf
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
/// Set format for a given encoding size according to IEEE 754 standards
|
||||
/// \param sz is the size of the encoding in bytes
|
||||
FloatFormat::FloatFormat(int4 sz)
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
From 49accbd25688976dc665b8bc7abd8775de2b26ed Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Thu, 11 Jun 2020 21:39:54 +0200
|
||||
Subject: [PATCH 14/23] Fix std::vector oob access in StringManager::saveXml()
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/stringmanage.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/stringmanage.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/stringmanage.cc
|
||||
index 6e60b4f66..60b6d6852 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/stringmanage.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/stringmanage.cc
|
||||
@@ -98,7 +98,7 @@ void StringManager::saveXml(ostream &s) const
|
||||
s << " <bytes";
|
||||
a_v_b(s, "trunc", stringData.isTruncated);
|
||||
s << ">\n" << setfill('0');
|
||||
- for(int4 i=0;stringData.byteData.size();++i) {
|
||||
+ for(uintp i=0;i<stringData.byteData.size();++i) {
|
||||
s << hex << setw(2) << (int4)stringData.byteData[i];
|
||||
if (i%20 == 19)
|
||||
s << "\n ";
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
From 7849991ccefe012792f1fc8cfc56f36772db32c6 Mon Sep 17 00:00:00 2001
|
||||
From: FXTi <[email protected]>
|
||||
Date: Wed, 26 Aug 2020 15:10:30 +0800
|
||||
Subject: [PATCH 16/23] Export two private field to SLEIGH plugin. (#4)
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/context.hh | 2 ++
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
index 3372e5ac5..5920bceb4 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
@@ -89,6 +89,8 @@ private:
|
||||
ConstructState *base_state;
|
||||
int4 alloc; // Number of ConstructState's allocated
|
||||
int4 delayslot; // delayslot depth
|
||||
+protected:
|
||||
+ ConstructState *getBaseState(void) { return base_state; }
|
||||
public:
|
||||
ParserContext(ContextCache *ccache);
|
||||
~ParserContext(void) { if (context != (uintm *)0) delete [] context; }
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
|
||||
index 1a758a488..1e96c2c30 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh.hh
|
||||
@@ -166,6 +166,7 @@ protected:
|
||||
ParserContext *obtainContext(const Address &addr,int4 state) const;
|
||||
void resolve(ParserContext &pos) const; ///< Generate a parse tree suitable for disassembly
|
||||
void resolveHandles(ParserContext &pos) const; ///< Prepare the parse tree for p-code generation
|
||||
+ ContextCache *getContextCache(void) { return cache; }
|
||||
public:
|
||||
Sleigh(LoadImage *ld,ContextDatabase *c_db); ///< Constructor
|
||||
virtual ~Sleigh(void); ///< Destructor
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
From 20caeaccb5e2b85e7c0f519b5f23cddea24b8801 Mon Sep 17 00:00:00 2001
|
||||
From: Anton Kochkov <[email protected]>
|
||||
Date: Tue, 22 Dec 2020 17:28:02 +0800
|
||||
Subject: [PATCH 18/23] Add FreeBSD and OpenBSD support (#6)
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/types.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/types.h b/Ghidra/Features/Decompiler/src/decompile/cpp/types.h
|
||||
index ff6f423ab..6d5b6acb2 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/types.h
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/types.h
|
||||
@@ -71,7 +71,7 @@ typedef char int1;
|
||||
typedef uint8 uintp;
|
||||
#endif
|
||||
|
||||
-#if defined (__linux__) && (defined (__i386__) || defined (__arm__))
|
||||
+#if (defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__)) && (defined (__i386__) || defined (__arm__))
|
||||
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define HOST_ENDIAN 1
|
||||
#else
|
||||
@@ -90,7 +90,7 @@ typedef char int1;
|
||||
typedef uint4 uintp;
|
||||
#endif
|
||||
|
||||
-#if defined (__linux__) && (defined (__x86_64__) || defined (__aarch64__))
|
||||
+#if (defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__)) && (defined (__x86_64__) || defined (__aarch64__))
|
||||
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define HOST_ENDIAN 1
|
||||
#else
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
From 8e5f8c4f5902e5874468181687fd64580eeb3119 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Sun, 14 Mar 2021 22:20:31 +0100
|
||||
Subject: [PATCH 21/23] Fail gently in PrintC when a Basic Block gives an
|
||||
invalid Address
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
index 56c37e783..07461326a 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
@@ -2904,6 +2904,10 @@ void PrintC::emitLabel(const FlowBlock *bl)
|
||||
if (bl == (FlowBlock *)0) return;
|
||||
BlockBasic *bb = (BlockBasic *)bl->subBlock(0);
|
||||
Address addr = bb->getEntryAddr();
|
||||
+ if (addr.isInvalid()) {
|
||||
+ emit->print("INVALID_ADDRESS");
|
||||
+ return;
|
||||
+ }
|
||||
const AddrSpace *spc = addr.getSpace();
|
||||
uintb off = addr.getOffset();
|
||||
if (!bb->hasSpecialLabel()) {
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
From bfa4d25c3154306fe03b853efec84bbc9d19c518 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Thu, 25 Jul 2019 19:00:44 +0200
|
||||
Subject: [PATCH 08/23] Make Commas less ugly
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
index c7e290fe8..19acbfaf0 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/printc.cc
|
||||
@@ -52,7 +52,7 @@ OpToken PrintC::boolean_and = { "&&", 2, 22, false, OpToken::binary, 1, 0, (OpTo
|
||||
OpToken PrintC::boolean_xor = { "^^", 2, 20, false, OpToken::binary, 1, 0, (OpToken *)0 };
|
||||
OpToken PrintC::boolean_or = { "||", 2, 18, false, OpToken::binary, 1, 0, (OpToken *)0 };
|
||||
OpToken PrintC::assignment = { "=", 2, 14, false, OpToken::binary, 1, 5, (OpToken *)0 };
|
||||
-OpToken PrintC::comma = { ",", 2, 2, true, OpToken::binary, 0, 0, (OpToken *)0 };
|
||||
+OpToken PrintC::comma = { ", ", 2, 2, true, OpToken::binary, 0, 0, (OpToken *)0 };
|
||||
OpToken PrintC::new_op = { "", 2, 62, false, OpToken::space, 1, 0, (OpToken *)0 };
|
||||
|
||||
// Inplace assignment operators
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
From c16edaf929f9087bb457a3e76e067cac9772d67b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Florian=20M=C3=A4rkl?= <[email protected]>
|
||||
Date: Sun, 25 Aug 2019 21:20:48 +0200
|
||||
Subject: [PATCH 12/23] Make SleighArchitecture Langs public
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh
|
||||
index 01d41fe07..7a902c5b0 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/sleigh_arch.hh
|
||||
@@ -98,7 +98,6 @@ class SleighArchitecture : public Architecture {
|
||||
protected:
|
||||
ostream *errorstream; ///< Error stream associated with \b this SleighArchitecture
|
||||
// buildLoader must be filled in by derived class
|
||||
- static void collectSpecFiles(ostream &errs); ///< Gather specification files in normal locations
|
||||
virtual Translate *buildTranslator(DocumentStorage &store);
|
||||
virtual PcodeInjectLibrary *buildPcodeInjectLibrary(void);
|
||||
virtual void buildSpecFile(DocumentStorage &store);
|
||||
@@ -113,7 +112,9 @@ public:
|
||||
virtual void printMessage(const string &message) const { *errorstream << message << endl; }
|
||||
virtual ~SleighArchitecture(void);
|
||||
virtual string getDescription(void) const;
|
||||
-
|
||||
+
|
||||
+ static void collectSpecFiles(ostream &errs); ///< Gather specification files in normal locations
|
||||
+ static const vector<LanguageDescription> &getLanguageDescriptions() { return description; }
|
||||
static string normalizeProcessor(const string &nm); ///< Try to recover a \e language \e id processor field
|
||||
static string normalizeEndian(const string &nm); ///< Try to recover a \e language \e id endianess field
|
||||
static string normalizeSize(const string &nm); ///< Try to recover a \e language \e id size field
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
From 815e71870e67c29187a20ee2563a11c09acb5a93 Mon Sep 17 00:00:00 2001
|
||||
From: FXTi <[email protected]>
|
||||
Date: Wed, 26 Aug 2020 22:37:55 +0800
|
||||
Subject: [PATCH 17/23] Make getBaseState return a pointer (#5)
|
||||
|
||||
---
|
||||
Ghidra/Features/Decompiler/src/decompile/cpp/context.hh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
index 5920bceb4..5d2e108f7 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/context.hh
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
int4 alloc; // Number of ConstructState's allocated
|
||||
int4 delayslot; // delayslot depth
|
||||
protected:
|
||||
- ConstructState *getBaseState(void) { return base_state; }
|
||||
+ ConstructState **getBaseState(void) { return &base_state; }
|
||||
public:
|
||||
ParserContext(ContextCache *ccache);
|
||||
~ParserContext(void) { if (context != (uintm *)0) delete [] context; }
|
||||
--
|
||||
2.24.3 (Apple Git-128)
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# Copied from Rizin
|
||||
project('zlib', 'c',
|
||||
version : '1.3.1',
|
||||
license : 'zlib',
|
||||
meson_version: '>=0.55.0',
|
||||
)
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
if cc.has_argument('--std=c99')
|
||||
add_project_arguments('--std=c99', language: ['c'])
|
||||
endif
|
||||
|
||||
link_args = []
|
||||
compile_args = []
|
||||
if cc.get_argument_syntax() == 'msvc'
|
||||
add_project_arguments(
|
||||
'-D_CRT_SECURE_NO_DEPRECATE',
|
||||
'-D_CRT_NONSTDC_NO_DEPRECATE',
|
||||
language : 'c')
|
||||
elif cc.get_argument_syntax() == 'gcc'
|
||||
# Don't spam consumers of this wrap with these warnings
|
||||
compile_args += cc.get_supported_arguments('-Wno-implicit-fallthrough')
|
||||
if host_machine.system() not in ['windows', 'darwin']
|
||||
link_args += '-Wl,--version-script,@0@/zlib.map'.format(meson.current_source_dir())
|
||||
endif
|
||||
endif
|
||||
|
||||
if cc.has_header('unistd.h')
|
||||
compile_args += '-DHAVE_UNISTD_H'
|
||||
endif
|
||||
|
||||
if cc.has_header('stdarg.h')
|
||||
compile_args += '-DHAVE_STDARG_H'
|
||||
endif
|
||||
|
||||
src = files([
|
||||
'adler32.c',
|
||||
'crc32.c',
|
||||
'deflate.c',
|
||||
'infback.c',
|
||||
'inffast.c',
|
||||
'inflate.c',
|
||||
'inftrees.c',
|
||||
'trees.c',
|
||||
'zutil.c',
|
||||
'compress.c',
|
||||
'uncompr.c',
|
||||
'gzclose.c',
|
||||
'gzlib.c',
|
||||
'gzread.c',
|
||||
'gzwrite.c'])
|
||||
|
||||
headers = files(['zconf.h', 'zlib.h'])
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
win = import('windows')
|
||||
win_args = []
|
||||
if cc.get_id() != 'msvc'
|
||||
win_args += '-DGCC_WINDRES'
|
||||
endif
|
||||
src += win.compile_resources('win32/zlib1.rc', args : win_args)
|
||||
endif
|
||||
|
||||
zlib = library('z', src,
|
||||
c_args : compile_args,
|
||||
link_args : link_args,
|
||||
vs_module_defs : 'win32/zlib.def',
|
||||
install : false)
|
||||
|
||||
incdir = include_directories('.')
|
||||
|
||||
zlib_dep = declare_dependency(
|
||||
link_with : zlib,
|
||||
include_directories : incdir)
|
||||
@@ -0,0 +1,19 @@
|
||||
# This file is autogenerated by acr-wrap
|
||||
|
||||
WRAP_wrap_git_url:=https://github.com/madler/zlib
|
||||
WRAP_wrap_git_revision:=51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
|
||||
WRAP_wrap_git_directory:=zlib
|
||||
WRAP_wrap_git_patch_directory:=zlib
|
||||
WRAP_wrap_git_depth:=1
|
||||
|
||||
zlib_all: zlib
|
||||
@echo "Nothing to do"
|
||||
|
||||
zlib:
|
||||
git clone --no-checkout --depth=1 https://github.com/madler/zlib zlib
|
||||
cd zlib && git fetch --depth=1 origin 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
|
||||
cd zlib && git checkout FETCH_HEAD
|
||||
cp -rf packagefiles/zlib/* zlib
|
||||
|
||||
zlib_clean:
|
||||
rm -rf zlib
|
||||
@@ -0,0 +1,6 @@
|
||||
[wrap-git]
|
||||
url = https://github.com/madler/zlib
|
||||
revision = 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
|
||||
directory = zlib
|
||||
patch_directory = zlib
|
||||
depth = 1
|
||||
Reference in new issue
Block a user