Skip to content

Commit 2a679f8

Browse files
mdempskyrsc
authored andcommitted
cmd/link: fix testdata generation
Fixes #8494. LGTM=rsc R=golang-codereviews, gobot, rsc, evankroske CC=golang-codereviews https://golang.org/cl/123040043
1 parent 6c67dd9 commit 2a679f8

File tree

9 files changed

+11
-8
lines changed

9 files changed

+11
-8
lines changed

src/cmd/link/pclntab_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ func checkPCData(t *testing.T, r *SymReader, name string, off, pc, pnum, val int
276276
// readPCData reads the PCData table offset off
277277
// to obtain and return the value associated with pc.
278278
func readPCData(t *testing.T, r *SymReader, name, pcdataname string, pcoff uint32, pc int) (int, bool) {
279+
// "If pcsp, pcfile, pcln, or any of the pcdata offsets is zero,
280+
// that table is considered missing, and all PCs take value -1."
281+
if pcoff == 0 {
282+
return -1, true
283+
}
284+
279285
var it PCIter
280286
for it.Init(r.p, r.data[pcoff:]); !it.Done; it.Next() {
281287
if it.PC <= uint32(pc) && uint32(pc) < it.NextPC {

src/cmd/link/testdata/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ALL=\
99
all: $(ALL)
1010

1111
%.6: %.s
12-
go tool 6a $*.s
12+
GOARCH=amd64 GOOS=darwin go tool 6a -trimpath=$(shell pwd) $*.s
1313

1414
pclntab.s: genpcln.go
1515
go run genpcln.go >pclntab.s

src/cmd/link/testdata/autosection.6

-40 Bytes
Binary file not shown.

src/cmd/link/testdata/autoweak.6

-40 Bytes
Binary file not shown.

src/cmd/link/testdata/dead.6

-230 Bytes
Binary file not shown.

src/cmd/link/testdata/hello.6

-40 Bytes
Binary file not shown.

src/cmd/link/testdata/layout.6

-40 Bytes
Binary file not shown.

src/cmd/link/testdata/link.hello.darwin.amd64

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*
77
00000060 00 00 00 00 00 00 00 00 19 00 00 00 38 01 00 00 |............8...|
88
00000070 5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00 |__TEXT..........|
9-
00000080 00 10 00 00 00 00 00 00 d6 10 00 00 00 00 00 00 |................|
10-
00000090 00 00 00 00 00 00 00 00 d6 10 00 00 00 00 00 00 |................|
9+
00000080 00 10 00 00 00 00 00 00 b0 10 00 00 00 00 00 00 |................|
10+
00000090 00 00 00 00 00 00 00 00 b0 10 00 00 00 00 00 00 |................|
1111
000000a0 07 00 00 00 05 00 00 00 03 00 00 00 00 00 00 00 |................|
1212
000000b0 5f 5f 74 65 78 74 00 00 00 00 00 00 00 00 00 00 |__text..........|
1313
000000c0 5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00 |__TEXT..........|
@@ -21,7 +21,7 @@
2121
*
2222
00000150 5f 5f 66 75 6e 63 74 61 62 00 00 00 00 00 00 00 |__functab.......|
2323
00000160 5f 5f 54 45 58 54 00 00 00 00 00 00 00 00 00 00 |__TEXT..........|
24-
00000170 20 20 00 00 00 00 00 00 b6 00 00 00 00 00 00 00 | ..............|
24+
00000170 20 20 00 00 00 00 00 00 90 00 00 00 00 00 00 00 | ..............|
2525
00000180 20 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ...............|
2626
*
2727
000001a0 19 00 00 00 98 00 00 00 5f 5f 44 41 54 41 00 00 |........__DATA..|
@@ -48,10 +48,7 @@
4848
00001070 00 00 00 00 00 00 00 00 5f 72 74 30 5f 67 6f 00 |........_rt0_go.|
4949
00001080 02 20 00 04 20 00 06 05 02 05 02 05 02 05 02 02 |. .. ...........|
5050
00001090 02 02 02 05 02 02 02 01 00 00 00 00 00 00 00 00 |................|
51-
000010a0 02 00 00 00 88 00 00 00 2f 55 73 65 72 73 2f 72 |......../Users/r|
52-
000010b0 73 63 2f 67 2f 67 6f 2f 73 72 63 2f 63 6d 64 2f |sc/g/go/src/cmd/|
53-
000010c0 6c 69 6e 6b 2f 74 65 73 74 64 61 74 61 2f 68 65 |link/testdata/he|
54-
000010d0 6c 6c 6f 2e 73 00 00 00 00 00 00 00 00 00 00 00 |llo.s...........|
51+
000010a0 02 00 00 00 88 00 00 00 68 65 6c 6c 6f 2e 73 00 |........hello.s.|
5552
*
5653
00002000 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a |hello world.|
5754
0000200c

src/cmd/link/testdata/pclntab.6

-812 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)