Go does can define functions in a plan9 style assembly file. I have a question about how to compile a plan9 style asm file to an ELF .o object?
在2020年10月20日星期二 UTC+8 上午1:12:45<di...@samantree.com> 写道: > Have a look at https://golang.org/doc/asm > and examples are always a good source of inspiration. For example > https://golang.org/src/math/dim.go at line 35 defines the prototype for > function Max, which is implemented in assembly in > https://golang.org/src/math/dim_amd64.s > > -- Diego > > On Fri, 16 Oct 2020 at 14:38, saurav deshpande <saurav.des...@gmail.com> > wrote: > >> okay, Thank you >> >> On Friday, October 16, 2020 at 6:06:34 PM UTC+5:30 iko...@gmail.com >> wrote: >> >>> I think you can use nasm assembly through inline ASM in cgo >>> indirectly... Go supports writing .s-files written in Go's internal >>> assembly format, which should be much faster than cgo to compile and is >>> probably preferable, but needs a bit of learning. >>> >>> *Joop Kiefte* - Chat @ Spike >>> <https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=q9zcd> >>> [image: q9zcd] >>> >>> On October 16, 2020 at 12:30 GMT, saurav deshpande < >>> saurav.des...@gmail.com> wrote: >>> >>> So, is it possible to define functions declared in go and defined in >>> nasm assembly? If yes then can you please share an example. >>> >>> Thank you >>> >>> On Friday, October 16, 2020 at 5:39:33 PM UTC+5:30 iko...@gmail.com >>> wrote: >>> >>>> I don't know how this should actually be done, but remember that the Go >>>> assembly is not actually Plan 9 assembly, it's an abstraction by itself, >>>> meant for internal use first and foremost. >>>> >>>> *Joop Kiefte* - Chat @ Spike >>>> <https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=q9y39> [image: >>>> q9y39] >>>> >>>> On October 16, 2020 at 10:20 GMT, saurav deshpande < >>>> saurav.des...@gmail.com> wrote: >>>> >>>> >>>> Thank you for the reply. >>>> I do not understand, actually I am trying to define the fuctions in >>>> plan9 assembly whoes declaration is done in a go file. I want to use >>>> macro >>>> like the macro in nasm, but couldn't understand how to do it. >>>> It would be very helpful if you could give an example. >>>> >>>> Thank you. >>>> >>>> >>>> On Friday, October 16, 2020 at 12:07:23 AM UTC+5:30 al...@pbrane.org >>>> wrote: >>>> >>>>> saurav deshpande <saurav.des...@gmail.com> once said: >>>>> > How to implement macro in plan9 assembly? I read the documentation >>>>> of >>>>> > plan9 assembly but could not find it. Is there any alternative for >>>>> > macro in plan9? >>>>> >>>>> Assembly language source files are preprocessed just like C source. >>>>> The familiar #define and #include directives should work as expected. >>>>> >>>>> Anthony >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "golang-nuts" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to golang-nuts...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/golang-nuts/c779e51f-ff41-4686-a843-0830316383c3n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/golang-nuts/c779e51f-ff41-4686-a843-0830316383c3n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/golang-nuts/79b37153-fcc1-4a5f-85ea-6127d28465d8n%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/golang-nuts/79b37153-fcc1-4a5f-85ea-6127d28465d8n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/f1170b24-bcbe-4e2c-8f91-2f992d810203n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/f1170b24-bcbe-4e2c-8f91-2f992d810203n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/1630c8a9-7bed-467a-b16d-f7fe1b17f155n%40googlegroups.com.