Browse Source

Make it so arch specific stuff can be simpler. Initial attempt at
making CPU_CFLAGS, which should allow things to be optimized per-CPU
and/or per-system.
-Erik

Eric Andersen 22 năm trước cách đây
mục cha
commit
7f90a63f7c
4 tập tin đã thay đổi với 172 bổ sung295 xóa
  1. 1 1
      Rules.mak
  2. 54 189
      extra/Configs/Config.arm
  3. 22 105
      extra/Configs/Config.i386
  4. 95 0
      extra/Configs/Config.in.arch

+ 1 - 1
Rules.mak

@@ -116,7 +116,7 @@ WARNINGS+=-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
 
 
 CFLAGS:=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) \
-	-I$(TOPDIR)include -iwithprefix include -I. -D_LIBC $(ARCH_CFLAGS)
+	-I$(TOPDIR)include -iwithprefix include -I. -D_LIBC $(CPU_CFLAGS) $(ARCH_CFLAGS)
 NATIVE_CFLAGS:=-O2 -Wall
 
 ifeq ($(strip $(DODEBUG)),y)

+ 54 - 189
extra/Configs/Config.arm

@@ -1,193 +1,58 @@
-# Library Configuration rules for uClibc
 #
-# This file contains rules which are shared between multiple Makefiles.  All
-# normal configuration options live in the file named "Config".  You probably
-# should not mess with this file unless you know what you are doing...  
-# 
-# Copyright (C) 2000 by Lineo, inc.
-# Copyright (C) 2000,2001 Erik Andersen <andersee@debian.org>
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/config-language.txt.
 #
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# This program 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Derived in part from the Linux-8086 C library, the GNU C Library, and several
-# other sundry sources.  Files within this library are copyright by their
-# respective copyright holders.
-
-NATIVE_CC = gcc
-
-# If you are running a cross compiler, you may want to set this
-# to something more interesting...  Target architecture is determined
-# by asking this compiler what arch it compiles stuff for.
-CROSS = #arm-linux-
-CC = $(CROSS)gcc
-AR = $(CROSS)ar
-LD = $(CROSS)ld
-NM = $(CROSS)nm
-STRIPTOOL = $(CROSS)strip
-#STRIPTOOL = /bin/true
 
