[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libdfp-patches] Fix regression where -fpic and -mcpu="foo" aren't passed to libdecnumber submake
- To: libdfp-patches <libdfp-patches@xxxxxxxxxx>
- Subject: [libdfp-patches] Fix regression where -fpic and -mcpu="foo" aren't passed to libdecnumber submake
- From: Ryan Arnold <rsa@xxxxxxxxxx>
- Date: Mon, 17 Jan 2011 12:50:31 -0600
I've checked in the following patch.
r12582 | ryanarn | 2011-01-17 12:42:34 -0600 (Mon, 17 Jan 2011) | 19 lines
An earlier change which removed the passing of the environment flags to the
libdecnumber submake invocation caused a regression where -f[pic|PIC] and
-mcpu="foo" aren't being passed to the libdecnumber 'make' stage, which caused
a segv on system Z, but was ultimately a regression on all platforms. The
following checkin corrects this problem.
2011-01-17 Ryan S. Arnold <rsa@xxxxxxxxxx>
* configure: Regenerated.
* configure.ac: Removed addition of -fPIC to CFLAGS and instead export
it to Makefile.in who is now responsible for adding it to CFLAGS. Set
(picflags): Default to -fpic since the GOT for libdfp should be small
enough that -fPIC isn't needed.
* Makefile.in: (BACKEND_CFLAGS): New variable which passes -mcpu=foo
and -fpic to the backend sub make invocation in -DEFS to get around
the fact that libdecnumber/Makefile.in won't allow overridden CFLAGS.
* sysdeps/dpd/dpd-private.c: Fixed 'used when uninitialized' warning
by switching "else if" case to "else" for Decimal128.
Ryan S. Arnold
IBM Linux Technology Center
Libdfp Maintainer
Index: configure
===================================================================
--- configure (revision 12265)
+++ configure (working copy)
@@ -276,7 +276,7 @@
ac_unique_file="printf_dfp.c"
ac_subdirs_all="$ac_subdirs_all libdecnumber"
ac_subdirs_all="$ac_subdirs_all libbid"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend mzarch with_dfp with_fp base_machine machine CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT OBJDUMP AS ASFLAGS libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend mzarch with_dfp with_fp base_machine machine CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT OBJDUMP AS ASFLAGS libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared picflag submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -2684,11 +2684,14 @@
fi;
-picflag="-fPIC";
-if test "$enable_shared" = "shared"; then
- CFLAGS="$CFLAGS $picflag"
-fi
+# Should be ok if we build static with this turned on. If the linker
+# complains that the GOT is too big this may need to be upgraded to -fPIC so
+# we get full addressibility.
+picflag="-fpic"
+{ echo "$as_me:$LINENO: configuring with \"$picflag\"" >&5
+echo "$as_me: configuring with \"$picflag\"" >&6;}
+
# Compute the list of sysdeps directories.
echo "$as_me:$LINENO: checking sysdep dirs" >&5
echo $ECHO_N "checking sysdep dirs... $ECHO_C" >&6
@@ -3709,6 +3712,7 @@
s,@glibc_build@,$glibc_build,;t t
s,@enable_static@,$enable_static,;t t
s,@enable_shared@,$enable_shared,;t t
+s,@picflag@,$picflag,;t t
s,@submachine@,$submachine,;t t
s,@submachine_opt@,$submachine_opt,;t t
s,@sysdep_dirs@,$sysdep_dirs,;t t
Index: Makefile.in
===================================================================
--- Makefile.in (revision 12265)
+++ Makefile.in (working copy)
@@ -71,6 +71,15 @@
asflags-cpu = $(submachine_opt)
endif
+picflag = @picflag@
+
+# Yes this is a bit of a hack, but gcc/libdecnumber/Makefile won't allow
+# CFLAGS to be overridden on a submake invocation.
+BACKEND_CFLAGS=
+ifeq (libdecnumber, $(dfp_backend))
+BACKEND_CFLAGS=$(cflags-cpu) $(picflag)
+endif
+
default_cflags := @CFLAGS@
default_asflags := @ASFLAGS@
@@ -79,8 +88,8 @@
+cflags := $(filter-out -I%,$(default_cflags))
endif
-# Add -mcpu=<CPU> targets.
-+cflags += $(cflags-cpu)
+# Add -mcpu=<CPU> targets and -f[pic|PIC].
++cflags += $(cflags-cpu) $(picflag)
# Don't duplicate options.
+cflags := $(sort $(+cflags))
@@ -172,12 +181,14 @@
@echo Processing Makefiles: $(makefile_dirs)
# Configure will have generated the Makefile for the selected backend. Let's
-# add it to the subdir list so it gets recursively invoked by Make. We pass
-# CFLAGS as a precaution. Don't pass -e to make or it could pull unwanted
-# variables from the environment.
+# add it to the subdir list so it gets recursively invoked by Make. Don't pass
+# -e to make or it could pull unwanted variables from the environment.
+# Yes, passing $(BACKEND_CFLAGS) in -DEFS is a hack, but since the
+# libdecnumber maintainers won't allow CFLAGS to be overridden and the libdfp
+# maintainer doesn't want to use libtool this hack will have to stand.
$(dfp_backend)/$(dfp_backend_lib):
@echo "+Building DFP backend $@"
- DEFS="-D__STDC_DEC_FP__=200704L $(mzarch)" CFLAGS="$(CFLAGS)" $(MAKE) -C $(dfp_backend)
+ DEFS="-D__STDC_DEC_FP__=200704L $(mzarch) $(BACKEND_CFLAGS)" $(MAKE) -C $(dfp_backend)
@echo
libdfp: @enable_static@ @enable_shared@
Index: configure.ac
===================================================================
--- configure.ac (revision 12265)
+++ configure.ac (working copy)
@@ -424,10 +424,12 @@
enable_shared=shared )
AC_SUBST(enable_shared)
-picflag="-fPIC";
-if test "$enable_shared" = "shared"; then
- CFLAGS="$CFLAGS $picflag"
-fi
+# Should be ok if we build static with this turned on. If the linker
+# complains that the GOT is too big this may need to be upgraded to -fPIC so
+# we get full addressibility.
+picflag="-fpic"
+AC_MSG_NOTICE(configuring with "$picflag")
+AC_SUBST(picflag)
# Compute the list of sysdeps directories.
AC_MSG_CHECKING(sysdep dirs)
Index: sysdeps/dpd/dpd-private.c
===================================================================
--- sysdeps/dpd/dpd-private.c (revision 12265)
+++ sysdeps/dpd/dpd-private.c (working copy)
@@ -669,7 +669,7 @@
extern void __get_dpd_digits (int bits, const void *const *args, char *str,
int *exp_p, int *sign_p, int *nan_p, int *inf_p);
-void
+void
__get_dpd_digits (int bits, const void *const *args,
char *str, int *exp_p, int *sign_p, int *nan_p, int *inf_p)
{
@@ -708,7 +708,7 @@
str[16] = '\0';
if (sign_p) *sign_p = d.ieee.negative;
}
-else if (bits == 128)
+else if (bits == 128)
{
union ieee754r_Decimal128 d;
d.td = *(_Decimal128*)args[0];
@@ -732,6 +732,8 @@
str[34] = '\0';
if (sign_p) *sign_p = d.ieee.negative;
}
+else
+ return;
str[0] = '0' + c_f.lmd;
if (exp_p) *exp_p = exp;