Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/link: tests fail after regenerating testdata on linux_amd64 #8494
After cd'ing into cmd/link/testdata and running "make" on Ubuntu 14.04, running "go test cmd/link" fails: --- FAIL: TestLinkHello (0.01s) prog_test.go:160: testdata/link.hello.darwin.amd64: output file differs at byte 136: have 0xed, want 0xd6 --- FAIL: TestPclntab (0.00s) pclntab_test.go:272: pclntab(func0): at pc=+0x0, pcdata#0=-134217728, want -1 pclntab_test.go:272: pclntab(func1): at pc=+0x0, pcdata#0=-134217728, want -1 pclntab_test.go:272: pclntab(func2): at pc=+0x0, pcdata#0=-134217728, want -1 The first failure seems to be because hello.6 embeds the source path "/Users/rsc/g/go/src/cmd/link/testdata/hello.s", which gets copied into the linker output, and regenerating hello.6 will cause it to contain a new source path depending on the user's checkout directory name. This seems easily fixed by changing cmd/link/testdata/Makefile to pass -trimpath=$PWD to 6a. The second failure is a bit more surprising though. Still investigating.
FWIW, the pclntab_test.go bug was triggered by revision 96917e010ddf9fb400e9e834813a9d3930ae252e. cmd/link/testdata/pclntab.s does not define a PCDATA 0 table, but because of the liblink bug fixed in that CL, 6a previously still emitted a PCDATA table for index 0 that explicitly mapped the entire PC range to -1. With new liblink, 6a emits a "0" value in index 0, which pclntab_test.go was erroneously treating as an offset still. That resulted in trying to parse the symtab header (e.g., 0xfffffffb, in LE encoding) as a varint, which seems to then coincide with the unwanted -134217728 value from the error message.