-#
-# just in case someone wants to use it
-ARCH_CFLAGS=
-
-# Set the following to `true' to make a debuggable build, and `false' for
-# production builds.
-DODEBUG = false
-
-# Compiler warnings you want to see 
-WARNINGS=-Wall
-
-# Note that the kernel source you use to compile with should be the same as the
-# Linux kernel you run your apps on.  uClibc doesn't even try to achieve binary
-# compatibility across kernel versions.  So don't expect, for example, uClibc
-# compiled with Linux kernel 2.0.x to implement lchown properly, since 2.0.x
-# can't do that. Similarly, if you compile uClibc vs Linux 2.4.x kernel headers,
-# but then run on Linux 2.0.x, lchown will be compiled into uClibc, but won't
-# work at all.  You have been warned.
-KERNEL_SOURCE=/usr/src/linux
-
-# Set this to `false' if your CPU doesn't have a memory management unit (MMU).
-# Set it to `true' otherwise.
-HAS_MMU = true
-
-# Set this to `false' if you don't have/need basic floating point support
-# support in libc (strtod, printf, scanf).  Set it to `true' otherwise.
-# If this is not true, then libm will not be built.
-HAS_FLOATING_POINT = true
-
-# Set to `true' if you want the math library to contain the full set
-# of C99 math library features.  Costs an extra 35k or so on x86. 
-DO_C99_MATH = false
-
-# Set this to 'false if you don't need shadow password support.
-HAS_SHADOW = false
-
-# Set this to `false' if you don't have/need locale support; `true' otherwise.
-# NOTE: Currently does not affect collation.
-# You must also generate the locale data and associated .h file.
-# See the README in directory extra/locale for details.
-HAS_LOCALE = false
-
-# Set this to `false' if you don't have/need wide char support.
-HAS_WCHAR = false
-
-# This specifies which malloc implementation is used.
-#
-# "malloc" use mmap for all allocations and so works very well on MMU-less
-# systems that do not support the brk() system call.   It is pretty smart 
-# about reusing already allocated memory, and minimizing memory wastage.
-#
-# "malloc-930716" is derived from libc-5.3.12 and uses the brk() system call
-# for all memory allocations.  This makes it very fast.  It is also pretty
-# smart about reusing already allocated memory, and minimizing memory wastage.
-# Because this uses brk() it will not work on uClinux MMU-less systems.
-#MALLOC = malloc 
-MALLOC = malloc-930716
-
-# If you want large file support (greater then 2 GiB) turn this on.
-# Do not enable this unless your kernel provides large file support.
-DOLFS = false
-
-# Posix regular expression code is really big -- 27k all by itself.
-# If you don't use regular expressions, turn this off and save space.
-# Of course, if you only staticly link, leave this on, since it will
-# only be included in your apps if you use regular expressions. 
-INCLUDE_REGEX=true
-
-# If you want to include RPC support, enable this.  RPC is almost never used 
-# for anything except NFS support, so unless you plan to use NFS, leave this
-# disabled.  This is off by default.
-INCLUDE_RPC = false
-
-# Normally we enable just enough RPC support for things like rshd and 
-# nfs mount to work.  If you find you need the rest of the RPC stuff, 
-# then enable this.
-INCLUDE_FULL_RPC = false
-
-# If you want to include support for the next version of the Internet
-# Protocol: IP version 6, enable this.  This is off by default.
-INCLUDE_IPV6 = false
-
-# If you want to include threads support, enable this.  The C library will
-# be compiled thread-safe, and the libpthread library will be built.
-INCLUDE_THREADS = true
-
-# If you want to support only Unix 98 PTYs enable this.  Some older
-# applications may need this disabled.  For most current programs, 
-# you can generally leave this true.
-UNIX98PTY_ONLY = true
-
-# Enable this if /dev/pts is on a devpts or devfs file system.  Both
-# these filesystems automatically manage permissions on the /dev/pts 
-# devices.  You may need to mount this fs on /dev/pts for this to work. 
-# This is true by default.
-ASSUME_DEVPTS = true
-
-
-# If you want to compile the library as PIC code, turn this on.
-# This is automagically enabled when HAVE_SHARED is true
-DOPIC = false
-
-# Enable support for shared libraries?  If this is false, you can
-# ignore all the rest of the options in this file...
-HAVE_SHARED = true
-
-# uClibc has a native shared library loader for some architectures.
-BUILD_UCLIBC_LDSO=true
-
-# If you are using shared libraries, but do not want/have a native
-# uClibc shared library loader, please specify the name of your
-# system's shared library loader here...
-#SYSTEM_LDSO=/lib/ld-linux.so.2
-
-# When using shared libraries, this path is the location where the
-# shared library will be invoked.  This value will be compiled into
-# every binary compiled with uClibc.  
-#
-# BIG FAT WARNING:  
-# If you do not have a shared library loader with the correct name
-# sitting in the directory this points to, your binaries will not run.
-SHARED_LIB_LOADER_PATH=$(DEVEL_PREFIX)/lib
-
-# DEVEL_PREFIX is the directory into which the uClibc development
-# environment will be installed.   The result will look something 
-# like the following:
-#   DEVEL_PREFIX/
-#	lib/            <contains all runtime and static libs>
-#	include/        <Where all the header files go>
-# This value is used by the 'make install' Makefile target.  Since this
-# directory is compiled into the uclibc cross compiler spoofer, you
-# have to recompile if you change this value...
-DEVEL_PREFIX = /usr/$(TARGET_ARCH)-linux-uclibc
-
-# SYSTEM_DEVEL_PREFIX is the directory prefix used when installing
-# bin/arch-uclibc-gcc, bin/arch-uclibc-ld, etc.   This is only used by
-# the 'make install' target, and is not compiled into anything.  This
-# defaults to $DEVEL_PREFIX/usr, but makers of .rpms and .debs will
-# want to set this to "/usr" instead.
-SYSTEM_DEVEL_PREFIX = $(DEVEL_PREFIX)
-
-# DEVEL_TOOL_PREFIX is the directory prefix used when installing
-# bin/gcc, bin/ld, etc.   This is only used by the 'make install'
-# target, and is not compiled into anything.  This defaults to
-# $DEVEL_PREFIX/usr, but makers of .rpms and .debs may want to
-# set this to something else.
-DEVEL_TOOL_PREFIX = $(DEVEL_PREFIX)/usr
-
-# If you want 'make install' to install everything under a temporary
-# directory, the define PREFIX during the install step,
-# i.e., 'make PREFIX=/var/tmp/uClibc install'.
-#PREFIX = $(TOPDIR)/_install
+mainmenu "uClibc C Library Configuration"
+
+menu "Target Architecture Features and Options"
+
+choice
+	prompt "Target Processor Type"
+	default CONFIG_GENERIC_ARM
+	help
+	  This is the processor type of your CPU. This information is used for
+	  optimizing purposes.  To build a library that will run on all ARMCPU
+	  types (albeit not optimally fast), you can specify "Generic Arm" here.
+	  If you pick anything other than "Generic Arm", there is no guarantee 
+	  that uClibc will even run on anything other than the selected processor
+	  type.
+
+	  Here are the settings recommended for greatest speed:
+	  - "Generic Arm" for any ARM core
+	  - "arm7tdmi" an MMU-less ARM core such as those distributed
+	    by Atmel, Samsung, and others.
+	  - "StrongARM" for Intel's StrongARM cores, such as the
+	     StrongARM 110/1100/1110.
+	  - "XScale" for Intel's XScale processors 
+
+	  If you don't know what to do, choose "Generic Arm".
+
+config CONFIG_GENERIC_ARM
+	bool "Generic Arm"
+
+config CONFIG_ARM7TDMI
+	bool "arm7tdmi"
+
+config CONFIG_STRONGARM
+	bool "StrongARM"
+
+config CONFIG_XSCALE
+	bool "XScale"
+
+endchoice
+
+config CPU_CFLAGS
+	string
+	default "" if CONFIG_GENERIC_ARM
+	default "-march=arm7tdmi" if CONFIG_ARM7TDMI
+	default "-march=strongarm" if CONFIG_STRONGARM
+	default "$(call check_gcc,-march=xscale,-march=strongarm)" if CONFIG_XSCALE
+
+source "extra/Configs/Config.in.arch"
+
+endmenu
+
+source "extra/Configs/Config.in"
+
 

