mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] Go in ptxdist
Date: Wed, 12 Oct 2016 02:07:57 +0200	[thread overview]
Message-ID: <20161012000757.GA845@archie.localdomain> (raw)
In-Reply-To: <20161011161826.GA19331@archie.localdomain>

On Tue, Oct 11, 2016 at 06:18:26PM +0200, Clemens Gruber wrote:
> Hi,
> 
> On Fri, Oct 07, 2016 at 08:37:55PM +0200, Uwe Kleine-König wrote:
> > I only took a quick look, but there is a return in _sfloat and after
> > that the VFP instructions are executed. And there are no conditional
> > instructions that would prevent a return. So unless I'm missing
> > something the ARMv5 code depends on kernel support.
> 
> They are doing something fancy here: They emulate the floating point
> instructions and then overwrite the LR to avoid returning to those
> hardfloat instructions.

s/LR/PC/g

After the emulation, they increase the program counter to skip the
hardfloat instructions after returning from _sfloat.
https://github.com/golang/go/blob/master/src/runtime/softfloat_arm.go#L648

> 
> See stepflt, _sfloat2 and sfloat2 in:
> https://github.com/golang/go/blob/master/src/runtime/softfloat_arm.go
> 
> As well as _sfloat and _sfloatpanic in:
> https://github.com/golang/go/blob/master/src/runtime/vlop_arm.s
> 
> 
> So, we could start with letting the user choose the GOARM value manually
> with explanations when to use which one:
> GOARM=5 (>=ARMv5 && <=ARMv7, armel with softfloat emulation)
> GOARM=6 (>=ARMv6 && <=ARMv7, armhf with VFPv1, but runs on VFPv2&3 too)
> GOARM=7 (==ARMv7, armhf with VFPv3 only)
> 
> Note:
> GOARM=5 works everywhere from ARMv5 to ARMv7 and does not require a VFP
> unit and no kernel emulation, because all floating point calls are
> emulated within Go itself. The linker inserts the call to _sfloat in
> those binaries. See the links above for the implementation.
> 
> 
> I think we could determine which GOARM version to use from both
> PTXCONF_GNU_TARGET and PTXCONF_CROSS_GCC_CONFIG_EXTRA in
> selected_toolchain/ptxconfig.
> I'd definitely prefer the autodetection, because it is very confusing at
> first which GOARM value is correct and why.
> 
> Bonus feature: Test compile a simple Go program which calls into a C
> library from the project, e.g. glibc. Problem is, we can't execute it.
> But at least we would have "some" problems detected by the linker. (?)
> 
> Thanks,
> Clemens


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2016-10-12  0:08 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
2016-10-07 18:37             ` Uwe Kleine-König
2016-10-11 16:18               ` Clemens Gruber
2016-10-12  0:07                 ` Clemens Gruber [this message]
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=20161012000757.GA845@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