From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VovYM-0003Kc-NE for mharc-grub-devel@gnu.org; Fri, 06 Dec 2013 08:34:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VovYE-00039q-Uy for grub-devel@gnu.org; Fri, 06 Dec 2013 08:34:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VovY9-0007H2-CD for grub-devel@gnu.org; Fri, 06 Dec 2013 08:34:38 -0500 Received: from mail-ee0-x235.google.com ([2a00:1450:4013:c00::235]:52363) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VovY9-0007Gt-5m for grub-devel@gnu.org; Fri, 06 Dec 2013 08:34:33 -0500 Received: by mail-ee0-f53.google.com with SMTP id b57so303228eek.40 for ; Fri, 06 Dec 2013 05:34:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=nTn+E86ahoyHl3ckoKwhOLIPdfvJFt9iqh/YLftlvi4=; b=jo0rXHA5KPu2TIU37OCYxirnh/HkUrMQOXTKDk0GW9H4asTsBBJ1NU6b9FCaTbU9GD z9ud6kydiENqrICyr4Xn/cAwsZfmGt4JLytlEShmayXlB5vZ97zveredgJH6lw+S/T7H eOwtNQDkcSgjcAHe6TMvehXrTKNPY+bZx7A+ZIGViewWBJxmowyQBfKGgGseuPeM0hwl DUC13KKxk5TYTIJInxNgK7qOw41OVxa0Yizkrkhq0Juh2yQ/D3jAgxxTMjbEBfcIMXq8 A2s5Ihj9bXVoFU7lK5nF2dI8S7vLK5he7FdMOz/k1t2lsqWfzHLeVf3TYNmZqxy/bzKD Zfgw== X-Received: by 10.14.107.3 with SMTP id n3mr17305681eeg.67.1386336872329; Fri, 06 Dec 2013 05:34:32 -0800 (PST) Received: from [192.168.1.16] (85-188.196-178.cust.bluewin.ch. [178.196.188.85]) by mx.google.com with ESMTPSA id a51sm117479218eeh.8.2013.12.06.05.34.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Dec 2013 05:34:31 -0800 (PST) Message-ID: <52A1D265.9070608@gmail.com> Date: Fri, 06 Dec 2013 14:34:29 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: The development of GRUB 2 Subject: [PATCH] Allow compiling without -mthumb-interwork as long as no thumb is involved X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="----enig2KMBLKFFIRNQBMPJFBPDB" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::235 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2013 13:34:44 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2KMBLKFFIRNQBMPJFBPDB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable My experiments with clang have shown that it doesn't accept -mthumb-interwork and generates code that isn't interworkable on armv5t even with explicit -march=3Darmv5t. Moreover the thumb code it generates even with -march=3Darmv5t contains Thumb-2 instructions which qemu rightfully interprets as bl to random address corrupting lr in process and producing crash dumps with senseless $pc and $lr. So any kind of thumb1 support with clang is in any case out of the question. Then the question if it makes sense to allow (but mention that it's not supported) compilations with clang and old GCC as long as they use only arm and thumb2. Which maintainance costs would it create? Having clang allowed helps for comparisons and to uncover hidden bugs (like .bss alignment bug in sparc64 port) but this usefulness is limited.= diff --git a/INSTALL b/INSTALL index b91d975..3be0271 100644 --- a/INSTALL +++ b/INSTALL @@ -17,6 +17,7 @@ configuring the GRUB. much bigger binaries. earlier versions not tested Note: clang 3.2 or later works for arm + None of tested clang versions generated usable thumb code earlier versions not tested Note: clang 3.3 or later works for arm64 earlier versions have no arm64 support diff --git a/conf/Makefile.common b/conf/Makefile.common index 4ec2b81..c390490 100644 --- a/conf/Makefile.common +++ b/conf/Makefile.common @@ -11,8 +11,6 @@ if COND_sparc64_ieee1275 LDFLAGS_PLATFORM =3D -Wl,-melf64_sparc -mno-relax endif if COND_arm - CFLAGS_PLATFORM +=3D -mthumb-interwork - CCASFLAGS_PLATFORM =3D -mthumb-interwork LDFLAGS_PLATFORM =3D -Wl,--wrap=3D__clear_cache endif if COND_arm64 diff --git a/configure.ac b/configure.ac index d13cd3d..0fb40e8 100644 --- a/configure.ac +++ b/configure.ac @@ -858,6 +858,28 @@ if test "x$target_cpu" =3D xarm; then if test "x$grub_cv_cc_mlong_calls" =3D xyes; then TARGET_CFLAGS=3D"$TARGET_CFLAGS -mlong-calls" fi + AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mt= humb_interwork, [ + CFLAGS=3D"$TARGET_CFLAGS -mthumb-interwork -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mthumb_interwork=3Dyes], + [grub_cv_cc_mthumb_interwork=3Dno]) + ]) + if test "x$grub_cv_cc_mthumb_interwork" =3D xyes; then + TARGET_CFLAGS=3D"$TARGET_CFLAGS -mthumb-interwork" + # clang defaults to thumb-interwork but not GCC + else + CFLAGS=3D"$TARGET_CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +#if defined (__thumb__) && !defined (__thumb2__) +#error thumb without interworking +#endif +]])], + [no_interwork_ok=3Dyes], + [no_interwork_ok=3Dno]) + if test x$no_interwork_ok =3D xno ; then + AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork= ]) + fi + fi fi =20 # ------enig2KMBLKFFIRNQBMPJFBPDB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKh0mUACgkQmBXlbbo5nOv07QD9GzM6Bg3F89QdbQBY8kbbH/j9 r7OwanVi7Ftlqddee4AA/2bo94NmDUk8QbEslQ2VYdhiUuIdvZ7LgJEkWy/vWYlQ =QjVD -----END PGP SIGNATURE----- ------enig2KMBLKFFIRNQBMPJFBPDB--