🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3547

Re: g++: Shared library, mapfiles, execution speed

#3547
From: Fred Ma
Date: Fri, 14 Mar 2003 09:52
48 lines
3374 bytes
Greg Menke wrote:

> I've not heard of a case where there is any significant difference
> between position independent and non-position independent.

That's reassuring.

> I suspect
> most code ends up compiled independent in any case.  Perhaps it could
> change something in how registers are allocated, but that would be
> something highly architecture specific.
>
> static vs shared is used to create either a dynamically or statically
> linked library.  A static library ends up being an archive of .o files
> that are included in a executable when its linked, whereas a
> dynamically linked library can be attached to an executable at
> runtime.  Optimization is not affected because shared/static is more
> of a linker issue than a compiler issue.  Once the code is in memory
> and the fixups applied to all the symbols, there isn't any difference.

Great.

> When you compile an executable, you're not creating a library, so
> shared/static are not applicable.
>
> >
> > The -shared is obvious, and the -Wl is for the linker.
> > I never used the linker explicitly before, relying on gcc to
> > pull it all together.  Now, I'm looking at "man ld", which
> > is the sunOS5.8 man page, and I'm not sure if it is the same
> > one that gcc uses.  Is there any reason to think otherwise?
>
> A map file is simply a textual representation of some of addresses &
> symbols in the output executable.  Perhaps Matlab is reading the map
> file to get symbol information or some such.  If you're curious about
> looking at compiled code, use objdump -dt against your .o file.
>
> Here, ld is not being invoked separately, the -Wl tells gcc to pass
> along the following parameter when it invokes ld.  You definately
> don't want to be playing around with ld until you know you need to.
>
> Gregm

Well, thanks for the confirmation that I shouldn't be poking around
with ld unnecessarily.  I wasn't looking forward to spending loads
of timing ramping up on a new tool.

Fred
Technical Details
Message-ID: <3E71A652.7371332@doe.carleton.ca>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail
References: <3E70F170.B4EE8B07@doe.carleton.ca> <m3u1e6g0e1.fsf@europa.pienet>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,e2dd6c17ce56ca38
X-Google-Attributes: gid11318c,public
X-Google-Thread: 106e3f,e2dd6c17ce56ca38
X-Google-Attributes: gid106e3f,public
X-Google-Thread: fc89c,e2dd6c17ce56ca38
X-Google-Attributes: gidfc89c,public
X-Google-Thread: 11035d,e2dd6c17ce56ca38
X-Google-Attributes: gid11035d,public
X-Google-ArrivalTime: 2003-03-14 01:57:25 PST
Message-ID: <3E71A652.7371332@doe.carleton.ca>
From: Fred Ma <fma@doe.carleton.ca>
X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.unix.programmer,gnu.gcc.help,comp.soft-sys.matlab,comp.unix.solaris
Subject: Re: g++: Shared library, mapfiles, execution speed
References: <3E70F170.B4EE8B07@doe.carleton.ca> <m3u1e6g0e1.fsf@europa.pienet>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 51
Date: Fri, 14 Mar 2003 04:52:19 -0500
NNTP-Posting-Host: 64.230.75.247
X-Complaints-To: abuse@sympatico.ca
X-Trace: news20.bellglobal.com 1047635760 64.230.75.247 (Fri, 14 Mar 2003 04:56:00 EST)
NNTP-Posting-Date: Fri, 14 Mar 2003 04:56:00 EST
Organization: Bell Sympatico
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail