Skip to content

Commit 23e05ca

Browse files
committed
feat: disable mingw useless exports
1 parent d358170 commit 23e05ca

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

c/meterpreter/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ID := $(shell id -u)
22
DOCKER_CONTAINER=rapid7/msf-ubuntu-x64-meterpreter:latest
3-
COMMON_GEN=-Wno-dev -DUSE_STATIC_MSVC_RUNTIMES=ON
3+
COMMON_GEN=-Wno-dev -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--strip-all,--build-id=none,--no-insert-timestamp,--exclude-all-symbols" -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--strip-all,--build-id=none,--no-insert-timestamp,--exclude-all-symbols" -DUSE_STATIC_MSVC_RUNTIMES=ON
44
COMMON_GEN_X86=-DCMAKE_TOOLCHAIN_FILE=../toolsets/i686-w64-mingw32.cmake -DBUILD_ARCH=Win32 ${COMMON_GEN}
55
COMMON_GEN_X64=-DCMAKE_TOOLCHAIN_FILE=../toolsets/x86_64-w64-mingw32.cmake -DBUILD_ARCH=x64 ${COMMON_GEN}
66
COMMON_BUILD=--config Release

c/meterpreter/workspace/metsrv/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME}.${T
3434
if(MSVC)
3535
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/DEF:\"${MOD_DEF_DIR}/metsrv.def\"")
3636
set_source_files_properties(${MOD_DEF_DIR}/metsrv.def PROPERTIES HEADER_FILE_ONLY TRUE)
37+
else()
38+
# Prevent MinGW from auto-exporting symbols.
39+
# With metsrv.def present this yields a single explicit export; without it, zero exports.
40+
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,--exclude-all-symbols")
3741
endif()
3842

3943
set(LINK_LIBS advapi32 winhttp wininet crypt32)

0 commit comments

Comments
 (0)