From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] Go in ptxdist
Date: Fri, 7 Oct 2016 18:47:27 +0200 [thread overview]
Message-ID: <20161007164727.GA25453@archie.localdomain> (raw)
In-Reply-To: <20161006091740.ucqtuzagmi5benl7@pengutronix.de>
Hi,
On Thu, Oct 06, 2016 at 11:17:40AM +0200, Michael Olbrich wrote:
> This is still not clear. 'use VFPv3' does not imply armhf ABI. You can mix
> code that uses VFPv3 with code that only uses ARMv5 features, as long as
> both use the same ABI (armel). But you cannot mix armel and armhf code.
To determine the ABI, I built 3 different Go hello world binaries and
looked at the headers.
First I tried with file and readelf but that did not help much.
Only the entry points differ between GOARM=5 and GOARM=7.
1: env GOOS=linux GOARCH=arm GOARM=5 go build hello.go
file: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV)
readelf -h | grep Entry: 0x71620
readelf -h | grep Flags: 0x5000002, Version5 EABI, <unknown>
2: env GOOS=linux GOARCH=arm GOARM=6 go build hello.go
file: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV)
readelf -h | grep Entry: 0x693cc
readelf -h | grep Flags: 0x5000002, Version5 EABI, <unknown>
3: env GOOS=linux GOARCH=arm GOARM=7 go build hello.go
file: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV)
readelf -h | grep Entry: 0x69300
readelf -h | grep Flags: 0x5000002, Version5 EABI, <unknown>
--
Marc wrote that in armel, floating point values are passed via normal
32-bit registers (r0, r1, .. ?) instead of VFP registers (s0, s1, .. /
d0, d1, .. ?)
So I disassembled the hello world binaries..
All contain single- and double-precision VFP floating point register
accesses like the following:
112fc: ed932a00 vldr s4, [r3]
But the first binary, built with GOARM=5, always has a branch before
floating point instructions or floating point registers are used.
It looks like this:
112fc: eb01823f bl 71c00 <_sfloat>
After the jump to _sfloat there are no VFP register accesses, only
regular integer registers and non-VFP instructions.
The second and third one, built with GOARM=6 and 7 do not even have
_sfloat and seem to use VFP registers unconditionally.
--
So, does this mean that they use armel EABI for GOARM=5 to stay
compatible with softfloat but take advantage of VFP if it is available?
(Similar to the GCC option -mfpu=softfp?)
And armhf for GOARM=6 and GOARM=7 where they do not have a softfloat
fallback and also use ARMv7 instructions like dmb with GOARM=7.
(The latter does not occur in my basic hello world example)
If you want to have a look at the disassemblies, I uploaded them here:
Search for runtime.f32hash to see the differences I spoke of.
And take a look at line 100968 of the disassembly hello_goarm5.S to see
the _sfloat instructions.
GOARM=5
https://gist.githubusercontent.com/clemensg/66d44f4149f0f4b38810a95125369de1/raw/d931d0ce89cde08569abce939953270a71d1e560/hello_goarm5.S
GOARM=6
https://gist.githubusercontent.com/clemensg/72deef3935eb4a6549172ab8c8d54848/raw/a8b32d0811848c3a352a0a77cdcf863da88aba68/hello_goarm6.S
GOARM=7
https://gist.githubusercontent.com/clemensg/14a5b1d606c974bc5f2890f02afedcc7/raw/4bc269e93eb21486b8dfcef69f9f695c65a59093/hello_goarm7.S
> I think we can rely on a host Go compiler to build 'our' Go compiler. We do
> the same thing with the C compiler and similar things. I think we may want
> to add it to 'ptxdist setup' or something like that, so that the user can
> specify a defined version.
OK, sounds good.
Clemens
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
next prev parent reply other threads:[~2016-10-07 16:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 15:23 Clemens Gruber
2016-10-05 13:13 ` Michael Olbrich
2016-10-05 15:55 ` Clemens Gruber
2016-10-05 16:31 ` Michael Olbrich
2016-10-05 20:42 ` Clemens Gruber
2016-10-06 9:17 ` Michael Olbrich
2016-10-07 16:47 ` Clemens Gruber [this message]
2016-10-07 18:37 ` Uwe Kleine-König
2016-10-11 16:18 ` Clemens Gruber
2016-10-12 0:07 ` Clemens Gruber
2016-10-06 6:33 ` Uwe Kleine-König
2016-10-06 10:04 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161007164727.GA25453@archie.localdomain \
--to=clemens.gruber@pqgruber.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox