public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: -fPIC
@ 2001-08-20  0:00 Petter Wahlman
  0 siblings, 0 replies; 4+ messages in thread
From: Petter Wahlman @ 2001-08-20  0:00 UTC (permalink / raw)
  To: Jason Moxham; +Cc: gcc-help

hi!

position independent code (PIC) uses the ebx register to store the address of
the
global offset table (GOT), this register should thus be used with caution.
i belive you'r code references ebx with the "...: "b" (b).." expression.

shared libraries are genarally marginally slower than statically linked libs
because the linker has to dynamically evaluate procedure linkage table entries
(PLT),
and modify the global table offset's memory image accordingly (unless the
LD_BIND_NOW
environment variable is set).


regards

Petter Wahlman


^ permalink raw reply	[flat|nested] 4+ messages in thread

* -fPIC
@ 2004-06-24 15:56 Rajrup Banerjee
  0 siblings, 0 replies; 4+ messages in thread
From: Rajrup Banerjee @ 2004-06-24 15:56 UTC (permalink / raw)
  To: gcc-help

Hi,

Can I make out by just looking at a .o that it has been
compiled using -fPIC option?
Or else how can I differentiate between two binaries(.o) compiled
from the same source file, one with -fPIC option, and one
without it?

Many Thanks and Best Regards,
Rajrup.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -fPIC
@ 2001-08-20  0:00 Petter Wahlman
  0 siblings, 0 replies; 4+ messages in thread
From: Petter Wahlman @ 2001-08-20  0:00 UTC (permalink / raw)
  To: Jason Moxham; +Cc: gcc-help

hi!

position independent code (PIC) uses the ebx register to store the address of
the
global offset table (GOT), this register should thus be used with caution.
i belive you'r code references ebx with the "...: "b" (b).." expression.

shared libraries are genarally marginally slower than statically linked libs
because the linker has to dynamically evaluate procedure linkage table entries
(PLT),
and modify the global table offset's memory image accordingly (unless the
LD_BIND_NOW
environment variable is set).


regards

Petter Wahlman


^ permalink raw reply	[flat|nested] 4+ messages in thread

* -fPIC
@ 2001-08-19 20:30 Jason Moxham
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Moxham @ 2001-08-19 20:30 UTC (permalink / raw)
  To: gcc-help

Using gcc-2.95.3 under linux x86

writing a  C asm wrapper for the "cpuid" instruction

asm volatile("cpuid" : "+a" (a) 
		     : "b" (b) , "c" (c) , "d" (d) : "cc");

works

but if compiled for shared libary  ie with -fPIC
then you get an asm error saying that " bx is allready used"

even changing specific registers to "g" and putting extra "movl" asm
instructions doesnt help

Not yet tried this under gcc-3.0 

I heard that shared libs are slight slower than static libs ?
is this because an extra register is "used" ?

Jason Moxham
j.l.moxham@maths.soton.ac.uk


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-06-24 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-20  0:00 -fPIC Petter Wahlman
  -- strict thread matches above, loose matches on Subject: below --
2004-06-24 15:56 -fPIC Rajrup Banerjee
2001-08-20  0:00 -fPIC Petter Wahlman
2001-08-19 20:30 -fPIC Jason Moxham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).