BOLT icon indicating copy to clipboard operation
BOLT copied to clipboard

Add -Wl,--emit-relocs or -Wl,-q Leading to performance degradation

Open zpget opened this issue 3 years ago • 3 comments

gcc8.2 add -Wl,--emit-relocs or -Wl,-q Leading 10% cpu degradation

zpget avatar Jun 07 '21 12:06 zpget

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.

yota9 avatar Jun 07 '21 13:06 yota9

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
  1. same code build A with no -q VS B with -q
  2. same qps press on A and B
  3. static container cpu usage test more than 5 times B > A 10%+
  • TEST 2 AA diff
  1. same code build A with no -q
  2. same qps press on A and A
  3. static container cpu usage test more than 5 times CPU cost same

Is there anything influence the -q link?

zpget avatar Jun 08 '21 02:06 zpget

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

aaupov avatar Jun 08 '21 18:06 aaupov