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

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

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
September 1, 2008 01:51
Subject:
linkers and $cc (Re: FYI - Blead changes to ExtUtils::CBuilder)
Message ID:
20080901085116.GF75181@plum.flirble.org
On Sun, Aug 31, 2008 at 08:53:23PM -0500, Ken Williams wrote:
> On Sun, Aug 31, 2008 at 2:00 AM, Reini Urban <rurban@x-ray.at> wrote:
> > cygwin has a good ld setting now (gcc or g++).
> > Before it was ld2, a helper script. Which was stupid. Which you overwrote
> > with gcc. But we want also g++ support for special C++ XS code. That's why
> > we don't want to touch ld.
> 
> I see.  In that case, I'd rather not perform the ld=cc step at all in
> the parent; it's confusing when two wrongs make a right.  Proposed
> patch attached.
> 
> > Why cc?
> > Because SUPER is Unix.pm, which has a special treatment for ld, which is also stupid. So
> > we revert it. We should trust the config.sh and don't try to be smarter. If a ld setting is
> > wrong, fix Configure, not CBuilder.
> 
> However, note that $Config{cc} and $Config{ld} don't pretend to be
> general-purpose compiler & linker commands; they're specifically for
> compiling & linking code for perl modules.  So I'm not sure it would
> be correct to "fix Configure".

Well, Jarkko has said that there is something to fix (I see that it's not
in perltodo.pod), but from memory, it's:

Right now, Configure probes for two commands, and sets two variables:

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 'cc' and 'gcc'.
	Fervent ANSI compilers may be called 'c89'.  AIX has xlc.

ld (dlsrc.U):
	This variable indicates the program to be used to link
	libraries for dynamic loading.  On some systems, it is 'ld'.
	On ELF systems, it should be $cc.  Mostly, we'll try to respect
	the hint file setting.


There is an implicit historical assumption, probably from Perl 1, that $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 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 Configure, and centralise all the special
case logic there or in hints files.

A small bikeshed issue remains - what to call it, given that $ld is already
taken (arguably for the wrong thing) and $link would be confused with the
Unix command line executable of the same name, which does something completely
different.



Nicholas Clark

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