-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
on linux/amd64, go test -c fmt
produces a binary of 3847664 bytes, however,
go test -c -race fmt
produces a binary of 14653432 bytes, almost 10MB larger!
This issue also affects the 1.4 release.
The problem is that this symbol:
0000000000c09bc0 0000000000982648 d runtime/race(.bss)
which should be put into the bss section, actually consumes space in the binary.
You can also see the problem in the program headers:
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000400040 0x0000000000400040
0x00000000000001f8 0x00000000000001f8 R 1000
INTERP 0x0000000000000be4 0x0000000000400be4 0x0000000000400be4
0x000000000000001c 0x000000000000001c R 1
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
LOAD 0x0000000000000040 0x0000000000400040 0x0000000000400040
0x0000000000458630 0x0000000000458630 R E 1000
LOAD 0x0000000000459000 0x0000000000859000 0x0000000000859000
0x00000000003991d8 0x00000000003991d8 R 1000
LOAD 0x00000000007f3000 0x0000000000bf3000 0x0000000000bf3000
0x00000000009a2fa0 0x00000000009bffe8 RW 1000
DYNAMIC 0x00000000007f3140 0x0000000000bf3140 0x0000000000bf3140
0x0000000000000140 0x0000000000000140 RW 8
TLS 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000010 R 8
GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 RW 8
LOOS+5041580 0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000 0x0000000000000000 8
The file size and mem size for the RW section is almost identical.
The race runtime syso file is correct, our linker somehow failed to put the bss in real bss.
text data bss dec hex filename
159066 484 9971272 10130822 9a9586 src/runtime/race/race_linux_amd64.syso
Should we also fix this for 1.4.1? Every race enabled binary is 10MB larger than it should be right now.