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: TestDisasmExtld fails on darwin/arm64 #49700
Comments
@jsshapiro thanks for the report. What version of the system linker do you have? What is the output of I have one machine with ld64-609.8 and it doesn't fail, and another machine with ld64-711 and it fails even with Go 1.17. Our builders seem to have ld64-609.8 and it passes. |
I have tried in two machines:
1. Apple 2021 MacBook Pro M1 Max (arm64), ld -v reports version
ld64-711, regression tests fail as I reported.
2. Apple 2018 MacBook Pro (Intel Core i9), ld -v reports version
ld64-711, regression tests pass.
If there is some way to roll back the inker version, I'll be happy to try
the earlier version. Apple/ARM is still a rapidly moving target. It's not
really surprising that linker code generation would still be changing at
this point.
Thanks for changing the issue title, by the way. I should know better.
… |
If you have a patch you want tested, feel free to let me know. |
Is it related to the macOS version? (Broken on Monterey, not broken before Monterey?) On the macOS machines I can access, I see
|
Thanks for the information. It seems this is specific to ARM64 using newer system ld (at least ld64-711). I think this is what happening: our PC-line table (for which our objdump uses) contains PCs to functions. On Darwin/ARM64 the binaries are PIE, so the dynamic linker rewrites the binary at load time by applying dynamic relocations. Objdump, being static, just reads the static content from the binary. With the old version of the darwin linker, the static content contains the right PCs that match the functions in the binary. The new version of the darwin linker seems to generate a different kind of dynamic relocations and leaves the static content not matching the function addresses, so objdump couldn't find the line number from the PCs. In general, objdump on PIE binaries needs more work. #17883 may be related. I'll see if there is anything simple we could do. Otherwise for the short term (1.18) we may skip the tests and revisit in the next cycle. |
@rhysh Interesting! it does look like OS-dependent. If I pass |
On Mon, Nov 22, 2021 at 4:56 PM Rhys Hiltner ***@***.***> wrote:
On the macOS machines I can access, I see ./all.bash pass at go1.17.3…
Thanks for reminding g me! I tried running all.bash on the M1 Max machine
on both 1.17.2 and 1.17.3 and got the same failure on both that I got on
Master.
Yeah, this definitely smells like a dynamic linker thing. We ran into some
similar stuff on MIPS 64 at SGI back in the Pleistocene.
|
Change https://golang.org/cl/366695 mentions this issue: |
Change https://go.dev/cl/405474 mentions this issue: |
The macOS 12 builders have an incompatible version of XCode installed. We fixed the bug on 1.18 but not 1.17. Updates #49700. Change-Id: Id356786aad351568ba6665430f093f5f78bb4357 Reviewed-on: https://go-review.googlesource.com/c/go/+/405474 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
This appears to be recent, as I don't recall seeing it when I built master a week ago. Could be a real bug, or could be a valid fix where the reference output didn't get updated. This has me temporarily stuck trying to build locally using go generics.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
git clone from repo (tried both github and origin)
git checkout master
cd src
./all.bash
Currently have go version go1.17.2 darwin/arm64, which was probably used for very early bootstrap.
What did you expect to see?
Successful unit tests completed.
What did you see instead?
--- FAIL: TestDisasmExtld (2.93s)
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-b8671a8435298d43c67d864e10c70b6b.exe -ldflags=-linkmode=external fmthello.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-b8671a8435298d43c67d864e10c70b6b.exe]
objdump_test.go:220: disassembly missing 'fmthello.go:6'
objdump_test.go:232: full disassembly:
TEXT main.main(SB)
:0 0x1000883a0 f9400b90 MOVD 16(R28), R16
:0 0x1000883a4 910003f1 MOVD RSP, R17
:0 0x1000883a8 eb10023f CMP R16, R17
:0 0x1000883ac 540002c9 BLS 22(PC)
:0 0x1000883b0 f81e0ffe MOVD.W R30, -32(RSP)
:0 0x1000883b4 f81f83fd MOVD R29, -8(RSP)
:0 0x1000883b8 d10023fd SUB $8, RSP, R29
:0 0x1000883bc d0000000 ADRP 8192(PC), R0
:0 0x1000883c0 91085c00 ADD $535, R0, R0
:0 0x1000883c4 b27e07e1 ORR $12, ZR, R1
:0 0x1000883c8 94000012 CALL main.Println(SB)
:0 0x1000883cc d00006c2 ADRP 892928(PC), R2
:0 0x1000883d0 91290442 ADD $2625, R2, R2
:0 0x1000883d4 39400042 MOVBU (R2), R2
:0 0x1000883d8 b40000c2 CBZ R2, 6(PC)
:0 0x1000883dc b0000000 ADRP 4096(PC), R0
:0 0x1000883e0 911c9400 ADD $1829, R0, R0
:0 0x1000883e4 b27d03e1 ORR $8, ZR, R1
:0 0x1000883e8 9400000a CALL main.Println(SB)
:0 0x1000883ec 14000004 JMP 4(PC)
:0 0x1000883f0 f85f83fd MOVD -8(RSP), R29
:0 0x1000883f4 f84207fe MOVD.P 32(RSP), R30
:0 0x1000883f8 d65f03c0 RET
:0 0x1000883fc d503201f NOOP
:0 0x100088400 17ffffff JMP -1(PC)
:0 0x100088404 aa1e03e3 MOVD R30, R3
:0 0x100088408 97ff3f82 CALL runtime.morestack_noctxt.abi0(SB)
:0 0x10008840c 17ffffe5 JMP main.main(SB)
--- FAIL: TestDisasmGnuAsm (4.07s)
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-a2fdf6fa5e30e7eb2b8d7d63be13b362.exe fmthello.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -gnu -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-a2fdf6fa5e30e7eb2b8d7d63be13b362.exe]
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-739d837da95c25909d2915651b14619d.exe fmthellocgo.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -gnu -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-739d837da95c25909d2915651b14619d.exe]
objdump_test.go:220: disassembly missing 'fmthellocgo.go:6'
objdump_test.go:232: full disassembly:
TEXT main.main(SB)
:0 0x1000884d0 f9400b90 MOVD 16(R28), R16 // ldr x16, [x28,#16]
:0 0x1000884d4 910003f1 MOVD RSP, R17 // mov x17, sp
:0 0x1000884d8 eb10023f CMP R16, R17 // cmp x17, x16
:0 0x1000884dc 540002c9 BLS 22(PC) // b.ls .+0x58
:0 0x1000884e0 f81e0ffe MOVD.W R30, -32(RSP) // str x30, [sp,#-32]!
:0 0x1000884e4 f81f83fd MOVD R29, -8(RSP) // stur x29, [sp,#-8]
:0 0x1000884e8 d10023fd SUB $8, RSP, R29 // sub x29, sp, #0x8
:0 0x1000884ec d0000000 ADRP 8192(PC), R0 // adrp x0, .+0x2000
:0 0x1000884f0 9108d800 ADD $566, R0, R0 // add x0, x0, #0x236
:0 0x1000884f4 b27e07e1 ORR $12, ZR, R1 // orr x1, xzr, #0xc
:0 0x1000884f8 94000012 CALL main.Println(SB) // bl .+0x48
:0 0x1000884fc d00006c2 ADRP 892928(PC), R2 // adrp x2, .+0xda000
:0 0x100088500 912a0442 ADD $2689, R2, R2 // add x2, x2, #0xa81
:0 0x100088504 39400042 MOVBU (R2), R2 // ldrb w2, [x2]
:0 0x100088508 b40000c2 CBZ R2, 6(PC) // cbz x2, .+0x18
:0 0x10008850c b0000000 ADRP 4096(PC), R0 // adrp x0, .+0x1000
:0 0x100088510 911d1000 ADD $1860, R0, R0 // add x0, x0, #0x744
:0 0x100088514 b27d03e1 ORR $8, ZR, R1 // orr x1, xzr, #0x8
:0 0x100088518 9400000a CALL main.Println(SB) // bl .+0x28
:0 0x10008851c 14000004 JMP 4(PC) // b .+0x10
:0 0x100088520 f85f83fd MOVD -8(RSP), R29 // ldur x29, [sp,#-8]
:0 0x100088524 f84207fe MOVD.P 32(RSP), R30 // ldr x30, [sp],#32
:0 0x100088528 d65f03c0 RET // ret
:0 0x10008852c d503201f NOOP // nop
:0 0x100088530 17ffffff JMP -1(PC) // b .+0xfffffffffffffffc
:0 0x100088534 aa1e03e3 MOVD R30, R3 // mov x3, x30
:0 0x100088538 97ff3f9e CALL runtime.morestack_noctxt.abi0(SB) // bl .+0xfffffffffffcfe78
:0 0x10008853c 17ffffe5 JMP main.main(SB) // b .+0xffffffffffffff94
--- FAIL: TestDisasm (4.08s)
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-ea6f791f716c96f8441f99ba474a41f0.exe fmthello.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-ea6f791f716c96f8441f99ba474a41f0.exe]
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-a6acfb7e9d32782fea9814ad1314bef1.exe fmthellocgo.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-a6acfb7e9d32782fea9814ad1314bef1.exe]
objdump_test.go:220: disassembly missing 'fmthellocgo.go:6'
objdump_test.go:232: full disassembly:
TEXT main.main(SB)
:0 0x1000884d0 f9400b90 MOVD 16(R28), R16
:0 0x1000884d4 910003f1 MOVD RSP, R17
:0 0x1000884d8 eb10023f CMP R16, R17
:0 0x1000884dc 540002c9 BLS 22(PC)
:0 0x1000884e0 f81e0ffe MOVD.W R30, -32(RSP)
:0 0x1000884e4 f81f83fd MOVD R29, -8(RSP)
:0 0x1000884e8 d10023fd SUB $8, RSP, R29
:0 0x1000884ec d0000000 ADRP 8192(PC), R0
:0 0x1000884f0 9108d800 ADD $566, R0, R0
:0 0x1000884f4 b27e07e1 ORR $12, ZR, R1
:0 0x1000884f8 94000012 CALL main.Println(SB)
:0 0x1000884fc d00006c2 ADRP 892928(PC), R2
:0 0x100088500 912a0442 ADD $2689, R2, R2
:0 0x100088504 39400042 MOVBU (R2), R2
:0 0x100088508 b40000c2 CBZ R2, 6(PC)
:0 0x10008850c b0000000 ADRP 4096(PC), R0
:0 0x100088510 911d1000 ADD $1860, R0, R0
:0 0x100088514 b27d03e1 ORR $8, ZR, R1
:0 0x100088518 9400000a CALL main.Println(SB)
:0 0x10008851c 14000004 JMP 4(PC)
:0 0x100088520 f85f83fd MOVD -8(RSP), R29
:0 0x100088524 f84207fe MOVD.P 32(RSP), R30
:0 0x100088528 d65f03c0 RET
:0 0x10008852c d503201f NOOP
:0 0x100088530 17ffffff JMP -1(PC)
:0 0x100088534 aa1e03e3 MOVD R30, R3
:0 0x100088538 97ff3f9e CALL runtime.morestack_noctxt.abi0(SB)
:0 0x10008853c 17ffffe5 JMP main.main(SB)
--- FAIL: TestDisasmCode (4.30s)
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-7f184b50e2cba293836d4b2309588185.exe fmthello.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -S -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-7f184b50e2cba293836d4b2309588185.exe]
objdump_test.go:156: Running [/Users/shap/Dev/Personal/go-generics/bin/go build -o /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-50c34f7265eea30b52665e483079b0c1.exe fmthellocgo.go]
objdump_test.go:209: Running [/var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/testobjdump.exe -S -s main.main /var/folders/tv/wzbzy7hd6fl95qfv0vxd8q700000gn/T/TestObjDump3987775514/hello-50c34f7265eea30b52665e483079b0c1.exe]
objdump_test.go:220: disassembly missing ' Println("hello, world")'
objdump_test.go:232: full disassembly:
TEXT main.main(SB)
0x1000884d0 f9400b90 MOVD 16(R28), R16
0x1000884d4 910003f1 MOVD RSP, R17
0x1000884d8 eb10023f CMP R16, R17
0x1000884dc 540002c9 BLS 22(PC)
0x1000884e0 f81e0ffe MOVD.W R30, -32(RSP)
0x1000884e4 f81f83fd MOVD R29, -8(RSP)
0x1000884e8 d10023fd SUB $8, RSP, R29
0x1000884ec d0000000 ADRP 8192(PC), R0
0x1000884f0 9108d800 ADD $566, R0, R0
0x1000884f4 b27e07e1 ORR $12, ZR, R1
0x1000884f8 94000012 CALL main.Println(SB)
0x1000884fc d00006c2 ADRP 892928(PC), R2
0x100088500 912a0442 ADD $2689, R2, R2
0x100088504 39400042 MOVBU (R2), R2
0x100088508 b40000c2 CBZ R2, 6(PC)
0x10008850c b0000000 ADRP 4096(PC), R0
0x100088510 911d1000 ADD $1860, R0, R0
0x100088514 b27d03e1 ORR $8, ZR, R1
0x100088518 9400000a CALL main.Println(SB)
0x10008851c 14000004 JMP 4(PC)
0x100088520 f85f83fd MOVD -8(RSP), R29
0x100088524 f84207fe MOVD.P 32(RSP), R30
0x100088528 d65f03c0 RET
0x10008852c d503201f NOOP
0x100088530 17ffffff JMP -1(PC)
0x100088534 aa1e03e3 MOVD R30, R3
0x100088538 97ff3f9e CALL runtime.morestack_noctxt.abi0(SB)
0x10008853c 17ffffe5 JMP main.main(SB)
FAIL
FAIL cmd/objdump 6.838s
The text was updated successfully, but these errors were encountered: