Performance 如何衡量GCC链接选项-Wl,-z,relro,-z对ARM上二进制启动的性能影响

Performance 如何衡量GCC链接选项-Wl,-z,relro,-z对ARM上二进制启动的性能影响,performance,gcc,binary,startup,elf,Performance,Gcc,Binary,Startup,Elf,我试图找到一种方法来衡量在ARM平台上使用relro和早期绑定链接选项对启动性能的影响 1470: number of relocations: 90 1470: number of relocations from cache: 3 1470: number of relative relocations: 1207 Thu Jan 1 00:17:00 UTC 1970 1470:

我试图找到一种方法来衡量在ARM平台上使用relro和早期绑定链接选项对启动性能的影响

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3
有人可以建议我如何找到使用该选项编译的二进制文件链接共享库所花费的时间

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3
非常感谢

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3

编辑1: 我的机器上没有时间信息

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3
root@arm:/#LD#u DEBUG=statistics/bin/date

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3

如果您使用的是GLIBC:

  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3
$ LD_DEBUG=statistics /bin/date
      4494:
      4494:     runtime linker statistics:
      4494:       total startup time in dynamic loader: 932928 clock cycles
      4494:                 time needed for relocation: 299052 clock cycles (32.0%)
      4494:                      number of relocations: 106
      4494:           number of relocations from cache: 4
      4494:             number of relative relocations: 1276
      4494:                time needed to load objects: 420660 clock cycles (45.0%)
Fri Feb 28 16:40:48 PST 2014

使用和不使用
-z,relro
构建二进制文件,并比较数字。

不幸的是,在ARM体系结构上,输出是不同的,并且没有给出任何时间度量。@boos ARM与x86不太可能有任何关系。您可能正在使用的C运行时库(
libc
)不是
GLIBC
。阅读该库的资源和/或增强它以产生您需要的信息可能会有所帮助。至少,更新您的问题,说明您实际使用的运行库。
  1470:                      number of relocations: 90
  1470:           number of relocations from cache: 3
  1470:             number of relative relocations: 1207 Thu Jan  1 00:17:00 UTC 1970
  1470:     
  1470:     runtime linker statistics:
  1470:                final number of relocations: 108
  1470:     final number of relocations from cache: 3