Group :: Sistema/Bibliotecas
RPM: gmp
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: gmp-4.2.2-alt1.patch
Download
Download
Makefile.am | 7 +++++--
acinclude.m4 | 28 ++++++++++++++++++++++++++++
configure.in | 2 ++
doc/gmp.texi | 4 ++--
gmp-h.in | 1 +
mpf/set_str.c | 25 +++++++++++++++++++++++--
mpn/Makeasm.am | 2 +-
7 files changed, 62 insertions(+), 7 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 2b2b1cf..ca58965 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -251,10 +251,13 @@ EXTRA_libgmp_la_SOURCES = tal-debug.c tal-notreent.c tal-reent.c
libgmp_la_DEPENDENCIES = @TAL_OBJECT@ \
$(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \
$(MPN_OBJECTS) @mpn_objs_in_libgmp@ \
- $(PRINTF_OBJECTS) $(SCANF_OBJECTS)
+ $(PRINTF_OBJECTS) $(SCANF_OBJECTS) \
+ $(srcdir)/libgmp.sym
libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES)
libgmp_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMP_LDFLAGS) \
- -version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE)
+ -version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) \
+ -export-symbols $(srcdir)/libgmp.sym
+EXTRA_DIST += libgmp.sym
# We need at least one .cc file in $(libgmpxx_la_SOURCES) so automake will
diff --git a/acinclude.m4 b/acinclude.m4
index c3eeb7d..08ab12b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1611,6 +1611,34 @@ rm -f conftest*
])
+dnl Checks whether the stack can be marked nonexecutable by passing an option
+dnl to the C-compiler when acting on .s files. Appends that option to ASFLAGS.
+dnl This macro is adapted from one found in GLIBC-2.3.5.
+AC_DEFUN([CL_AS_NOEXECSTACK],[
+dnl AC_REQUIRE([AC_PROG_CC]) GMP uses something else
+AC_CACHE_CHECK([whether assembler supports --noexecstack option],
+cl_cv_as_noexecstack, [dnl
+ cat > conftest.c <<EOF
+void foo() {}
+EOF
+ if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS
+ -S -o conftest.s conftest.c >/dev/null]) \
+ && grep -q .note.GNU-stack conftest.s \
+ && AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -Wa,--noexecstack
+ -c -o conftest.o conftest.s >/dev/null])
+ then
+ cl_cv_as_noexecstack=yes
+ else
+ cl_cv_as_noexecstack=no
+ fi
+ rm -f conftest*])
+ if test "$cl_cv_as_noexecstack" = yes; then
+ ASMFLAGS="$ASMFLAGS -Wa,--noexecstack"
+ fi
+ AC_SUBST(ASMFLAGS)
+])
+
+
dnl GMP_ASM_LABEL_SUFFIX
dnl --------------------
dnl : - is usual.
diff --git a/configure.in b/configure.in
index f5e80c5..4bdd45a 100644
--- a/configure.in
+++ b/configure.in
@@ -2047,6 +2047,8 @@ echo " MPN_PATH=\"$path\""
# Automake ansi2knr support.
AM_C_PROTOTYPES
+CL_AS_NOEXECSTACK
+
GMP_PROG_AR
GMP_PROG_NM
diff --git a/doc/gmp.texi b/doc/gmp.texi
index ae66887..42c1cb3 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -65,9 +65,9 @@ software''. A copy of the license is included in
@c may want to search-and-replace to some online source.
@c
-@dircategory GNU libraries
+@dircategory System/Libraries
@direntry
-* gmp: (gmp). GNU Multiple Precision Arithmetic Library.
+* gmp: (gmp). GNU Multiple Precision Arithmetic Library.
@end direntry
@c html <meta name="description" content="...">
diff --git a/gmp-h.in b/gmp-h.in
index 13034bb..d137221 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -22,6 +22,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#if defined (__cplusplus)
#include <iosfwd> /* for std::istream, std::ostream, std::string */
+#include <cstdio> /* for std::FILE */
#endif
diff --git a/mpf/set_str.c b/mpf/set_str.c
index 2bccd26..4c7914a 100644
--- a/mpf/set_str.c
+++ b/mpf/set_str.c
@@ -271,8 +271,29 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
}
if (expptr != 0)
- /* FIXME: Should do some error checking here. */
- exp_in_base = strtol (expptr, (char **) 0, exp_base);
+ {
+ /* Scan and convert the exponent, in base exp_base. */
+ long dig, neg = -(long) ('-' == expptr[0]);
+ expptr -= neg; /* conditional increment */
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ if (dig >= exp_base)
+ {
+ TMP_FREE;
+ return -1;
+ }
+ exp_in_base = dig;
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ while (dig < exp_base)
+ {
+ exp_in_base = exp_in_base * exp_base;
+ exp_in_base += dig;
+ c = (unsigned char) *expptr++;
+ dig = digit_value[c];
+ }
+ exp_in_base = (exp_in_base ^ neg) - neg; /* conditional negation */
+ }
else
exp_in_base = 0;
if (dotpos != 0)
diff --git a/mpn/Makeasm.am b/mpn/Makeasm.am
index 2e736c9..bb66700 100644
--- a/mpn/Makeasm.am
+++ b/mpn/Makeasm.am
@@ -22,7 +22,7 @@
# COMPILE minus CC.
#
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
# Flags used for preprocessing (in ansi2knr rules).
#