BOLT
BOLT copied to clipboard
Add -Wl,--emit-relocs or -Wl,-q Leading to performance degradation
gcc8.2 add -Wl,--emit-relocs or -Wl,-q Leading 10% cpu degradation
How did you measured it? The -q option just adds a few information non-allocatable sections, it must not influence on the performance. You can strip you binary and it should be the same, as without -q linker option.
How did you measured it? The -q option just adds a few information non-allocatable sections, it must not influence on the performance. You can strip you binary and it should be the same, as without -q linker option.
- TEST 1 AB diff
- same code build A with no -q VS B with -q
- same qps press on A and B
- static container cpu usage test more than 5 times B > A 10%+
- TEST 2 AA diff
- same code build A with no -q
- same qps press on A and A
- static container cpu usage test more than 5 times CPU cost same
Is there anything influence the -q link?
To reiterate what @yota9 said:
-q/--emit-relocs
option instructs linker to preserve relocation sections, but these sections are not loaded into memory during the execution (they are non-allocatable). So the B side will only take more space on disk, but not in the memory during the execution. The option doesn't affect code generation. Text section contents should be identical between A side and B side - you can check that using objdump -dj.text
.
Binutils reference: https://sourceware.org/binutils/docs/ld/Options.html