Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/asm: cannot assemble return jump #23838

Closed
cherrymui opened this issue Feb 15, 2018 · 1 comment
Closed

cmd/asm: cannot assemble return jump #23838

cherrymui opened this issue Feb 15, 2018 · 1 comment

Comments

@cherrymui
Copy link
Member

The compiler generates return jump using RET instruction with the target in Prog.To. Currently it is not possible to write such instruction in assembly. On many architectures the assembler accepts it but misassembles it.

With (return jump from function with a frame)

TEXT	f(SB),4,$8
	CALL	f1(SB)
	RET	f2(SB)

AMD64: reject with invalid instruction MOVQ f2+8(SP), BP
ARM: assemble to MOVW.P f2+12(R13), R15; ...
ARM64: reject with invalid instruction MOVD.P f2+16(RSP), R30
MIPS: assemble to MOVW f2(R29), R4; ...
PPC64: assemble to MOVD f2(R1), R31; ...
S390X: assemble to MOVD f2(R15), R14; ...

None of them are right.

I will send a CL.

@cherrymui cherrymui self-assigned this Feb 15, 2018
@gopherbot
Copy link

Change https://golang.org/cl/94175 mentions this issue: cmd/asm: fix assembling return jump

@golang golang locked and limited conversation to collaborators Mar 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants