Skip to content

Commit e5e8db4

Browse files
committed
Fix cutter build by enforcing exclude-libs,ALL
1 parent efeea7d commit e5e8db4

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

c/jsdec-cutter.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ static RzAnnotatedCode *parse_json(RzStrBuf *sb) {
319319
return code;
320320
}
321321

322-
RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr) {
322+
RZ_API RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr) {
323323
ExecContext ectx;
324324
ectx.core = core;
325325
ectx.anno = rz_strbuf_new("");

cutter-plugin/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ add_library(jsdec_cutter MODULE
1717
JSDecDecompiler.cpp
1818
)
1919

20+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
21+
2022
find_library(libjsdec NAMES jsdec PATHS "${JSDEC_BUILD_DIR}")
21-
include_directories("../c")
23+
include_directories("../include")
2224

2325
find_package(Cutter REQUIRED)
2426

cutter-plugin/JSDecDecompiler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <QJsonObject>
99
#include <QJsonArray>
1010

11-
#include "../c/jsdec-cutter.h"
11+
#include "jsdec-cutter.h"
1212

1313
JSDecDecompiler::JSDecDecompiler(QObject *parent)
1414
: Decompiler("jsdec", "jsdec", parent) {

c/jsdec-cutter.h include/jsdec-cutter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extern "C" {
1010

1111
#include <rz_util/rz_annotated_code.h>
1212

13-
RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr);
13+
RZ_API RzAnnotatedCode *jsdec_as_annotation(RzCore *core, ut64 addr);
1414

1515
#ifdef __cplusplus
1616
}

meson.build

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ project('jsdec', 'c', meson_version: '>=0.56.0',
1111

1212
cc = meson.get_compiler('c')
1313

14-
jsdec_incs = ['.', 'c']
14+
jsdec_incs = ['.', 'c', 'include']
1515
jsdec_c_args = []
1616
jsdec_src = [
1717
'c' / 'jsdec.c',
@@ -67,6 +67,7 @@ if build_type == 'standalone'
6767
install: false,
6868
)
6969
elif build_type == 'cutter'
70+
jsdec_deps = [ libquickjs_dep.as_link_whole() ]
7071
jsdec_deps += dependency('rz_core')
7172
jsdec_deps += dependency('rz_util')
7273
jsdec_deps += dependency('rz_cons')
@@ -79,6 +80,13 @@ elif build_type == 'cutter'
7980
'c' / 'jsdec-cutter.c'
8081
]
8182

83+
if cc.has_argument('-fvisibility=hidden')
84+
jsdec_c_args += '-fvisibility=hidden'
85+
endif
86+
if cc.has_argument('-flto')
87+
jsdec_c_args += '-flto'
88+
endif
89+
8290
libjsdec = static_library('jsdec', jsdec_src,
8391
c_args : jsdec_c_args,
8492
dependencies: jsdec_deps,
@@ -90,7 +98,7 @@ elif build_type == 'cutter'
9098
)
9199
libjsdec_dep = declare_dependency(
92100
link_with: libjsdec,
93-
include_directories: include_directories(jsdec_incs),
101+
include_directories: include_directories(['include']),
94102
)
95103
elif build_type == 'rizin'
96104
# build plugin for Rizin

0 commit comments

Comments
 (0)