-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: non-reproducible builds for some cgo code #20272
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
Comments
In particular, diffing the -S output, the larger object file also contains: 26091a26092,26102
> type..namedata.***uint8. SRODATA dupok size=11
> 0x0000 00 00 08 2a 2a 2a 75 69 6e 74 38 ...***uint8
> type.***uint8 SRODATA dupok size=56
> 0x0000 08 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ................
> 0x0010 a1 e3 63 f9 00 08 08 36 00 00 00 00 00 00 00 00 ..c....6........
> 0x0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> 0x0030 00 00 00 00 00 00 00 00 ........
> rel 24+8 t=1 runtime.algarray+80
> rel 32+8 t=1 runtime.gcbits.01+0
> rel 40+4 t=5 type..namedata.***uint8.+0
> rel 48+8 t=1 type.**uint8+0
26101a26113
> rel 44+4 t=6 type.***uint8+0 |
Broken, it appears, by CL 39915. |
Diagnosis: CL 39915 sorts signats by ShortName for reproducibility. But ShortName treats types However, though this works for |
The simplest fix appears to be to sort both by t.ShortName() and then by t.String(). This always generates the smaller output file, thanks to the fact that |
CL https://golang.org/cl/42955 mentions this issue. |
Reproduce:
Grab the three cgo-generated files from https://gist.github.com/josharian/88c23ec7c4c7c45ac87a539ee18ede5d. These were generated from a slightly minimized, old copy of package github.com/mattn/go-gtk/glib. Run
go tool compile -o a.o *.go
on them multiple times, and check that the output file is identical.Want:
Exactly one canonical output for these inputs.
Have:
Two distinct outputs, one object file that is 240250 bytes and one that is 240092. The difference appears to be in the namedata (type information) symbols that are emitted.
The text was updated successfully, but these errors were encountered: