develooper Front page | perl.perl5.porters | Postings from September 2008

Re: linkers and $cc (Re: FYI - Blead changes to ExtUtils::CBuilder)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
September 2, 2008 07:17
Subject:
Re: linkers and $cc (Re: FYI - Blead changes to ExtUtils::CBuilder)
Message ID:
20080902141726.GZ75181@plum.flirble.org
On Mon, Sep 01, 2008 at 12:08:24PM -0400, Andy Dougherty wrote:

> (Incidentally, I chose the name 'ld' because on SunOS 4.1, that's the 
> command you actually used to build dynamically-loadable modules.)

This dates from Perl 1?
 
> In parrot, I tried to call the command used to link object files and 
> libraries into an executable 'link', since that's what my 
> vaguely-remembered DOS and VMS experience suggested.  I don't think any 
> real confusion has ensued, so it's probably a reasonable name for perl5 to 
> use.
> 
> Alas, I've always worried that introducing it would make things worse, 
> since now the module building utilities would have to look for 
> $Config{link} and institute a fall-back plan if it weren't found.

I added the appended to perltodo

Nicholas Clark

Change 34240 by nicholas@nicholas-plum on 2008/09/02 14:16:13

	Note the task TODO of splitting the linker from the compiler.

Affected files ...

... //depot/perl/pod/perltodo.pod#236 edit

Differences ...

==== //depot/perl/pod/perltodo.pod#236 (text) ====

@@ -329,6 +329,52 @@
 
 Make F<pod/roffitall> be updated by F<pod/buildtoc>.
 
+=head2 Split "linker" from "compiler"
+
+Right now, Configure probes for two commands, and sets two variables:
+
+=over 4
+
+=item * C<cc (cc.U)>
+
+This variable holds the name of a command to execute a C compiler which
+can resolve multiple global references that happen to have the same
+name.  Usual values are F<cc> and F<gcc>.
+Fervent ANSI compilers may be called F<c89>.  AIX has F<xlc>.
+
+=item * ld (dlsrc.U)
+
+This variable indicates the program to be used to link
+libraries for dynamic loading.  On some systems, it is F<ld>.
+On ELF systems, it should be C<$cc>.  Mostly, we'll try to respect
+the hint file setting.
+
+=back
+
+There is an implicit historical assumption, probably from Perl 1, that C<$cc>
+is also the correct command for linking object files together to make an
+executable. This may be true on Unix, but it's not true on other platforms,
+and there are a maze of work arounds in other places (such as F<Makefile.SH>)
+to cope with this.
+
+Ideally, we should create a new variable to hold the name of the executable
+linker program, probe for it in F<Configure>, and centralise all the special
+case logic there or in hints files.
+
+A small bikeshed issue remains - what to call it, given that C<$ld> is already
+taken (arguably for the wrong thing) and C<$link> could be confused with the
+Unix command line executable of the same name, which does something completely
+different. Andy Dougherty makes the counter argument "In parrot, I tried to
+call the command used to link object files and  libraries into an executable
+F<link>, since that's what my vaguely-remembered DOS and VMS experience
+suggested.  I don't think any real confusion has ensued, so it's probably a
+reasonable name for perl5 to use."
+
+"Alas, I've always worried that introducing it would make things worse, 
+since now the module building utilities would have to look for 
+C<$Config{link}> and institute a fall-back plan if it weren't found."
+
+
 =head1 Tasks that need a little C knowledge
 
 These tasks would need a little C knowledge, but don't need any specific

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About