[Development] how to reduce the relocation <-- Use static qt libraries

song.7.liu at nokia.com song.7.liu at nokia.com
Tue Jul 24 15:22:25 CEST 2012


Yes, the bottleneck of the loading now is the local relocations instead of inter-library's.

So what we want to do will be reducing the number of local relocation.

Based on my understanding, this local relocation should be caused by the "symbol inter-positioning".
And from gcc option -Bsymbolic:
"
When creating a shared library, bind references to global symbols to the definition within the shared library, if any. Normally, it is possible for a program linked against a shared library to override the definition within the shared library. This option is only meaningful on ELF platforms which support shared libraries.
"

But for my case, it's not needed to override the definition within the libqt5.so.
So, besides the prelink solution, I think the compiler (I mean armlink) should provide the ability to disable this symbol inter-positioning, just like the -Bsymbolic in gcc.

Does anyone have idea from the compiler point of view ?

Also I see that Qt also uses the "-Bsymbolic-functions" to do some optimization, is that similar case to reduce the relocation ?

Thanks,
Song

-----Original Message-----
From: development-bounces+song.7.liu=nokia.com at qt-project.org [mailto:development-bounces+song.7.liu=nokia.com at qt-project.org] On Behalf Of ext Thiago Macieira
Sent: Tuesday, July 24, 2012 6:20 PM
To: development at qt-project.org
Subject: Re: [Development] how to reduce the relocation <-- Use static qt libraries

On terça-feira, 24 de julho de 2012 08.42.29, song.7.liu at nokia.com wrote:
> Thanks, but can you detail more about the ELF pre-linking ?

/sbin/prelink

Indeed, I think prelinking is the only solution for your case. Given the statistics I posted on another email, the merging of libraries will not help a lot since the number of relocations that disappear is small.

But note that ELF prelinking requires that the operating system supports it. 
We know that Linux does, but you mentioned that you're using something proprietary.

For me:
$ prelink -p | grep '^/.*Qt'
/home/thiago/obj/qt/qt-4.8-release/lib/libQt3Support.so.4.8.0 [0xdb627b48]
0x0000003834800000-0x0000003834ce5bf8:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtTest.so.4.8.0 [0x9d13ac84]
0x000000381a600000-0x000000381a828af8:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtGui.so.4.8.0 [0x978b2ec7]
0x0000003819400000-0x000000381a189710:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtSql.so.4.8.0 [0x4bc61e3d]
0x0000003825e00000-0x0000003826042ac0:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtWebKit.so.4.9.0 [0xfb691ee5]
0x000000382de00000-0x000000382fac4bf8:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtMultimedia.so.4.8.0 [0x71012a29]
0x000000381fc00000-0x000000381fe2cd30:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtNetwork.so.4.8.0 [0x2d86dad0]
0x0000003817a00000-0x0000003817d6fd98:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtCore.so.4.8.0 [0xaad2da54]
0x0000003816000000-0x0000003816502e30:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtXmlPatterns.so.4.8.0 [0xe849dcfd]
0x0000003831800000-0x0000003831e75900:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtSvg.so.4.8.0 [0x8f513e75]
0x000000381ae00000-0x000000381b058d68:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtDBus.so.4.8.0 [0x73fc0f52]
0x0000003817200000-0x0000003817489eb0:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtOpenGL.so.4.8.0 [0x170b3bfa]
0x0000003830000000-0x00000038303098a0:
/home/thiago/obj/qt/qt-4.8-release/lib/libQtXml.so.4.8.0 [0xc9f92297]
0x0000003817600000-0x0000003817844f28:

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden



More information about the Development mailing list