Skip to content

Commit 98fd8d9

Browse files
Wei Xiaobradfitz
Wei Xiao
authored andcommitted
arm64/arm64asm: strip comments of objdump 2.29
Objdump (2.29) generates new format of comments starting with "//" instead of original ";", e.g: "csinv x23, x2, x19, cc // cc = lo, ul, last". Improve test generation framework to recognize and strip such comments. Fixes golang/go#23237 Change-Id: I0ccf70791f43d696b0e20ded7f284eb277bea31c Reviewed-on: https://go-review.googlesource.com/85476 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent ea034f7 commit 98fd8d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arm64/arm64asm/objdumpext_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ func objdump(ext *ExtDis) error {
172172
var (
173173
undefined = []byte("undefined")
174174
unpredictable = []byte("unpredictable")
175+
slashslash = []byte("//")
175176
)
176177

177178
func parseLine(line []byte, encstart []byte) (addr uint64, enc []byte, text string) {
@@ -204,9 +205,16 @@ func parseLine(line []byte, encstart []byte) (addr uint64, enc []byte, text stri
204205
text = "unpredictable"
205206
return
206207
}
208+
// Strip trailing comment starting with ';'
209+
// e.g: "csinv x23, x2, x19, cc ; xxx"
207210
if i := bytes.IndexByte(line, ';'); i >= 0 {
208211
line = bytes.TrimSpace(line[:i])
209212
}
213+
// Strip trailing comment starting with "//"
214+
// e.g: "fccmpe s2, s9, #0x7, ne // xxx"
215+
if i := bytes.Index(line, slashslash); i >= 0 {
216+
line = bytes.TrimSpace(line[:i])
217+
}
210218
text = string(fixSpace(line))
211219
return
212220
}

0 commit comments

Comments
 (0)