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/objdump: incorrect filename for function #32068

Open
josharian opened this issue May 15, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@josharian
Copy link
Contributor

commented May 15, 2019

$ go tool objdump -s cmplx.Inf ../pkg/darwin_amd64/math/cmplx.a
TEXT math/cmplx.Inf(SB) gofile..$GOROOT/src/math/bits.go
  bits.go:27		0x2e24			90			NOPL			
  isinf.go:19		0x2e25			f20f100500000000	MOVSD_XMM 0(IP), X0	[4:8]R_PCREL:$f64.7ff0000000000000	
  isinf.go:20		0x2e2d			f20f11442408		MOVSD_XMM X0, 0x8(SP)	
  isinf.go:20		0x2e33			f20f11442410		MOVSD_XMM X0, 0x10(SP)	
  isinf.go:20		0x2e39			c3			RET			

Note that cmplx.Inf is listed as being in $GOROOT/src/math/bits.go. It looks like cmd/objdump may assume that the first instruction in the function is located within the function. With inlmarks in a prologue-less function, at least, this assumption is false.

Also, why is that inlining mark there in the first place?

cc @randall77 because this is an unintended consequence of inlmarks
cc @dr2chase for all things position

@randall77

This comment has been minimized.

Copy link
Contributor

commented May 16, 2019

Before genssa, we have:

v8 (+21) = InlMark <void> [1] v1
v19 (+17) = InlMark <void> [2] v1
v14 (22) = MOVSDconst <float64> [+Inf] : X0

After genssa, we have:

v8 00006 (?) NOP
v19 00007 (+17) XCHGL	AX, AX
v14 00008 (+21) MOVSD	$(+Inf.0), X0

Yes, there's something odd about the inline mark removal which might need fixing. Somehow instead of removing both marks, it merged one into a real instruction (v8->v14) and maybe that forced it to keep the other one (v19)?

The main bug I'm not surprised about. There's no other place to get position information other than the first instruction. Except maybe the return instruction (if there is one)?

@josharian

This comment has been minimized.

Copy link
Contributor Author

commented May 16, 2019

Another place to look for position information, at least on amd64, is any trailing (padding) INT $3 instructions.

But changing the heuristic to look first for a RET and then at the first instruction if no RET seems like a good place to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.