+ 22 - 105
extra/Configs/Config.i386

@@ -19,17 +19,15 @@ choice
 
 	  Here are the settings recommended for greatest speed:
 	  - "386" for the AMD/Cyrix/Intel 386DX/DXL/SL/SLC/SX, Cyrix/TI
-	    486DLC/DLC2, UMC 486SX-S and NexGen Nx586.  Only "386" kernels
-	    will run on a 386 class machine.
+	     486DLC/DLC2, UMC 486SX-S and NexGen Nx586.  Only "386" kernels
+	     will run on a 386 class machine.
 	  - "486" for the AMD/Cyrix/IBM/Intel 486DX/DX2/DX4 or
-	    SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
-	  - "586" for generic Pentium CPUs lacking the TSC
-	    (time stamp counter) register.
-	  - "Pentium-Classic" for the Intel Pentium.
+	     SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
+	  - "586" for Intel Pentium and other generic Pentium CPUs
 	  - "Pentium-MMX" for the Intel Pentium MMX.
 	  - "Pentium-Pro" for the Intel Pentium Pro/Celeron/Pentium II.
 	  - "Pentium-III" for the Intel Pentium III
-	    and Celerons based on the Coppermine core.
+	     and Celerons based on the Coppermine core.
 	  - "Pentium-4" for the Intel Pentium 4.
 	  - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D).
 	  - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird).
@@ -48,10 +46,7 @@ config CONFIG_486
 	bool "486"
 
 config CONFIG_586
-	bool "586/K5/5x86/6x86/6x86MX"
-
-config CONFIG_586TSC
-	bool "Pentium-Classic"
+	bool "Pentium/586/K5/5x86/6x86/6x86MX/Winchip-2A/Winchip-3"
 
 config CONFIG_586MMX
 	bool "Pentium-MMX"
