-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Commit 03a849f
cgo/out: include path to line macros to avoid build tmp directory being embedded
When the external linker is used the work directory of the compiler is
embedded into compressed sections of the LTO objects. Making them
unreproducible between builds.
The culprit seems to be fact that the line macros uses bare symbol
names, and GCC prepends each symbol with current directory when
compiling.
These files are included when building the final build id stamped into
the binary, thus they should be identical between builds.
Reproduction of the issue:
$ CGO_CFLAGS='-flto' go build -work -trimpath -ldflags '-linkmode=external' main.go
WORK=/tmp/go-build2408155205
$ cd /tmp/go-build2408155205/b001
$ objdump -h ./_x002.o | grep GoStringLen
7 .gnu.lto__GoStringLen.0.6b7d5558e3553715 0000013b 0000000000000000 0000000000000000 0000009c 2**0
$ objcopy ./_x002.o /dev/null --dump-section .gnu.lto__GoStringLen.0.6b7d5558e3553715=GoStringLen.zst
$ unzstd ./GoStringLen.zst
$ strings GoStringLen
/tmp/go-build2408155205/b001
cgo-builtin-prolog1 parent d15515a commit 03a849f
1 file changed
+7
-7
lines changedLines changed: 7 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1471 | 1471 |
| |
1472 | 1472 |
| |
1473 | 1473 |
| |
1474 | - | ||
1474 | + | ||
1475 | 1475 |
| |
1476 | 1476 |
| |
1477 | 1477 |
| |
| |||
1535 | 1535 |
| |
1536 | 1536 |
| |
1537 | 1537 |
| |
1538 | - | ||
1538 | + | ||
1539 | 1539 |
| |
1540 | 1540 |
| |
1541 | 1541 |
| |
| |||
1577 | 1577 |
| |
1578 | 1578 |
| |
1579 | 1579 |
| |
1580 | - | ||
1580 | + | ||
1581 | 1581 |
| |
1582 | 1582 |
| |
1583 | 1583 |
| |
| |||
1766 | 1766 |
| |
1767 | 1767 |
| |
1768 | 1768 |
| |
1769 | - | ||
1769 | + | ||
1770 | 1770 |
| |
1771 | 1771 |
| |
1772 | 1772 |
| |
| |||
1873 | 1873 |
| |
1874 | 1874 |
| |
1875 | 1875 |
| |
1876 | - | ||
1876 | + | ||
1877 | 1877 |
| |
1878 | 1878 |
| |
1879 | 1879 |
| |
| |||
1906 | 1906 |
| |
1907 | 1907 |
| |
1908 | 1908 |
| |
1909 | - | ||
1909 | + | ||
1910 | 1910 |
| |
1911 | 1911 |
| |
1912 | 1912 |
| |
| |||
1968 | 1968 |
| |
1969 | 1969 |
| |
1970 | 1970 |
| |
1971 | - | ||
1971 | + | ||
1972 | 1972 |
| |
1973 | 1973 |
| |
1974 | 1974 |
| |
|
0 commit comments