All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Cort Dougan <cort@fsmlabs.com>
Cc: Andre Hedrick <andre@linux-ide.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Xavier Bestel <xavier.bestel@free.fr>,
	Mark Mielke <mark@mark.mielke.cc>,
	Rik van Riel <riel@conectiva.com.br>,
	David McIlwraith <quack@bigpond.net.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: spinlocks, the GPL, and binary-only modules
Date: Wed, 20 Nov 2002 12:01:36 -0800	[thread overview]
Message-ID: <3DDBEA20.C8E1DC2C@digeo.com> (raw)
In-Reply-To: 20021120124405.C17249@duath.fsmlabs.com

Cort Dougan wrote:
> 
>  A single config option that adds -fno-inline wouldn't be
> fork-worthy.

It takes a 400k patch to make the kernel build with -fno-inline.

The patch is generated by a script which weeds out all the
`extern inline's.  And then you need another little patch which
provides stub implementations of __this_fixmap_does_not_exist() and
__br_lock_usage_bug().

The extern-inline-weeder script is from Jim Houston.


#!/usr/bin/perl
#
# This script changes "extern inline" to "static inline" in header
# files.  I did this so that I could use -finstrument-functions to
# trace Linux kernel code.  The script is pretty stupid if it finds
# extern and inline togther its likely to make a change.  It removes
# the inline from forward references and changes extern to static
# for definitions.

open(FIND, "find . -name \*.[ch] |") || die "couldn't run find on *.[ch]\n";
while ($f = <FIND>) {
	chop $f;
	if (!open(FILE, $f)) {
		print STDERR "Can't open $f\n";
		next;
	}
#	print STDERR "scanning $f\n";
	undef $file_content;
	$file_content = "";
	$modified = 0;
OUT:
	while ($line = <FILE>) {
		# check for comment, ignore lines that start with 
		# a comment.  Ignore block comments
		if ($line =~ /^\s*\/\*.*\*\//) {
			$file_content .= $line;
			next;
		}
		if ($line =~ /^\s*\/\*/) {
			$file_content .= $line;
			while ($line = <FILE>) {
				$file_content .= $line;
				if ($line =~ /\*\//) { 
					next OUT;
				}
			}
			print STDERR "??? $f: end of file in comment?";
			
		}
		if ($line  =~ /extern\s+(.*)(inline|__inline|__inline__)\s/) {
			$extra = 0;
			if ($line =~ /^#define/) {
				# Alpha & ARM have defines
				# for extern inline which I'm
				#ignoring for now.
				$file_content .= $line;
				next;
			}
			while (!($line =~ /;|{/)) {
				if (!($nl = <FILE>)) {
					die "hit EOF... file=$f\n";
				}
				if (++$extra > 8) {
					print STDERR "??? $f: $line";
					last;
				}
				$line .= $nl;
			}
			if ($line =~ /{/) {
				$line =~ s/extern/static/;
				$modified = 1;
			} elsif ($line =~ /;/) {
				$line =~ s/[ 	]*__inline__[ 	]*/ /;
				$line =~ s/[ 	]*__inline[ 	]*/ /;
				$line =~ s/[ 	]*inline[ 	]*/ /;
				$modified = 1;
			}
		}
		$file_content .= $line;
	}
	close(FILE);
	$name = $f . ".orig";
	if ($modified && -e $name) {
		print STDERR "$name already exists - no changes made\n";
		next;
	}
	if ($modified) {
#		if (link($f, $name)) {
#			unlink($f);
#		} else {
#			print STDERR "Can't move $f to $name\n";
#			next;
#		}
		if (!open(FILE, ">$f")) {
			prinf STDERR "Can't open $f for output\n";
			next;
		}
		print FILE $file_content;
		close(FILE);
	}
}

  parent reply	other threads:[~2002-11-20 19:54 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-19 22:09 spinlocks, the GPL, and binary-only modules Jeff Garzik
2002-11-20  1:52 ` Rik van Riel
2002-11-20  2:48   ` Josh Myer
2002-11-20  2:59     ` Rik van Riel
2002-11-20  4:26       ` Ross Vandegrift
2002-11-20  6:41         ` archaios
2002-11-20  5:01           ` Andre Hedrick
2002-11-20  5:24           ` Jon Portnoy
2002-11-20  5:47             ` GPL rant -- was: " Zac Hansen
2002-11-20 14:21         ` Alan Cox
2002-11-20 18:57           ` Andre Hedrick
2002-11-20 19:09             ` Daniel Jacobowitz
2002-11-20 19:32               ` Andre Hedrick
2002-11-20 19:33             ` Alan Cox
2002-11-20 19:11               ` Andre Hedrick
2002-11-20 18:57       ` Thomas Langås
2002-11-20 19:15         ` Dana Lacoste
2002-11-20 18:32           ` nick
2002-11-20 19:50             ` Andre Hedrick
2002-11-20 19:16               ` nick
2002-11-21  2:25           ` Rik van Riel
2002-11-21  5:10             ` TAINTED (Re: spinlocks, the GPL, and binary-only modules) Andre Hedrick
2002-11-20  2:49   ` spinlocks, the GPL, and binary-only modules David McIlwraith
2002-11-20  3:06     ` Rik van Riel
2002-11-20  8:12       ` Mark Mielke
2002-11-20 10:17         ` Xavier Bestel
2002-11-20 14:19           ` Alan Cox
2002-11-20 14:09             ` Richard B. Johnson
2002-11-20 18:54             ` Andre Hedrick
2002-11-20 19:31               ` Cort Dougan
2002-11-20 19:40                 ` Andre Hedrick
2002-11-20 19:44                   ` Cort Dougan
2002-11-20 19:55                     ` Andre Hedrick
2002-11-20 20:41                       ` Jeff Garzik
2002-11-20 21:15                         ` Alan Cox
2002-11-20 22:03                           ` Andre Hedrick
2002-11-20 22:09                             ` Rik van Riel
2002-11-20 22:15                               ` Andre Hedrick
2002-11-20 22:43                             ` Alan Cox
2002-11-20 22:17                               ` Andre Hedrick
2002-11-20 22:36                               ` Larry McVoy
2002-11-20 23:16                                 ` Eli Carter
2002-11-20 20:49                       ` Alan Cox
2002-11-20 20:01                     ` Andrew Morton [this message]
2002-11-20 20:05                       ` Larry McVoy
2002-11-20 18:25           ` Andre Hedrick
2002-11-21 10:36     ` Arjan van de Ven
2002-11-21 13:08       ` Andre Hedrick
2002-11-21 17:02         ` Mark Mielke
2002-11-22  0:00           ` Andre Hedrick
2002-11-21 17:21       ` Jeff Garzik
2002-11-22  6:19         ` Mark Mielke
2002-11-20  4:12   ` Some like it HOT! (Re: spinlocks, the GPL, and binary-only modules) Andre Hedrick
2002-11-20  6:21 ` spinlocks, the GPL, and binary-only modules Andre Hedrick
2002-11-20  7:38 ` Jeremy Fitzhardinge
  -- strict thread matches above, loose matches on Subject: below --
2002-11-20  3:03 David McIlwraith
2002-11-20  6:31 Samium Gromoff
2002-11-20  8:27 ` Mark Mielke
2002-11-20 19:09 Nicholas Berry
     [not found] <fa.fglehrv.95g32b@ifi.uio.no>
     [not found] ` <fa.h7et98v.hjm1of@ifi.uio.no>
2002-11-21  0:03   ` Russ Allbery
     [not found] <fa.ni4tkev.3ge008@ifi.uio.no>
     [not found] ` <fa.onsrmsv.1g08thi@ifi.uio.no>
2002-11-21  9:05   ` Giacomo Catenazzi
2002-11-21 16:54 Herman Oosthuysen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DDBEA20.C8E1DC2C@digeo.com \
    --to=akpm@digeo.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andre@linux-ide.org \
    --cc=cort@fsmlabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@mark.mielke.cc \
    --cc=quack@bigpond.net.au \
    --cc=riel@conectiva.com.br \
    --cc=xavier.bestel@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.