Randy Eckenrode 2026-05-07 18:16:31 -04:00
commit ad15de5dbd
No known key found for this signature in database
GPG key ID: 64C1CD4EC2A600D9
3 changed files with 175 additions and 29 deletions

View file

@ -9,6 +9,7 @@ project(
version : '@version@'
)
add_project_arguments(
'-DLD_VERSION=@version@',
# Prevent build failures due to these targets not being defined
'-DTARGET_OS_BRIDGE=0',
'-DTARGET_OS_EXCLAVEKIT=0',
@ -63,6 +64,32 @@ corecrypto_dep = declare_dependency(
link_with : corecrypto,
)
common = static_library(
'common',
dependencies : [ corecrypto_dep ],
include_directories : [
common_inc,
'cache_builder',
'lsl',
'other-tools',
],
sources : [
'common/CRC32c.cpp',
'common/CachePatching.cpp',
'common/Diagnostics.cpp',
'common/DyldSharedCache.cpp',
'common/MachOFile.cpp',
'common/MachOLayout.cpp',
'common/MachOLoaded.cpp',
'common/TargetPolicy.cpp',
'common/Utilities.cpp',
],
)
common_dep = declare_dependency(
include_directories : [ 'common' ],
link_with : common,
)
lsl = static_library(
'lsl',
cpp_args : [
@ -77,7 +104,6 @@ lsl = static_library(
],
sources : [
'lsl/Allocator.cpp',
'lsl/CRC32c.cpp',
'lsl/PVLEInt64.cpp',
],
)
@ -107,7 +133,7 @@ libmach_o = static_library(
'mach_o/FunctionStarts.cpp',
'mach_o/FunctionVariants.cpp',
'mach_o/GradedArchitectures.cpp',
'mach_o/Header.cpp',
'mach_o/LazyLoadDylib.cpp',
'mach_o/Image.cpp',
'mach_o/Instructions.cpp',
# 'mach_o/LinkerOptimizationHints.cpp',
@ -121,6 +147,7 @@ libmach_o = static_library(
'mach_o/SplitSeg.cpp',
'mach_o/Symbol.cpp',
'mach_o/Universal.cpp',
'mach_o/UnsafeHeader.cpp',
'mach_o/Version32.cpp',
'mach_o/Version64.cpp',
],
@ -147,12 +174,12 @@ libmach_o_writer = static_library(
'mach_o_writer/ExportsTrieWriter.cpp',
'mach_o_writer/FunctionStartsWriter.cpp',
'mach_o_writer/FunctionVariantsWriter.cpp',
'mach_o_writer/HeaderWriter.cpp',
'mach_o_writer/LinkerOptimizationHintsWriter.cpp',
'mach_o_writer/NListSymbolTableWriter.cpp',
'mach_o_writer/RebaseOpcodesWriter.cpp',
'mach_o_writer/SplitSegWriter.cpp',
'mach_o_writer/UniversalWriter.cpp',
'mach_o_writer/UnsafeHeaderWriter.cpp',
],
)
libmach_o_writer_dep = declare_dependency(
@ -170,7 +197,11 @@ libminidyld = static_library(
'-DPRIVATE',
'-DBUILDING_LIBDYLD=1',
],
dependencies : [ corecrypto_dep, lsl_dep ],
dependencies : [
common_dep,
corecrypto_dep,
lsl_dep
],
include_directories : [
common_inc,
'cache_builder',
@ -178,9 +209,6 @@ libminidyld = static_library(
'libdyld_introspection',
],
sources : [
'common/CachePatching.cpp',
'common/MachOLayout.cpp',
'common/MachOLoaded.cpp',
'libdyld/CrashReporterAnnotations.c',
],
)
@ -189,6 +217,7 @@ libdsc_extractor = shared_library(
'dsc_extractor',
cpp_args : [ '-DBUILDING_SHARED_CACHE_EXTRACTOR=1' ],
dependencies : [
common_dep,
corecrypto_dep,
libmach_o_dep,
lsl_dep
@ -204,13 +233,8 @@ libdsc_extractor = shared_library(
name_prefix : '',
name_suffix : 'bundle',
sources : [
'common/DyldSharedCache.cpp',
'common/MachOFile.cpp',
'common/TargetPolicy.cpp',
'other-tools/dsc_extractor.cpp',
'other-tools/dsc_iterator.cpp',
'common/MachOLayout.cpp',
'common/Diagnostics.cpp',
],
)
@ -223,6 +247,30 @@ executable(
sources : [ 'other-tools/dsc_extractor_bin.cpp' ],
)
executable(
'dyld_analyzer',
cpp_args : [ '-DBUILDING_LEGACY_TOOL' ],
dependencies : [
common_dep,
libmach_o_dep,
lsl_dep,
],
include_directories : [
common_inc,
'cache_builder',
'other-tools',
],
install : true,
link_with : [ libminidyld ],
sources : [
'other-tools/dyld_analyzer.cpp',
'other-tools/FileUtils.cpp',
'other-tools/MiscFileUtils.cpp',
'other-tools/Tool.cpp',
],
)
executable(
'dyld_info',
cpp_args : [
@ -230,6 +278,7 @@ executable(
'-DBUILDING_FOR_TOOLCHAIN=1',
],
dependencies : [
common_dep,
corecrypto_dep,
libmach_o_dep,
llvm_dep,
@ -244,13 +293,6 @@ executable(
link_args : [ '-Wl,-weak-lLTO' ],
link_with : [ libminidyld ],
sources : [
'common/Diagnostics.cpp',
'common/DyldSharedCache.cpp',
'common/MachOAnalyzer.cpp',
'common/MachOFile.cpp',
'common/MetadataVisitor.cpp',
'common/SwiftVisitor.cpp',
'common/TargetPolicy.cpp',
'other-tools/dyld_info.cpp',
'other-tools/FileUtils.cpp',
'other-tools/MiscFileUtils.cpp',
@ -258,3 +300,101 @@ executable(
],
)
install_man('doc/man/man1/dyld_info.1')
# Requires headers from unpublished ld-prime sources
# executable(
# 'libtool',
# dependencies : [ lsl_dep ],
# include_directories : [
# common_inc,
# 'cache_builder',
# 'mach_o_writer',
# ],
# install : true,
# sources : [
# 'other-tools/libtool.cpp',
# 'other-tools/Tool.cpp',
# ],
# )
# install_man('doc/man/man1/libtool.1')
#
# # ranlib is a symlink to libtool
# install_man('doc/man/man1/ranlib.1')
# Requires headers from unpublished ld-prime sources
# executable(
# 'lipo',
# dependencies : [ lsl_dep ],
# include_directories : [ common_inc ],
# install : true,
# sources : [
# 'other-tools/lipo.cpp',
# 'other-tools/Tool.cpp',
# ],
# )
executable(
'nm',
cpp_args : [ '-DBUILDING_LEGACY_TOOL' ],
dependencies : [
common_dep,
libmach_o_dep,
lsl_dep,
],
include_directories : [
common_inc,
'cache_builder',
'other-tools',
],
install : true,
link_with : [ libminidyld ],
sources : [
'other-tools/MiscFileUtils.cpp',
'other-tools/nm.cpp',
'other-tools/Tool.cpp',
],
)
executable(
'strings',
cpp_args : [ '-DBUILDING_LEGACY_TOOL' ],
dependencies : [
common_dep,
libmach_o_dep,
lsl_dep,
],
include_directories : [
common_inc,
'cache_builder',
'other-tools',
],
install : true,
link_with : [ libminidyld ],
sources : [
'other-tools/MiscFileUtils.cpp',
'other-tools/strings.cpp',
'other-tools/Tool.cpp',
],
)
executable(
'size',
cpp_args : [ '-DBUILDING_LEGACY_TOOL' ],
dependencies : [
common_dep,
libmach_o_dep,
lsl_dep,
],
include_directories : [
common_inc,
'cache_builder',
'other-tools',
],
install : true,
link_with : [ libminidyld ],
sources : [
'other-tools/MiscFileUtils.cpp',
'other-tools/size.cpp',
'other-tools/Tool.cpp',
],
)

View file

@ -10,6 +10,7 @@
pkgsBuildHost,
sourceRelease,
stdenvNoCC,
xnuHeaders,
}:
let
@ -70,18 +71,19 @@ let
install -D -m644 -t "$out/include/os" \
'${xnu}/libsyscall/os/tsd.h' \
'${xnu}/libkern/os/atomic_private.h' \
'${xnu}/libkern/os/atomic_private_arch.h' \
'${xnu}/libkern/os/atomic_private_impl.h' \
'${xnu}/libkern/os/base_private.h' \
'${xnuHeaders}/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders/os/atomic_private.h' \
'${xnuHeaders}/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders/os/atomic_private_arch.h' \
'${xnuHeaders}/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders/os/atomic_private_impl.h' \
'${xnuHeaders}/Library/Frameworks/Kernel.framework/Versions/A/PrivateHeaders/os/base_private.h' \
'${libplatform}/private/os/lock_private.h'
substituteInPlace "$out/include/os/lock_private.h" \
--replace-fail ', bridgeos(4.0)' ""
install -D -m644 -t "$out/include/sys" \
'${xnu}/bsd/sys/kern_memorystatus.h' \
'${xnu}/bsd/sys/reason.h'
'${xnuHeaders}/include/sys/commpage_private.h' \
'${xnuHeaders}/include/sys/kern_memorystatus.h' \
'${xnuHeaders}/include/sys/reason.h'
# This file is part of ld-prime, which is unhelpfully not included in the dyld source release.
# Fortunately, nothing in it is actually needed to build `dyld_info` and `dsc_extractor`.
@ -100,7 +102,7 @@ mkAppleDerivation {
propagatedBuildOutputs = [ ];
xcodeHash = "sha256-F/V1XzBP1qEDpUDTz+jyp5dbcfqdQp8s9NW2OBoU5x0=";
xcodeHash = "sha256-eECKavCwz8NDqPOgW1YZ4ldQQHSUdBvAGRtYcVgEX/w=";
patches = [
# Disable use of private kdebug API
@ -134,7 +136,8 @@ mkAppleDerivation {
--replace-fail '__API_UNAVAILABLE(ios, tvos, watchos) __API_UNAVAILABLE(bridgeos)' ""
substituteInPlace include/mach-o/utils_priv.h \
--replace-fail 'SPI_AVAILABLE(macos(15.0), ios(18.0), tvos(18.0), watchos(11.0))' ""
--replace-fail 'SPI_AVAILABLE' "__SPI_AVAILABLE" \
--replace-fail '____SPI_AVAILABLE' "__SPI_AVAILABLE"
substituteInPlace libdyld/utils.cpp \
--replace-fail 'DYLD_EXCLAVEKIT_UNAVAILABLE' ""
@ -146,6 +149,9 @@ mkAppleDerivation {
= { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 };
EOF
substituteInPlace other-tools/Tool.cpp \
--replace-fail 'bridgeOS 6,' ""
# Fix header includes
substituteInPlace libdyld_introspection/dyld_introspection.cpp \
--replace-fail 'dyld_introspection.h' 'mach-o/dyld_introspection.h'

View file

@ -164,8 +164,8 @@
"version": "413"
},
"dyld": {
"hash": "sha256-rvWFiQVLJKqL0hOL2nRqwRkyPc/OvGnL0GEBymq7Fio=",
"version": "1340"
"hash": "sha256-uXFAHIgSrAR2duFhSvOXdaa0x8GTj4Qjq9TNGOZRGhU=",
"version": "1376.6"
},
"eap8021x": {
"hash": "sha256-nwCp5QgtXC2X3y5eR3DnXkdpECNkLmejM2iGQ6nuPaQ=",