This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support minimum kernel version for glibc build other than CT_KERNEL_VERSION


On Tue, 2008-08-26 at 20:37 +0200, Yann E. MORIN wrote:
> But we could argue for ever on the subject, depending on the kind of
> target
> we are used to... So let's take the current behavior to be the
> default, and
> keep using the kernel headers version, if you will.

That's fine.  I'll keep the current default behavior.  Updated patch is
attached to the end of this message.

> Please note that I have updated the glibc and eglibc config options to
> a
> common file, so that it's easier to add common options (obviously).
> That's
> in rev 960 if you care to update your patch. That's no problem if you
> send
> it against r959, however.

Thanks for the heads up.  I went ahead and updated it against this
change.  Thanks for adding eglibc support by the way!  I actually did
this myself about a month ago when building an e500v2 toolchain, and
fully intended to submit the patches for it... but it's not until now
that I've had time to start submitting patches upstream.  For what it's
worth, your eglibc support seems nicer than my own.

By the way, I just noticed that even though you moved some of the EGLIBC
config options into the glibc-eglibc-common.in file, the libc_eglibc.sh
script still references CT_LIBC_EGLIBC_USE_PORTS instead of
CT_LIBC_GLIBC_USE_PORTS.

Index: scripts/build/libc_glibc.sh
===================================================================
--- scripts/build/libc_glibc.sh	(revision 960)
+++ scripts/build/libc_glibc.sh	(working copy)
@@ -211,7 +211,7 @@
     extra_config=""
     case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
         *enable-kernel*) ;;
-        *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
+        *) extra_config="${extra_config} --enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
     esac
     case "${CT_LIBC_GLIBC_EXTRA_CONFIG}" in
         *-tls*) ;;
@@ -314,7 +314,7 @@
     # We don't need to be conditional on wether the user did set different
     # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
 
-    extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
+    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
 
     case "${CT_THREADS}" in
         nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
Index: scripts/build/libc_eglibc.sh
===================================================================
--- scripts/build/libc_eglibc.sh	(revision 960)
+++ scripts/build/libc_eglibc.sh	(working copy)
@@ -198,7 +198,7 @@
     # We don't need to be conditional on wether the user did set different
     # values, as they CT_LIBC_GLIBC_EXTRA_CONFIG is passed after extra_config
 
-    extra_config="--enable-kernel=$(echo ${CT_KERNEL_VERSION} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
+    extra_config="--enable-kernel=$(echo ${CT_LIBC_GLIBC_MIN_KERNEL} |sed -r -e 's/^([^.]+\.[^.]+\.[^.]+)(|\.[^.]+)$/\1/;')"
 
     case "${CT_THREADS}" in
         nptl)           extra_config="${extra_config} --with-__thread --with-tls";;
Index: config/libc/glibc-eglibc-common.in
===================================================================
--- config/libc/glibc-eglibc-common.in	(revision 960)
+++ config/libc/glibc-eglibc-common.in	(working copy)
@@ -67,3 +67,47 @@
       earlier.
 
       Eg.: crypt        (for very old libces)
+
+config LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
+    bool
+    prompt "Use headers version for minimum kernel version supported"
+    default y
+    help
+      If enabled, crosstool-ng will use the chosen version of kernel
+      headers for the glibc minimum kernel version supported, which is
+      what gets passed to "--enable-kernel=" when configuring glibc.
+
+      Enabling this will ensure that no legacy compatibility code for
+      older kernels is built into your C libraries, but it will
+      be unable to run on kernel versions older than whichever kernel
+      headers version you've built the toolchain for.
+
+      If you know for sure that your toolchain will never need to build
+      applications that will run under a kernel version older than your
+      chosen kernel headers version (CT_KERNEL_VERSION), you can choose
+      "y" here.
+
+config LIBC_GLIBC_MIN_KERNEL_CHOSEN
+    string
+    prompt "Minimum kernel version supported"
+    default "2.6.9"
+    depends on ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
+    help
+      Specify the earliest Linux kernel version you want glibc to
+      include support for.  This does not have to match the kernel
+      headers version used for your toolchain.  This controls what is
+      passed to the "--enable-kernel=" option to the glibc configure
+      script.
+
+      If you want to be able to statically link programs with your
+      toolchain's C library, make sure this kernel version is lower than
+      all kernels you wish to support to avoid "FATAL: kernel too old"
+      errors.  The higher the version you specify, the less legacy code
+      will be built into libc.
+
+      Most people can leave this at the default value of "2.6.9".
+
+config LIBC_GLIBC_MIN_KERNEL
+    string
+    default KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
+    default LIBC_GLIBC_MIN_KERNEL_CHOSEN if ! LIBC_GLIBC_USE_HEADERS_MIN_KERNEL



--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]