FAQ
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?

--
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

  • Ian Lance Taylor at Apr 3, 2016 at 1:48 pm

    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.
  • Rob Pike at Apr 3, 2016 at 6:42 pm
    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.
  • Nigel Tao at Apr 4, 2016 at 12:14 am

    On Sun, Apr 3, 2016 at 11:48 PM, Ian Lance Taylor wrote:
    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.
    I added gc and !gc build tags, instead of gccgo and !gccgo.

    IIRC there is the possibility of the gc compiler changing its calling
    convention in the distant future (e.g. pass some args in registers
    instead of the stack). If so, we might need separate build tags (and
    separate .s files, at least during transition) for the old and new
    calling conventions. It may make sense then to have a build tag
    convention for asm-syntax and/or calling convention, not just the gc
    vs gccgo compiler, but that's probably another conversation for
    another time.

    --
    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.
  • Aram Hăvărneanu at Apr 4, 2016 at 11:32 am

    On Mon, Apr 4, 2016 at 2:14 AM, Nigel Tao wrote:
    It may make sense then to have a build tag
    convention
    We already have one that would work for this use case, go1.x tags.

    However we never promised we'd keep .s files working, and in fact, we
    broke them at least once before.

    --
    Aram Hăvărneanu

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
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 © 2021 Grokbase