Skip to content

Commit decd420

Browse files
committed
merge bitcoin#29739: swap cctools otool for llvm-objdump
1 parent 0f8c420 commit decd420

File tree

10 files changed

+31
-25
lines changed

10 files changed

+31
-25
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ $(OSX_DMG): deploydir
130130
$(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -o $@ $(APP_DIST_DIR) -- $(if $(SOURCE_DATE_EPOCH),-volume_date all_file_dates =$(SOURCE_DATE_EPOCH))
131131

132132
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
133-
OTOOL=$(OTOOL) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR)
133+
OBJDUMP=$(OBJDUMP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR)
134134

135135
deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt
136136
endif !BUILD_DARWIN

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ AC_PATH_PROG(CCACHE,ccache)
122122
AC_PATH_PROG(XGETTEXT,xgettext)
123123
AC_PATH_PROG(HEXDUMP,hexdump)
124124
AC_PATH_TOOL(OBJCOPY, objcopy)
125+
AC_PATH_TOOL([OBJDUMP], [objdump])
125126
AC_PATH_TOOL(DSYMUTIL, dsymutil)
126127
AC_PATH_PROG(DOXYGEN, doxygen)
127128
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
@@ -836,7 +837,6 @@ case $host in
836837
;;
837838
*)
838839
AC_PATH_TOOL([DSYMUTIL], [dsymutil], dsymutil)
839-
AC_PATH_TOOL([OTOOL], [otool], otool)
840840
AC_PATH_PROGS([XORRISOFS], [xorrisofs], xorrisofs)
841841

842842
dnl libtool will try to strip the static lib, which is a problem for

contrib/macdeploy/macdeployqtplus

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class FrameworkInfo(object):
7979
bundleBinaryDirectory = "Contents/MacOS"
8080

8181
@classmethod
82-
def fromOtoolLibraryLine(cls, line: str) -> Optional['FrameworkInfo']:
82+
def fromLibraryLine(cls, line: str) -> Optional['FrameworkInfo']:
8383
# Note: line must be trimmed
8484
if line == "":
8585
return None
@@ -90,7 +90,7 @@ class FrameworkInfo(object):
9090

9191
m = cls.reOLine.match(line)
9292
if m is None:
93-
raise RuntimeError(f"otool line could not be parsed: {line}")
93+
raise RuntimeError(f"Line could not be parsed: {line}")
9494

9595
path = m.group(1)
9696

@@ -122,7 +122,7 @@ class FrameworkInfo(object):
122122
break
123123
i += 1
124124
if i == len(parts):
125-
raise RuntimeError(f"Could not find .framework or .dylib in otool line: {line}")
125+
raise RuntimeError(f"Could not find .framework or .dylib in line: {line}")
126126

127127
info.frameworkName = parts[i]
128128
info.frameworkDirectory = "/".join(parts[:i])
@@ -184,24 +184,24 @@ class DeploymentInfo(object):
184184
return False
185185

