[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] New 'libm' option group
- To: patches@xxxxxxxxxx
- Subject: [patches] New 'libm' option group
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Sat, 31 Mar 2007 13:54:21 -0700
I've committed the following patch to add 'libm' to its own option
group. The documentation in 'option-groups.def' is meant to explain
what it is and how to use it; if it's not clear, please let me know.
I had started out trying to implement an option group corresponding
exactly to the POSIX_C_LANG_MATH option group appearing in the 2003
spec; part of the original option group plan was to use the
partitioning of functions given there as the blueprints for EGLIBC
option groups. However, this turned out to be tricker than I'd
- Given the way the implementations of libm's functions come from
various places throughout the sysdep tree, it was hard for me to get
a handle on exactly where definitions were coming from, and be sure
that disabling the group would really ensure those functions weren't
present. Being more familiar with the math code would have helped
- libm also contains functions which properly belong in
OPTION_POSIX_C_LANG_SUPPORT, OPTION_XSI_MATH, and
OPTION_XSI_C_LANG_SUPPORT, option groups, and perhaps
OPTION_EGLIBC_BSD_MATH and OPTION_EGLIBC_GNU_MATH option groups.
But in the end, it seems to me that embedded developers concerned
with space --- the audience for option groups --- simply want a
supported way to get rid of libm. Making them check off a series of
committee-designed groupings to accomplish this seems
So I backed off all that, and made the following simple and limited
2007-03-31 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
Add the OPTION_EGLIBC_LIBM option group.
* option-groups.def (OPTION_EGLIBC_LIBM): New entry.
* option-groups.defaults (OPTION_EGLIBC_LIBM): Set default value.
* math/Makefile: include ../option-groups.mak.
Add libm to OPTION_EGLIBC_LIBM option group.
* Makerules (extra-libs, extra-libs-others): Let option groups
control these values, too.
--- math/Makefile (revision 1815)
+++ math/Makefile (working copy)
@@ -21,6 +21,8 @@
subdir := math
# Installed header files.
headers := math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
@@ -35,8 +37,8 @@
# Build the -lm library.
-extra-libs := libm
-extra-libs-others = $(extra-libs)
+extra-libs-$(OPTION_EGLIBC_LIBM) := libm
+extra-libs-others-$(OPTION_EGLIBC_LIBM) = $(extra-libs-$(OPTION_EGLIBC_LIBM))
libm-support = k_standard s_lib_version s_matherr s_signgam \
fclrexcpt fgetexcptflg fraiseexcpt fsetexcptflg \
--- Makerules (revision 1815)
+++ Makerules (working copy)
@@ -406,14 +406,16 @@
# Include targets in the selected option groups.
-routines += $(routines-y)
-others += $(others-y)
-install-bin += $(install-bin-y)
-install-sbin += $(install-sbin-y)
-extra-objs += $(extra-objs-y)
-tests += $(tests-y)
-xtests += $(xtests-y)
-test-srcs += $(test-srcs-y)
+routines += $(routines-y)
+others += $(others-y)
+extra-libs += $(extra-libs-y)
+extra-libs-others += $(extra-libs-others-y)
+install-bin += $(install-bin-y)
+install-sbin += $(install-sbin-y)
+extra-objs += $(extra-objs-y)
+tests += $(tests-y)
+xtests += $(xtests-y)
+test-srcs += $(test-srcs-y)
# Modify the list of routines we build for different targets
--- option-groups.defaults (revision 1815)
+++ option-groups.defaults (working copy)
@@ -10,3 +10,4 @@
# By default, all option groups are enabled.
OPTION_EGLIBC_CATGETS = y
OPTION_EGLIBC_LOCALES = y
+OPTION_EGLIBC_LIBM = y
--- option-groups.def (revision 1815)
+++ option-groups.def (working copy)
@@ -49,3 +49,21 @@
This option group includes all locale definitions other than
that for the "C" locale. If this option group is omitted, then
only the "C" locale is supported.
+ bool "libm (math library)"
+ This option group includes the 'libm' library, containing
+ mathematical functions. If this option group is omitted, then
+ an EGLIBC installation does not include shared or unshared versions
+ of the math library.
+ Note that this does not remove all floating-point related
+ functionality from EGLIBC; for example, 'printf' and 'scanf'
+ can still print and read floating-point values with this option
+ group disabled.
+ Note that the ISO Standard C++ library 'libstdc++' depends on
+ EGLIBC's math library 'libm'. If you disable this option
+ group, you will not be able to build 'libstdc++' against the
+ resulting EGLIBC installation.