Fix Building

This commit is contained in:
Thomas A. 2024-10-29 22:16:39 -07:00
parent d5775f40ce
commit 2ca1da9bc7
3 changed files with 82 additions and 58 deletions

View File

@ -47,11 +47,13 @@ set(ar_sources
move.c
print.c
replace.c
../libstuff/unix_standard_mode.c
../libstuff/execute.c
../libstuff/port.c
../libstuff/fatals.c
../libstuff/allocate.c
../libstuff/diagnostics.c
../libstuff/execute.c
../libstuff/fatals.c
../libstuff/port.c
../libstuff/unix_standard_mode.c
)
add_executable(${APPLE_TARGET_TRIPLET_PRIMARY}-ar ${ar_sources})

View File

@ -6,9 +6,9 @@ endif()
add_definitions(-DHAVE_BCMP=1 -DHAVE_BZERO=1 -DHAVE_BCOPY=1 -DHAVE_INDEX=1 -DHAVE_RINDEX=1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-everything")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fblocks -Wno-everything")
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")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fblocks -std=c++20 -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")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../include/foreign)
@ -18,6 +18,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rd)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rd/BlocksRuntime)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rd/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/abstraction)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/mach_o)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_definitions(-U__APPLE__
@ -43,50 +44,68 @@ elseif (TARGET_ARM64)
endif(TARGET_x86_64 OR TARGET_i386)
set(ld64_sources
./ld/InputFiles.cpp
./ld/OutputFile.cpp
./ld/SymbolTable.cpp
./ld/code-sign-blobs/blob.cpp
./ld/parsers/lto_file.cpp
./ld/parsers/opaque_section_file.cpp
./ld/parsers/macho_relocatable_file.cpp
./ld/parsers/macho_dylib_file.cpp
./ld/parsers/textstub_dylib_file.cpp
./ld/parsers/archive_file.cpp
./ld/Options.cpp
./ld/Resolver.cpp
./ld/ld.cpp
./ld/Snapshot.cpp
./ld/passes/branch_island.cpp
./ld/passes/compact_unwind.cpp
./ld/passes/code_dedup.cpp
./ld/passes/got.cpp
ld/passes/inits.cpp
ld/passes/thread_starts.cpp
./ld/passes/tlvp.cpp
./ld/passes/branch_shim.cpp
./ld/passes/dtrace_dof.cpp
./ld/passes/order.cpp
./ld/passes/dylibs.cpp
./ld/passes/stubs/stubs.cpp
./ld/passes/huge.cpp
./ld/passes/bitcode_bundle.cpp
./ld/passes/objc.cpp
ld/PlatformSupport.cpp
./3rd/md5.c
./3rd/strlcat.c
./3rd/BlocksRuntime/runtime.c
./3rd/BlocksRuntime/data.c
./3rd/helper.c
./3rd/strlcpy.c
./3rd/qsort_r.c
./3rd/eprintf.c
3rd/eprintf.c
3rd/helper.c
3rd/md5.c
3rd/mkpath_np.c
./ld/debugline.c
3rd/qsort_r.c
3rd/reallocf.c
3rd/sha1.c
3rd/sha256.c
3rd/strlcat.c
3rd/strlcpy.c
ld/FatFile.cpp
ld/InputFiles.cpp
ld/Mangling.cpp
ld/Options.cpp
ld/OutputFile.cpp
ld/PlatformSupport.cpp
ld/Resolver.cpp
ld/ResponseFiles.cpp
ld/Snapshot.cpp
ld/SymbolTable.cpp
ld/code-sign-blobs/blob.cpp
ld/debugline.c
ld/ld.cpp
ld/libcodedirectory.c
ld/parsers/archive_file.cpp
ld/parsers/generic_dylib_file.cpp
ld/parsers/lto_file.cpp
ld/parsers/macho_dylib_file.cpp
ld/parsers/macho_relocatable_file.cpp
ld/parsers/opaque_section_file.cpp
ld/parsers/textstub_dylib_file.cpp
ld/passes/bitcode_bundle.cpp
ld/passes/branch_island.cpp
ld/passes/branch_shim.cpp
ld/passes/code_dedup.cpp
ld/passes/compact_unwind.cpp
ld/passes/dtrace_dof.cpp
ld/passes/dylibs.cpp
ld/passes/got.cpp
ld/passes/huge.cpp
ld/passes/inits.cpp
ld/passes/objc.cpp
ld/passes/objc_constants.cpp
ld/passes/objc_stubs.cpp
ld/passes/order.cpp
ld/passes/stubs/stubs.cpp
ld/passes/thread_starts.cpp
ld/passes/tlvp.cpp
mach_o/Error.cpp
mach_o/ExportsTrie.cpp
# other/ObjectDump.cpp
# other/PruneTrie.cpp
# other/machochecker.cpp
# other/objcimageinfo.cpp
# other/unwinddump.cpp
)
add_executable(${APPLE_TARGET_TRIPLET_PRIMARY}-ld ${ld64_sources})
target_link_libraries(${APPLE_TARGET_TRIPLET_PRIMARY}-ld -lpthread -ldl)
target_link_libraries(${APPLE_TARGET_TRIPLET_PRIMARY}-ld -lpthread -ldl -ldispatch -lBlocksRuntime)
# musl libc systems need libexecinfo
find_library(EXECINFO

View File

@ -40,26 +40,29 @@ elseif (TARGET_ARM64)
endif(TARGET_x86_64 OR TARGET_i386)
add_library(stuff OBJECT
../libstuff/fatals.c
../libstuff/bytesex.c
../libstuff/align.c
../libstuff/allocate.c
../libstuff/errors.c
../libstuff/apple_version.c
../libstuff/arch.c
../libstuff/arch_usage.c
../libstuff/port.c
../libstuff/apple_version.c
../libstuff/args.c
../libstuff/bytesex.c
../libstuff/depinfo.c
../libstuff/diagnostics.c
../libstuff/errors.c
../libstuff/execute.c
../libstuff/rnd.c
../libstuff/fatals.c
../libstuff/get_arch_from_host.c
../libstuff/get_toc_byte_sex.c
../libstuff/ofile.c
../libstuff/ofile_error.c
../libstuff/port.c
../libstuff/print.c
../libstuff/rnd.c
../libstuff/set_arch_flag_name.c
../libstuff/swap_headers.c
../libstuff/unix_standard_mode.c
../libstuff/version_number.c
../libstuff/print.c
../libstuff/swap_headers.c
../libstuff/get_arch_from_host.c
../libstuff/set_arch_flag_name.c
../libstuff/get_toc_byte_sex.c
../libstuff/args.c
../libstuff/write64.c
)