Skip to content

Commit 3dca683

Browse files
committed
build: support -no_fixup_chains in ld64
Patch in suport for using -no_fixup_chains, with ld64. This option just seems to be missing from our version, as it exists in later releases. This is needed so we can disable fixup_chains in our security checks.
1 parent d4018f0 commit 3dca683

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

depends/packages/native_cctools.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ $(package)_file_name=$($(package)_version).tar.gz
55
$(package)_sha256_hash=6b73269efdf5c58a070e7357b66ee760501388549d6a12b423723f45888b074b
66
$(package)_build_subdir=cctools
77
$(package)_dependencies=native_libtapi
8+
$(package)_patches=no_fixup_chains.patch
89

910
define $(package)_set_vars
1011
$(package)_config_opts=--target=$(host) --enable-lto-support
@@ -18,11 +19,13 @@ ifneq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
1819
define $(package)_preprocess_cmds
1920
mkdir -p $($(package)_staging_prefix_dir)/lib && \
2021
cp $(llvm_lib_dir)/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
21-
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools
22+
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools && \
23+
patch -p1 < $($(package)_patch_dir)/no_fixup_chains.patch
2224
endef
2325
else
2426
define $(package)_preprocess_cmds
25-
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools
27+
cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools && \
28+
patch -p1 < $($(package)_patch_dir)/no_fixup_chains.patch
2629
endef
2730
endif
2831

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
commit 5860b35ff6c7241d1c35a1b3197b45e5c9ff86cf
2+
Author: fanquake <[email protected]>
3+
Date: Thu Jun 29 11:52:43 2023 +0100
4+
5+
ld64: add support for -no_fixup_chains
6+
7+
This is added in later versions, and is required if we want to be able
8+
to disable fixup_chains, for use in security tests.
9+
10+
diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp
11+
index 15e8e88..b6580af 100644
12+
--- a/cctools/ld64/src/ld/Options.cpp
13+
+++ b/cctools/ld64/src/ld/Options.cpp
14+
@@ -4128,6 +4128,9 @@ void Options::parse(int argc, const char* argv[])
15+
else if ( strcmp(arg, "-fixup_chains") == 0 ) {
16+
fMakeChainedFixups = true;
17+
}
18+
+ else if ( strcmp(arg, "-no_fixup_chains") == 0 ) {
19+
+ fMakeChainedFixups = false;
20+
+ }
21+
else if (strcmp(arg, "-debug_variant") == 0) {
22+
fDebugVariant = true;
23+
}

0 commit comments

Comments
 (0)