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

Thiago Macieira thiago.macieira at intel.com
Sun Jul 29 15:09:47 CEST 2012


On domingo, 29 de julho de 2012 08.13.20, song.7.liu at nokia.com wrote:
> - actually for loading time, the bottleneck is the R_ARM_ABS32 relocation,
> which is reduced around 97% now !
> 
> Finally the overall loading time is reduced from ~10-20s to ~1s...

Wow! Any chance you can blog about this somewhere? If you don't, I will based 
on your data.

> But I still have some question about the R_ARM_ABS32 relocation.
> 
> It seems if the function is virtual (with "default" visibility), then it
> will be added into .rel.dyn as the R_ARM_ABS32 type, for example: 007b0124 
> 0011a802 R_ARM_ABS32            00311e4b  
> _ZN20QEventDispatcherUNIX13processEventsE6QFlagsIN10QEventLoop17ProcessEven
> tsFlagEE
> 
> Could someone help with below:
> 1. why the virtual function with "default" visibility needs relocation even
> if it's implemented inside ? 

That's what "default" means: the symbol can be interposed by another, from a 
different library. It is possible that another library implements a different 
version of this function.

If it weren't like that, if it resolved to the local library, it would be 
behaviour of "protected" visibility. That is:

> 2. when changed to "protected" visibility, I
> guess it's optimized to add a GOT.PLT entry as a R_ARM_RELATIVE relocation,
> is that true ?

The virtual table gets a relative relocation, true. Virtual calls don't need 
PLT entries since they're always indirect. The PLT for a virtual function only 
shows up if that function is called non-virtually: that is, from the 
constructor, when the full class name was specified or when the compiler could 
prove what class the object is.

-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120729/8fb1317e/attachment.sig>


More information about the Development mailing list