Re: Linux GPL and binary module exception clause?

Nix
2003-12-13T00:12:13Z

[catching up with vast backlog]

On Thu, 4 Dec 2003, viro@parcelfarce.linux.theplanet.co.uk mused:
> FWIW, it would be very nice if somebody did hard and messy work and
> produced lists of in-tree modules using given symbols. Ideally - automated
> that, but that won't be easy to do (quite a few are used only via inlined
> wrappers and in some cases - under an ifdef; many arch-specific exports
> are of that sort).

ISTM that this could be done quite easily with a hacked-up libcpp that
does token pasting and #include processing, but does *not* process #if
statements themselves.

Preprocess every translation unit in the kernel with that, and grep each
of them for every exported symbol in turn, and bingo. :)

I'll have a hack sometime this weekend if nobody else gets around to it.

(Of course, this will say that stuff in #if 0's and other #ifdef
branches that can't be reached is in fact used, but such code isn't
common.)

> Some approximation might be obtained by building all modules and
> doing nm on them, with manual work for non-obvious cases.

Hang on, surely you can tell which symbols in modules are exported just
by looking for expansions of EXPORT_SYMBOL{_GPL}? Why is this bit hard?

I think the problem is you're trying to compile rather than doing a
hacked -E :) we don't need to compile for this, just do most of the
preprocessing phase.

--
`...some suburbanite DSL customer who thinks kernel patches are some
form of military insignia.' --- Bob Apthorpe