diff options
author | fanquake <fanquake@gmail.com> | 2024-01-30 09:37:37 +0000 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-05-08 16:36:41 +0800 |
commit | 7f5ac4520d1553170b1053a9ffcd58179386a6d2 (patch) | |
tree | d0b2d5b5e0e4e1abaeab6f5fc29bc5cfe8791a98 /depends | |
parent | 43a66c55ec8770cf7c21112aac9b997f3f2fb704 (diff) |
build: swap otool for (llvm-)objdump
Similar to libtool, (llvm-)otool only exists with a version suffix
on some systems (Ubuntu), which makes it annoying to use/find. Avoid
this, by switching to objdump. Which is a drop-in replacement.
This is related to #21778, and the switchover to using vanilla LLVM for
macOS.
Diffstat (limited to 'depends')
-rw-r--r-- | depends/Makefile | 2 | ||||
-rw-r--r-- | depends/builders/darwin.mk | 4 | ||||
-rw-r--r-- | depends/builders/default.mk | 3 | ||||
-rw-r--r-- | depends/config.site.in | 6 | ||||
-rw-r--r-- | depends/hosts/darwin.mk | 6 | ||||
-rw-r--r-- | depends/hosts/default.mk | 2 | ||||
-rw-r--r-- | depends/packages/native_llvm.mk | 1 |
7 files changed, 15 insertions, 9 deletions
diff --git a/depends/Makefile b/depends/Makefile index 005d9696fb..016c8f64ad 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -233,7 +233,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ -e 's|@RANLIB@|$(host_RANLIB)|' \ -e 's|@NM@|$(host_NM)|' \ -e 's|@STRIP@|$(host_STRIP)|' \ - -e 's|@OTOOL@|$(host_OTOOL)|' \ + -e 's|@OBJDUMP@|$(host_OBJDUMP)|' \ -e 's|@DSYMUTIL@|$(host_DSYMUTIL)|' \ -e 's|@build_os@|$(build_os)|' \ -e 's|@host_os@|$(host_os)|' \ diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk index 554bfd2c3e..be04e1d8f3 100644 --- a/depends/builders/darwin.mk +++ b/depends/builders/darwin.mk @@ -3,7 +3,7 @@ build_darwin_CXX:=$(shell xcrun -f clang++) -isysroot$(shell xcrun --show-sdk-pa build_darwin_AR:=$(shell xcrun -f ar) build_darwin_RANLIB:=$(shell xcrun -f ranlib) build_darwin_STRIP:=$(shell xcrun -f strip) -build_darwin_OTOOL:=$(shell xcrun -f otool) +build_darwin_OBJDUMP:=$(shell xcrun -f objdump) build_darwin_NM:=$(shell xcrun -f nm) build_darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) build_darwin_SHA256SUM=shasum -a 256 @@ -15,7 +15,7 @@ darwin_CXX:=$(shell xcrun -f clang++) -stdlib=libc++ -isysroot$(shell xcrun --sh darwin_AR:=$(shell xcrun -f ar) darwin_RANLIB:=$(shell xcrun -f ranlib) darwin_STRIP:=$(shell xcrun -f strip) -darwin_OTOOL:=$(shell xcrun -f otool) +darwin_OBJDUMP:=$(shell xcrun -f objdump) darwin_NM:=$(shell xcrun -f nm) darwin_DSYMUTIL:=$(shell xcrun -f dsymutil) darwin_native_binutils= diff --git a/depends/builders/default.mk b/depends/builders/default.mk index 50869cd8a2..2a1709d98a 100644 --- a/depends/builders/default.mk +++ b/depends/builders/default.mk @@ -1,6 +1,7 @@ default_build_CC = gcc default_build_CXX = g++ default_build_AR = ar +default_build_OBJDUMP = objdump default_build_TAR = tar default_build_RANLIB = ranlib default_build_STRIP = strip @@ -12,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1) build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1) endef -$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL DSYMUTIL TOUCH,$(eval $(call add_build_tool_func,$(var)))) +$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OBJDUMP DSYMUTIL TOUCH,$(eval $(call add_build_tool_func,$(var)))) define add_build_flags_func build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1) diff --git a/depends/config.site.in b/depends/config.site.in index 81975f02b9..f6bed6a9d4 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -118,9 +118,9 @@ if test -n "@STRIP@"; then fi if test "@host_os@" = darwin; then - if test -n "@OTOOL@"; then - OTOOL="@OTOOL@" - ac_cv_path_OTOOL="${OTOOL}" + if test -n "@OBJDUMP@"; then + OBJDUMP="@OBJDUMP@" + ac_cv_path_OBJDUMP="${OBJDUMP}" fi if test -n "@DSYMUTIL@"; then diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk index 639259ace3..2c4ef0644d 100644 --- a/depends/hosts/darwin.mk +++ b/depends/hosts/darwin.mk @@ -19,6 +19,8 @@ clang_prog=$(build_prefix)/bin/clang clangxx_prog=$(clang_prog)++ llvm_config_prog=$(build_prefix)/bin/llvm-config +darwin_OBJDUMP=$(build_prefix)/bin/$(host)-objdump + else # FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's # system @@ -37,9 +39,11 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++") llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config") llvm_lib_dir=$(shell $(llvm_config_prog) --libdir) + +darwin_OBJDUMP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-objdump") endif -cctools_TOOLS=AR RANLIB STRIP NM OTOOL DSYMUTIL +cctools_TOOLS=AR RANLIB STRIP NM DSYMUTIL # Make-only lowercase function 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)))))))))))))))))))))))))) diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index 6a6cab6cc6..d82c33f29c 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -38,5 +38,5 @@ host_$1 = $$($(host_arch)_$(host_os)_$1) host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) endef -$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OTOOL DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) +$(foreach tool,CC CXX AR RANLIB STRIP NM OBJCOPY OBJDUMP DSYMUTIL,$(eval $(call add_host_tool_func,$(tool)))) $(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) diff --git a/depends/packages/native_llvm.mk b/depends/packages/native_llvm.mk index 09994eb012..1953c91bf4 100644 --- a/depends/packages/native_llvm.mk +++ b/depends/packages/native_llvm.mk @@ -18,6 +18,7 @@ define $(package)_stage_cmds cp -P bin/clang++ $($(package)_staging_prefix_dir)/bin/ && \ cp bin/dsymutil $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \ cp bin/llvm-config $($(package)_staging_prefix_dir)/bin/ && \ + cp bin/llvm-objdump $($(package)_staging_prefix_dir)/bin/$(host)-objdump && \ cp include/llvm-c/ExternC.h $($(package)_staging_prefix_dir)/include/llvm-c && \ cp include/llvm-c/lto.h $($(package)_staging_prefix_dir)/include/llvm-c && \ cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \ |