FAQ
I politely object to your use of the word "standard" when referring to
assembly language.

-rob

On Sun, Apr 3, 2016 at 6:48 AM, Ian Lance Taylor wrote:
On Sun, Apr 3, 2016 at 5:20 AM, Nigel Tao wrote:
https://github.com/golang/snappy/issues/27 is a bug where an asm file
(decode_amd64.s) that compiles fine with the gc compiler doesn't with
another compiler, xgcc.

I'm not very experienced with Go compilers other than the gc one.
What's the right fix here? Do I change the .s code or is it a bug in
xgcc, whatever that is? If it's the code, do I need a specific build
tag?
The gc compiler supports its own assembler syntax based on the Plan 9
assembler and implemented in cmd/asm. The gccgo compiler can link
against assembly or C code, but does not support the gc assembler
syntax. Even if did support the gc assembler syntax, it would require
different assembly code as the calling convention is different.

Since you have Go code that can be used instead of the asm code, the
simple fix is to use build tags so that the Go code is used when the
`gccgo` build tag is used. The slightly more complex fix is to write
C code that does the same thing as the asm code, and let it be fully
optimized by the C compiler when using gccgo. The still more complex,
and probably unnecessary, fix is to rewrite the assembly code into
standard syntax, using the appropriate calling convention.

Ian

--
You received this message because you are subscribed to the Google Groups
"golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 5 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedApr 3, '16 at 12:20p
activeApr 4, '16 at 11:32a
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase