[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] gcc og -PIC



Mark Wrobel <sslug@sslug> writes:

> Jeg har et kort spørgsmål
> Hvorfor skal man huske at bruge gcc flaget -PIC når man kompilerer et
> objekt der skal indgå i et shared lib?

Når man linker et shared object ved man ikke hvilken virtuel adresse
den vil ende op på (i modsætning til et normalt program).

Hvis man ikke bruger -fPIC, skal run-time linkeren tilrette adresserne
i koden når et .so åbnes. Dette gør at koden ikke kan deles mellem
flere processer (og der er vist nogle platforme hvor det slet ikke kan
lade sig gøre at bruge shared objects uden -fPIC).

Hvis du bruger -fPIC skal der stadig laves fixups -- men de laves i et
meget lille segment og hovdeparten af koden forbliver delt. PIC kode
er dog langsommere at eksekvere fordi det skal gøre visse ting
indirekte via det segment.

Her er noget mere interessant information:

http://groups.google.com/groups?th=a710e588a64354e7

-- 
===============================================================
<sslug@sslug>                           Herlev, Denmark     
<URL:http://www.andreasen.org/>                             <*>   
===============================================================



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *