Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

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

Open
zpget opened this issue Jun 7, 2021 · 3 comments
Open

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

zpget opened this issue Jun 7, 2021 · 3 comments

Comments

@zpget
Copy link

zpget commented Jun 7, 2021

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

@yota9
Copy link
Contributor

yota9 commented Jun 7, 2021

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.

@zpget
Copy link
Author

zpget commented Jun 8, 2021

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?

@aaupov
Copy link
Contributor

aaupov commented Jun 8, 2021

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants