[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r20832 - in /fsf/trunk/libc: ./ malloc/ nptl/ nptl/sysdeps/x86_64/ ports/ ports/sysdeps/ia64/ ports/sysdeps/ia64/fpu/ ports/...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r20832 - in /fsf/trunk/libc: ./ malloc/ nptl/ nptl/sysdeps/x86_64/ ports/ ports/sysdeps/ia64/ ports/sysdeps/ia64/fpu/ ports/...
- From: eglibc@xxxxxxxxxx
- Date: Tue, 25 Sep 2012 00:01:45 -0000
Author: eglibc
Date: Tue Sep 25 00:01:44 2012
New Revision: 20832
Log:
Import glibc-mainline for 2012-09-25
Added:
fsf/trunk/libc/ports/sysdeps/ia64/Makeconfig
fsf/trunk/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/Makeconfig
fsf/trunk/libc/NEWS
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
fsf/trunk/libc/ports/ChangeLog.ia64
fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c
fsf/trunk/libc/ports/sysdeps/tile/sysdep.h
fsf/trunk/libc/stdio-common/printf_fphex.c
fsf/trunk/libc/stdio-common/tst-printf-round.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Tue Sep 25 00:01:44 2012
@@ -1,3 +1,24 @@
+2012-09-24 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * Makeconfig (+postctorT): Replace crtendS.o with crtend.o.
+
+ [BZ #14562]
+ * malloc/arena.c (heap_trim): Properly get fencepost and adjust
+ new chunk size with MALLOC_ALIGN_MASK.
+
+2012-09-24 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ [BZ #5044]
+ * stdio-common/printf_fphex.c: Include <stdbool.h> and
+ <rounding-mode.h>.
+ (__printf_fphex): Determine rounding using get_rounding_mode and
+ round_away.
+ * stdio-common/tst-printf-round.c (struct hex_test): New
+ structure.
+ (hex_tests): New variable.
+ (test_hex_in_one_mode): New function.
+ (do_test): Also run tests for hex float output.
+
2012-09-21 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* libio/iopopen.c [_IO_HAVE_SYS_WAIT]: Make code unconditional.
Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Tue Sep 25 00:01:44 2012
@@ -581,7 +581,7 @@
+postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
# Variants of the two previous definitions for statically linking programs.
+prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o`
-+postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o`
++postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o`
+interp = $(addprefix $(elf-objpfx),interp.os)
csu-objpfx = $(common-objpfx)csu/
elf-objpfx = $(common-objpfx)elf/
Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Tue Sep 25 00:01:44 2012
@@ -9,12 +9,12 @@
* The following bugs are resolved with this release:
- 1349, 3479, 5400, 6778, 6808, 9685, 9914, 10014, 10038, 11607, 13412,
- 13542, 13717, 13696, 13939, 13966, 14042, 14090, 14166, 14150, 14151,
- 14154, 14157, 14166, 14173, 14195, 14237, 14252, 14283, 14298, 14303,
- 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14459, 14476, 14505,
- 14510, 14516, 14518, 14519, 14532, 14538, 14544, 14545, 14576, 14579,
- 14583, 14587.
+ 1349, 3479, 5044, 5400, 6778, 6808, 9685, 9914, 10014, 10038, 11607,
+ 13412, 13542, 13717, 13696, 13939, 13966, 14042, 14090, 14166, 14150,
+ 14151, 14154, 14157, 14166, 14173, 14195, 14237, 14252, 14283, 14298,
+ 14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14459, 14476,
+ 14505, 14510, 14516, 14518, 14519, 14532, 14538, 14544, 14545, 14562,
+ 14576, 14579, 14583, 14587.
* Support for STT_GNU_IFUNC symbols added for s390 and s390x.
Optimized versions of memcpy, memset, and memcmp added for System z10 and
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Tue Sep 25 00:01:44 2012
@@ -655,15 +655,19 @@
unsigned long pagesz = GLRO(dl_pagesize);
mchunkptr top_chunk = top(ar_ptr), p, bck, fwd;
heap_info *prev_heap;
- long new_size, top_size, extra;
+ long new_size, top_size, extra, prev_size, misalign;
/* Can this heap go away completely? */
while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) {
prev_heap = heap->prev;
- p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ));
+ prev_size = prev_heap->size - (MINSIZE-2*SIZE_SZ);
+ p = chunk_at_offset(prev_heap, prev_size);
+ /* fencepost must be properly aligned. */
+ misalign = ((long) p) & MALLOC_ALIGN_MASK;
+ p = chunk_at_offset(prev_heap, prev_size - misalign);
assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
p = prev_chunk(p);
- new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
+ new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ) + misalign;
assert(new_size>0 && new_size<(long)(2*MINSIZE));
if(!prev_inuse(p))
new_size += p->prev_size;
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Tue Sep 25 00:01:44 2012
@@ -1,3 +1,9 @@
+2012-09-24 H.J. Lu <hongjiu.lu@xxxxxxxxx>
+
+ * sysdeps/x86_64/tls.h (THREAD_SETMEM): Add "()" when casting
+ to uint64_t for 64-bit store.
+ (THREAD_SETMEM_NC): Likewise.
+
2012-09-19 H.J. Lu <hongjiu.lu@xxxxxxxxx>
* sysdeps/i386/tls.h (THREAD_SETMEM): Cast to uint64_t for
Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h Tue Sep 25 00:01:44 2012
@@ -256,7 +256,7 @@
abort (); \
\
asm volatile ("movq %q0,%%fs:%P1" : \
- : IMM_MODE ((uint64_t) value), \
+ : IMM_MODE ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member))); \
}})
@@ -281,7 +281,7 @@
abort (); \
\
asm volatile ("movq %q0,%%fs:%P1(,%q2,8)" : \
- : IMM_MODE ((uint64_t) value), \
+ : IMM_MODE ((uint64_t) (value)), \
"i" (offsetof (struct pthread, member[0])), \
"r" (idx)); \
}})
Modified: fsf/trunk/libc/ports/ChangeLog.ia64
==============================================================================
--- fsf/trunk/libc/ports/ChangeLog.ia64 (original)
+++ fsf/trunk/libc/ports/ChangeLog.ia64 Tue Sep 25 00:01:44 2012
@@ -1,3 +1,13 @@
+2012-09-24 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * ports/sysdeps/ia64/fpu/fegetround.c (fegetround): Move contents
+ of function to ...
+ * ports/sysdeps/ia64/fpu/get-rounding-mode.h: ... here.
+
+2012-09-24 Mike Frysinger <vapier@xxxxxxxxxx>
+
+ * sysdeps/ia64/Makeconfig: New file.
+
2012-08-16 Carlos O'Donell <carlos_odonell@xxxxxxxxxx>
* sysdeps/ia64/ldsodefs.h (ARCH_PLTENTER_MEMBERS)
Added: fsf/trunk/libc/ports/sysdeps/ia64/Makeconfig
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/ia64/Makeconfig (added)
+++ fsf/trunk/libc/ports/sysdeps/ia64/Makeconfig Tue Sep 25 00:01:44 2012
@@ -1,0 +1,2 @@
+# ia64 does not provide crtbeginT.o, so use crtbegin.o.
++prectorT = $(+prector)
Modified: fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c (original)
+++ fsf/trunk/libc/ports/sysdeps/ia64/fpu/fegetround.c Tue Sep 25 00:01:44 2012
@@ -1,5 +1,5 @@
/* Return current rounding direction.
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Christian Boissat <Christian.Boissat@xxxxxxx>, 1999.
@@ -17,14 +17,10 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <fenv.h>
+#include <get-rounding-mode.h>
int
fegetround (void)
{
- fenv_t fpsr;
-
- __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
-
- return (fpsr >> 10) & 3;
+ return get_rounding_mode ();
}
Added: fsf/trunk/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h (added)
+++ fsf/trunk/libc/ports/sysdeps/ia64/fpu/get-rounding-mode.h Tue Sep 25 00:01:44 2012
@@ -1,0 +1,37 @@
+/* Return current rounding direction within libc. IA64 version.
+ Copyright (C) 1999-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Christian Boissat <Christian.Boissat@xxxxxxx>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef IA64_GET_ROUNDING_MODE_H
+#define IA64_GET_ROUNDING_MODE_H 1
+
+#include <fenv.h>
+
+/* Return the floating-point rounding mode. */
+
+static inline int
+get_rounding_mode (void)
+{
+ fenv_t fpsr;
+
+ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
+
+ return (fpsr >> 10) & 3;
+}
+
+#endif /* get-rounding-mode.h */
Modified: fsf/trunk/libc/ports/sysdeps/tile/sysdep.h
==============================================================================
--- fsf/trunk/libc/ports/sysdeps/tile/sysdep.h (original)
+++ fsf/trunk/libc/ports/sysdeps/tile/sysdep.h Tue Sep 25 00:01:44 2012
@@ -66,7 +66,7 @@
#define REGSIZE 4
#endif
-/* Support a limited form of shared assembly between tile and tilegx.
+/* Support a limited form of shared assembly between tilepro and tilegx.
The presumption is that LD/ST are used for manipulating registers.
Since opcode parsing is case-insensitive, we don't need to provide
definitions for these on tilegx. */
@@ -86,7 +86,7 @@
#endif
/* Provide "pointer-oriented" instruction variants. These differ not
- just for tile vs tilegx, but also for tilegx -m64 vs -m32. */
+ just for tilepro vs tilegx, but also for tilegx -m64 vs -m32. */
#if defined __tilegx__ && __WORDSIZE == 32
#define ADD_PTR addx
#define ADDI_PTR addxi
Modified: fsf/trunk/libc/stdio-common/printf_fphex.c
==============================================================================
--- fsf/trunk/libc/stdio-common/printf_fphex.c (original)
+++ fsf/trunk/libc/stdio-common/printf_fphex.c Tue Sep 25 00:01:44 2012
@@ -28,6 +28,8 @@
#include <_itoa.h>
#include <_itowa.h>
#include <locale/localeinfo.h>
+#include <stdbool.h>
+#include <rounding-mode.h>
/* #define NDEBUG 1*/ /* Undefine this for debugging assertions. */
#include <assert.h>
@@ -343,21 +345,33 @@
--numend;
}
+ bool do_round_away = false;
+
+ if (precision != -1 && precision < numend - numstr)
+ {
+ char last_digit = precision > 0 ? numstr[precision - 1] : leading;
+ char next_digit = numstr[precision];
+ int last_digit_value = (last_digit >= 'A' && last_digit <= 'F'
+ ? last_digit - 'A' + 10
+ : (last_digit >= 'a' && last_digit <= 'f'
+ ? last_digit - 'a' + 10
+ : last_digit - '0'));
+ int next_digit_value = (next_digit >= 'A' && next_digit <= 'F'
+ ? next_digit - 'A' + 10
+ : (next_digit >= 'a' && next_digit <= 'f'
+ ? next_digit - 'a' + 10
+ : next_digit - '0'));
+ bool more_bits = ((next_digit_value & 7) != 0
+ || precision + 1 < numend - numstr);
+ int rounding_mode = get_rounding_mode ();
+ do_round_away = round_away (negative, last_digit_value & 1,
+ next_digit_value >= 8, more_bits,
+ rounding_mode);
+ }
+
if (precision == -1)
precision = numend - numstr;
- else if (precision < numend - numstr
- && (numstr[precision] > '8'
- || (('A' < '0' || 'a' < '0')
- && numstr[precision] < '0')
- || (numstr[precision] == '8'
- && (precision + 1 < numend - numstr
- /* Round to even. */
- || (precision > 0
- && ((numstr[precision - 1] & 1)
- ^ (isdigit (numstr[precision - 1]) == 0)))
- || (precision == 0
- && ((leading & 1)
- ^ (isdigit (leading) == 0)))))))
+ else if (do_round_away)
{
/* Round up. */
int cnt = precision;
Modified: fsf/trunk/libc/stdio-common/tst-printf-round.c
==============================================================================
--- fsf/trunk/libc/stdio-common/tst-printf-round.c (original)
+++ fsf/trunk/libc/stdio-common/tst-printf-round.c Tue Sep 25 00:01:44 2012
@@ -68,6 +68,99 @@
}
}
+struct hex_test
+{
+ double d;
+ const char *fmt;
+ const char *rd[4], *rn[4], *rz[4], *ru[4];
+};
+
+static const struct hex_test hex_tests[] =
+ {
+ {
+ 0x1.fffffp+4, "%.1a",
+ { "0x1.fp+4", "0x3.fp+3", "0x7.fp+2", "0xf.fp+1" },
+ { "0x2.0p+4", "0x4.0p+3", "0x8.0p+2", "0x1.0p+5" },
+ { "0x1.fp+4", "0x3.fp+3", "0x7.fp+2", "0xf.fp+1" },
+ { "0x2.0p+4", "0x4.0p+3", "0x8.0p+2", "0x1.0p+5" }
+ },
+ {
+ -0x1.fffffp+4, "%.1a",
+ { "-0x2.0p+4", "-0x4.0p+3", "-0x8.0p+2", "-0x1.0p+5" },
+ { "-0x2.0p+4", "-0x4.0p+3", "-0x8.0p+2", "-0x1.0p+5" },
+ { "-0x1.fp+4", "-0x3.fp+3", "-0x7.fp+2", "-0xf.fp+1" },
+ { "-0x1.fp+4", "-0x3.fp+3", "-0x7.fp+2", "-0xf.fp+1" }
+ },
+ {
+ 0x1.88p+4, "%.1a",
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.8p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" },
+ { "0x1.9p+4", "0x3.1p+3", "0x6.2p+2", "0xc.4p+1" }
+ },
+ {
+ -0x1.88p+4, "%.1a",
+ { "-0x1.9p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" },
+ { "-0x1.8p+4", "-0x3.1p+3", "-0x6.2p+2", "-0xc.4p+1" }
+ },
+ {
+ 0x1.78p+4, "%.1a",
+ { "0x1.7p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.8p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.7p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" },
+ { "0x1.8p+4", "0x2.fp+3", "0x5.ep+2", "0xb.cp+1" }
+ },
+ {
+ -0x1.78p+4, "%.1a",
+ { "-0x1.8p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.8p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.7p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" },
+ { "-0x1.7p+4", "-0x2.fp+3", "-0x5.ep+2", "-0xb.cp+1" }
+ },
+ {
+ 64.0 / 3.0, "%.1a",
+ { "0x1.5p+4", "0x2.ap+3", "0x5.5p+2", "0xa.ap+1" },
+ { "0x1.5p+4", "0x2.bp+3", "0x5.5p+2", "0xa.bp+1" },
+ { "0x1.5p+4", "0x2.ap+3", "0x5.5p+2", "0xa.ap+1" },
+ { "0x1.6p+4", "0x2.bp+3", "0x5.6p+2", "0xa.bp+1" }
+ },
+ {
+ -64.0 / 3.0, "%.1a",
+ { "-0x1.6p+4", "-0x2.bp+3", "-0x5.6p+2", "-0xa.bp+1" },
+ { "-0x1.5p+4", "-0x2.bp+3", "-0x5.5p+2", "-0xa.bp+1" },
+ { "-0x1.5p+4", "-0x2.ap+3", "-0x5.5p+2", "-0xa.ap+1" },
+ { "-0x1.5p+4", "-0x2.ap+3", "-0x5.5p+2", "-0xa.ap+1" }
+ },
+ };
+
+static int
+test_hex_in_one_mode (double d, const char *fmt, const char *expected[4],
+ const char *mode_name)
+{
+ char buf[100];
+ int ret = snprintf (buf, sizeof buf, fmt, d);
+ if (ret <= 0 || ret >= (int) sizeof buf)
+ {
+ printf ("snprintf for %a returned %d\n", d, ret);
+ return 1;
+ }
+ if (strcmp (buf, expected[0]) == 0
+ || strcmp (buf, expected[1]) == 0
+ || strcmp (buf, expected[2]) == 0
+ || strcmp (buf, expected[3]) == 0)
+ return 0;
+ else
+ {
+ printf ("snprintf (\"%s\", %a) returned \"%s\" not "
+ "\"%s\" or \"%s\" or \"%s\" or \"%s\" (%s)\n",
+ fmt, d, buf, expected[0], expected[1], expected[2], expected[3],
+ mode_name);
+ return 1;
+ }
+}
+
static int
do_test (void)
{
@@ -103,6 +196,37 @@
}
#endif
}
+
+ for (size_t i = 0; i < sizeof (hex_tests) / sizeof (hex_tests[0]); i++)
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rn, "default rounding mode");
+#ifdef FE_DOWNWARD
+ if (!fesetround (FE_DOWNWARD))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rd, "FE_DOWNWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_TOWARDZERO
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].rz, "FE_TOWARDZERO");
+ fesetround (save_round_mode);
+ }
+#endif
+#ifdef FE_UPWARD
+ if (!fesetround (FE_UPWARD))
+ {
+ result |= test_hex_in_one_mode (hex_tests[i].d, hex_tests[i].fmt,
+ hex_tests[i].ru, "FE_UPWARD");
+ fesetround (save_round_mode);
+ }
+#endif
+ }
+
return result;
}
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits