diff --git a/Make.inc b/Make.inc index 6e4b8b73299aef..3e73312b36d2f1 100644 --- a/Make.inc +++ b/Make.inc @@ -1472,8 +1472,18 @@ else LIBGCC_NAME := libgcc_s_seh-1.$(SHLIB_EXT) endif endif +# On macOS, libgcc_s has soversion 1.1 always on aarch64 and only for GCC 12+ +# (-> libgfortran 5) on x86_64 ifeq ($(OS),Darwin) +ifeq ($(ARCH),aarch64) LIBGCC_NAME := libgcc_s.1.1.$(SHLIB_EXT) +else +ifeq ($(LIBGFORTRAN_VERSION),5) +LIBGCC_NAME := libgcc_s.1.1.$(SHLIB_EXT) +else +LIBGCC_NAME := libgcc_s.1.$(SHLIB_EXT) +endif +endif endif ifneq ($(findstring $(OS),Linux FreeBSD),) LIBGCC_NAME := libgcc_s.$(SHLIB_EXT).1 diff --git a/base/Makefile b/base/Makefile index 97c32fd544ec3d..28570c74f351a8 100644 --- a/base/Makefile +++ b/base/Makefile @@ -235,11 +235,19 @@ else ifneq ($(USE_SYSTEM_OPENLIBM),0) $(eval $(call symlink_system_library,OPENLIBM,$(LIBMNAME))) endif +# On macOS, libgcc_s has soversion 1.1 always on aarch64 and only for GCC 12+ +# (-> libgfortran 5) on x86_64 ifeq ($(OS),Darwin) +ifeq ($(ARCH),aarch64) +$(eval $(call symlink_system_library,CSL,libgcc_s,1.1)) +else +ifeq ($(LIBGFORTRAN_VERSION),5) $(eval $(call symlink_system_library,CSL,libgcc_s,1.1)) else $(eval $(call symlink_system_library,CSL,libgcc_s,1)) endif +endif +endif ifneq (,$(LIBGFORTRAN_VERSION)) $(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION))) endif diff --git a/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl b/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl index 7a51fb4240b2d8..604c7ae89dd5eb 100644 --- a/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl +++ b/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl @@ -32,7 +32,11 @@ if Sys.iswindows() const libstdcxx = "libstdc++-6.dll" const libgomp = "libgomp-1.dll" elseif Sys.isapple() - const libgcc_s = "@rpath/libgcc_s.1.1.dylib" + if arch(HostPlatform()) == "aarch64" || libgfortran_version(HostPlatform()) == v"5" + const libgcc_s = "@rpath/libgcc_s.1.1.dylib" + else + const libgcc_s = "@rpath/libgcc_s.1.dylib" + end const libgfortran = string("@rpath/", "libgfortran.", libgfortran_version(HostPlatform()).major, ".dylib") const libstdcxx = "@rpath/libstdc++.6.dylib" const libgomp = "@rpath/libgomp.1.dylib"