@@ -71,9 +66,6 @@ config CONFIG_K6
 config CONFIG_K7
 	bool "Athlon/Duron/K7"
 
-config CONFIG_ELAN
-	bool "Elan"
-
 config CONFIG_CRUSOE
 	bool "Crusoe"
 
@@ -83,105 +75,30 @@ config CONFIG_WINCHIPC6
 config CONFIG_WINCHIP2
 	bool "Winchip-2"
 
-config CONFIG_WINCHIP3D
-	bool "Winchip-2A/Winchip-3"
-
 config CONFIG_CYRIXIII
 	bool "CyrixIII/VIA-C3"
 
 endchoice
 
-config UCLIBC_HAS_MMU
-	bool "Target CPU has a memory management unit (MMU)"
-	default y
-	help
-	  If your target CPU does not have a memory management unit (MMU), 
-	  then answer N here.  Normally, Linux runs on systems with an MMU.  
-	  If you are building a uClinux system, answer N.
-
-	  Most people will answer Y.
-
-config UCLIBC_HAS_FLOATS
-	bool "Enable floating point number support"
-	default y
-	help
-	  This option allows you to entirely omit all floating point number
-	  support from uClibc.  This will cause floating point functions like
-	  strtod() to be entirely omitted from uClibc.  Other functions, such
-	  as printf() and scanf() will still be included in the library, but
-	  will not contain support for floating point numbers.
-
-	  Answering N to this option can reduce the size of uClibc.  Most people
-	  will answer Y.
-
-config HAS_FPU
-	bool "Target CPU has a floating point unit (FPU)"
-	depends on UCLIBC_HAS_FLOATS
-	default y
-	help
-	  If your target CPU does not have a floating management unit (FPU),
-	  but you wish to support floating point functions, then uClibc will
-	  need to be compiled with soft floating point support (-msoft-float).
-	  If your target CPU does not have an FPU or an FPU emulator within the
-	  Linux kernel, then you should answer N.
-
-	  Most people will answer Y.
-
-config DO_C99_MATH
-	bool "Enable full C99 math library support"
-	depends on UCLIBC_HAS_FLOATS
-	default n
-	help
-	  If you want the uClibc math library to contain the full set C99
-	  math library features, then answer Y.  If you leave this set to
-	  N the math library will contain only the math functions that were
-	  listed as part of the traditionla POSIX/IEEE 1003.1b-1993 standard.
-	  Leaving this option set to N will save around 35k on an x86 system.
-
-	  If your applications require the newer C99 math library functions, 
-	  then answer Y.
-
-config WARNINGS
-	string "Compiler Warnings"
-	default "-Wall"
-	help
-	  Set this to the set of gcc warnings you wish to see while compiling.
-
-config KERNEL_SOURCE
-	string "Linux kernel header location"
-	default "/usr/src/linux"
-	help
-	  The kernel source you use to compile with should be the same as the
-	  Linux kernel you run your apps on.  uClibc doesn't even try to achieve binary
-	  compatibility across kernel versions.  So don't expect, for example, uClibc
-	  compiled with Linux kernel 2.0.x to implement lchown properly, since 2.0.x
-	  can't do that. Similarly, if you compile uClibc vs Linux 2.4.x kernel headers,
-	  but then run on Linux 2.0.x, lchown will be compiled into uClibc, but won't
-	  work at all.  You have been warned.
-
-config C_SYMBOL_PREFIX
+config CPU_CFLAGS
 	string
