Skip to content

Commit

Permalink
Fixes to build under arm32 ( raspberry pi on 32bit debian). (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosepMaJAZ authored Jun 22, 2024
1 parent 49525fc commit e1fba7a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ if(${PCEM_CPU_TYPE} STREQUAL "i386")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
endif()

set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing")
if(${PCEM_CPU_TYPE} MATCHES "arm.*")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -fno-strict-aliasing")
else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer -mstackrealign -fno-strict-aliasing")
endif()

if (UNIX)
add_definitions(-D_FILE_OFFSET_BITS=64)
Expand Down
9 changes: 8 additions & 1 deletion cmake/arch-detect.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
#if defined(__ARM_ARCH_7__) \\
#if defined(__ARM_ARCH_8__) \\
|| defined(__ARM_ARCH_8A__) \\
|| (defined(__ARM_ARCH) && __ARM_ARCH >= 8) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 8)
#error cmake_ARCH armv8
#elif defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__ARM_ARCH) && __ARM_ARCH >= 7) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
Expand All @@ -13,6 +19,7 @@ set(archdetect_c_code "
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__ARM_ARCH) && __ARM_ARCH >= 6) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
Expand Down
16 changes: 7 additions & 9 deletions src/codegen/codegen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,17 @@ if(${PCEM_CPU_TYPE} STREQUAL "i386")
)
endif()

if(${PCEM_CPU_TYPE} STREQUAL "arm")
set(PCEM_SRC ${PCEM_SRC}
codegen/arm32/codegen_backend_arm.c
codegen/arm32/codegen_backend_arm_ops.c
codegen/arm32/codegen_backend_arm_uops.c
)
endif()

if(${PCEM_CPU_TYPE} STREQUAL "arm64")
set(PCEM_SRC ${PCEM_SRC}
codegen/arm64/codegen_backend_arm64.c
codegen/arm64/codegen_backend_arm64_imm.c
codegen/arm64/codegen_backend_arm64_ops.c
codegen/arm64/codegen_backend_arm64_uops.c
)
endif()
elseif(${PCEM_CPU_TYPE} MATCHES "armv.*")
set(PCEM_SRC ${PCEM_SRC}
codegen/arm32/codegen_backend_arm.c
codegen/arm32/codegen_backend_arm_ops.c
codegen/arm32/codegen_backend_arm_uops.c
)
endif()

0 comments on commit e1fba7a

Please sign in to comment.