From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8688 Path: news.gmane.org!not-for-mail From: Khem Raj Newsgroups: gmane.linux.lib.musl.general Subject: Re: status of armhf asm with VFP instructions Date: Thu, 15 Oct 2015 23:42:56 -0700 Message-ID: <1C314980-DEC4-4C34-9126-1AA2FA231F4C@gmail.com> References: <20151015223320.GW10551@port70.net> <20151015224425.GA8645@brightrain.aerifal.cx> <20151015231606.GX10551@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.4\)) Content-Type: multipart/signed; boundary="Apple-Mail=_264AD270-54B7-42D5-9FDF-0958346AAD55"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Trace: ger.gmane.org 1444977799 12165 80.91.229.3 (16 Oct 2015 06:43:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Oct 2015 06:43:19 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8700-gllmg-musl=m.gmane.org@lists.openwall.com Fri Oct 16 08:43:18 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1ZmyjV-0006K2-7S for gllmg-musl@m.gmane.org; Fri, 16 Oct 2015 08:43:17 +0200 Original-Received: (qmail 11266 invoked by uid 550); 16 Oct 2015 06:43:15 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 10222 invoked from network); 16 Oct 2015 06:43:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:message-id :references:to; bh=q2LMGGH+O4hCWOBNczDRBySOnhMx9Eo0o6/DqD5RWEY=; b=XeG+giKW8vd0rroUP0BV1QgiYYdiKUCuks9cfqVyKgYUUjMxpfU8VRZW8YkIpeHY94 Ce6IuW//koaVivGuJQ5Pk3/RnU+SYs/mn4Gk98UrdzcYze2fyAwwejRa8rlob4rZ9DJ6 RWYQbQDeziOBuG5uj4RgpU0LMA24OXEgxJDi2SIbiPAXqNdYP6Be46+PkHZ8rkcbUEM7 xarvkUG072N5NSAo3v1quMZhIksLx5El3daBGUdczx+xSSEhtuZeWzsHGPv5d/BE7p+Z TjEjkGY1d/wb9VWGXN1NCwbiWs4cWvxReCozD5anmS6zE6sEhQrty3IzYnJZ3ASGawSP pkjA== X-Received: by 10.68.68.143 with SMTP id w15mr14760709pbt.56.1444977782996; Thu, 15 Oct 2015 23:43:02 -0700 (PDT) X-Pgp-Agent: GPGMail 2.6b2 In-Reply-To: <20151015231606.GX10551@port70.net> X-Mailer: Apple Mail (2.3096.4) Xref: news.gmane.org gmane.linux.lib.musl.general:8688 Archived-At: --Apple-Mail=_264AD270-54B7-42D5-9FDF-0958346AAD55 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On Oct 15, 2015, at 4:16 PM, Szabolcs Nagy wrote: > > * Rich Felker [2015-10-15 18:44:25 -0400]: >> On Fri, Oct 16, 2015 at 12:33:20AM +0200, Szabolcs Nagy wrote: >>> it is not possible to write arm asm in a way that pleases all >>> assemblers, here is a summary of the problems relevant to musl: >>> >>> some instructions can be written in several ways since UAL >>> (= unified assembler language) was introduced to unify arm >>> and thumb instruction mnemonics. >>> >>> in case of armhf VFP instructions musl uses the following ones >>> in hand written asm: >>> >>> hex ual old >>> >>> eeb1XacX vsqrt.f32 fsqrts >>> eeb1XbcX vsqrt.f64 fsqrtd >>> eeb0XacX vabs.f64 fabss >>> eeb0XbcX vabs.f64 fabsd >>> eef1Xa10 vmrs fpscr mrc p10,7,.. >>> eee1Xa10 vmsr fpscr mcr p10,7,.. > > sorry, for reading/writing fpscr fmrx/fmxr can be used in the > old syntax instead of vmrs/vmsr, but clang does not know > those names. > >>> the issues: >>> >>> (1) binutils gas rejects UAL VFP instructions unless either >>> the -mfpu= option is passed or the asm source >>> has '.fpu ' directive, the old names work though >>> (if the target is hard float). A gcc toolchain built >>> --with-float=hard but without --with-fpu= does not >>> pass -mfpu to the assembler. >>> >>> (2) Most UAL mnemonics were added in binutils 2.18, older >>> binutils only supports the old syntax. Some UAL mnemonics were >>> added later, vmrs and vmsr only appear in binutils 2.21 >>> (released in 2010). >>> >>> (3) The clang assembler does not support old mnemonics in general >>> but includes a few exceptions (e.g. fabs and fsqrt are supported, >>> but not the mrc or mcr coprocessor instructions). >>> >>> Using UAL asm is the clean solution, but then to fix (1) we >>> should have .fpu directives in the asm files. >>> >>> However the conflict between (2) and (3) means that fenv code >>> using vmrs and vmsr either drops support for old binutils gas >>> or the clang assembler. >> >> It seems we're already using the new forms vsqrt and vabs in >> src/math/armhf/*.s. So using vmrs/vmsr presumably will not break >> support for any toolchains that work now. >> > > vmrs/vmsr can break on old binutils versions (2.18 - 2.20) and > 2.20 is not that ancient.. is that ok? > >> I think the reason this went unnoticed for so long is that Aboriginal >> Linux (the only real user of the ancient binutils, due to GPL v2 vs v3 >> issues) does not use the armhf ABI at all; it only targets standard >> EABI for which musl does not use any math/fenv asm. >> >> So I'm ok with the fpu-related changes proposed, but I'm not sure what >> to do about UAL issues elsewhere. Right now we have a lot of files >> with instructions written as .word in them which is a mess and which >> precludes Cortex-M (thumb2-only) targets. These are files which need >> to be built even on non-hf, so changing them presumably will break >> support for old binutils. As a workaround, users needing old binutils >> could perhaps misuse the ASM_CMD var in the Makefile to run a sed >> script that replaces UAL with old-syntax asm. Or someone could patch >> the old binutils to accept UAL... >> > > most likely ual is the long term solution. thats right. > > maybe it is best to switch to ual and then write that script > if ppl with old binutils run into issues. agree here. --Apple-Mail=_264AD270-54B7-42D5-9FDF-0958346AAD55 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iEYEARECAAYFAlYgnHQACgkQuwUzVZGdMxQV5gCff3FXRK5/BrjctNZBFXk5JP4j JLUAnRpzZUkeueG8qS5v/Km90jBRzPKx =xHQL -----END PGP SIGNATURE----- --Apple-Mail=_264AD270-54B7-42D5-9FDF-0958346AAD55--