-	default ""
-
-config UCLIBC_UCLINUX_BROKEN_MUNMAP
-	bool
-	depends on !HAS_MMU
-	default y
-
-config HAVE_ELF
-	bool
-	default y
-
-config NO_UNDERSCORES
-	bool
-	default n
-
-config HAVE_DOT_HIDDEN
-	bool
-	default n
+	default "-march=i386" if CONFIG_386
+	default "-march=i486" if CONFIG_486
+	default "-march=i586" if CONFIG_586
+	default "$(call check_gcc,-march=pentium-mmx,-march=i586)" if CONFIG_586MMX
+	default "-march=i686" if CONFIG_686
+	default "$(call check_gcc,-march=pentium3,-march=i686)" if CONFIG_PENTIUMIII
+	default "$(call check_gcc,-march=pentium4,-march=i686)" if CONFIG_PENTIUM4
+	default "$(call check_gcc,-march=k6,-march=i586)" if CONFIG_K6
+	default "$(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)" if CONFIG_K7
+	default "-march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0" if CONFIG_CRUSOE
+	default "$(call check_gcc,-march=winchip-c6,-march=i586)" if CONFIG_WINCHIPC6
+	default "$(call check_gcc,-march=winchip2,-march=i586)" if CONFIG_WINCHIP2
+	default "$(call check_gcc,-march=c3,-march=i586)" if CONFIG_CYRIXIII
+
+source "extra/Configs/Config.in.arch"
 
 endmenu
 
 source "extra/Configs/Config.in"
 
-

+ 95 - 0
extra/Configs/Config.in.arch

@@ -0,0 +1,95 @@
+#
+# For a description of the syntax of this configuration file,
+# see Documentation/kbuild/config-language.txt.
+#
+
+config UCLIBC_HAS_MMU
+	bool "Target CPU has a memory management unit (MMU)"
+	default y
+	help
+	  If your target CPU does not have a memory management unit (MMU), 
+	  then answer N here.  Normally, Linux runs on systems with an MMU.  
+	  If you are building a uClinux system, answer N.
+
+	  Most people will answer Y.
+
+config UCLIBC_HAS_FLOATS
+	bool "Enable floating point number support"
+	default y
+	help
+	  This option allows you to entirely omit all floating point number
+	  support from uClibc.  This will cause floating point functions like
+	  strtod() to be omitted from uClibc.  Other floating point functions, 
+	  such as printf() and scanf() will still be included in the library, 
+	  but will not contain support for floating point numbers.
+
+	  Answering N to this option can reduce the size of uClibc.  Most people
+	  will answer Y.
+
+config HAS_FPU
+	bool "Target CPU has a floating point unit (FPU)"
+	depends on UCLIBC_HAS_FLOATS
+	default y
+	help
+	  If your target CPU does not have a Floating Point Unit (FPU) or a
+	  kernel FPU emulator, but you still wish to support floating point
+	  functions, then uClibc will need to be compiled with soft floating
+	  point support (-msoft-float).  If your target CPU does not have an
+	  FPU or an FPU emulator within the Linux kernel, then you should
+	  answer N.
+
+	  Most people will answer Y.
+
+config DO_C99_MATH
+	bool "Enable full C99 math library support"
+	depends on UCLIBC_HAS_FLOATS
+	default n
+	help
+	  If you want the uClibc math library to contain the full set C99
+	  math library features, then answer Y.  If you leave this set to
+	  N the math library will contain only the math functions that were
+	  listed as part of the traditionla POSIX/IEEE 1003.1b-1993 standard.
+	  Leaving this option set to N will save around 35k on an x86 system.
+
+	  If your applications require the newer C99 math library functions, 
+	  then answer Y.
+
+config WARNINGS
+	string "Compiler Warnings"
+	default "-Wall"
+	help
+	  Set this to the set of gcc warnings you wish to see while compiling.
+
+config KERNEL_SOURCE
+	string "Linux kernel header location"
+	default "/usr/src/linux"
+	help
+	  The kernel source you use to compile with should be the same as the
+	  Linux kernel you run your apps on.  uClibc doesn't even try to achieve binary
+	  compatibility across kernel versions.  So don't expect, for example, uClibc
+	  compiled with Linux kernel 2.0.x to implement lchown properly, since 2.0.x
+	  can't do that. Similarly, if you compile uClibc vs Linux 2.4.x kernel headers,
+	  but then run on Linux 2.0.x, lchown will be compiled into uClibc, but won't
+	  work at all.  You have been warned.
+
+config C_SYMBOL_PREFIX
+	string
+	default ""
+
+config UCLIBC_UCLINUX_BROKEN_MUNMAP
+	bool
+	depends on !UCLIBC_HAS_MMU
+	default y
+
+config HAVE_ELF
+	bool
+	default y
+
+config NO_UNDERSCORES
+	bool
+	default n
+
+config HAVE_DOT_HIDDEN
+	bool
+	default n
+