Easy to read Golang assembly output?

后端 未结 5 1775
猫巷女王i
猫巷女王i 2020-12-24 06:13

I\'m interested in examining the x86 assembly output of the standard Go compiler to see if my code is really being converted into reasonably efficient assembly code; hopeful

5条回答
  •  清酒与你
    2020-12-24 07:00

    I don't recommend using the output of -S as the Go linker can change what gets written to the object code quite a lot. It does give you some idea as to what is going on.

    The go assembler output is rather non-standard too.

    When I want to do this I always use objdump which will give you a nice standard assembler output.

    Eg for x86 / amd64

    objdump -d executable > disassembly
    

    And for ARM (to get the register names to be the same as Go uses)

    objdump -M reg-names-raw -d executable > disassembly
    

提交回复
热议问题