Re: test10-pre7

Peter Samuelson
2000-11-01T02:33:51Z

[Linus]
> But it doesn't even WORK.
>
> You need to have
>
> LINK_FIRST1
> LINK_FIRST2
> LINK_FIRST3
> ...
>
> etc to get the proper ordering.

??? No you don't. Perhaps you mean something else. Here's how
LINK_FIRST works:

Say you have foo.o, bar.o, baz.o and lots of other objects. foo.o must
come before bar.o which must come before baz.o which must come before
some other object. But of course all of the above are conditional:
they can be configured as modules, or not at all.

LINK_FIRST := foo.o bar.o baz.o

obj-$(CONFIG_BAR) += bar.o
obj-$(CONFIG_BAZ) += baz.o
obj-$(CONFIG_BLURFL) += blurfl.o
obj-$(CONFIG_FOO) += foo.o
obj-$(CONFIG_...).....

Problem solved. If CONFIG_FOO=y CONFIG_BAR=n CONFIG_BAZ=y etc, link
order is

foo.o baz.o {everything else}

In short, LINK_FIRST/LINK_LAST take care of any case I can think of in
the kernel. Including things like "buslogic and aha174x must come
before aha1520, but the two parallel zip drivers must come last in
drivers/scsi because you don't want to renumber scsi drives more than
you have to" or "certain ISA cards must come after ne.c because of
autoprobe lockups on cheap ne clones, but ne2kpci should come *before*
ne so ne won't get the pci cards".

> In many other cases, like SCSI, we need almost _total_ ordering. For such
> a case, theer is no "first" or "last" - there is a well-specific ORDER.

I don't understand why we need *total* ordering -- I am only aware of a
few specific requirements.

Anyway, we still need to remove duplicates. NCR53c9x.o appears a lot.
If we can make all those cases go away by use of CONFIG_SCSI_53C9X or
something, I will be a lot happier. Your proposed method,

obj-53C9X-$(CONFIG_SCSI_MCA_53C9X) := y
obj-53C9X-$(CONFIG_SCSI_OKTAGON) := y
obj-$(obj-53C9X-y) := y
obj-$(obj-53C9X-m) := m

is definitely less ugly than a lot of what we do now ... but I still
don't like it. Mostly because each shared object file creates
special-case code in the makefile.

> The only way it would work is to make LINK_FIRST maintain the order,
> but once you do that LINK_FIRST is completely superfluous, as it ends
> up being exactly the same as $(obj-y).

The theory behind LINK_FIRST is that most drivers do not care about
their order: the ones that do are the exception, not the rule. If in
fact you *do* care about the order of every last driver in the kernel,
then I agree that LINK_FIRST is a bad idea.

> So trust me, LINK_FIRST/LINK_LAST is not going to happen.

> And if you really want to remove duplicates, at worst we can even use
> an external program for it - which would solve all these things once
> and for all.

This is true. Mainly what we disagree on is which method is the bigger
kludge. (:

Peter