Skip to content
This repository was archived by the owner on Aug 23, 2022. It is now read-only.

Commit 5dec010

Browse files
author
Peter Goodman
authored
Disable building any 32-bit runtimes. (#712)
1 parent 21970a5 commit 5dec010

File tree

1 file changed

+0
-105
lines changed

1 file changed

+0
-105
lines changed

mcsema/Arch/X86/Runtime/CMakeLists.txt

-105
Original file line numberDiff line numberDiff line change
@@ -37,91 +37,9 @@ elseif(APPLE)
3737

3838
else()
3939
# Create the runtimes
40-
# 32-bit binaries work on both 32 and 64 bit platforms
4140

42-
set(MCSMEMA_RT32 mcsema_rt32-${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION})
4341
set(MCSMEMA_RT64 mcsema_rt64-${LLVM_MAJOR_VERSION}.${LLVM_MINOR_VERSION})
4442

45-
if(WIN32)
46-
add_executable(mcsema-print-runtime-x86
47-
print_PE_32_windows.cpp
48-
)
49-
50-
# this is going to import the public include headers of remill
51-
target_link_libraries(mcsema-print-runtime-x86 PRIVATE remill)
52-
target_include_directories(mcsema-print-runtime-x86 PRIVATE
53-
"${REMILL_INCLUDE_LOCATION}" "${MCSEMA_SOURCE_DIR}"
54-
)
55-
56-
# build a static library from this generated object
57-
add_library(${MCSMEMA_RT32} STATIC ${MCSMEMA_RT32}.obj runtime_32.o)
58-
set_target_properties(${MCSMEMA_RT32} PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x86")
59-
60-
# add_library does not know how to link this thing together from an obj
61-
# tell cmake its just like C (the same command line will work for the object)
62-
set_target_properties(
63-
${MCSMEMA_RT32}
64-
PROPERTIES
65-
LINKER_LANGUAGE C
66-
)
67-
68-
# use a custom step to build asm->obj since cmake wont recognize how to build our asm
69-
add_custom_command(
70-
OUTPUT ${MCSMEMA_RT32}.obj
71-
COMMAND "${CMAKE_C_COMPILER}" -m32 /Fo${MCSMEMA_RT32}.obj /c runtime_32.asm
72-
DEPENDS runtime_32.asm
73-
COMMENT "Building Runtime ASM..."
74-
)
75-
76-
set_source_files_properties(
77-
${MCSMEMA_RT32}.obj
78-
PROPERTIES
79-
EXTERNAL_OBJECT True
80-
GENERATED True
81-
)
82-
83-
add_custom_command(
84-
OUTPUT runtime_32.asm
85-
COMMAND mcsema-print-runtime-x86
86-
DEPENDS mcsema-print-runtime-x86
87-
COMMENT "Generating 32-bit Windows PE runtime..."
88-
)
89-
90-
elseif(UNIX)
91-
# Linux and friends
92-
add_compile_options(-Wno-invalid-offsetof)
93-
94-
add_executable(mcsema-print-runtime-x86
95-
print_ELF_32_linux.cpp
96-
)
97-
98-
# this is going to import the public include headers of remill
99-
target_link_libraries(mcsema-print-runtime-x86 PRIVATE remill)
100-
target_include_directories(mcsema-print-runtime-x86 PRIVATE
101-
"${REMILL_INCLUDE_LOCATION}" "${MCSEMA_SOURCE_DIR}"
102-
)
103-
104-
add_library(${MCSMEMA_RT32} STATIC runtime_32.S runtime_32.o)
105-
set_target_properties(${MCSMEMA_RT32}
106-
PROPERTIES COMPILE_FLAGS "-m32 -fPIC" LINK_FLAGS "-m32 -fPIC"
107-
)
108-
109-
add_custom_command(
110-
OUTPUT runtime_32.S
111-
COMMAND mcsema-print-runtime-x86
112-
DEPENDS mcsema-print-runtime-x86
113-
COMMENT "Generating 32-bit Linux ELF runtime..."
114-
)
115-
116-
else()
117-
message(ERROR "Unsupported operating system")
118-
endif()
119-
120-
install(
121-
TARGETS ${MCSMEMA_RT32}
122-
ARCHIVE DESTINATION "${install_folder}/lib"
123-
)
124-
12543
# only do 64-bit binaries on 64-bit platforms
12644
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
12745
if(WIN32)
@@ -216,21 +134,6 @@ if(DEFINED REMILL_SOURCE_DIR)
216134
set(REMILL_SOURCE "-I${REMILL_SOURCE_DIR}")
217135
endif()
218136

219-
# Create a runtime.
220-
add_custom_command(
221-
OUTPUT runtime_32.o
222-
COMMAND "${CMAKE_CXX_COMPILER}" -std=gnu++11 "${REMILL_INCLUDE}" "${REMILL_SOURCE}" "${REMILL_SOURCE_DIR}" -I"${MCSEMA_SOURCE_DIR}" -m32 -fPIC -c "${CMAKE_CURRENT_SOURCE_DIR}/Runtime.cpp" -o runtime_32.o
223-
DEPENDS Runtime.cpp
224-
COMMENT "Building 32-bit runtime"
225-
)
226-
227-
set_source_files_properties(
228-
runtime_32.o
229-
PROPERTIES
230-
EXTERNAL_OBJECT True
231-
GENERATED True
232-
)
233-
234137
# only do 64-bit binaries on 64-bit platforms
235138
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
236139
add_custom_command(
@@ -248,14 +151,6 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
248151
)
249152
endif()
250153

251-
add_runtime(runtime_x86
252-
SOURCES "Runtime.cpp"
253-
ADDRESS_SIZE 32
254-
BCFLAGS "-xc++" "-m32" "-std=gnu++17" "-Wno-deprecated-declarations"
255-
INCLUDEDIRECTORIES "${CMAKE_SOURCE_DIR}" "${MCSEMA_SOURCE_DIR}" "${REMILL_INCLUDE_LOCATION}"
256-
INSTALLDESTINATION "${install_folder}/lib"
257-
)
258-
259154
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
260155
add_runtime(runtime_amd64
261156
SOURCES "Runtime.cpp"

0 commit comments

Comments
 (0)