https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116750
Bug ID: 116750
Summary: --coverage generates random .data.rel
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jdavidpeter at gmail dot com
Target Milestone: ---
Execute the following snippet a few times:
echo 'int main(void) { return 0; }' > test.c && g++ -c --coverage test.c -o
test.o && sha1sum test.o
You'll notice that the sha1sum is different each time.
It is because in the generated object file .data.rel will contain random bytes.
objdump -D will show random assembly instructions in .data.rel as it is trying
to parse it.
What is the reason for this behaviour? Is this a bug?
I was trying to track down while running my theoretically fully deterministic
and idempotent builds produced different binary signatures every time.
It would be great if there would be a way to make behaviour deterministic, but
just learning what is the cause would be already much appreciated.