On Sat, Dec 03, 2005 at 11:23:02PM +0100, David N. Welton wrote:
> Perhaps the difference is that with the bits and pieces of gcc that you
> get, you don't even realize that you have them, which is different from
>  noting that you have several .jar files floating around in your
> download that aren't under the same terms as the rest of the code.

Sure, I'd hope that the example of httpd binaries using the GPL+linking
exception licensed code helps people overcome that psychical barrier.

Here is a small howto for those playing at home that want to convince
themselves that the ASF has indeed been shipping binaries that use
GPL+linking exception licensed code without bad things happening.

You'll need OS X to play along, chosen because I know Cliff, Geir and
Leo use OS X notebooks, and I'm using httpd as an example because it is
ASF's most popular chunk of code written in C, afaik, and Apple uses it
as part of OS X Server, afair. You may get by gy just grepping the
binaries for the function symbols I listed, but you'd miss out on
looking at the disassembled functions in lovely powerpc assembler. ;)

Let's start with making sure that I've got the licenses right. Go to
http://developer.apple.com/darwin/projects/compiler/ . You'll notice
that Apple describes all the cool stuff that comes with XCode 2.1 a bit
further down the site. Among the cool stuff is stuff licensed under "GPL
with linking exception", namely if you follow the link under:

Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file.  (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
"

at http://developer.apple.com/darwin/licenses/gpl-2-gcc-exception-3.txt
. That license covers

/usr/lib/gcc/darwin/3.3/crt2.o

which we will disassemble to see what is in there.

$ otool -tvV /usr/lib/gcc/darwin/3.3/crt2.o
[snip]

OK, there is a chunk of powerpc assembler code in a few functions.
The functions are
$ otool -tvV /usr/lib/gcc/darwin/3.3/crt2.o | grep :
/usr/lib/gcc/darwin/3.3/crt2.o:
_darwin_unwind_dyld_add_image_hook:
_darwin_unwind_dyld_remove_image_hook:
___darwin_gcc3_preregister_frame_info:

Cool. So we now know there is a bunch of functions in a gcc startup code
file on OS X, and we know their names, one of which seems to be very
gcc-specific, and we know that they are under GPL+linking exception.

Let's go and look at the source code, just to be sure, though.

Go to
http://gcc.gnu.org/viewcvs/trunk/gcc/config/darwin-crt2.c?rev=101314&view=markup
to look at the corresponding gcc source code to that object code file.

And blimey! There they all are, in source code form, all the functions
from above and the license even looks just the same. Okay, looks like it
is indeed code coming from gcc and indeed under GPL+linking exception.

Now, lets go and fetch us a httpd release from apache.org. Since we are
mean bastards trying to prove a point, we'll go and get it straight from
the tried and beaten apache.org server, to avoid "hey, it's a mirror, we
are not responsible for what they put up" excuses.

wget
http://www.apache.org/dist/httpd/binaries/macosx/httpd-2.0.50-powerpc-apple-darwin7.4.0.tar.gz

twiddle thumbs, tar zxvf it, cd into it.

$ file bindist/bin/httpd
bindist/bin/httpd: Mach-O executable ppc

cool! it's a binary and it's executable. Wonder what's in it? Let's
look.

$ otool -tvV bindist/bin/httpd | grep _darwin
_darwin_unwind_dyld_add_image_hook:
_darwin_unwind_dyld_remove_image_hook:
___darwin_gcc3_preregister_frame_info:
00025b0c        addi    r8,r8,___darwin_gcc3_preregister_frame_info
00025b54        addi    r8,r8,___darwin_gcc3_preregister_frame_info

woah! cool! the GPL+linking exception licensed functions are right
there, even the gcc3 specific one, in full glory in the Apache Software
License Version 2.0 licensed binary. And it seems to be OK. In fact,it
seems to have been OK since

[TGZ] httpd-2.0.50-powerpc-apple-darwin7.4.0.tar.gz      02-Jul-2004
10:04   11M  HTTP Server project

judging by http://www.apache.org/dist/httpd/binaries/macosx/

I spare you the one-on-one comparison of the disassembly, as that'd be
pointless, as the ASF is using GPL+linking exception licensed code just
as the license allows it, and just like it is desired, and in particular
since the binary was compiled with a gcc < 3.3, and the code changes
slightly between the releases, and that old gcc version is not part of
XCode on Tiger. But a quick look at the dissembly and the C code in
gcc's CVS should be convincing enough that it is the same code.

A compiler that
imposes crappy restrictions on its output would be a useless toy. But
stuff that has to be woven into the compiled executables that get
distributed around has to be licensed somehow, to keep the lawyers
happy, and the FSF uses that "link your heart out, we don't care" clause
to do that, and make sure people can actually be safe distributing their
stuff under the licenses of their choice, rather than having to limit
themselves to whichever licenses FSF comes up with. They are pretty
pragmatic, when it comes to making sure they end up advancing free
software.

The clever audience taking notes at home will recognize the GPL+linking
exception style of licenses as being just the kind of license GNU
Classpath is distributed under.

> As far as I'm concerned, though, I'd vote for practicality - I don't
> care how 'free java' is licensed, as long as I can link proprietary code
> to it if needs be, and it frees me from using Sun's java, and all the
> restrictions that that entails.

Same here. So, I hope this provides enough of a reason for the
GPL+linking exception style of licenses to be officially blessed, so
that we can get that code in here, finally. ;)

cheers,
dalibor topic

> -- 
> David N. Welton
> - http://www.dedasys.com/davidw/
> 
> Linux, Open Source Consulting
> - http://www.dedasys.com/

Reply via email to