Re: [PATCH] Support new egcs/pgcc -mpentium(pro) options

Andi Kleen (ak@muc.de)
Sun, 13 Dec 1998 12:34:36 +0100


In muc.lists.linux-kernel, you wrote:
>
>--YiEDa0DAkWCtVeE4
>Content-Type: text/plain; charset=us-ascii
>
>Hello penguinoids,
>
>I have wrote a small patch against 2.1.131-ac9 which implements the
>promised enhanced support for the new egcs/pgcc i386 target submodel
>options such as -mpentium, -mpentiumpro, -march=pentium and
>-march=pentiumpro.

Suggested options for PPro/egcs 1.1:

-O2 -march=pentiumpro -mpentiumpro -fno-gcse

and remove the -malign-* options, because egcs does now a better job
at that. -fno-gcse is needed to prevent code bloat and excessive spill
code on x86 (the global CSE pass does not seem to be well tuned for
register starved machines like the x86 yet). Also it is less risky, because
GCSE does a lot of code movement, which might uncover locking bugs (this
applies if you want a working kernel, if you want to uncover bugs it looks
different ;)

The problem is that gcc 2.7.2 does not understand these new options,
so the Makefiles have to know which compiler version is being used.
Now using a CONFIG_* option to select the kernel compiler is rather
ugly, because the kernel makefile could just check for that itself. For
that something like autoconf would be needed to determine the characteristics
of the compilation host (not of the target, because the kernel might be
cross compiled).

Alternatives are cheap hacks like:

Makefile.pre

#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)

ifdef CONFIG_M686
ARCH_CFLAGS := -fno-gcse -mpentiumpro -march=pentiumpro -DCPU=686
endif

... other processors

#else /* GCC 2.7.x */

ifdef CONFIG_M686
# the bug of -fno-strength-reduce is fixed in 2.7.x minor releases,
# so in theory we could test for that too.
ARCH_CFLAGS := -fno-strength-reduce -m486 -DCPU=686 -malign-loops=2 ....
endif

#endif

Real makefile:

Makefile.cflags: arch/$(ARCH)/Makefile.pre
$(MAKE) -f arch/$(ARCH)/Makefile Makefile.cflags
include arch/$(ARCH)/Makefile.cflags

-Andi
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/