Fix linking with static lib
This commit is contained in:
parent
0d92da5d7e
commit
97b1d8744c
13
configure
vendored
13
configure
vendored
@ -836,6 +836,7 @@ fi
|
||||
|
||||
werror=""
|
||||
as_shared_lib="no"
|
||||
as_static_lib="no"
|
||||
|
||||
for opt do
|
||||
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
|
||||
@ -1584,8 +1585,13 @@ for opt do
|
||||
;;
|
||||
--as-shared-lib)
|
||||
as_shared_lib="yes"
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS -fPIC -DAS_SHARED_LIB=1"
|
||||
QEMU_CXXFLAGS="$QEMU_CXXFLAGS -fPIC -DAS_SHARED_LIB=1"
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS -fPIC -DAS_LIB=1"
|
||||
QEMU_CXXFLAGS="$QEMU_CXXFLAGS -fPIC -DAS_LIB=1"
|
||||
;;
|
||||
--as-static-lib)
|
||||
as_static_lib="yes"
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS -fPIC -DAS_LIB=1"
|
||||
QEMU_CXXFLAGS="$QEMU_CXXFLAGS -fPIC -DAS_LIB=1"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown option $opt"
|
||||
@ -4927,6 +4933,9 @@ fi
|
||||
if test "$as_shared_lib" = "yes" ; then
|
||||
echo "AS_SHARED_LIB=y" >> $config_host_mak
|
||||
fi
|
||||
if test "$as_static_lib" = "yes" ; then
|
||||
echo "AS_STATIC_LIB=y" >> $config_host_mak
|
||||
fi
|
||||
|
||||
echo "ROMS=$roms" >> $config_host_mak
|
||||
echo "MAKE=$make" >> $config_host_mak
|
||||
|
@ -654,7 +654,7 @@ int libafl_qemu_run(void)
|
||||
|
||||
//// --- End LibAFL code ---
|
||||
|
||||
#ifdef AS_SHARED_LIB
|
||||
#ifdef AS_LIB
|
||||
int qemu_user_init(int argc, char **argv, char **envp);
|
||||
__attribute__((section(".init_array"))) void *_qemu_user_init_ctr = &qemu_user_init;
|
||||
|
||||
|
28
meson.build
28
meson.build
@ -2656,16 +2656,7 @@ foreach target : target_dirs
|
||||
exe_name += '-unsigned'
|
||||
endif
|
||||
|
||||
if 'AS_SHARED_LIB' in config_host
|
||||
emulator = shared_library(exe_name, exe['sources'],
|
||||
install: true,
|
||||
c_args: c_args,
|
||||
dependencies: arch_deps + deps + exe['dependencies'],
|
||||
objects: lib.extract_all_objects(recursive: true),
|
||||
link_language: link_language,
|
||||
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
|
||||
link_args: link_args)
|
||||
else
|
||||
if 'AS_SHARED_LIB' not in config_host and 'AS_STATIC_LIB' not in config_host
|
||||
emulator = executable(exe_name, exe['sources'],
|
||||
install: true,
|
||||
c_args: c_args,
|
||||
@ -2675,6 +2666,23 @@ foreach target : target_dirs
|
||||
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
|
||||
link_args: link_args,
|
||||
gui_app: exe['gui'])
|
||||
else
|
||||
if 'AS_SHARED_LIB' in config_host
|
||||
emulator = shared_library(exe_name, exe['sources'],
|
||||
install: true,
|
||||
c_args: c_args,
|
||||
dependencies: arch_deps + deps + exe['dependencies'],
|
||||
objects: lib.extract_all_objects(recursive: true),
|
||||
link_language: link_language,
|
||||
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
|
||||
link_args: link_args)
|
||||
endif
|
||||
if 'AS_STATIC_LIB' in config_host
|
||||
emulator = static_library(exe_name, exe['sources'],
|
||||
c_args: c_args,
|
||||
dependencies: arch_deps + deps + exe['dependencies'],
|
||||
objects: lib.extract_all_objects(recursive: true))
|
||||
endif
|
||||
endif
|
||||
|
||||
if targetos == 'darwin'
|
||||
|
Loading…
x
Reference in New Issue
Block a user