summaryrefslogtreecommitdiffhomepage
path: root/sofort/ccenv
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-02-15 22:16:31 -0500
committermidipix <writeonce@midipix.org>2019-02-19 14:48:50 -0500
commitd8919c0cd26648bebffcc1b69e0c53d5c36db4f4 (patch)
treea30d9cd1fa4e89336d77df3f50d0f3dd0dff02ca /sofort/ccenv
parent6583a4c82628692c608303f09d0f26c846d6d64f (diff)
downloadmmglue-d8919c0cd26648bebffcc1b69e0c53d5c36db4f4.tar.bz2
mmglue-d8919c0cd26648bebffcc1b69e0c53d5c36db4f4.tar.xz
build system: ccenv: attemt to use otool for binary format detection.
Diffstat (limited to 'sofort/ccenv')
-rw-r--r--sofort/ccenv/ccenv.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index 04db31e..91f613c 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -87,7 +87,7 @@ ccenv_find_tool()
ccenv_set_primary_tools()
{
ccenv_core_tools="ar nm objdump ranlib size strip strings objcopy"
- ccenv_hack_tools="addr2line cov elfedit readelf readobj"
+ ccenv_hack_tools="addr2line cov elfedit readelf readobj otool"
ccenv_peep_tools="perk mdso dlltool windmc windres"
for __tool in $ccenv_core_tools $ccenv_hack_tools $ccenv_peep_tools; do
@@ -528,6 +528,7 @@ ccenv_create_freestanding_executable()
ccenv_set_cc_binfmt()
{
ccenv_use_perk=
+ ccenv_use_otool=
ccenv_use_readelf=
ccenv_use_readobj=
ccenv_use_bfd_objdump=
@@ -573,6 +574,24 @@ ccenv_set_cc_binfmt()
&& ccenv_use_readelf=yes
fi
+ # MACHO-64 / otool
+ if [ -n "$ccenv_otool" ] && [ -z "$ccenv_cc_binfmt" ]; then
+ $ccenv_otool -hv $ccenv_image 2>/dev/null \
+ | grep -i 'MH_MAGIC_64' \
+ > /dev/null \
+ && ccenv_cc_binfmt='MACHO' \
+ && ccenv_use_otool=yes
+ fi
+
+ # MACHO-32 / otool
+ if [ -n "$ccenv_otool" ] && [ -z "$ccenv_cc_binfmt" ]; then
+ $ccenv_otool -hv $ccenv_image 2>/dev/null \
+ | grep -i 'MH_MAGIC' \
+ > /dev/null \
+ && ccenv_cc_binfmt='MACHO' \
+ && ccenv_use_otool=yes
+ fi
+
# MACHO-64 / readelf
if [ -n "$ccenv_readany" ] && [ -z "$ccenv_cc_binfmt" ]; then
$ccenv_readany -h $ccenv_image 2>/dev/null \