Currently, we fail to detect some Darwin assembler capabilities because the
configure tests rely on a BINUTILS objdump, which isn’t generally available
on Darwin.

Darwin uses a tool called "otool" to provide information about objects, and we
should be able to extend or adapt config tests to use this.

libtool already ‘knows’ about otool, we just need to teach the GCC configury.

OK for trunk?
Iain

        * configure.ac (NCN_STRICT_CHECK_TOOLS): Check otool.
        (ACX_CHECK_INSTALLED_TARGET_TOOL): Likewise
        (GCC_TARGET_TOOL): Likewise.
        * Makefile.tpl (HOST_EXPORTS): Add OTOOL, OTOOL_FOR_TARGET.
        (BASE_TARGET_EXPORTS): OTOOL, export OTOOL_FOR_TARGET.
        OTOOL, OTOOL_FOR_TARGET: New substitutions. 
        (EXTRA_HOST_FLAGS, EXTRA_TARGET_FLAGS): Add OTOOL.
        * configure: Regenerate. 
        * Makefile.in: Likewise.

gcc/

        * configure.ac (gcc_cv_otool): Set.
        * configure: Regenerate.


diff --git a/Makefile.tpl b/Makefile.tpl
index 447d324595..834bec3820 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -208,6 +208,7 @@ HOST_EXPORTS = \
        OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
        OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
        READELF="$(READELF)"; export READELF; \
+       OTOOL="$(OTOOL)"; export OTOOL; \
        AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
        AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
        GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
@@ -217,6 +218,7 @@ HOST_EXPORTS = \
        OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
        RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
        READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
+       OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
        TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export 
TOPLEVEL_CONFIGURE_ARGUMENTS; \
        HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
        GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
@@ -290,6 +292,7 @@ BASE_TARGET_EXPORTS = \
        OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
        RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
        READELF="$(READELF_FOR_TARGET)"; export READELF; \
+       OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
        STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
        WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \
        WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \
@@ -398,6 +401,7 @@ NM = @NM@
 OBJDUMP = @OBJDUMP@
 RANLIB = @RANLIB@
 READELF = @READELF@
+OTOOL = @OTOOL@
 STRIP = @STRIP@
 WINDRES = @WINDRES@
 WINDMC = @WINDMC@
@@ -506,6 +510,7 @@ OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
 OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
 RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
 READELF_FOR_TARGET=@READELF_FOR_TARGET@
+OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
 STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
 WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@
 WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@
@@ -628,6 +633,7 @@ EXTRA_HOST_FLAGS = \
        'OBJDUMP=$(OBJDUMP)' \
        'RANLIB=$(RANLIB)' \
        'READELF=$(READELF)' \
+       'OTOOL=$(OTOOL)' \
        'STRIP=$(STRIP)' \
        'WINDRES=$(WINDRES)' \
        'WINDMC=$(WINDMC)' \
@@ -687,6 +693,7 @@ EXTRA_TARGET_FLAGS = \
        'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \
        'RANLIB=$$(RANLIB_FOR_TARGET)' \
        'READELF=$$(READELF_FOR_TARGET)' \
+       'OTOOL=$$(OTOOL_FOR_TARGET)' \
        'WINDRES=$$(WINDRES_FOR_TARGET)' \
        'WINDMC=$$(WINDMC_FOR_TARGET)' \
        'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \

diff --git a/configure.ac b/configure.ac
index a0b0917dd5..01ca33d566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3321,6 +3321,7 @@ NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
 NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
 NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
 NCN_STRICT_CHECK_TOOLS(READELF, readelf)
+NCN_STRICT_CHECK_TOOLS(OTOOL, otool)
 AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
@@ -3355,6 +3356,7 @@ ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, 
objcopy)
 ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
 ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
 ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
+ACX_CHECK_INSTALLED_TARGET_TOOL(OTOOL_FOR_TARGET, otool)
 ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
 ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
@@ -3384,6 +3386,7 @@ GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, 
[binutils/objcopy])
 GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
 GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
 GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
+GCC_TARGET_TOOL(otool, OTOOL_FOR_TARGET, OTOOL)
 GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
 GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
 GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])

diff --git a/gcc/configure.ac b/gcc/configure.ac
index 65f9c92ec8..c3320ec3f4 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2466,6 +2466,23 @@ else
        AC_MSG_RESULT($gcc_cv_readelf)
 fi
 
+# Figure out what otool we will be using.
+AS_VAR_SET_IF(gcc_cv_otool,, [
+if test -x otool$build_exeext; then
+       gcc_cv_otool=./otool$build_exeext
+elif ( set dummy $OTOOL_FOR_TARGET; test -x $[2] ); then
+        gcc_cv_otool="$OTOOL_FOR_TARGET"
+else
+        AC_PATH_PROG(gcc_cv_otool, $OTOOL_FOR_TARGET)
+fi])
+
+AC_MSG_CHECKING(what otool to use)
+if test x$gcc_cv_otool = x; then
+       AC_MSG_RESULT(not found)
+else
+       AC_MSG_RESULT($gcc_cv_otool)
+fi
+
 # Figure out what assembler alignment features are present.
 gcc_GAS_CHECK_FEATURE([.balign and .p2align], gcc_cv_as_balign_and_p2align,
  [2,6,0],,
-- 
2.17.1


Reply via email to