186186
def getFrameworks(binaryPath: str, verbose: int) -> List[FrameworkInfo]:
187+
objdump = os.getenv("OBJDUMP", "objdump")
187188
if verbose:
188-
print(f"Inspecting with otool: {binaryPath}")
189-
otoolbin=os.getenv("OTOOL", "otool")
190-
otool = run([otoolbin, "-L", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True)
191-
if otool.returncode != 0:
192-
sys.stderr.write(otool.stderr)
189+
print(f"Inspecting with {objdump}: {binaryPath}")
190+
output = run([objdump, "--macho", "--dylibs-used", binaryPath], stdout=PIPE, stderr=PIPE, universal_newlines=True)
191+
if output.returncode != 0:
192+
sys.stderr.write(output.stderr)
193193
sys.stderr.flush()
194-
raise RuntimeError(f"otool failed with return code {otool.returncode}")
194+
raise RuntimeError(f"{objdump} failed with return code {output.returncode}")
195195

196-
otoolLines = otool.stdout.split("\n")
197-
otoolLines.pop(0) # First line is the inspected binary
196+
lines = output.stdout.split("\n")
197+
lines.pop(0) # First line is the inspected binary
198198
if ".framework" in binaryPath or binaryPath.endswith(".dylib"):
199-
otoolLines.pop(0) # Frameworks and dylibs list themselves as a dependency.
199+
lines.pop(0) # Frameworks and dylibs list themselves as a dependency.
200200

201201
libraries = []
202-
for line in otoolLines:
202+
for line in lines:
203203
line = line.replace("@loader_path", os.path.dirname(binaryPath))
204-
info = FrameworkInfo.fromOtoolLibraryLine(line.strip())
204+
info = FrameworkInfo.fromLibraryLine(line.strip())
205205
if info is not None:
206206
if verbose:
207207
print("Found framework:")

depends/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
226226
-e 's|@RANLIB@|$(host_RANLIB)|' \
227227
-e 's|@NM@|$(host_NM)|' \
228228
-e 's|@STRIP@|$(host_STRIP)|' \
229-
-e 's|@OTOOL@|$(host_OTOOL)|' \
229+
-e 's|@OBJDUMP@|$(host_OBJDUMP)|' \
230230
-e 's|@build_os@|$(build_os)|' \
231231
-e 's|@host_os@|$(host_os)|' \
232232
-e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \

depends/builders/darwin.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ build_darwin_CXX:=$(shell xcrun -f clang++) -isysroot$(shell xcrun --show-sdk-pa
33
build_darwin_AR:=$(shell xcrun -f ar)
44
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
55
build_darwin_STRIP:=$(shell xcrun -f strip)
6-
build_darwin_OTOOL:=$(shell xcrun -f otool)
6+
build_darwin_OBJDUMP:=$(shell xcrun -f objdump)
77
build_darwin_NM:=$(shell xcrun -f nm)
88
build_darwin_SHA256SUM=shasum -a 256
99
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
@@ -14,7 +14,7 @@ darwin_CXX:=$(shell xcrun -f clang++) -stdlib=libc++ -isysroot$(shell xcrun --sh
1414
darwin_AR:=$(shell xcrun -f ar)
1515
darwin_RANLIB:=$(shell xcrun -f ranlib)
1616
darwin_STRIP:=$(shell xcrun -f strip)
17-
darwin_OTOOL:=$(shell xcrun -f otool)
17+
darwin_OBJDUMP:=$(shell xcrun -f objdump)
1818
darwin_NM:=$(shell xcrun -f nm)
1919
darwin_native_binutils=
2020
darwin_native_toolchain=

depends/builders/default.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
default_build_CC = gcc
22
default_build_CXX = g++
33
default_build_AR = ar
4+
default_build_OBJDUMP = objdump
45
default_build_TAR = tar
56
default_build_RANLIB = ranlib
67
default_build_STRIP = strip
@@ -12,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1)
1213
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
1314
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
1415
endef
15-
$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL TOUCH,$(eval $(call add_build_tool_func,$(var))))
16+
$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OBJDUMP TOUCH,$(eval $(call add_build_tool_func,$(var))))
1617
define add_build_flags_func
1718
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
1819
build_$1=$$(build_$(build_arch)_$(build_os)_$1)

depends/config.site.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ if test -n "@STRIP@"; then
121121
fi
122122

123123
if test "@host_os@" = darwin; then
124-
if test -n "@OTOOL@"; then
125-
OTOOL="@OTOOL@"
126-
ac_cv_path_ac_pt_OTOOL="${OTOOL}"
124+
if test -n "@OBJDUMP@"; then
125+
OBJDUMP="@OBJDUMP@"
126+
ac_cv_path_ac_pt_OBJDUMP="${OBJDUMP}"
127127
fi
128128
fi
129129

depends/hosts/darwin.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ clang_prog=$(build_prefix)/bin/clang
1919
clangxx_prog=$(clang_prog)++
2020
llvm_config_prog=$(build_prefix)/bin/llvm-config
2121

22+
darwin_OBJDUMP=$(build_prefix)/bin/$(host)-objdump
23+
2224
else
2325
# FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's
2426
# system
@@ -37,9 +39,11 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
3739
llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config")
3840

3941
llvm_lib_dir=$(shell $(llvm_config_prog) --libdir)
42+
43+
darwin_OBJDUMP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-objdump")
4044
endif
4145

42-
cctools_TOOLS=AR RANLIB STRIP NM OTOOL
46+
cctools_TOOLS=AR RANLIB STRIP NM
4347

4448
# Make-only lowercase function
4549
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))

depends/hosts/default.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1)
3838
host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1)
3939
endef
4040

41-
$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OTOOL,$(eval $(call add_host_tool_func,$(tool))))
41+
$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OBJDUMP,$(eval $(call add_host_tool_func,$(tool))))
4242
$(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags))))

depends/packages/native_llvm.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ define $(package)_stage_cmds
1818
cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin/ && \
1919
cp bin/dsymutil $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \
2020
cp bin/llvm-config $($(package)_staging_prefix_dir)/bin/ && \
21+
cp bin/llvm-objdump $($(package)_staging_prefix_dir)/bin/$(host)-objdump && \
2122
cp include/llvm-c/ExternC.h $($(package)_staging_prefix_dir)/include/llvm-c && \
2223
cp include/llvm-c/lto.h $($(package)_staging_prefix_dir)/include/llvm-c && \
2324
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \

0 commit comments

Comments
 (0)