avo
avo copied to clipboard
operand,build: support external package symbols
Add support for referencing symbols in other packages. Include an example of calling an external function or (potentially easier) reading a variable from another package.
Related: #39
Onur has expressed interest on this feature on Twitter: https://twitter.com/onkkil/status/1145041747979964416.
As a workaround, it should be possible to use NewDataAddr
. You'll just have to include the annoying unicode dot yourself. So something like the following would give the reference you want.
xyz := operand.NewDataAddr(Symbol{Name: "·xyz"}, 0)
I'd like to provide a cleaner interface for this, but I hope this works for now?
Thanks, it works as expected. Here is a little example.
xyz := operand.NewDataAddr(Symbol{Name: "·xyz"}, 0)
MOVQ(xyz.Offset(8), reg.R8)
Great, glad that worked!