Skip to content

Commit

Permalink
cctools/ld64: Add ARM64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
CuriousTommy committed Apr 18, 2020
1 parent eb9ad97 commit 9b9ef9c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions cctools/ld64/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
project(ld64)

if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "aarch64")
add_compile_definitions(__arm64__)
endif()

add_definitions(-DHAVE_BCMP=1 -DHAVE_BZERO=1 -DHAVE_BCOPY=1 -DHAVE_INDEX=1 -DHAVE_RINDEX=1)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fblocks -std=c++11 -Wno-long-long -Wno-import -Wno-format -Wno-deprecated -Wno-unused-variable -Wno-unused-private-field -Wno-unused-function -Wno-invalid-offsetof -Wno-int-conversion -Wno-char-subscripts -Wno-shift-negative-value")
Expand All @@ -15,8 +19,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/abstraction)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_definitions(-U__APPLE__
-DEMULATED_HOST_CPU_TYPE=16777223
-DEMULATED_HOST_CPU_SUBTYPE=3
-D__STDC_LIMIT_MACROS=1
-D__STDC_CONSTANT_MACROS=1
-DHAVE_EXECINFO_H=1
Expand All @@ -25,6 +27,19 @@ add_definitions(-U__APPLE__
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
-Du_short=uint16_t)

# i386 has a different CPU type/subtype, but Darling only supports x86_64
if (TARGET_x86_64 OR TARGET_i386)
add_definitions(
-DEMULATED_HOST_CPU_TYPE=16777223
-DEMULATED_HOST_CPU_SUBTYPE=3
)
elseif (TARGET_ARM64)
add_definitions(
-DEMULATED_HOST_CPU_TYPE=16777228
-DEMULATED_HOST_CPU_SUBTYPE=0
)
endif(TARGET_x86_64 OR TARGET_i386)

set(ld64_sources
./ld/InputFiles.cpp
./ld/OutputFile.cpp
Expand Down

0 comments on commit 9b9ef9c

Please sign in to comment.