Skip to content

Commit 816314e

Browse files
committed
Merge bitcoin#20644: Add patch to make codesign_allocate compatible with Apple's
a4118c6 Add patch to make codesign_allocate compatible with Apple's (Pieter Wuille) Pull request description: This is an alternative to bitcoin#20638. The problem is that Apple's codesign(_allocate) apparently rounds the "vmsize" attribute on the __LINKEDIT section to a multiple of 0x2000 on x86_64 rather than 0x1000 (as their published source code does). This divergence means that the binary signed by codesign is slightly different from the one recreated by our reattach-sig-to-gitian-output process, and the signature being invalid. This fixes it by patching our codesign_allocate source code to also use 0x2000. In tests, this appears to result in matching binaries. ACKs for top commit: jonasschnelli: Tested ACK a4118c6 - removed the osx cache, built commit a4118c6 for osx in gitian (dependency where built, patch was applied), signed on my signing mac (detach-sig-create), ran gitian osx signer with the produces signature and the a4118c6 build (detach-sig-apply), signature then was successful verified on my Mac (codesign -v /Volumes/Bitcoin-Core/Bitcoin-Qt.app) MarcoFalke: Concept ACK a4118c6 Tree-SHA512: 07b8cdf8216249ddfe4bd38b39f2b48b2e190d4002b84d8981e62197bbbc9f25ac5c137bcc32057b23fbf38cbb2889ef95101ce008edfbf608cd170b88b3acbc
2 parents b7136c1 + a4118c6 commit 816314e

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

depends/packages/native_cctools.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $(package)_download_path=https://github.com/tpoechtrager/cctools-port/archive
44
$(package)_file_name=$($(package)_version).tar.gz
55
$(package)_sha256_hash=e51995a843533a3dac155dd0c71362dd471597a2d23f13dff194c6285362f875
66
$(package)_build_subdir=cctools
7-
$(package)_patches=ld64_disable_threading.patch
7+
$(package)_patches=ld64_disable_threading.patch segalign.patch
88

99
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
1010
$(package)_clang_version=8.0.0
@@ -80,7 +80,8 @@ endef
8080
define $(package)_preprocess_cmds
8181
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ./libtapi/build.sh && \
8282
CC=$($(package)_cc) CXX=$($(package)_cxx) INSTALLPREFIX=$($(package)_extract_dir) ./libtapi/install.sh && \
83-
patch -p1 < $($(package)_patch_dir)/ld64_disable_threading.patch
83+
patch -p1 < $($(package)_patch_dir)/ld64_disable_threading.patch && \
84+
patch -p1 < $($(package)_patch_dir)/segalign.patch
8485
endef
8586

8687
define $(package)_config_cmds
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
commit 7f2eb11ce6ebec7eb9b8e1429535e453054143e5
2+
Author: Pieter Wuille <[email protected]>
3+
Date: Sun Dec 13 11:34:21 2020 -0800
4+
5+
Make cctools_port's codesign_allocate compatible with Apple's
6+
7+
diff --git a/cctools/libstuff/arch.c b/cctools/libstuff/arch.c
8+
index 6f2332f..d85c25c 100644
9+
--- a/cctools/libstuff/arch.c
10+
+++ b/cctools/libstuff/arch.c
11+
@@ -134,7 +134,7 @@ static const struct cpu_entry cpu_entries[] = {
12+
{ CPU_TYPE_ARM, LITTLE_ENDIAN_BYTE_SEX, 0, 0x4000 },
13+
14+
/* desktop */
15+
- { CPU_TYPE_X86_64, LITTLE_ENDIAN_BYTE_SEX, 0x7fff5fc00000LL, 0x1000 },
16+
+ { CPU_TYPE_X86_64, LITTLE_ENDIAN_BYTE_SEX, 0x7fff5fc00000LL, 0x2000 /* Used to be 0x1000; changed to 0x2000 to match Apple's distributed codesign_allocate. */},
17+
{ CPU_TYPE_I386, LITTLE_ENDIAN_BYTE_SEX, 0xc0000000, 0x1000 },
18+
{ CPU_TYPE_POWERPC, BIG_ENDIAN_BYTE_SEX, 0xc0000000, 0x1000 },
19+
{ CPU_TYPE_POWERPC64, BIG_ENDIAN_BYTE_SEX, 0x7ffff00000000LL, 0x1000 },

0 commit comments

Comments
 (0)