Browse Source

glibc package update to 222 with all patches enabled and optimizations

Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>
master
basebuilder_pel7ppc64bebuilder0 7 years ago
parent
commit
209fe0988b
  1. 6
      SOURCES/glibc-aa64-commonpagesize-64k.patch
  2. 44
      SOURCES/glibc-aa64-setcontext.patch
  3. 72
      SOURCES/glibc-aarch64-add-ptr_mangle-support.patch
  4. 26
      SOURCES/glibc-aarch64-fpu-optional-trapping-exceptions.patch
  5. 32
      SOURCES/glibc-aarch64-ifunc.patch
  6. 8
      SOURCES/glibc-aarch64-rh1076760.patch
  7. 133
      SOURCES/glibc-aarch64-syscall-rewrite.patch
  8. 15
      SOURCES/glibc-arm-hardfloat-3.patch
  9. 20
      SOURCES/glibc-fedora-__libc_multiple_libcs.patch
  10. 54
      SOURCES/glibc-fedora-elf-ORIGIN.patch
  11. 4
      SOURCES/glibc-fedora-elf-init-hidden_undef.patch
  12. 10
      SOURCES/glibc-fedora-elf-rh737223.patch
  13. 58
      SOURCES/glibc-fedora-gai-canonical.patch
  14. 8
      SOURCES/glibc-fedora-getrlimit-PLT.patch
  15. 4
      SOURCES/glibc-fedora-i386-tls-direct-seg-refs.patch
  16. 2
      SOURCES/glibc-fedora-ldd.patch
  17. 6
      SOURCES/glibc-fedora-linux-tcsetattr.patch
  18. 12
      SOURCES/glibc-fedora-localedef.patch
  19. 22
      SOURCES/glibc-fedora-locarchive.patch
  20. 2
      SOURCES/glibc-fedora-manual-dircategory.patch
  21. 4
      SOURCES/glibc-fedora-nptl-linklibc.patch
  22. 2
      SOURCES/glibc-fedora-nscd.patch
  23. 2
      SOURCES/glibc-fedora-ppc-unwind.patch
  24. 62
      SOURCES/glibc-fedora-regcomp-sw11561.patch
  25. 6
      SOURCES/glibc-fedora-streams-rh436349.patch
  26. 4
      SOURCES/glibc-fedora-uname-getrlimit.patch
  27. 18
      SOURCES/glibc-fix-test-write-buf-size.patch
  28. 4
      SOURCES/glibc-gmake.patch
  29. 1450
      SOURCES/glibc-manual-update.patch
  30. 2
      SOURCES/glibc-powerpc-ldbl_high.patch
  31. 24
      SOURCES/glibc-ppc64le-01.patch
  32. 2
      SOURCES/glibc-ppc64le-02.patch
  33. 466
      SOURCES/glibc-ppc64le-03.patch
  34. 300
      SOURCES/glibc-ppc64le-04.patch
  35. 144
      SOURCES/glibc-ppc64le-05.patch
  36. 248
      SOURCES/glibc-ppc64le-06.patch
  37. 208
      SOURCES/glibc-ppc64le-07.patch
  38. 588
      SOURCES/glibc-ppc64le-08.patch
  39. 204
      SOURCES/glibc-ppc64le-09.patch
  40. 18
      SOURCES/glibc-ppc64le-10.patch
  41. 24
      SOURCES/glibc-ppc64le-11.patch
  42. 9
      SOURCES/glibc-ppc64le-12.patch
  43. 80
      SOURCES/glibc-ppc64le-13.patch
  44. 16
      SOURCES/glibc-ppc64le-14.patch
  45. 20
      SOURCES/glibc-ppc64le-15.patch
  46. 26
      SOURCES/glibc-ppc64le-16.patch
  47. 228
      SOURCES/glibc-ppc64le-17.patch
  48. 48
      SOURCES/glibc-ppc64le-18.patch
  49. 54
      SOURCES/glibc-ppc64le-19.patch
  50. 12
      SOURCES/glibc-ppc64le-20.patch
  51. 96
      SOURCES/glibc-ppc64le-21.patch
  52. 48
      SOURCES/glibc-ppc64le-22.patch
  53. 50
      SOURCES/glibc-ppc64le-23.patch
  54. 32
      SOURCES/glibc-ppc64le-24.patch
  55. 256
      SOURCES/glibc-ppc64le-25.patch
  56. 228
      SOURCES/glibc-ppc64le-26.patch
  57. 410
      SOURCES/glibc-ppc64le-27.patch
  58. 88
      SOURCES/glibc-ppc64le-28.patch
  59. 500
      SOURCES/glibc-ppc64le-29.patch
  60. 2424
      SOURCES/glibc-ppc64le-30.patch
  61. 558
      SOURCES/glibc-ppc64le-31.patch
  62. 218
      SOURCES/glibc-ppc64le-32.patch
  63. 590
      SOURCES/glibc-ppc64le-33.patch
  64. 16
      SOURCES/glibc-ppc64le-34.patch
  65. 32
      SOURCES/glibc-ppc64le-35.patch
  66. 38
      SOURCES/glibc-ppc64le-36.patch
  67. 10
      SOURCES/glibc-ppc64le-37.patch
  68. 118
      SOURCES/glibc-ppc64le-38.patch
  69. 214
      SOURCES/glibc-ppc64le-39.patch
  70. 40
      SOURCES/glibc-ppc64le-40.patch
  71. 438
      SOURCES/glibc-ppc64le-41.patch
  72. 196
      SOURCES/glibc-ppc64le-42.patch
  73. 14
      SOURCES/glibc-ppc64le-43.patch
  74. 18
      SOURCES/glibc-ppc64le-44.patch
  75. 10
      SOURCES/glibc-rh1000923.patch
  76. 12
      SOURCES/glibc-rh1008298.patch
  77. 18
      SOURCES/glibc-rh1020637.patch
  78. 16
      SOURCES/glibc-rh1025612.patch
  79. 14
      SOURCES/glibc-rh1025934.patch
  80. 30
      SOURCES/glibc-rh1027101.patch
  81. 64
      SOURCES/glibc-rh1027348-1.patch
  82. 4
      SOURCES/glibc-rh1027348-2.patch
  83. 22
      SOURCES/glibc-rh1027348-3.patch
  84. 20
      SOURCES/glibc-rh1027348-4.patch
  85. 146
      SOURCES/glibc-rh1027348.patch
  86. 16
      SOURCES/glibc-rh1028652.patch
  87. 42
      SOURCES/glibc-rh1032435.patch
  88. 12
      SOURCES/glibc-rh1039496.patch
  89. 26
      SOURCES/glibc-rh1039970.patch
  90. 12
      SOURCES/glibc-rh1046199.patch
  91. 12
      SOURCES/glibc-rh1047983.patch
  92. 24
      SOURCES/glibc-rh1048036.patch
  93. 198
      SOURCES/glibc-rh1048123.patch
  94. 78
      SOURCES/glibc-rh1063681.patch
  95. 20
      SOURCES/glibc-rh1064063.patch
  96. 22
      SOURCES/glibc-rh1064066.patch
  97. 9
      SOURCES/glibc-rh1064945.patch
  98. 34
      SOURCES/glibc-rh1067755.patch
  99. 6
      SOURCES/glibc-rh1070458.patch
  100. 4
      SOURCES/glibc-rh1070471.patch
  101. Some files were not shown because too many files have changed in this diff Show More

6
SOURCES/glibc-aa64-commonpagesize-64k.patch

@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
@@ -8,7 +8,7 @@
case "$machine" in
aarch64*)
# Parameters to allow auto-detection of -z relro.
# Parameters to allow auto-detection of -z relro.
- libc_commonpagesize=0x1000
+ libc_commonpagesize=0x10000
libc_relro_required=yes
;;
libc_relro_required=yes
;;
esac

44
SOURCES/glibc-aa64-setcontext.patch

@ -14,41 +14,41 @@ index aff2e32..70b2e32 100644 @@ -14,41 +14,41 @@ index aff2e32..70b2e32 100644
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/getcontext.S
@@ -1,6 +1,6 @@
/* Save current context.

- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 Free Software Foundation, Inc.

This file is part of the GNU C Library.

@@ -53,6 +53,9 @@ ENTRY(__getcontext)
mov x2, sp
str x2, [x0, oSP]

mov x2, sp
str x2, [x0, oSP]
+ /* Initialize the pstate. */
+ str xzr, [x0, oPSTATE]
+
/* Figure out where to place the first context extension
block. */
add x2, x0, #oEXTENSION
/* Figure out where to place the first context extension
block. */
add x2, x0, #oEXTENSION
diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
index a98f67f..f45a655 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -1,6 +1,6 @@
/* Set current context.

- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2009-2014 Free Software Foundation, Inc.

This file is part of the GNU C Library.

@@ -22,68 +22,108 @@
#include "ucontext_i.h"
#include "ucontext-internal.h"

-/* int setcontext (const ucontext_t *ucp) */
+/* int __setcontext (const ucontext_t *ucp)

- .text
-
-ENTRY(__setcontext)
@ -74,13 +74,13 @@ index a98f67f..f45a655 100644 @@ -74,13 +74,13 @@ index a98f67f..f45a655 100644
- sub sp, sp, x3
+ Restores the machine context in UCP and thereby resumes execution
+ in that context.

- /* Compute the base address of the ucontext structure. */
- add x1, sp, #RT_SIGFRAME_UCONTEXT
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to restore anything
+ other than the PRESERVED state. */

- /* Only ucontext is required in the frame, *copy* it in. */
-
-#if UCONTEXT_SIZE % 16
@ -94,7 +94,7 @@ index a98f67f..f45a655 100644 @@ -94,7 +94,7 @@ index a98f67f..f45a655 100644
- sub x2, x2, 1
- cbnz x2, 0b
+ .text

- /* rt_sigreturn () -- no arguments, sp points to struct rt_sigframe. */
- mov x8, SYS_ify (rt_sigreturn)
+ENTRY (__setcontext)
@ -108,7 +108,7 @@ index a98f67f..f45a655 100644 @@ -108,7 +108,7 @@ index a98f67f..f45a655 100644
+ mov x2, #0
+ mov x3, #_NSIG8
+ mov x8, SYS_ify (rt_sigprocmask)
svc 0
svc 0
-
- /* Ooops we failed. Recover the stack */
-
@ -197,11 +197,11 @@ index a98f67f..f45a655 100644 @@ -197,11 +197,11 @@ index a98f67f..f45a655 100644
+ br x16
PSEUDO_END (__setcontext)
weak_alias (__setcontext, setcontext)

-ENTRY(__startcontext)
+ENTRY (__startcontext)
mov x0, x19
cbnz x0, __setcontext
mov x0, x19
cbnz x0, __setcontext
-1: b HIDDEN_JUMPTARGET(_exit)
-END(__startcontext)
+1: b HIDDEN_JUMPTARGET (_exit)
@ -216,5 +216,5 @@ index 1afff78..ab3930c 100644 @@ -216,5 +216,5 @@ index 1afff78..ab3930c 100644
oPC mcontext (pc)
+oPSTATE mcontext (pstate)
oEXTENSION mcontext (__reserved)

#define fpsimd_context(member) offsetof (struct fpsimd_context, member)

72
SOURCES/glibc-aarch64-add-ptr_mangle-support.patch

@ -9,23 +9,23 @@ index 250f2af..2d38bbf 100644 @@ -9,23 +9,23 @@ index 250f2af..2d38bbf 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/__longjmp.S
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/__longjmp.S
@@ -50,8 +50,12 @@ ENTRY (__longjmp)
ldp x23, x24, [x0, #JB_X23<<3]
ldp x25, x26, [x0, #JB_X25<<3]
ldp x27, x28, [x0, #JB_X27<<3]
ldp x23, x24, [x0, #JB_X23<<3]
ldp x25, x26, [x0, #JB_X25<<3]
ldp x27, x28, [x0, #JB_X27<<3]
+#ifdef PTR_DEMANGLE
+ ldp x29, x4, [x0, #JB_X29<<3]
+ PTR_DEMANGLE (x30, x4, x3, x2)
+#else
ldp x29, x30, [x0, #JB_X29<<3]
ldp x29, x30, [x0, #JB_X29<<3]
-
+#endif
ldp d8, d9, [x0, #JB_D8<<3]
ldp d10, d11, [x0, #JB_D10<<3]
ldp d12, d13, [x0, #JB_D12<<3]
ldp d8, d9, [x0, #JB_D8<<3]
ldp d10, d11, [x0, #JB_D10<<3]
ldp d12, d13, [x0, #JB_D12<<3]
@@ -87,8 +91,12 @@ ENTRY (__longjmp)
cfi_same_value(d13)
cfi_same_value(d14)
cfi_same_value(d15)
cfi_same_value(d13)
cfi_same_value(d14)
cfi_same_value(d15)
-
- ldr x5, [x0, #JB_SP<<3]
+#ifdef PTR_DEMANGLE
@ -34,9 +34,9 @@ index 250f2af..2d38bbf 100644 @@ -34,9 +34,9 @@ index 250f2af..2d38bbf 100644
+#else
+ ldr x5, [x0, #JB_SP<<3]
+#endif
mov sp, x5
cmp x1, #0
mov x0, #1
mov sp, x5
cmp x1, #0
mov x0, #1
diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/jmpbuf-offsets.h glibc-2.17-c758a686/ports/sysdeps/aarch64/jmpbuf-offsets.h
index 84c2ccc..bcf2afa 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/jmpbuf-offsets.h
@ -44,7 +44,7 @@ index 84c2ccc..bcf2afa 100644 @@ -44,7 +44,7 @@ index 84c2ccc..bcf2afa 100644
@@ -39,6 +39,22 @@
#define JB_D14 20
#define JB_D15 21

+#ifndef __ASSEMBLER__
+#include <setjmp.h>
+#include <stdint.h>
@ -72,7 +72,7 @@ index 22c6c2b..39a5dc2 100644 @@ -72,7 +72,7 @@ index 22c6c2b..39a5dc2 100644
@@ -29,16 +29,6 @@
#define _JMPBUF_CFA_UNWINDS_ADJ(jmpbuf, context, adj) \
_JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) _Unwind_GetCFA (context), adj)

-static inline uintptr_t __attribute__ ((unused))
-_jmpbuf_sp (__jmp_buf jmpbuf)
-{
@ -85,37 +85,37 @@ index 22c6c2b..39a5dc2 100644 @@ -85,37 +85,37 @@ index 22c6c2b..39a5dc2 100644
-
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))

diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
index cb94e01..5822abd 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/setjmp.S
@@ -39,13 +39,25 @@ ENTRY (__sigsetjmp)
stp x23, x24, [x0, #JB_X23<<3]
stp x25, x26, [x0, #JB_X25<<3]
stp x27, x28, [x0, #JB_X27<<3]
stp x23, x24, [x0, #JB_X23<<3]
stp x25, x26, [x0, #JB_X25<<3]
stp x27, x28, [x0, #JB_X27<<3]
+
+#ifdef PTR_MANGLE
+ PTR_MANGLE (x4, x30, x3, x2)
+ stp x29, x4, [x0, #JB_X29<<3]
+#else
stp x29, x30, [x0, #JB_X29<<3]
stp x29, x30, [x0, #JB_X29<<3]
+#endif
stp d8, d9, [x0, #JB_D8<<3]
stp d10, d11, [x0, #JB_D10<<3]
stp d12, d13, [x0, #JB_D12<<3]
stp d14, d15, [x0, #JB_D14<<3]
stp d8, d9, [x0, #JB_D8<<3]
stp d10, d11, [x0, #JB_D10<<3]
stp d12, d13, [x0, #JB_D12<<3]
stp d14, d15, [x0, #JB_D14<<3]
+#ifdef PTR_MANGLE
+ mov x4, sp
+ PTR_MANGLE (x5, x4, x3, x2)
+ str x5, [x0, #JB_SP<<3]
+#else
mov x2, sp
str x2, [x0, #JB_SP<<3]
mov x2, sp
str x2, [x0, #JB_SP<<3]
+#endif
#if defined NOT_IN_libc && defined IS_IN_rtld
/* In ld.so we never save the signal mask */
mov w0, #0
/* In ld.so we never save the signal mask */
mov w0, #0
diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/sysdep.h glibc-2.17-c758a686/ports/sysdeps/aarch64/sysdep.h
index 0dd597a..7169ba7 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/sysdep.h
@ -123,7 +123,7 @@ index 0dd597a..7169ba7 100644 @@ -123,7 +123,7 @@ index 0dd597a..7169ba7 100644
@@ -78,6 +78,17 @@
# define L(name) .L##name
#endif

+/* Load or store to/from a pc-relative EXPR into/from R, using T. */
+#define LDST_PCREL(OP, R, T, EXPR) \
+ adrp T, EXPR; \
@ -143,9 +143,9 @@ index f3f0ada..5ccf1da 100644 @@ -143,9 +143,9 @@ index f3f0ada..5ccf1da 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -371,8 +371,44 @@ __local_syscall_error: \

#endif /* __ASSEMBLER__ */

-/* Pointer mangling is not yet supported for AArch64. */
-#define PTR_MANGLE(var) (void) (var)
-#define PTR_DEMANGLE(var) (void) (var)
@ -188,14 +188,14 @@ index f3f0ada..5ccf1da 100644 @@ -188,14 +188,14 @@ index f3f0ada..5ccf1da 100644
+# define PTR_DEMANGLE(var) PTR_MANGLE (var)
+# endif
+#endif

#endif /* linux/aarch64/sysdep.h */
commit 0b1f8e35640f5b3f7af11764ade3ff060211c309
Author: Carlos O'Donell <carlos@redhat.com>
Date: Mon Sep 23 01:44:38 2013 -0400

BZ #15754: Fix test case for ARM.

Statically built binaries use __pointer_chk_guard_local,
while dynamically built binaries use __pointer_chk_guard.
Provide the right definition depending on the test case
@ -207,13 +207,13 @@ index cb8da93..27d249b 100644 @@ -207,13 +207,13 @@ index cb8da93..27d249b 100644
+++ glibc-2.17-c758a686/elf/Makefile
@@ -1019,6 +1019,9 @@ tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child"
tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child"

tst-ptrguard1-ARGS = --command "$(host-built-program-cmd) --child"
+# When built statically, the pointer guard interface uses
+# __pointer_chk_guard_local.
+CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"

$(objpfx)tst-leaks1: $(libdl)
diff --git glibc-2.17-c758a686/sysdeps/generic/stackguard-macros.h glibc-2.17-c758a686/sysdeps/generic/stackguard-macros.h
index 4fa3d96..b4a6b23 100644
@ -222,7 +222,7 @@ index 4fa3d96..b4a6b23 100644 @@ -222,7 +222,7 @@ index 4fa3d96..b4a6b23 100644
@@ -3,5 +3,10 @@
extern uintptr_t __stack_chk_guard;
#define STACK_CHK_GUARD __stack_chk_guard

+#ifdef PTRGUARD_LOCAL
extern uintptr_t __pointer_chk_guard_local;
-#define POINTER_CHK_GUARD __pointer_chk_guard_local

26
SOURCES/glibc-aarch64-fpu-optional-trapping-exceptions.patch

@ -3,7 +3,7 @@ Author: Marcus Shawcroft <marcus.shawcroft@arm.com> @@ -3,7 +3,7 @@ Author: Marcus Shawcroft <marcus.shawcroft@arm.com>
Date: Fri Mar 7 14:05:20 2014 +0000

[PATCH] [AArch64] Optional trapping exceptions support.

Trapping exceptions in AArch64 are optional. The relevant exception
control bits in FPCR are are defined as RES0 hence the absence of
support can be detected by reading back the FPCR and comparing with
@ -12,9 +12,9 @@ Date: Fri Mar 7 14:05:20 2014 +0000 @@ -12,9 +12,9 @@ Date: Fri Mar 7 14:05:20 2014 +0000
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/feenablxcpt.c
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/feenablxcpt.c
@@ -35,5 +35,18 @@ feenableexcept (int excepts)

_FPU_SETCW (fpcr);

+ /* Trapping exceptions are optional in AArch64 the relevant enable
+ bits in FPCR are RES0 hence the absence of support can be
+ detected by reading back the FPCR and comparing with the required
@ -37,13 +37,13 @@ Date: Fri Mar 7 14:05:20 2014 +0000 @@ -37,13 +37,13 @@ Date: Fri Mar 7 14:05:20 2014 +0000
fpu_control_t fpcr;
fpu_fpsr_t fpsr;
+ fpu_control_t updated_fpcr;

_FPU_GETCW (fpcr);
_FPU_GETFPSR (fpsr);
@@ -51,6 +52,15 @@ fesetenv (const fenv_t *envp)

_FPU_SETCW (fpcr);

+ /* Trapping exceptions are optional in AArch64 the relevant enable
+ bits in FPCR are RES0 hence the absence of support can be
+ detected by reading back the FPCR and comparing with the required
@ -55,7 +55,7 @@ Date: Fri Mar 7 14:05:20 2014 +0000 @@ -55,7 +55,7 @@ Date: Fri Mar 7 14:05:20 2014 +0000
+
return 0;
}

commit 423a7160af7fcffc61aac5e2e36d0b6b5b083214
Author: Wilco <wdijkstr@arm.com>
Date: Thu Apr 17 09:39:27 2014 +0100
@ -71,7 +71,7 @@ Date: Thu Apr 17 09:39:27 2014 +0100 @@ -71,7 +71,7 @@ Date: Thu Apr 17 09:39:27 2014 +0100
int status;
pid_t pid;
- fenv_t saved;

- fegetenv (&saved);
- errno = 0;
- fesetenv (FE_NOMASK_ENV);
@ -86,7 +86,7 @@ Date: Thu Apr 17 09:39:27 2014 +0100 @@ -86,7 +86,7 @@ Date: Thu Apr 17 09:39:27 2014 +0100
@@ -349,7 +345,13 @@ feexcp_nomask_test (const char *flag_name, int fe_exc)
int status;
pid_t pid;

- printf ("Test: after fedisableexcept (%s) processes will abort\n",
+ if (1 && feenableexcept (fe_exc) == -1)
+ {
@ -95,19 +95,19 @@ Date: Thu Apr 17 09:39:27 2014 +0100 @@ -95,19 +95,19 @@ Date: Thu Apr 17 09:39:27 2014 +0100
+ }
+
+ printf ("Test: after feenableexcept (%s) processes will abort\n",
flag_name);
flag_name);
printf (" when feraiseexcept (%s) is called.\n", flag_name);
pid = fork ();
@@ -470,7 +472,6 @@ feenable_test (const char *flag_name, int fe_exc)
{
int excepts;

-
printf ("Tests for feenableexcepts etc. with flag %s\n", flag_name);

/* First disable all exceptions. */
@@ -488,8 +489,12 @@ feenable_test (const char *flag_name, int fe_exc)
flag_name, excepts);
flag_name, excepts);
++count_errors;
}
-

32
SOURCES/glibc-aarch64-ifunc.patch

@ -125,9 +125,9 @@ index 8686fd5..2b10581 100644 @@ -125,9 +125,9 @@ index 8686fd5..2b10581 100644
#define R_AARCH64_TLS_TPREL64 1030 /* TP-relative offset, 64 bit. */
#define R_AARCH64_TLSDESC 1031 /* TLS Descriptor. */
+#define R_AARCH64_IRELATIVE 1032 /* STT_GNU_IFUNC relocation. */

/* ARM relocs. */

diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-irel.h glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-irel.h
index 32dee0f..9a48dc2 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-irel.h
@ -138,18 +138,18 @@ index 32dee0f..9a48dc2 100644 @@ -138,18 +138,18 @@ index 32dee0f..9a48dc2 100644
- Copyright (C) 2012 Free Software Foundation, Inc.
+ Copyright (C) 2012-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
@@ -22,15 +22,31 @@

#include <stdio.h>
#include <unistd.h>
+#include <ldsodefs.h>

-/* AArch64 does not yet implement IFUNC support. However since
- 2011-06-20 provision of a elf_ifunc_invoke has been mandatory. */
+#define ELF_MACHINE_IRELA 1

static inline ElfW(Addr)
__attribute ((always_inline))
elf_ifunc_invoke (ElfW(Addr) addr)
@ -173,36 +173,36 @@ index 32dee0f..9a48dc2 100644 @@ -173,36 +173,36 @@ index 32dee0f..9a48dc2 100644
+ else
+ __libc_fatal ("unexpected reloc type in static binary");
}

#endif
diff --git glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-machine.h glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-machine.h
index b1878a7..1db5a5b 100644
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-machine.h
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/dl-machine.h
@@ -23,6 +23,7 @@

#include <tls.h>
#include <dl-tlsdesc.h>
+#include <dl-irel.h>

/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute__ ((unused))
@@ -336,6 +337,12 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
}
break;

}
break;
+ case R_AARCH64_IRELATIVE:
+ value = map->l_addr + reloc->r_addend;
+ value = elf_ifunc_invoke (value);
+ *reloc_addr = value;
+ break;
+
default:
_dl_reloc_bad_type (map, r_type, 0);
break;
default:
_dl_reloc_bad_type (map, r_type, 0);
break;
@@ -379,6 +386,13 @@ elf_machine_lazy_rel (struct link_map *map,
td->entry = (void*)(D_PTR (map, l_info[ADDRIDX (DT_TLSDESC_PLT)])
+ map->l_addr);
+ map->l_addr);
}
+ else if (__glibc_unlikely (r_type == R_AARCH64_IRELATIVE))
+ {

8
SOURCES/glibc-aarch64-rh1076760.patch

@ -2,19 +2,19 @@ @@ -2,19 +2,19 @@
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/nptl/tls.h
@@ -63,7 +63,7 @@ typedef struct
# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)

/* Alignment requirements for the initial TCB. */
-# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
+# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)

/* This is the size of the TCB. */
# define TLS_TCB_SIZE sizeof (tcbhead_t)
@@ -72,7 +72,7 @@ typedef struct
# define TLS_PRE_TCB_SIZE sizeof (struct pthread)

/* Alignment requirements for the TCB. */
-# define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)

/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */

133
SOURCES/glibc-aarch64-syscall-rewrite.patch

@ -40,8 +40,8 @@ index 8be1464..d5c31f3 100644 @@ -40,8 +40,8 @@ index 8be1464..d5c31f3 100644
+ mov x10, x0
+ mov x11, x2
+ mov x12, x3
+
/* Sanity check args. */
+
/* Sanity check args. */
- cbz x0, 1f
- cbz x1, 1f
- /* Insert the args onto the new stack. */
@ -49,16 +49,16 @@ index 8be1464..d5c31f3 100644 @@ -49,16 +49,16 @@ index 8be1464..d5c31f3 100644
+ mov x0, #-EINVAL
+ cbz x10, .Lsyscall_error
+ cbz x1, .Lsyscall_error

/* Do the system call. */
/* Do the system call. */
+ /* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */
mov x0, x2 /* flags */
mov x0, x2 /* flags */
-
/* New sp is already in x1. */
mov x2, x4 /* ptid */
mov x3, x5 /* tls */
mov x4, x6 /* ctid */

/* New sp is already in x1. */
mov x2, x4 /* ptid */
mov x3, x5 /* tls */
mov x4, x6 /* ctid */
-#ifdef RESET_PID
- /* We rely on the kernel preserving the argument regsiters across a
- each system call so that we can inspect the flags against after
@ -66,41 +66,41 @@ index 8be1464..d5c31f3 100644 @@ -66,41 +66,41 @@ index 8be1464..d5c31f3 100644
- mov x5, x0
-#endif
-
mov x8, #SYS_ify(clone)
mov x8, #SYS_ify(clone)
- /* X0:flags, x1:newsp, x2:parenttidptr, x3:newtls, x4:childtid. */
svc 0x0
svc 0x0
- cfi_endproc
cmp x0, #0
cmp x0, #0
- beq 2f
- blt C_SYMBOL_NAME(__syscall_error)
+ beq thread_start
+ blt .Lsyscall_error
RET
RET
-1: mov x0, #-EINVAL
- b syscall_error
+PSEUDO_END (__clone)

-2:
+ .align 4
+ .type thread_start, %function
+thread_start:
cfi_startproc
cfi_undefined (x30)
mov x29, 0
cfi_startproc
cfi_undefined (x30)
mov x29, 0
+
#ifdef RESET_PID
- tbnz x5, #CLONE_THREAD_BIT, 3f
+ tbnz x11, #CLONE_THREAD_BIT, 3f
mov x0, #-1
mov x0, #-1
- tbnz x5, #CLONE_VM_BIT, 2f
+ tbnz x11, #CLONE_VM_BIT, 2f
mov x8, #SYS_ify(getpid)
svc 0x0
mov x8, #SYS_ify(getpid)
svc 0x0
2:
@@ -86,18 +83,16 @@ ENTRY(__clone)
sub x1, x1, #PTHREAD_SIZEOF
str w0, [x1, #PTHREAD_PID_OFFSET]
str w0, [x1, #PTHREAD_TID_OFFSET]
sub x1, x1, #PTHREAD_SIZEOF
str w0, [x1, #PTHREAD_PID_OFFSET]
str w0, [x1, #PTHREAD_TID_OFFSET]
-
3:
#endif
@ -112,22 +112,22 @@ index 8be1464..d5c31f3 100644 @@ -112,22 +112,22 @@ index 8be1464..d5c31f3 100644
+ /* Pick the function arg execute. */
+ mov x0, x12
+ blr x10

/* We are done, pass the return value through x0. */
b HIDDEN_JUMPTARGET(_exit)
cfi_endproc
/* We are done, pass the return value through x0. */
b HIDDEN_JUMPTARGET(_exit)
cfi_endproc
- cfi_startproc
-PSEUDO_END (__clone)
+ .size thread_start, .-thread_start

weak_alias (__clone, clone)
diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
index f01fb84..be6c026 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/ioctl.S
@@ -20,13 +20,12 @@

.text
.text
ENTRY(__ioctl)
- movz x8, #__NR_ioctl
- sxtw x0, w0
@ -139,11 +139,11 @@ index f01fb84..be6c026 100644 @@ -139,11 +139,11 @@ index f01fb84..be6c026 100644
+ svc #0x0
+ cmn x0, #4095
+ b.cs .Lsyscall_error
ret
ret
-
- PSEUDO_END (__ioctl)
+PSEUDO_END (__ioctl)

weak_alias (__ioctl, ioctl)
diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/nptl/localplt.data
index 84af95d..dfca9a7 100644
@ -159,7 +159,7 @@ index e0e5cc0..a3b9284 100644 @@ -159,7 +159,7 @@ index e0e5cc0..a3b9284 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -26,119 +26,60 @@

# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
- .section ".text"; \
@ -248,7 +248,7 @@ index e0e5cc0..a3b9284 100644 @@ -248,7 +248,7 @@ index e0e5cc0..a3b9284 100644
+# define DOCARGS_4 DOCARGS_3; str x3, [sp, 32]
+# define DOCARGS_5 DOCARGS_3; stp x3, x4, [sp, 32]
+# define DOCARGS_6 DOCARGS_5; str x5, [sp, 48]

# define UNDOCARGS_0
-
-# define DOCARGS_1 \
@ -327,7 +327,7 @@ index e0e5cc0..a3b9284 100644 @@ -327,7 +327,7 @@ index e0e5cc0..a3b9284 100644
+# define UNDOCARGS_4 UNDOCARGS_2; ldp x2, x3, [sp, 24]
+# define UNDOCARGS_5 UNDOCARGS_3; ldp x3, x4, [sp, 32]
+# define UNDOCARGS_6 UNDOCARGS_4; ldp x4, x5, [sp, 40]

# ifdef IS_IN_libpthread
# define CENABLE bl __pthread_enable_asynccancel
@@ -160,11 +101,9 @@
@ -347,7 +347,7 @@ index e0e5cc0..a3b9284 100644 @@ -347,7 +347,7 @@ index e0e5cc0..a3b9284 100644
/* There is no __local_multiple_threads for librt, so use the TCB. */
@@ -173,20 +112,10 @@ extern int __local_multiple_threads attribute_hidden;
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) == 0, 1)
header.multiple_threads) == 0, 1)
# else
-# define SINGLE_THREAD_P \
- stp x0, x30, [sp, -16]!; \
@ -369,18 +369,18 @@ index e0e5cc0..a3b9284 100644 @@ -369,18 +369,18 @@ index e0e5cc0..a3b9284 100644
+ ldr w##R, [x##R, PTHREAD_MULTIPLE_THREADS_OFFSET]
# endif
# endif

diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/syscall.S glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/syscall.S
index 574fdf1..fac6416 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/syscall.S
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/syscall.S
@@ -37,8 +37,6 @@ ENTRY (syscall)
mov x6, x7
svc 0x0
cmn x0, #4095
mov x6, x7
svc 0x0
cmn x0, #4095
- b.cs 1f
+ b.cs .Lsyscall_error
RET
RET
-1:
- b SYSCALL_ERROR
PSEUDO_END (syscall)
@ -407,13 +407,13 @@ index 713bf7d..9961c03 100644 @@ -407,13 +407,13 @@ index 713bf7d..9961c03 100644
-# define ret PSEUDO_RET
+ cmn x0, #4095; \
+ b.cs .Lsyscall_error

# undef PSEUDO_END
# define PSEUDO_END(name) \
@@ -83,15 +72,7 @@
ENTRY (name); \
DO_CALL (syscall_name, args);

-/* Notice the use of 'RET' instead of 'ret' the assembler is case
- insensitive and eglibc already uses the preprocessor symbol 'ret'
- so we use the upper case 'RET' to force through a ret instruction
@ -424,16 +424,16 @@ index 713bf7d..9961c03 100644 @@ -424,16 +424,16 @@ index 713bf7d..9961c03 100644
-# undef ret_NOERRNO
-# define ret_NOERRNO PSEUDO_RET_NOERRNO
+# define ret_NOERRNO ret

# undef PSEUDO_END_NOERRNO
# define PSEUDO_END_NOERRNO(name) \
@@ -109,47 +90,38 @@
# define PSEUDO_END_ERRVAL(name) \
END (name)

-# define ret_ERRVAL PSEUDO_RET_NOERRNO
+# define ret_ERRVAL ret

+# define SYSCALL_ERROR .Lsyscall_error
# if NOT_IN_libc
-# define SYSCALL_ERROR __local_syscall_error
@ -441,15 +441,15 @@ index 713bf7d..9961c03 100644 @@ -441,15 +441,15 @@ index 713bf7d..9961c03 100644
# define SYSCALL_ERROR_HANDLER \
-__local_syscall_error: \
+.Lsyscall_error: \
adrp x1, C_SYMBOL_NAME(rtld_errno); \
adrp x1, C_SYMBOL_NAME(rtld_errno); \
- add x1, x1, #:lo12:C_SYMBOL_NAME(rtld_errno); \
neg w0, w0; \
neg w0, w0; \
- str w0, [x1]; \
+ str w0, [x1, :lo12:C_SYMBOL_NAME(rtld_errno)]; \
mov x0, -1; \
RET;
mov x0, -1; \
RET;
# else

# define SYSCALL_ERROR_HANDLER \
-__local_syscall_error: \
- stp x29, x30, [sp, -32]!; \
@ -466,14 +466,14 @@ index 713bf7d..9961c03 100644 @@ -466,14 +466,14 @@ index 713bf7d..9961c03 100644
+ neg w2, w0; \
+ ldr x1, [x1, :gottprel_lo12:errno]; \
+ mrs x3, tpidr_el0; \
mov x0, -1; \
mov x0, -1; \
- ldr x19, [sp,16]; \
- ldp x29, x30, [sp], 32; \
- cfi_adjust_cfa_offset (-32); \
- cfi_restore (x29); \
- cfi_restore (x30); \
+ str w2, [x1, x3]; \
RET;
RET;
# endif
# else
-# define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
@ -482,15 +482,15 @@ index 713bf7d..9961c03 100644 @@ -482,15 +482,15 @@ index 713bf7d..9961c03 100644
+.Lsyscall_error: \
+ b __syscall_error;
# endif

/* Linux takes system call args in registers:
- syscall number in the SVC instruction
+ syscall number x8
arg 1 x0
arg 2 x1
arg 3 x2
arg 1 x0
arg 2 x1
arg 3 x2
@@ -177,28 +149,8 @@ __local_syscall_error: \

# undef DO_CALL
# define DO_CALL(syscall_name, args) \
- DOARGS_##args \
@ -516,24 +516,25 @@ index 713bf7d..9961c03 100644 @@ -516,24 +516,25 @@ index 713bf7d..9961c03 100644
-# define UNDOARGS_6 /* nothing */
-# define UNDOARGS_7 /* nothing */
+ svc 0

#else /* not __ASSEMBLER__ */

diff --git glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/vfork.S glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/vfork.S
index f2dc49b..3fb68b9 100644
--- glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/vfork.S
+++ glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/aarch64/vfork.S
@@ -38,10 +38,8 @@ ENTRY (__vfork)
RESTORE_PID
RESTORE_PID
#endif
cmn x0, #4095
cmn x0, #4095
- b.cs 1f
+ b.cs .Lsyscall_error
RET
RET
-1:
- b SYSCALL_ERROR

PSEUDO_END (__vfork)
libc_hidden_def (__vfork)
--
--
1.8.3.1


15
SOURCES/glibc-arm-hardfloat-3.patch

@ -4,18 +4,19 @@ diff -Nru glibc-2.17-c758a686/elf/dl-load.c glibc-2.17-c758a686/elf/dl-load.c @@ -4,18 +4,19 @@ diff -Nru glibc-2.17-c758a686/elf/dl-load.c glibc-2.17-c758a686/elf/dl-load.c
--- glibc-2.17-c758a686/elf/dl-load.c 2012-06-06 13:07:41.727524312 -0600
+++ glibc-2.17-c758a686/elf/dl-load.c 2012-06-06 13:11:19.308681002 -0600
@@ -2093,10 +2093,14 @@ _dl_map_object (struct link_map *loader,
soname = ((const char *) D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_SONAME]->d_un.d_val);
if (strcmp (name, soname) != 0)
soname = ((const char *) D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_SONAME]->d_un.d_val);
if (strcmp (name, soname) != 0)
- continue;
+#ifdef __arm__
+ if (strcmp (name, "ld-linux.so.3")
+ || strcmp (soname, "ld-linux-armhf.so.3"))
+#endif
+ continue;

/* We have a match on a new name -- cache it. */
/* We have a match on a new name -- cache it. */
- add_name_to_object (l, soname);
+ add_name_to_object (l, name);
l->l_soname_added = 1;
}
l->l_soname_added = 1;
}

20
SOURCES/glibc-fedora-__libc_multiple_libcs.patch

@ -20,19 +20,19 @@ Subject: [PATCH] Properly set __libc_multiple_libcs @@ -20,19 +20,19 @@ Subject: [PATCH] Properly set __libc_multiple_libcs
@@ -23,11 +23,9 @@
/* Type of the initializer. */
typedef void (*init_t) (int, char **, char **);

-#ifndef HAVE_INLINED_SYSCALLS
/* Flag, nonzero during startup phase. */
extern int _dl_starting_up;
extern int _dl_starting_up_internal attribute_hidden;
-#endif


static void
@@ -132,9 +130,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
while (i-- > 0)
call_init (main_map->l_initfini[i], argc, argv, env);

-#ifndef HAVE_INLINED_SYSCALLS
/* Finished starting up. */
INTUSE(_dl_starting_up) = 0;
@ -44,12 +44,12 @@ Subject: [PATCH] Properly set __libc_multiple_libcs @@ -44,12 +44,12 @@ Subject: [PATCH] Properly set __libc_multiple_libcs
@@ -81,10 +81,8 @@ unsigned long long _dl_load_adds;
create a fake scope containing nothing. */
struct r_scope_elem _dl_initial_searchlist;

-#ifndef HAVE_INLINED_SYSCALLS
/* Nonzero during startup. */
int _dl_starting_up = 1;
-#endif

/* Random data provided by the kernel. */
void *_dl_random;
--- glibc-2.17-c758a686/elf/rtld.c
@ -57,7 +57,7 @@ Subject: [PATCH] Properly set __libc_multiple_libcs @@ -57,7 +57,7 @@ Subject: [PATCH] Properly set __libc_multiple_libcs
@@ -106,7 +106,6 @@ static struct audit_list
struct audit_list *next;
} *audit_list;

-#ifndef HAVE_INLINED_SYSCALLS
/* Set nonzero during loading and initialization of executable and
libraries, cleared before the executable's entry point runs. This
@ -67,17 +67,17 @@ Subject: [PATCH] Properly set __libc_multiple_libcs @@ -67,17 +67,17 @@ Subject: [PATCH] Properly set __libc_multiple_libcs
int _dl_starting_up = 0;
INTVARDEF(_dl_starting_up)
-#endif

/* This is the structure which defines all variables global to ld.so
(except those which cannot be added for some reason). */
@@ -929,10 +927,8 @@ dl_main (const ElfW(Phdr) *phdr,
/* Process the environment variable which control the behaviour. */
process_envvars (&mode);

-#ifndef HAVE_INLINED_SYSCALLS
/* Set up a flag which tells we are just starting. */
INTUSE(_dl_starting_up) = 1;
-#endif

if (*user_entry == (ElfW(Addr)) ENTRY_POINT)
{

54
SOURCES/glibc-fedora-elf-ORIGIN.patch

@ -18,8 +18,8 @@ index 18a83d2..6e16a9a 100644 @@ -18,8 +18,8 @@ index 18a83d2..6e16a9a 100644
--- glibc-2.17-c758a686/elf/dl-load.c
+++ glibc-2.17-c758a686/elf/dl-load.c
@@ -249,8 +249,7 @@ is_trusted_path_normalize (const char *path, size_t len)


static size_t
-is_dst (const char *start, const char *name, const char *str,
- int is_path, int secure)
@ -28,9 +28,9 @@ index 18a83d2..6e16a9a 100644 @@ -28,9 +28,9 @@ index 18a83d2..6e16a9a 100644
size_t len;
bool is_curly = false;
@@ -279,12 +278,6 @@ is_dst (const char *start, const char *name, const char *str,
&& (!is_path || name[len] != ':'))
&& (!is_path || name[len] != ':'))
return 0;

- if (__builtin_expect (secure, 0)
- && ((name[len] != '\0' && name[len] != '/'
- && (!is_path || name[len] != ':'))
@ -39,11 +39,11 @@ index 18a83d2..6e16a9a 100644 @@ -39,11 +39,11 @@ index 18a83d2..6e16a9a 100644
-
return len;
}

@@ -299,13 +292,10 @@ _dl_dst_count (const char *name, int is_path)
{
size_t len;

- /* $ORIGIN is not expanded for SUID/GUID programs (except if it
- is $ORIGIN alone) and it must always appear first in path. */
++name;
@ -54,17 +54,17 @@ index 18a83d2..6e16a9a 100644 @@ -54,17 +54,17 @@ index 18a83d2..6e16a9a 100644
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0
+ || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
+ || (len = is_dst (start, name, "LIB", is_path)) != 0)
++cnt;

++cnt;
name = strchr (name + len, '$');
@@ -338,9 +328,16 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
size_t len;

++name;
size_t len;
++name;
- if ((len = is_dst (start, name, "ORIGIN", is_path,
- INTUSE(__libc_enable_secure))) != 0)
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
{
{
+ /* For SUID/GUID programs $ORIGIN must always appear
+ first in a path element. */
+ if (__builtin_expect (INTUSE(__libc_enable_secure), 0)
@ -74,25 +74,25 @@ index 18a83d2..6e16a9a 100644 @@ -74,25 +74,25 @@ index 18a83d2..6e16a9a 100644
+ repl = (const char *) -1;
+ else
#ifndef SHARED
if (l == NULL)
repl = _dl_get_origin ();
if (l == NULL)
repl = _dl_get_origin ();
@@ -351,9 +348,9 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
check_for_trusted = (INTUSE(__libc_enable_secure)
&& l->l_type == lt_executable);
}
check_for_trusted = (INTUSE(__libc_enable_secure)
&& l->l_type == lt_executable);
}
- else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
+ else if ((len = is_dst (start, name, "PLATFORM", is_path)) != 0)
repl = GLRO(dl_platform);
repl = GLRO(dl_platform);
- else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
+ else if ((len = is_dst (start, name, "LIB", is_path)) != 0)
repl = DL_DST_LIB;

if (repl != NULL && repl != (const char *) -1)
repl = DL_DST_LIB;
if (repl != NULL && repl != (const char *) -1)
@@ -373,6 +370,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
element, but keep an empty element at the end. */
if (wp == result && is_path && *name == ':' && name[1] != '\0')
++name;
element, but keep an empty element at the end. */
if (wp == result && is_path && *name == ':' && name[1] != '\0')
++name;
+ check_for_trusted = false;
}
else
/* No DST we recognize. */
}
else
/* No DST we recognize. */

4
SOURCES/glibc-fedora-elf-init-hidden_undef.patch

@ -7,7 +7,7 @@ diff -Nru glibc-2.17-c758a686/csu/elf-init.c glibc-2.17-c758a686/csu/elf-init.c @@ -7,7 +7,7 @@ diff -Nru glibc-2.17-c758a686/csu/elf-init.c glibc-2.17-c758a686/csu/elf-init.c
@@ -63,6 +63,23 @@ extern void (*__init_array_end []) (int,
extern void (*__fini_array_start []) (void) attribute_hidden;
extern void (*__fini_array_end []) (void) attribute_hidden;

+#if defined HAVE_VISIBILITY_ATTRIBUTE \
+ && (defined SHARED || defined LIBC_NONSHARED)
+# define hidden_undef_2(x) #x
@ -25,6 +25,6 @@ diff -Nru glibc-2.17-c758a686/csu/elf-init.c glibc-2.17-c758a686/csu/elf-init.c @@ -25,6 +25,6 @@ diff -Nru glibc-2.17-c758a686/csu/elf-init.c glibc-2.17-c758a686/csu/elf-init.c
+hidden_undef (__init_array_end)
+hidden_undef (__fini_array_start)
+hidden_undef (__fini_array_end)

/* These function symbols are provided for the .init/.fini section entry
points automagically by the linker. */

10
SOURCES/glibc-fedora-elf-rh737223.patch

@ -3,13 +3,13 @@ diff -Nru glibc-2.17-c758a686/elf/setup-vdso.h glibc-2.17-c758a686/elf/setup-vds @@ -3,13 +3,13 @@ diff -Nru glibc-2.17-c758a686/elf/setup-vdso.h glibc-2.17-c758a686/elf/setup-vds
--- glibc-2.17-c758a686/elf/setup-vdso.h 2012-10-10 21:34:38.000000000 -0600
+++ glibc-2.17-c758a686/elf/setup-vdso.h 2012-10-11 09:43:14.152958832 -0600
@@ -93,7 +93,9 @@ setup_vdso (struct link_map *main_map __
char *copy = malloc (len);
if (copy == NULL)
_dl_fatal_printf ("out of memory\n");
char *copy = malloc (len);
if (copy == NULL)
_dl_fatal_printf ("out of memory\n");
- l->l_libname->name = l->l_name = memcpy (copy, dsoname, len);
+ l->l_libname->name = memcpy (copy, dsoname, len);
+ if (GLRO(dl_debug_mask))
+ l->l_name = copy;
}

}
/* Add the vDSO to the object list. */

58
SOURCES/glibc-fedora-gai-canonical.patch

@ -10,24 +10,24 @@ Date: Tue Oct 15 10:21:13 2013 +0200 @@ -10,24 +10,24 @@ Date: Tue Oct 15 10:21:13 2013 +0200
--- glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
+++ glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
@@ -565,8 +565,8 @@ gaih_inet (const char *name, const struct gaih_service *service,

/* If we do not have to look for IPv6 addresses, use
the simple, old functions, which do not support
/* If we do not have to look for IPv6 addresses, use
the simple, old functions, which do not support
- IPv6 scope ids. */
- if (req->ai_family == AF_INET)
+ IPv6 scope ids, nor retrieving the canonical name. */
+ if (req->ai_family == AF_INET && (req->ai_flags & AI_CANONNAME) == 0)
{
/* Allocate additional room for struct host_data. */
size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*)
{
/* Allocate additional room for struct host_data. */
size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*)
@@ -1107,70 +1107,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
/* Only the first entry gets the canonical name. */
if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
{
/* Only the first entry gets the canonical name. */
if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
{
- char *tmpbuf2 = NULL;
- bool malloc_tmpbuf2 = false;
-
if (canon == NULL)
if (canon == NULL)
- {
- struct hostent *h = NULL;
- int herrno;
@ -91,34 +91,34 @@ Date: Tue Oct 15 10:21:13 2013 +0200 @@ -91,34 +91,34 @@ Date: Tue Oct 15 10:21:13 2013 +0200
+ /* If the canonical name cannot be determined, use
+ the passed in string. */
+ canon = orig_name;

#ifdef HAVE_LIBIDN
if (req->ai_flags & AI_CANONIDN)
if (req->ai_flags & AI_CANONIDN)
@@ -1185,9 +1125,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
if (rc != IDNA_SUCCESS)
{
int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
if (rc != IDNA_SUCCESS)
{
- if (malloc_tmpbuf2)
- free (tmpbuf2);
-
if (rc == IDNA_MALLOC_ERROR)
result = -EAI_MEMORY;
else if (rc == IDNA_DLOPEN_ERROR)
if (rc == IDNA_MALLOC_ERROR)
result = -EAI_MEMORY;
else if (rc == IDNA_DLOPEN_ERROR)
@@ -1217,17 +1154,11 @@ gaih_inet (const char *name, const struct gaih_service *service,
canon = strdup (canon);
if (canon == NULL)
{
canon = strdup (canon);
if (canon == NULL)
{
- if (malloc_tmpbuf2)
- free (tmpbuf2);
-
result = -EAI_MEMORY;
goto free_and_return;
}
}
}
result = -EAI_MEMORY;
goto free_and_return;
}
}
}
-
- if (malloc_tmpbuf2)
- free (tmpbuf2);
}

family = at2->family;
}
family = at2->family;

8
SOURCES/glibc-fedora-getrlimit-PLT.patch

@ -9,9 +9,9 @@ Date: Sat Dec 6 23:40:48 2014 +0000 @@ -9,9 +9,9 @@ Date: Sat Dec 6 23:40:48 2014 +0000
--- glibc-2.17-c758a686/include/sys/resource.h
+++ glibc-2.17-c758a686/include/sys/resource.h
@@ -14,5 +14,6 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)

extern int __setrlimit (enum __rlimit_resource __resource,
const struct rlimit *__rlimits);
const struct rlimit *__rlimits);
+libc_hidden_proto (__getrlimit)
#endif
#endif
@ -23,12 +23,12 @@ Date: Sat Dec 6 23:40:48 2014 +0000 @@ -23,12 +23,12 @@ Date: Sat Dec 6 23:40:48 2014 +0000
}
+libc_hidden_def (__getrlimit)
weak_alias (__getrlimit, getrlimit)

stub_warning (getrlimit)
--- glibc-2.17-c758a686/sysdeps/mach/hurd/getrlimit.c
+++ glibc-2.17-c758a686/sysdeps/mach/hurd/getrlimit.c
@@ -43,4 +43,5 @@ __getrlimit (enum __rlimit_resource resource, struct rlimit *rlimits)

return 0;
}
+libc_hidden_def (__getrlimit)

4
SOURCES/glibc-fedora-i386-tls-direct-seg-refs.patch

@ -2,7 +2,7 @@ diff -Nru glibc-2.17-c758a686/sysdeps/i386/Makefile glibc-2.17-c758a686/sysdeps/ @@ -2,7 +2,7 @@ diff -Nru glibc-2.17-c758a686/sysdeps/i386/Makefile glibc-2.17-c758a686/sysdeps/
--- glibc-2.17-c758a686/sysdeps/i386/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ glibc-2.17-c758a686/sysdeps/i386/Makefile 2012-06-07 12:15:21.826318641 -0600
@@ -62,6 +64,14 @@ endif

ifneq (,$(filter -mno-tls-direct-seg-refs,$(CFLAGS)))
defines += -DNO_TLS_DIRECT_SEG_REFS
+else
@ -14,5 +14,5 @@ diff -Nru glibc-2.17-c758a686/sysdeps/i386/Makefile glibc-2.17-c758a686/sysdeps/ @@ -14,5 +14,5 @@ diff -Nru glibc-2.17-c758a686/sysdeps/i386/Makefile glibc-2.17-c758a686/sysdeps/
+CPPFLAGS-.oS += -DNO_TLS_DIRECT_SEG_REFS
+CFLAGS-.oS += -mno-tls-direct-seg-refs
endif

ifeq ($(subdir),elf)

2
SOURCES/glibc-fedora-ldd.patch

@ -28,7 +28,7 @@ Date: Wed Aug 16 15:59:55 2017 +0200 @@ -28,7 +28,7 @@ Date: Wed Aug 16 15:59:55 2017 +0200
# This can be a non-ELF binary or no binary at all.
nonelf "$file" || {
@@ -185,7 +173,7 @@ warning: you do not have execution permission for" "\`$file'" >&2
result=1
result=1
}
;;
- 2)

6
SOURCES/glibc-fedora-linux-tcsetattr.patch

@ -6,13 +6,13 @@ diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c glibc-2.17-c75 @@ -6,13 +6,13 @@ diff -Nru glibc-2.17-c758a686/sysdeps/unix/sysv/linux/tcsetattr.c glibc-2.17-c75
struct __kernel_termios k_termios;
unsigned long int cmd;
+ int retval;

switch (optional_actions)
{
@@ -79,6 +80,35 @@ tcsetattr (fd, optional_actions, termios
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
__KERNEL_NCCS * sizeof (cc_t));

__KERNEL_NCCS * sizeof (cc_t));
- return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+ retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
+

12
SOURCES/glibc-fedora-localedef.patch

@ -2,10 +2,10 @@ diff -Nru glibc-2.17-c758a686/localedata/Makefile glibc-2.17-c758a686/localedata @@ -2,10 +2,10 @@ diff -Nru glibc-2.17-c758a686/localedata/Makefile glibc-2.17-c758a686/localedata
--- glibc-2.17-c758a686/localedata/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ glibc-2.17-c758a686/localedata/Makefile 2012-06-07 12:15:21.776318827 -0600
@@ -211,6 +211,7 @@ $(INSTALL-SUPPORTED-LOCALES): install-lo
echo -n '...'; \
input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
$(LOCALEDEF) --alias-file=../intl/locale.alias \
echo -n '...'; \
input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
$(LOCALEDEF) --alias-file=../intl/locale.alias \
+ --no-archive \
-i locales/$$input -c -f charmaps/$$charset \
$(addprefix --prefix=,$(install_root)) $$locale; \
echo ' done'; \
-i locales/$$input -c -f charmaps/$$charset \
$(addprefix --prefix=,$(install_root)) $$locale; \
echo ' done'; \

22
SOURCES/glibc-fedora-locarchive.patch

@ -5,47 +5,47 @@ diff -Nru glibc-2.17-c758a686/ChangeLog.17 glibc-2.17-c758a686/ChangeLog.17 @@ -5,47 +5,47 @@ diff -Nru glibc-2.17-c758a686/ChangeLog.17 glibc-2.17-c758a686/ChangeLog.17
--- glibc-2.17-c758a686/ChangeLog.17 2012-06-05 07:42:49.000000000 -0600
+++ glibc-2.17-c758a686/ChangeLog.17 2012-06-07 12:15:21.564319619 -0600
@@ -11818,6 +11829,10 @@ d2009-10-30 Ulrich Drepper <drepper@re
[BZ #4368]
* stdlib/stdlib.h: Remove obsolete part of comment for realpath.
[BZ #4368]
* stdlib/stdlib.h: Remove obsolete part of comment for realpath.

+2007-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ * locale/programs/locarchive.c (add_alias, insert_name): Remove static.
+
2007-04-16 Ulrich Drepper <drepper@redhat.com>

[BZ #4364]
[BZ #4364]
diff -Nru glibc-2.17-c758a686/locale/programs/locarchive.c glibc-2.17-c758a686/locale/programs/locarchive.c
--- glibc-2.17-c758a686/locale/programs/locarchive.c 2012-06-05 07:42:49.000000000 -0600
+++ glibc-2.17-c758a686/locale/programs/locarchive.c 2012-06-07 12:15:21.585319540 -0600
@@ -252,9 +252,9 @@ oldlocrecentcmp (const void *a, const vo
/* forward decls for below */
static uint32_t add_locale (struct locarhandle *ah, const char *name,
locale_data_t data, bool replace);
locale_data_t data, bool replace);
-static void add_alias (struct locarhandle *ah, const char *alias,
- bool replace, const char *oldname,
- uint32_t *locrec_offset_p);
+void add_alias (struct locarhandle *ah, const char *alias,
+ bool replace, const char *oldname,
+ uint32_t *locrec_offset_p);


static bool
@@ -635,7 +635,7 @@ close_archive (struct locarhandle *ah)
#include "../../intl/explodename.c"
#include "../../intl/l10nflist.c"

-static struct namehashent *
+struct namehashent *
insert_name (struct locarhandle *ah,
const char *name, size_t name_len, bool replace)
const char *name, size_t name_len, bool replace)
{
@@ -693,7 +693,7 @@ insert_name (struct locarhandle *ah,
return &namehashtab[idx];
}

-static void
+void
add_alias (struct locarhandle *ah, const char *alias, bool replace,
const char *oldname, uint32_t *locrec_offset_p)
const char *oldname, uint32_t *locrec_offset_p)
{

2
SOURCES/glibc-fedora-manual-dircategory.patch

@ -11,7 +11,7 @@ Subject: [PATCH] Change @dircategory. @@ -11,7 +11,7 @@ Subject: [PATCH] Change @dircategory.
+++ glibc-2.17-c758a686/manual/libc.texinfo
@@ -7,7 +7,7 @@
@include macros.texi

@comment Tell install-info what to do.
-@dircategory Software libraries
+@dircategory Libraries

4
SOURCES/glibc-fedora-nptl-linklibc.patch

@ -3,7 +3,7 @@ diff -Nru glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile @@ -3,7 +3,7 @@ diff -Nru glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile
+++ glibc-2.17-c758a686/nptl/Makefile 2012-06-07 12:15:21.816318678 -0600
@@ -529,15 +529,19 @@ $(addprefix $(objpfx), \
$(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
$(objpfx)libpthread_nonshared.a
$(objpfx)tst-unload: $(common-objpfx)dlfcn/libdl.so
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# $(objpfx)linklibc.so is used instead of $(common-objpfx)libc.so,
@ -14,7 +14,7 @@ diff -Nru glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile @@ -14,7 +14,7 @@ diff -Nru glibc-2.17-c758a686/nptl/Makefile glibc-2.17-c758a686/nptl/Makefile
$(objpfx)libpthread_nonshared.a
$(objpfx)../libc.so: $(common-objpfx)libc.so ;
$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a

$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so
+
+$(objpfx)linklibc.so: $(common-objpfx)libc.so

2
SOURCES/glibc-fedora-nscd.patch

@ -8,5 +8,5 @@ diff -Nru glibc-2.17-c758a686/nscd/nscd.conf glibc-2.17-c758a686/nscd/nscd.conf @@ -8,5 +8,5 @@ diff -Nru glibc-2.17-c758a686/nscd/nscd.conf glibc-2.17-c758a686/nscd/nscd.conf
-# server-user nobody
+ server-user nscd
# stat-user somebody
debug-level 0
debug-level 0
# reload-count 5

2
SOURCES/glibc-fedora-ppc-unwind.patch

@ -15,7 +15,7 @@ diff -Nru glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/Makefile glibc-2.17-c758 @@ -15,7 +15,7 @@ diff -Nru glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/Makefile glibc-2.17-c758
@@ -35,6 +35,8 @@ CFLAGS-rtld-memmove.os = $(no-special-re
CFLAGS-rtld-memchr.os = $(no-special-regs)
CFLAGS-rtld-strnlen.os = $(no-special-regs)

+CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
+
ifeq ($(subdir),csu)

62
SOURCES/glibc-fedora-regcomp-sw11561.patch

@ -23,13 +23,13 @@ elements compare against the byte sequence of it, not its name. @@ -23,13 +23,13 @@ elements compare against the byte sequence of it, not its name.
--- glibc-2.17-c758a686/posix/regcomp.c
+++ glibc-2.17-c758a686/posix/regcomp.c
@@ -2772,40 +2772,29 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,

/* Local function for parse_bracket_exp used in _LIBC environement.
Seek the collating symbol entry correspondings to NAME.
- Return the index of the symbol in the SYMB_TABLE. */
+ Return the index of the symbol in the SYMB_TABLE,
+ or -1 if not found. */

auto inline int32_t
__attribute ((always_inline))
- seek_collating_symbol_entry (name, name_len)
@ -57,7 +57,7 @@ elements compare against the byte sequence of it, not its name. @@ -57,7 +57,7 @@ elements compare against the byte sequence of it, not its name.
- break;
- }
+ int32_t elem;

- /* Next entry. */
- elem += second;
- }
@ -79,10 +79,10 @@ elements compare against the byte sequence of it, not its name. @@ -79,10 +79,10 @@ elements compare against the byte sequence of it, not its name.
+ }
+ return -1;
}

/* Local function for parse_bracket_exp used in _LIBC environment.
@@ -2814,8 +2803,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,

auto inline unsigned int
__attribute ((always_inline))
- lookup_collation_sequence_value (br_elem)
@ -90,27 +90,27 @@ elements compare against the byte sequence of it, not its name. @@ -90,27 +90,27 @@ elements compare against the byte sequence of it, not its name.
+ lookup_collation_sequence_value (bracket_elem_t *br_elem)
{
if (br_elem->type == SB_CHAR)
{
{
@@ -2843,7 +2831,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
int32_t elem, idx;
elem = seek_collating_symbol_entry (br_elem->opr.name,
sym_name_len);
int32_t elem, idx;
elem = seek_collating_symbol_entry (br_elem->opr.name,
sym_name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
@@ -2861,7 +2849,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
/* Return the collation sequence value. */
return *(unsigned int *) (extra + idx);
}
/* Return the collation sequence value. */
return *(unsigned int *) (extra + idx);
}
- else if (symb_table[2 * elem] == 0 && sym_name_len == 1)
+ else if (sym_name_len == 1)
{
/* No valid character. Match it as a single byte
character. */
{
/* No valid character. Match it as a single byte
character. */
@@ -2883,11 +2871,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,

auto inline reg_errcode_t
__attribute ((always_inline))
- build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem)
@ -124,7 +124,7 @@ elements compare against the byte sequence of it, not its name. @@ -124,7 +124,7 @@ elements compare against the byte sequence of it, not its name.
unsigned int ch;
uint32_t start_collseq;
@@ -2966,25 +2951,22 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,

auto inline reg_errcode_t
__attribute ((always_inline))
- build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name)
@ -138,18 +138,18 @@ elements compare against the byte sequence of it, not its name. @@ -138,18 +138,18 @@ elements compare against the byte sequence of it, not its name.
int32_t elem, idx;
size_t name_len = strlen ((const char *) name);
if (nrules != 0)
{
elem = seek_collating_symbol_entry (name, name_len);
{
elem = seek_collating_symbol_entry (name, name_len);
- if (symb_table[2 * elem] != 0)
+ if (elem != -1)
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
/* Skip the name of collating element name. */
idx += 1 + extra[idx];
}
{
/* We found the entry. */
idx = symb_table[2 * elem + 1];
/* Skip the name of collating element name. */
idx += 1 + extra[idx];
}
- else if (symb_table[2 * elem] == 0 && name_len == 1)
+ else if (name_len == 1)
{
/* No valid character, treat it as a normal
character. */
{
/* No valid character, treat it as a normal
character. */

6
SOURCES/glibc-fedora-streams-rh436349.patch

@ -9,7 +9,7 @@ diff -Nru glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h glib @@ -9,7 +9,7 @@ diff -Nru glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/bits/posix_opt.h glib
@@ -188,4 +188,7 @@
/* Typed memory objects are not available. */
#define _POSIX_TYPED_MEMORY_OBJECTS -1

+/* Streams are not available. */
+#define _XOPEN_STREAMS -1
+
@ -20,9 +20,9 @@ diff -Nru glibc-2.17-c758a686/streams/Makefile glibc-2.17-c758a686/streams/Makef @@ -20,9 +20,9 @@ diff -Nru glibc-2.17-c758a686/streams/Makefile glibc-2.17-c758a686/streams/Makef
@@ -20,7 +20,7 @@
#
subdir := streams

-headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
+#headers = stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
routines = isastream getmsg getpmsg putmsg putpmsg fattach fdetach

include ../Rules

4
SOURCES/glibc-fedora-uname-getrlimit.patch

@ -18,7 +18,7 @@ be used nowadays to change the uname result. @@ -18,7 +18,7 @@ be used nowadays to change the uname result.
+ __getrlimit;
}
}

--- glibc-2.17-c758a686/nptl/nptl-init.c
+++ glibc-2.17-c758a686/nptl/nptl-init.c
@@ -414,7 +414,7 @@ __pthread_initialize_minimal_internal (void)
@ -43,7 +43,7 @@ be used nowadays to change the uname result. @@ -43,7 +43,7 @@ be used nowadays to change the uname result.
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/smp.h
@@ -36,7 +36,7 @@ is_smp_system (void)
char *cp;

/* Try reading the number using `sysctl' first. */
- if (uname (&u.uts) == 0)
+ if (__uname (&u.uts) == 0)

18
SOURCES/glibc-fix-test-write-buf-size.patch

@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
# This patch fixes tst-cancel4, tst-cancel5, tst-cancelx4 and tst-cancelx5
# failures on newer kernels where the write buffers are larger.
# failures on newer kernels where the write buffers are larger.
#
# commit e7074e4c5edb0acaa979ea08e533736f906a9d68
# Author: David S. Miller <davem@davemloft.net>
# Date: Tue Jul 23 02:31:37 2013 -0700
#
#
# Increase nptl test case buffer size so we really block on current Linux kernels.
#
#
# * tst-cancel4.c (WRITE_BUFFER_SIZE): Increase to 16384.
#
#
# commit 135529b443631f840cc66d0cc395f79c416434d9
# Author: David S. Miller <davem@davemloft.net>
# Date: Tue Jul 23 11:31:39 2013 -0700
#
#
# Remove Linux kernel version ambiguity in comment added by previous commit.
#
#
# * tst-cancel4.c (WRITE_BUFFER_SIZE): Adjust comment.
#
#
diff -urN glibc-2.17-c758a686/nptl/tst-cancel4.c glibc-2.17-c758a686/nptl/tst-cancel4.c
--- glibc-2.17-c758a686/nptl/tst-cancel4.c 2014-07-25 22:07:09.130021164 -0400
+++ glibc-2.17-c758a686/nptl/tst-cancel4.c 2014-07-25 22:12:07.580022919 -0400
@@ -83,7 +83,30 @@
# define IPC_ADDVAL 0
#endif

-#define WRITE_BUFFER_SIZE 4096
+/* The WRITE_BUFFER_SIZE value needs to be choosen such that if we set
+ the socket send buffer size to '1', a write of this size on that
@ -49,6 +49,6 @@ diff -urN glibc-2.17-c758a686/nptl/tst-cancel4.c glibc-2.17-c758a686/nptl/tst-ca @@ -49,6 +49,6 @@ diff -urN glibc-2.17-c758a686/nptl/tst-cancel4.c glibc-2.17-c758a686/nptl/tst-ca
+ slack space. */
+
+#define WRITE_BUFFER_SIZE 16384

/* Cleanup handling test. */
static int cl_called;

4
SOURCES/glibc-gmake.patch

@ -22,7 +22,7 @@ diff -urN glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure @@ -22,7 +22,7 @@ diff -urN glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure
+ 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;

diff -urN glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in
--- glibc-2.17-c758a686/configure.in 2015-01-15 16:32:14.781441511 -0500
+++ glibc-2.17-c758a686/configure.in 2015-01-15 16:32:34.970817501 -0500
@ -32,6 +32,6 @@ diff -urN glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in @@ -32,6 +32,6 @@ diff -urN glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in
[GNU Make[^0-9]*\([0-9][0-9.]*\)],
- [3.79* | 3.[89]*], critic_missing="$critic_missing make")
+ [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")

AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
[GNU gettext.* \([0-9]*\.[0-9.]*\)],

1450
SOURCES/glibc-manual-update.patch

File diff suppressed because it is too large Load Diff

2
SOURCES/glibc-powerpc-ldbl_high.patch

@ -4,7 +4,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -4,7 +4,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
@@ -190,6 +190,9 @@
# define ldbl_unpack default_ldbl_unpack
#endif

+/* Extract high double. */
+#define ldbl_high(x) ((double) x)
+

24
SOURCES/glibc-ppc64le-01.patch

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
# Date: Tue Feb 4 09:48:47 2014 -0200
#
# abilist-pattern configurability
#
#
# This patch creates implicit rules to match the abifiles if
# abilist-pattern is defined in the architecture Makefile. This allows
# machine specific Makefiles to define different abifiles names
@ -13,9 +13,9 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules @@ -13,9 +13,9 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
--- glibc-2.17-c758a686/Makerules 2014-06-02 15:29:42.000000000 +0000
+++ glibc-2.17-c758a686/Makerules 2014-06-02 15:25:21.000000000 +0000
@@ -1152,6 +1152,14 @@
LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
mv -f $@T $@

LC_ALL=C $(OBJDUMP) --dynamic-syms $< > $@T
mv -f $@T $@
+# A sysdeps/.../Makefile can set abilist-pattern to something like
+# %-foo.abilist to look for libc-foo.abilist instead of libc.abilist.
+# This makes sense if multiple ABIs can be most cleanly supported by a
@ -25,12 +25,12 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules @@ -25,12 +25,12 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
+endif
+
vpath %.abilist $(+sysdep_dirs)

# The .PRECIOUS rule prevents the files built by an implicit rule whose
@@ -1161,18 +1169,42 @@
.PRECIOUS: %.symlist
generated += $(extra-libs:=.symlist)

+ifdef abilist-pattern
+check-abi-%: $(common-objpfx)config.make $(abilist-pattern) $(objpfx)%.symlist
+ $(check-abi-pattern)
@ -39,16 +39,16 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules @@ -39,16 +39,16 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
+ $(check-abi-pattern)
+endif
check-abi-%: $(common-objpfx)config.make %.abilist $(objpfx)%.symlist
$(check-abi)
$(check-abi)
check-abi-%: $(common-objpfx)config.make %.abilist $(common-objpfx)%.symlist
$(check-abi)
$(check-abi)
+define check-abi-pattern
+ diff -p -U 0 $(filter $(abilist-pattern),$^) $(filter %.symlist,$^)
+endef
define check-abi
diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
diff -p -U 0 $(filter %.abilist,$^) $(filter %.symlist,$^)
endef

+ifdef abilist-pattern
+update-abi-%: $(objpfx)%.symlist $(abilist-pattern)
+ $(update-abi-pattern)
@ -56,9 +56,9 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules @@ -56,9 +56,9 @@ diff -urN glibc-2.17-c758a686/Makerules glibc-2.17-c758a686/Makerules
+ $(update-abi-pattern)
+endif
update-abi-%: $(objpfx)%.symlist %.abilist
$(update-abi)
$(update-abi)
update-abi-%: $(common-objpfx)%.symlist %.abilist
$(update-abi)
$(update-abi)
+define update-abi-pattern
+@if cmp -s $^ 2> /dev/null; \
+ then \

2
SOURCES/glibc-ppc64le-02.patch

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
# Date: Tue Feb 4 09:49:34 2014 -0200
#
# PowerPC: powerpc64le abilist for 2.17
#
#
# This patch is the abifiles for powerpc64le based on GLIBC 2.17.
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/ld-le.abilist glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/ld-le.abilist

466
SOURCES/glibc-ppc64le-03.patch

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
# commit 9e54314bb06aace405553552f7e7b7d8c172968c
# Author: Joseph Myers <joseph@codesourcery.com>
# Date: Thu Jun 6 19:02:09 2013 +0000
#
#
# Update miscellaneous scripts from upstream.
#
#
diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/config.guess
--- glibc-2.17-c758a686/scripts/config.guess 2014-05-26 15:59:45.000000000 -0500
+++ glibc-2.17-c758a686/scripts/config.guess 2014-05-26 16:01:00.000000000 -0500
@ -14,10 +14,10 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -14,10 +14,10 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
-# 2011, 2012 Free Software Foundation, Inc.
+# Copyright 1992-2013 Free Software Foundation, Inc.

-timestamp='2012-09-25'
+timestamp='2013-11-29'

# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
@ -49,24 +49,24 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -49,24 +49,24 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
+#
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+

me=`echo "$0" | sed -e 's,.*/,,'`

@@ -54,9 +50,7 @@
GNU config.guess ($timestamp)

Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -138,6 +132,27 @@
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
@ -89,38 +89,38 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -89,38 +89,38 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
+esac
+
# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -859,21 +874,21 @@
exit ;;
exit ;;
*:GNU:*:*)
# the GNU system
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -886,59 +901,54 @@
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
@ -128,46 +128,46 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -128,46 +128,46 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
fi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-gnu
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
@ -179,58 +179,58 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -179,58 +179,58 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
eval $set_cc_for_build
@@ -957,54 +967,63 @@
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
;;
+ or1k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
+ echo sparc-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
+ echo hppa64-unknown-linux-${LIBC}
exit ;;
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+ *) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
esac
exit ;;
ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
+ echo powerpc64-unknown-linux-${LIBC}
exit ;;
exit ;;
ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
+ echo powerpc-unknown-linux-${LIBC}
@ -240,45 +240,45 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -240,45 +240,45 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-unknown-linux-${LIBC}
exit ;;
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1237,19 +1256,31 @@
exit ;;
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
@ -317,8 +317,8 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c @@ -317,8 +317,8 @@ diff -urN glibc-2.17-c758a686/scripts/config.guess glibc-2.17-c758a686/scripts/c
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
diff -urN glibc-2.17-c758a686/scripts/config.sub glibc-2.17-c758a686/scripts/config.sub
--- glibc-2.17-c758a686/scripts/config.sub 2014-05-26 15:59:45.000000000 -0500
@ -367,8 +367,8 @@ diff -urN glibc-2.17-c758a686/scripts/config.sub glibc-2.17-c758a686/scripts/con @@ -367,8 +367,8 @@ diff -urN glibc-2.17-c758a686/scripts/config.sub glibc-2.17-c758a686/scripts/con
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").


-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
@ -378,206 +378,206 @@ diff -urN glibc-2.17-c758a686/scripts/config.sub glibc-2.17-c758a686/scripts/con @@ -378,206 +378,206 @@ diff -urN glibc-2.17-c758a686/scripts/config.sub glibc-2.17-c758a686/scripts/con
@@ -73,9 +68,7 @@
version="\
GNU config.sub ($timestamp)

-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
-Free Software Foundation, Inc.
+Copyright 1992-2013 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -156,7 +149,7 @@
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
+ -apple | -axis | -knuth | -cray | -microblaze*)
os=
basic_machine=$1
;;
os=
basic_machine=$1
;;
@@ -259,10 +252,12 @@
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | be32 | be64 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
| bfin \
| bfin \
- | c4x | clipper \
+ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
@@ -270,10 +265,11 @@
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -291,16 +287,17 @@
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
- | nios | nios2 \
+ | nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| ns16k | ns32k \
| open8 \
- | or32 \
+ | or1k | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
@@ -328,7 +325,7 @@
c6x)
basic_machine=tic6x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -370,13 +367,13 @@
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
@@ -385,11 +382,13 @@
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -407,12 +406,13 @@
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| orion-* \
@@ -788,7 +788,7 @@
basic_machine=ns32k-utek
os=-sysv
;;
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze)
+ microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=microblaze-xilinx
;;
mingw64)
@@ -796,7 +796,7 @@
os=-mingw64
;;
mingw32)
os=-mingw64
;;
mingw32)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
os=-mingw32
;;
mingw32ce)
@@ -832,7 +832,7 @@
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
- basic_machine=i386-pc
+ basic_machine=i686-pc
os=-msys
;;
mvs)
os=-msys
;;
mvs)
@@ -1023,7 +1023,11 @@
basic_machine=i586-unknown
os=-pw32
;;
basic_machine=i586-unknown
os=-pw32
;;
- rdos)
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
basic_machine=i386-pc
os=-rdos
;;
basic_machine=i386-pc
os=-rdos
;;
@@ -1350,7 +1354,7 @@
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1496,9 +1500,6 @@
-aros*)
os=-aros
;;
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
-zvmoe)
os=-zvmoe
;;
@@ -1547,6 +1548,9 @@
c4x-* | tic4x-*)
os=-coff
;;
c4x-* | tic4x-*)
os=-coff
;;
+ c8051-*)
+ os=-elf
+ ;;
hexagon-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
@@ -1590,6 +1594,9 @@
mips*-*)
os=-elf
;;
mips*-*)
os=-elf
;;
+ or1k-*)
+ os=-elf
+ ;;
or32-*)
os=-coff
;;
or32-*)
os=-coff
;;
diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/install-sh
--- glibc-2.17-c758a686/scripts/install-sh 2014-05-26 15:59:45.000000000 -0500
+++ glibc-2.17-c758a686/scripts/install-sh 2014-05-26 16:00:34.000000000 -0500
@ -640,13 +640,13 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -640,13 +640,13 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.

+nl='
+'
+IFS=" "" $nl"

# set DOITPROG to echo to test this script

# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
@ -736,11 +736,11 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -736,11 +736,11 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
- true
+ doit_exec=$doit
fi

-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
-
- if [ -d $dst ]; then
- instcmd=:
- else
@ -749,9 +749,9 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -749,9 +749,9 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
-else
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.

-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
@ -761,7 +761,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -761,7 +761,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
- echo "install: $src does not exist"
- exit 1
- fi
-
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
@ -803,19 +803,19 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -803,19 +803,19 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ fi
+ }
+'

-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
+posix_mkdir=

-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
+# Desired mode of installed file.
+mode=0755

-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
@ -840,7 +840,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -840,7 +840,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=

- pathcomp="${pathcomp}/"
+src=
+dst=
@ -947,7 +947,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -947,7 +947,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ esac
+ done
fi

-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
@ -966,7 +966,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -966,7 +966,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ # This can happen when creating conditional directories.
+ exit 0
+fi

-# If we're going to rename the final executable, determine the name now.
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
@ -998,8 +998,8 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -998,8 +998,8 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi

- if [ x"$transformarg" = x ]
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
+for src
@ -1098,12 +1098,12 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1098,12 +1098,12 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
else
- dstfile=`basename $dst $transformbasename |
else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
+ mkdir_mode=
fi

fi
-# don't allow the sed command to completely eliminate the filename
+ posix_mkdir=false
+ case $umask in
@ -1144,8 +1144,8 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1144,8 +1144,8 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ trap '' 0;;
+ esac;;
+ esac

- if [ x"$dstfile" = x ]
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
+ if
@ -1185,7 +1185,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1185,7 +1185,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
else
else
- true
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
@ -1199,10 +1199,10 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1199,10 +1199,10 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
fi
fi
+ prefix=$prefix/
+ done

-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
@ -1227,7 +1227,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1227,7 +1227,7 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
+ if test -n "$prefixes"; then
@ -1311,11 +1311,11 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins @@ -1311,11 +1311,11 @@ diff -urN glibc-2.17-c758a686/scripts/install-sh glibc-2.17-c758a686/scripts/ins
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1

+ trap '' 0
+ fi
+done

-exit 0
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
@ -1333,7 +1333,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/ @@ -1333,7 +1333,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain

+scriptversion=2009-04-28.21; # UTC
+
+# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
@ -1388,7 +1388,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/ @@ -1388,7 +1388,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/
+ ;;
+ esac
+done

for file
do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
@ -1438,7 +1438,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/ @@ -1438,7 +1438,7 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/
+ fi
+ ;;
+esac

- pathcomp=
- for d
- do
@ -1496,15 +1496,15 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/ @@ -1496,15 +1496,15 @@ diff -urN glibc-2.17-c758a686/scripts/mkinstalldirs glibc-2.17-c758a686/scripts/
+ fi
+ fi
+ fi

- pathcomp="$pathcomp/"
- done
+ pathcomp=$pathcomp/
+ done
done

exit $errstatus

-# mkinstalldirs ends here
+# Local Variables:
+# mode: shell-script

300
SOURCES/glibc-ppc64le-04.patch

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
# commit 9605ca6c085a749f29b6866a3e00bce1ba1a2698
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:12:56 2013 +0930
#
#
# IBM long double mechanical changes to support little-endian
# http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html
#
#
# This patch starts the process of supporting powerpc64 little-endian
# long double in glibc. IBM long double is an array of two ieee
# doubles, so making union ibm_extended_long_double reflect this fact is
# the correct way to access fields of the doubles.
#
#
# * sysdeps/ieee754/ldbl-128ibm/ieee754.h
# (union ibm_extended_long_double): Define as an array of ieee754_double.
# (IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
@ -23,14 +23,14 @@ @@ -23,14 +23,14 @@
# * sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
# * sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
# * sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c 2014-05-26 21:08:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c 2014-05-26 21:08:10.000000000 -0500
@@ -36,9 +36,9 @@
else if (arg > LDBL_MAX_10_EXP + 1)
return LDBL_MAX * LDBL_MAX;

- u.d = arg;
- arg_high = u.dd[0];
- arg_low = u.dd[1];
@ -45,7 +45,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7 @@ -45,7 +45,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c 2014-05-26 21:08:10.000000000 -0500
@@ -162,39 +162,39 @@
x = x + xl;

/* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]). */
- ex2_u.d = __expl_table[T_EXPL_RES1 + tval1]
- * __expl_table[T_EXPL_RES2 + tval2];
@ -57,8 +57,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7 @@ -57,8 +57,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7
- ex2_u.ieee.exponent += n_i >> unsafe;
+ ex2_u.d[0].ieee.exponent += n_i >> unsafe;
/* Fortunately, there are no subnormal lowpart doubles in
__expl_table, only normal values and zeros.
But after scaling it can be subnormal. */
__expl_table, only normal values and zeros.
But after scaling it can be subnormal. */
- exponent2 = ex2_u.ieee.exponent2 + (n_i >> unsafe);
- if (ex2_u.ieee.exponent2 == 0)
- /* assert ((ex2_u.ieee.mantissa2|ex2_u.ieee.mantissa3) == 0) */;
@ -69,47 +69,47 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7 @@ -69,47 +69,47 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_expl.c glibc-2.17-c7
- ex2_u.ieee.exponent2 = exponent2;
+ ex2_u.d[1].ieee.exponent = exponent2;
else if (exponent2 <= -54)
{
{
- ex2_u.ieee.exponent2 = 0;
- ex2_u.ieee.mantissa2 = 0;
- ex2_u.ieee.mantissa3 = 0;
+ ex2_u.d[1].ieee.exponent = 0;
+ ex2_u.d[1].ieee.mantissa0 = 0;
+ ex2_u.d[1].ieee.mantissa1 = 0;
}
}
else
{
static const double
two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
{
static const double
two54 = 1.80143985094819840000e+16, /* 4350000000000000 */
twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */
- ex2_u.dd[1] *= two54;
- ex2_u.ieee.exponent2 += n_i >> unsafe;
- ex2_u.dd[1] *= twom54;
+ ex2_u.d[1].d *= two54;
+ ex2_u.d[1].ieee.exponent += n_i >> unsafe;
+ ex2_u.d[1].d *= twom54;
}

}
/* Compute scale = 2^n_1. */
- scale_u.d = 1.0L;
- scale_u.ieee.exponent += n_i - (n_i >> unsafe);
+ scale_u.ld = 1.0L;
+ scale_u.d[0].ieee.exponent += n_i - (n_i >> unsafe);

/* Approximate e^x2 - 1, using a seventh-degree polynomial,
with maximum error in [-2^-16-2^-53,2^-16+2^-53]
with maximum error in [-2^-16-2^-53,2^-16+2^-53]
@@ -204,7 +204,7 @@
/* Return result. */
fesetenv (&oldenv);

- result = x22 * ex2_u.d + ex2_u.d;
+ result = x22 * ex2_u.ld + ex2_u.ld;

/* Now we can test whether the result is ultimate or if we are unsure.
In the later case we should probably call a mpn based routine to give
In the later case we should probably call a mpn based routine to give
@@ -238,7 +238,7 @@
if (!unsafe)
return result;
return result;
else
- return result * scale_u.d;
+ return result * scale_u.ld;
@ -120,7 +120,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c @@ -120,7 +120,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h 2014-05-26 21:08:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h 2014-05-26 21:08:10.000000000 -0500
@@ -180,29 +180,9 @@

union ibm_extended_long_double
{
- long double d;
@ -149,9 +149,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c @@ -149,9 +149,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c
+ long double ld;
+ union ieee754_double d[2];
+ };

__END_DECLS

diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c 2014-05-26 21:08:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c 2014-05-26 21:08:10.000000000 -0500
@ -161,12 +161,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -161,12 +161,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
int ediff;
- u.d = value;
+ u.ld = value;

- *is_neg = u.ieee.negative;
- *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
+ *is_neg = u.d[0].ieee.negative;
+ *expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;

- lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3;
- hi = ((long long) u.ieee.mantissa0 << 32) | u.ieee.mantissa1;
+ lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
@ -177,13 +177,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -177,13 +177,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
+ if (u.d[1].ieee.exponent > 0)
{
lo |= 1LL << 52;

/* The lower double is normalized separately from the upper. We may
need to adjust the lower manitissa to reflect this. */
need to adjust the lower manitissa to reflect this. */
- ediff = u.ieee.exponent - u.ieee.exponent2;
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;
if (ediff > 53)
lo = lo >> (ediff-53);
lo = lo >> (ediff-53);
}
@@ -59,8 +59,8 @@
difference between the long double and the rounded high double
@ -198,13 +198,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -198,13 +198,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
if (hi == 0LL)
@@ -92,7 +92,7 @@
#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \
- (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))

- (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB)))
- if (u.ieee.exponent == 0)
+ if (u.d[0].ieee.exponent == 0)
{
/* A biased exponent of zero is a special case.
Either it is a zero or it is a denormal number. */
Either it is a zero or it is a denormal number. */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h 2014-05-26 21:08:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h 2014-05-26 21:08:10.000000000 -0500
@ -218,7 +218,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -218,7 +218,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ union ibm_extended_long_double u;
+ u.ld = x;
+ *exp = u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;

- lo = ((int64_t)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
- hi = ((int64_t)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
+ lo = ((uint64_t)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
@ -231,14 +231,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -231,14 +231,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
lo |= (1ULL << 52);
lo = lo << 7; /* pre-shift lo to match ieee854. */
/* The lower double is normalized separately from the upper. We
may need to adjust the lower manitissa to reflect this. */
may need to adjust the lower manitissa to reflect this. */
- ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;
if (ediff > 53)
lo = lo >> (ediff-53);
lo = lo >> (ediff-53);
hi |= (1ULL << 52);
}

- if ((eldbl.ieee.negative != eldbl.ieee.negative2)
- && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
+ if ((u.d[0].ieee.negative != u.d[1].ieee.negative)
@ -249,7 +249,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -249,7 +249,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
@@ -58,10 +58,10 @@
unsigned long hidden2, lzcount;
unsigned long long hi, lo;

- u.ieee.negative = sign;
- u.ieee.negative2 = sign;
- u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
@ -259,38 +259,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -259,38 +259,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ u.d[0].ieee.exponent = exp + IEEE754_DOUBLE_BIAS;
+ u.d[1].ieee.exponent = exp-53 + IEEE754_DOUBLE_BIAS;
/* Expect 113 bits (112 bits + hidden) right justified in two longs.
The low order 53 bits (52 + hidden) go into the lower double */
The low order 53 bits (52 + hidden) go into the lower double */
lo = (lo64 >> 7)& ((1ULL << 53) - 1);
@@ -78,7 +78,7 @@
if (hidden2)
{
hi++;
{
hi++;
- u.ieee.negative2 = !sign;
+ u.d[1].ieee.negative = !sign;
lo = (1ULL << 53) - lo;
}
lo = (1ULL << 53) - lo;
}
/* The hidden bit of the lo mantissa is zero so we need to
@@ -94,32 +94,32 @@
lzcount = lzcount - 11;
if (lzcount > 0)
{
{
- int expnt2 = u.ieee.exponent2 - lzcount;
+ int expnt2 = u.d[1].ieee.exponent - lzcount;
if (expnt2 >= 1)
{
/* Not denormal. Normalize and set low exponent. */
lo = lo << lzcount;
if (expnt2 >= 1)
{
/* Not denormal. Normalize and set low exponent. */
lo = lo << lzcount;
- u.ieee.exponent2 = expnt2;
+ u.d[1].ieee.exponent = expnt2;
}
else
{
/* Is denormal. */
lo = lo << (lzcount + expnt2);
}
else
{
/* Is denormal. */
lo = lo << (lzcount + expnt2);
- u.ieee.exponent2 = 0;
+ u.d[1].ieee.exponent = 0;
}
}
}
}
}
else
{
@ -299,7 +299,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -299,7 +299,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ u.d[1].ieee.negative = 0;
+ u.d[1].ieee.exponent = 0;
}

- u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
- u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
- u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
@ -311,7 +311,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -311,7 +311,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ u.d[0].ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
+ return u.ld;
}

/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
@@ -128,18 +128,18 @@
default_ldbl_pack (double a, double aa)
@ -324,7 +324,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -324,7 +324,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ u.d[1].d = aa;
+ return u.ld;
}

static inline void
default_ldbl_unpack (long double l, double *a, double *aa)
{
@ -336,7 +336,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -336,7 +336,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ *a = u.d[0].d;
+ *aa = u.d[1].d;
}

#ifndef ldbl_pack
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c 2014-05-26 21:08:01.000000000 -0500
@ -344,7 +344,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -344,7 +344,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
@@ -34,11 +34,11 @@
unsigned long long hi, lo;
int exponent2;

- u.ieee.negative = sign;
- u.ieee.negative2 = sign;
- u.ieee.exponent = expt + IBM_EXTENDED_LONG_DOUBLE_BIAS;
@ -355,54 +355,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -355,54 +355,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
+ u.d[0].ieee.exponent = expt + IEEE754_DOUBLE_BIAS;
+ u.d[1].ieee.exponent = 0;
+ exponent2 = expt - 53 + IEEE754_DOUBLE_BIAS;

#if BITS_PER_MP_LIMB == 32
/* The low order 53 bits (52 + hidden) go into the lower double */
@@ -74,15 +74,15 @@
else
lzcount = lzcount + 42;

lzcount = lzcount + 42;
- if (lzcount > u.ieee.exponent)
+ if (lzcount > u.d[0].ieee.exponent)
{
{
- lzcount = u.ieee.exponent;
- u.ieee.exponent = 0;
+ lzcount = u.d[0].ieee.exponent;
+ u.d[0].ieee.exponent = 0;
exponent2 -= lzcount;
}
exponent2 -= lzcount;
}
else
{
{
- u.ieee.exponent -= (lzcount - 1);
+ u.d[0].ieee.exponent -= (lzcount - 1);
exponent2 -= (lzcount - 1);
}

exponent2 -= (lzcount - 1);
}
@@ -112,9 +112,9 @@
{
if ((hi & (1LL << 53)) != 0)
hi -= 1LL << 52;
{
if ((hi & (1LL << 53)) != 0)
hi -= 1LL << 52;
- u.ieee.exponent++;
+ u.d[0].ieee.exponent++;
}
}
- u.ieee.negative2 = !sign;
+ u.d[1].ieee.negative = !sign;
lo = (1LL << 53) - lo;
}

lo = (1LL << 53) - lo;
}
@@ -135,17 +135,17 @@
exponent2 = exponent2 - lzcount;
}
exponent2 = exponent2 - lzcount;
}
if (exponent2 > 0)
- u.ieee.exponent2 = exponent2;
+ u.d[1].ieee.exponent = exponent2;
else
lo >>= 1 - exponent2;
lo >>= 1 - exponent2;
}
else
- u.ieee.negative2 = 0;
+ u.d[1].ieee.negative = 0;

- u.ieee.mantissa3 = lo & 0xffffffffLL;
- u.ieee.mantissa2 = (lo >> 32) & 0xfffff;
- u.ieee.mantissa1 = hi & 0xffffffffLL;
@ -411,7 +411,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -411,7 +411,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
+ u.d[1].ieee.mantissa0 = (lo >> 32) & 0xfffff;
+ u.d[0].ieee.mantissa1 = hi & 0xffffffffLL;
+ u.d[0].ieee.mantissa0 = (hi >> 32) & ((1LL << (LDBL_MANT_DIG - 86)) - 1);

- return u.d;
+ return u.ld;
}
@ -426,83 +426,83 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2 @@ -426,83 +426,83 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2
- eldbl.d = fpnum.ldbl.d; \
+ union ibm_extended_long_double u; \
+ u.ld = fpnum.ldbl.d; \
\
\
assert (sizeof (long double) == 16); \
\
\
- lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \
- hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \
+ lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \
+ hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \
lo <<= 7; /* pre-shift lo to match ieee854. */ \
/* If the lower double is not a denomal or zero then set the hidden \
53rd bit. */ \
53rd bit. */ \
- if (eldbl.ieee.exponent2 != 0) \
+ if (u.d[1].ieee.exponent != 0) \
lo |= (1ULL << (52 + 7)); \
lo |= (1ULL << (52 + 7)); \
else \
lo <<= 1; \
lo <<= 1; \
/* The lower double is normalized separately from the upper. We \
may need to adjust the lower manitissa to reflect this. */ \
may need to adjust the lower manitissa to reflect this. */ \
- ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent; \
if (ediff > 53 + 63) \
lo = 0; \
lo = 0; \
else if (ediff > 53) \
lo = lo >> (ediff - 53); \
lo = lo >> (ediff - 53); \
- else if (eldbl.ieee.exponent2 == 0 && ediff < 53) \
+ else if (u.d[1].ieee.exponent == 0 && ediff < 53) \
lo = lo << (53 - ediff); \
lo = lo << (53 - ediff); \
- if (eldbl.ieee.negative != eldbl.ieee.negative2 \
- && (eldbl.ieee.exponent2 != 0 || lo != 0L)) \
+ if (u.d[0].ieee.negative != u.d[1].ieee.negative \
+ && (u.d[1].ieee.exponent != 0 || lo != 0L)) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \
@@ -59,7 +59,7 @@
/* we have a borrow from the hidden bit, so shift left 1. */ \
hi = 0xffffffffffffeLL | (lo >> 59); \
lo = 0xfffffffffffffffLL & (lo << 1); \
/* we have a borrow from the hidden bit, so shift left 1. */ \
hi = 0xffffffffffffeLL | (lo >> 59); \
lo = 0xfffffffffffffffLL & (lo << 1); \
- eldbl.ieee.exponent--; \
+ u.d[0].ieee.exponent--; \
} \
else \
hi--; \
} \
else \
hi--; \
@@ -110,9 +110,9 @@
*--wnumstr = L'0'; \
} \
\
*--wnumstr = L'0'; \
} \
\
- leading = eldbl.ieee.exponent == 0 ? '0' : '1'; \
+ leading = u.d[0].ieee.exponent == 0 ? '0' : '1'; \
\
\
- exponent = eldbl.ieee.exponent; \
+ exponent = u.d[0].ieee.exponent; \
\
\
if (exponent == 0) \
{ \
{ \
@@ -122,18 +122,18 @@
{ \
/* This is a denormalized number. */ \
expnegative = 1; \
{ \
/* This is a denormalized number. */ \
expnegative = 1; \
- exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1; \
+ exponent = IEEE754_DOUBLE_BIAS - 1; \
} \
} \
} \
} \
- else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS) \
+ else if (exponent >= IEEE754_DOUBLE_BIAS) \
{ \
expnegative = 0; \
{ \
expnegative = 0; \
- exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS; \
+ exponent -= IEEE754_DOUBLE_BIAS; \
} \
} \
else \
{ \
expnegative = 1; \
{ \
expnegative = 1; \
- exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS); \
+ exponent = -(exponent - IEEE754_DOUBLE_BIAS); \
} \
} \
} while (0)

diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c 2014-05-26 21:08:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c 2014-05-26 21:08:10.000000000 -0500
@ -512,7 +512,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2 @@ -512,7 +512,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2
union ibm_extended_long_double u;
- u.d = x;
+ u.ld = x;

- if (fabs (u.dd[0]) < TWO52)
+ if (fabs (u.d[0].d) < TWO52)
{
@ -520,11 +520,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2 @@ -520,11 +520,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2
+ double high = u.d[0].d;
feholdexcept (&env);
if (high > 0.0)
{
{
@@ -51,11 +51,11 @@
high += TWO52;
high += TWO52;
if (high == 0.0) high = -0.0;
}
}
- u.dd[0] = high;
- u.dd[1] = 0.0;
+ u.d[0].d = high;
@ -542,23 +542,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2 @@ -542,23 +542,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2
feholdexcept (&env);
- if (u.dd[0] > 0.0)
+ if (u.d[0].d > 0.0)
{
{
- if (u.dd[1] > 0.0)
+ if (u.d[1].d > 0.0)
{
/* If the high/low doubles are the same sign then simply
round the low double. */
{
/* If the high/low doubles are the same sign then simply
round the low double. */
- high = u.dd[0];
- low = u.dd[1];
+ high = u.d[0].d;
+ low = u.d[1].d;
}
}
- else if (u.dd[1] < 0.0)
+ else if (u.d[1].d < 0.0)
{
/* Else the high double is pre rounded and we need to
adjust for that. */

{
/* Else the high double is pre rounded and we need to
adjust for that. */
- tau = __nextafter (u.dd[0], 0.0);
- tau = (u.dd[0] - tau) * 2.0;
- high = u.dd[0] - tau;
@ -567,28 +567,28 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2 @@ -567,28 +567,28 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2
+ tau = (u.d[0].d - tau) * 2.0;
+ high = u.d[0].d - tau;
+ low = u.d[1].d + tau;
}
low += TWO52;
low -= TWO52;
}
}
low += TWO52;
low -= TWO52;
}
- else if (u.dd[0] < 0.0)
+ else if (u.d[0].d < 0.0)
{
{
- if (u.dd[1] < 0.0)
+ if (u.d[1].d < 0.0)
{
/* If the high/low doubles are the same sign then simply
round the low double. */
{
/* If the high/low doubles are the same sign then simply
round the low double. */
- high = u.dd[0];
- low = u.dd[1];
+ high = u.d[0].d;
+ low = u.d[1].d;
}
}
- else if (u.dd[1] > 0.0)
+ else if (u.d[1].d > 0.0)
{
/* Else the high double is pre rounded and we need to
adjust for that. */
{
/* Else the high double is pre rounded and we need to
adjust for that. */
- tau = __nextafter (u.dd[0], 0.0);
- tau = (u.dd[0] - tau) * 2.0;
- high = u.dd[0] - tau;
@ -597,21 +597,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2 @@ -597,21 +597,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c glibc-2
+ tau = (u.d[0].d - tau) * 2.0;
+ high = u.d[0].d - tau;
+ low = u.d[1].d + tau;
}
low = TWO52 - low;
low = -(low - TWO52);
}
}
low = TWO52 - low;
low = -(low - TWO52);
}
- u.dd[0] = high + low;
- u.dd[1] = high - u.dd[0] + low;
+ u.d[0].d = high + low;
+ u.d[1].d = high - u.d[0].d + low;
fesetenv (&env);
}

- return u.d;
+ return u.ld;
}

long_double_symbol (libm, __nearbyintl, nearbyintl);
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c 2014-05-26 21:08:01.000000000 -0500
@ -632,7 +632,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c glibc-2.17 @@ -632,7 +632,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/strtold_l.c glibc-2.17
+ if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \
+ (flt) = u.ld; \
} while (0)

#include <strtod_l.c>
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c 2014-05-26 21:08:01.000000000 -0500

144
SOURCES/glibc-ppc64le-05.patch

@ -1,28 +1,28 @@ @@ -1,28 +1,28 @@
# commit 4cf69995e26e16005d4e3843ad4d18c75cf21a04
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:19:44 2013 +0930
#
#
# Fix for [BZ #15680] IBM long double inaccuracy
# http://sourceware.org/ml/libc-alpha/2013-06/msg00919.html
#
#
# I discovered a number of places where denormals and other corner cases
# were being handled wrongly.
#
#
# - printf_fphex.c: Testing for the low double exponent being zero is
# unnecessary. If the difference in exponents is less than 53 then the
# high double exponent must be nearing the low end of its range, and the
# low double exponent hit rock bottom.
#
#
# - ldbl2mpn.c: A denormal (ie. exponent of zero) value is treated as
# if the exponent was one, so shift mantissa left by one. Code handling
# normalisation of the low double mantissa lacked a test for shift count
# greater than bits in type being shifted, and lacked anything to handle
# the case where the difference in exponents is less than 53 as in
# printf_fphex.c.
#
#
# - math_ldbl.h (ldbl_extract_mantissa): Same as above, but worse, with
# code testing for exponent > 1 for some reason, probably a typo for >= 1.
#
#
# - math_ldbl.h (ldbl_insert_mantissa): Round the high double as per
# mpn2ldbl.c (hi is odd or explicit mantissas non-zero) so that the
# number we return won't change when applying ldbl_canonicalize().
@ -32,12 +32,12 @@ @@ -32,12 +32,12 @@
# mantissa. Also by inspection, lzcount can never be less than zero so
# remove that test. Lastly, masking bitfields to their widths can be
# left to the compiler.
#
#
# - mpn2ldbl.c: The overflow checks here on rounding of high double were
# just plain wrong. Incrementing the exponent must be accompanied by a
# shift right of the mantissa to keep the value unchanged. Above notes
# for ldbl_insert_mantissa are also relevant.
#
#
# [BZ #15680]
# * sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c: Comment fix.
# * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@ -55,7 +55,7 @@ @@ -55,7 +55,7 @@
# * sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
# (__mpn_construct_long_double): Fix test for overflow of high
# mantissa and correct normalisation. Avoid undefined shift.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c 2014-05-27 19:13:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c 2014-05-27 19:14:45.000000000 -0500
@ -77,10 +77,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -77,10 +77,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
int ediff;
+
u.ld = value;

*is_neg = u.d[0].ieee.negative;
@@ -43,27 +44,36 @@

lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
hi = ((long long) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
- /* If the lower double is not a denomal or zero then set the hidden
@ -94,7 +94,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -94,7 +94,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
+ lo |= 1ULL << 52;
+ else
+ lo = lo << 1;

- /* The lower double is normalized separately from the upper. We may
- need to adjust the lower manitissa to reflect this. */
- ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent;
@ -125,9 +125,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17- @@ -125,9 +125,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c glibc-2.17-
lo = (1ULL << 53) - lo;
- if (hi == 0LL)
+ if (hi == 0)
{
/* we have a borrow from the hidden bit, so shift left 1. */
hi = 0x0ffffffffffffeLL | (lo >> 51);
{
/* we have a borrow from the hidden bit, so shift left 1. */
hi = 0x0ffffffffffffeLL | (lo >> 51);
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h 2014-05-27 19:13:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h 2014-05-27 19:51:13.000000000 -0500
@ -140,7 +140,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -140,7 +140,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+
u.ld = x;
*exp = u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS;

lo = ((uint64_t)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1;
hi = ((uint64_t)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1;
- /* If the lower double is not a denomal or zero then set the hidden
@ -156,7 +156,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -156,7 +156,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
- lo = lo >> (ediff-53);
- hi |= (1ULL << 52);
- }

- if ((u.d[0].ieee.negative != u.d[1].ieee.negative)
- && ((u.d[1].ieee.exponent != 0) && (lo != 0LL)))
+ if (u.d[0].ieee.exponent != 0)
@ -192,7 +192,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -192,7 +192,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ double is denormal ie. has an exponent of zero). */
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53;
+ if (ediff > 0)
{
{
- /* we have a borrow from the hidden bit, so shift left 1. */
- hi = (hi << 1) | (lo >> 59);
- lo = 0xfffffffffffffffLL & (lo << 1);
@ -217,7 +217,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -217,7 +217,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ lo = (((uint64_t) 1 << 60) - 1) & (lo << 1);
+ *exp = *exp - 1;
+ }
}
}
}
+ else
+ /* If the larger magnitude double is denormal then the smaller
@ -227,7 +227,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -227,7 +227,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
*lo64 = (hi << 60) | lo;
*hi64 = hi >> 4;
}

static inline long double
-ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
+ldbl_insert_mantissa (int sign, int exp, int64_t hi64, uint64_t lo64)
@ -237,16 +237,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -237,16 +237,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
- unsigned long long hi, lo;
+ int expnt2;
+ uint64_t hi, lo;

u.d[0].ieee.negative = sign;
u.d[1].ieee.negative = sign;
u.d[0].ieee.exponent = exp + IEEE754_DOUBLE_BIAS;
- u.d[1].ieee.exponent = exp-53 + IEEE754_DOUBLE_BIAS;
+ u.d[1].ieee.exponent = 0;
+ expnt2 = exp - 53 + IEEE754_DOUBLE_BIAS;
+
+
/* Expect 113 bits (112 bits + hidden) right justified in two longs.
The low order 53 bits (52 + hidden) go into the lower double */
The low order 53 bits (52 + hidden) go into the lower double */
- lo = (lo64 >> 7)& ((1ULL << 53) - 1);
- hidden2 = (lo64 >> 59) & 1ULL;
+ lo = (lo64 >> 7) & (((uint64_t) 1 << 53) - 1);
@ -255,7 +255,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -255,7 +255,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
- hi |= (hi64 << 4);
+ hi = lo64 >> 60;
+ hi |= hi64 << 4;

- if (lo != 0LL)
+ if (lo != 0)
{
@ -266,33 +266,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -266,33 +266,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ /* hidden bit of low double controls rounding of the high double.
+ If hidden is '1' and either the explicit mantissa is non-zero
+ or hi is odd, then round up hi and adjust lo (2nd mantissa)
plus change the sign of the low double to compensate. */
plus change the sign of the low double to compensate. */
- if (hidden2)
+ if ((lo & ((uint64_t) 1 << 52)) != 0
+ && ((hi & 1) != 0 || (lo & (((uint64_t) 1 << 52) - 1)) != 0))
{
hi++;
{
hi++;
+ if ((hi & ((uint64_t) 1 << 53)) != 0)
+ {
+ hi = hi >> 1;
+ u.d[0].ieee.exponent++;
+ }
u.d[1].ieee.negative = !sign;
u.d[1].ieee.negative = !sign;
- lo = (1ULL << 53) - lo;
+ lo = ((uint64_t) 1 << 53) - lo;
}
}
- /* The hidden bit of the lo mantissa is zero so we need to
- normalize the it for the low double. Shift it left until the
- hidden bit is '1' then adjust the 2nd exponent accordingly. */
- hidden bit is '1' then adjust the 2nd exponent accordingly. */
+ /* Normalize the low double. Shift the mantissa left until
+ the hidden bit is '1' and adjust the exponent accordingly. */

if (sizeof (lo) == sizeof (long))
lzcount = __builtin_clzl (lo);
lzcount = __builtin_clzl (lo);
@@ -91,34 +132,30 @@
lzcount = __builtin_clzl ((long) (lo >> 32));
lzcount = __builtin_clzl ((long) (lo >> 32));
else
lzcount = __builtin_clzl ((long) lo) + 32;
lzcount = __builtin_clzl ((long) lo) + 32;
- lzcount = lzcount - 11;
- if (lzcount > 0)
+ lzcount = lzcount - (64 - 53);
@ -303,7 +303,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -303,7 +303,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ /* Not denormal. */
+ u.d[1].ieee.exponent = expnt2;
+ else
{
{
- int expnt2 = u.d[1].ieee.exponent - lzcount;
- if (expnt2 >= 1)
- {
@ -315,14 +315,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -315,14 +315,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ as if it was 1, hence the extra shift. */
+ if (expnt2 > -53)
+ lo >>= 1 - expnt2;
else
else
- {
- /* Is denormal. */
- lo = lo << (lzcount + expnt2);
- u.d[1].ieee.exponent = 0;
- }
+ lo = 0;
}
}
}
else
- {
@ -330,7 +330,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -330,7 +330,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
- u.d[1].ieee.exponent = 0;
- }
+ u.d[1].ieee.negative = 0;

- u.d[1].ieee.mantissa1 = lo & ((1ULL << 32) - 1);
- u.d[1].ieee.mantissa0 = (lo >> 32) & ((1ULL << 20) - 1);
- u.d[0].ieee.mantissa1 = hi & ((1ULL << 32) - 1);
@ -341,11 +341,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -341,11 +341,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
+ u.d[0].ieee.mantissa0 = hi >> 32;
return u.ld;
}

@@ -133,6 +170,10 @@
return u.ld;
}

+/* To suit our callers we return *hi64 and *lo64 as if they came from
+ an ieee854 112 bit mantissa, that is, 48 bits in *hi64 (plus one
+ implicit bit) and 64 bits in *lo64. */
@ -356,7 +356,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -356,7 +356,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
@@ -162,13 +203,13 @@
*aa = xl;
}

-/* Simple inline nearbyint (double) function .
+/* Simple inline nearbyint (double) function.
Only works in the default rounding mode
@ -366,7 +366,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -366,7 +366,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
{
- double two52 = 0x10000000000000LL;
+ double two52 = 0x1p52;

if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
{
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c
@ -374,20 +374,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -374,20 +374,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c 2014-05-27 19:14:45.000000000 -0500
@@ -70,9 +70,9 @@
else
lzcount = __builtin_clzl ((long) val) + 32;
lzcount = __builtin_clzl ((long) val) + 32;
if (hi)
- lzcount = lzcount - 11;
+ lzcount = lzcount - (64 - 53);
else
- lzcount = lzcount + 42;
+ lzcount = lzcount + 53 - (64 - 53);

if (lzcount > u.d[0].ieee.exponent)
{
{
@@ -98,29 +98,27 @@
}
}
}

- if (lo != 0L)
+ if (lo != 0)
{
@ -395,37 +395,37 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -395,37 +395,37 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
- If hidden2 is '1' and either the explicit mantissa is non-zero
+ /* hidden bit of low double controls rounding of the high double.
+ If hidden is '1' and either the explicit mantissa is non-zero
or hi is odd, then round up hi and adjust lo (2nd mantissa)
plus change the sign of the low double to compensate. */
or hi is odd, then round up hi and adjust lo (2nd mantissa)
plus change the sign of the low double to compensate. */
if ((lo & (1LL << 52)) != 0
- && ((hi & 1) != 0 || (lo & ((1LL << 52) - 1))))
+ && ((hi & 1) != 0 || (lo & ((1LL << 52) - 1)) != 0))
{
hi++;
{
hi++;
- if ((hi & ((1LL << 52) - 1)) == 0)
+ if ((hi & (1LL << 53)) != 0)
{
{
- if ((hi & (1LL << 53)) != 0)
- hi -= 1LL << 52;
+ hi >>= 1;
u.d[0].ieee.exponent++;
}
u.d[1].ieee.negative = !sign;
lo = (1LL << 53) - lo;
}

u.d[0].ieee.exponent++;
}
u.d[1].ieee.negative = !sign;
lo = (1LL << 53) - lo;
}
- /* The hidden bit of the lo mantissa is zero so we need to normalize
- it for the low double. Shift it left until the hidden bit is '1'
- then adjust the 2nd exponent accordingly. */
+ /* Normalize the low double. Shift the mantissa left until
+ the hidden bit is '1' and adjust the exponent accordingly. */

if (sizeof (lo) == sizeof (long))
lzcount = __builtin_clzl (lo);
lzcount = __builtin_clzl (lo);
@@ -128,24 +126,24 @@
lzcount = __builtin_clzl ((long) (lo >> 32));
lzcount = __builtin_clzl ((long) (lo >> 32));
else
lzcount = __builtin_clzl ((long) lo) + 32;
lzcount = __builtin_clzl ((long) lo) + 32;
- lzcount = lzcount - 11;
- if (lzcount > 0)
- {
@ -437,16 +437,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -437,16 +437,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
+ exponent2 -= lzcount;
+
if (exponent2 > 0)
u.d[1].ieee.exponent = exponent2;
u.d[1].ieee.exponent = exponent2;
- else
+ else if (exponent2 > -53)
lo >>= 1 - exponent2;
lo >>= 1 - exponent2;
+ else
+ lo = 0;
}
else
u.d[1].ieee.negative = 0;

- u.d[1].ieee.mantissa1 = lo & 0xffffffffLL;
- u.d[1].ieee.mantissa0 = (lo >> 32) & 0xfffff;
- u.d[0].ieee.mantissa1 = hi & 0xffffffffLL;
@ -455,21 +455,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17- @@ -455,21 +455,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c glibc-2.17-
+ u.d[1].ieee.mantissa0 = lo >> 32;
+ u.d[0].ieee.mantissa1 = hi;
+ u.d[0].ieee.mantissa0 = hi >> 32;

return u.ld;
}
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:13:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:14:45.000000000 -0500
@@ -43,15 +43,15 @@
lo <<= 1; \
lo <<= 1; \
/* The lower double is normalized separately from the upper. We \
may need to adjust the lower manitissa to reflect this. */ \
may need to adjust the lower manitissa to reflect this. */ \
- ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent; \
- if (ediff > 53 + 63) \
+ ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53; \
+ if (ediff > 63) \
lo = 0; \
lo = 0; \
- else if (ediff > 53) \
- lo = lo >> (ediff - 53); \
- else if (u.d[1].ieee.exponent == 0 && ediff < 53) \
@ -481,6 +481,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2 @@ -481,6 +481,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2
if (u.d[0].ieee.negative != u.d[1].ieee.negative \
- && (u.d[1].ieee.exponent != 0 || lo != 0L)) \
+ && lo != 0) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \

248
SOURCES/glibc-ppc64le-06.patch

@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
# commit 1b6adf888de14675bc3207578dcb7132ed5f8ecc
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:21:58 2013 +0930
#
#
# PowerPC floating point little-endian [1 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html
#
#
# This is the first of a series of patches to ban ieee854_long_double
# and the ieee854_long_double macros when using IBM long double. union
# ieee854_long_double just isn't correct for IBM long double, especially
# when little-endian, and pretending it is OK has allowed a number of
# bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/.
#
#
# This changes the few places in generic code that use it.
#
#
# * stdio-common/printf_size.c (__printf_size): Don't use
# union ieee854_long_double in fpnum union.
# * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use
@ -26,19 +26,19 @@ @@ -26,19 +26,19 @@
# * math/test-misc.c (main): Don't use union ieee854_long_double.
# ports/
# * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
#
#
diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-misc.c
--- glibc-2.17-c758a686/math/test-misc.c 2014-05-27 19:53:22.000000000 -0500
+++ glibc-2.17-c758a686/math/test-misc.c 2014-05-27 19:53:45.000000000 -0500
@@ -721,300 +721,161 @@

#ifndef NO_LONG_DOUBLE
{
- union ieee854_long_double v1;
- union ieee854_long_double v2;
- long double ld;
+ long double v1, v2;

- v1.d = ld = LDBL_MIN;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = LDBL_MIN;
@ -47,29 +47,29 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -47,29 +47,29 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("fpclassify (LDBL_MIN) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MIN) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
result = 1;
}
- ld = nextafterl (ld, LDBL_MIN / 2.0);
- if (fpclassify (ld) != FP_SUBNORMAL)
+ v2 = nextafterl (v1, LDBL_MIN / 2.0);
+ if (fpclassify (v2) != FP_SUBNORMAL)
{
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
printf ("fpclassify (LDBL_MIN-epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
result = 1;
}
- v2.d = ld = nextafterl (ld, LDBL_MIN);
- if (fpclassify (ld) != FP_NORMAL)
+ v2 = nextafterl (v2, LDBL_MIN);
+ if (fpclassify (v2) != FP_NORMAL)
{
printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
printf ("fpclassify (LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
result = 1;
}

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
+ if (v1 != v2)
{
@ -94,9 +94,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -94,9 +94,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("LDBL_MIN: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("LDBL_MIN-epsilon+epsilon != LDBL_MIN: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- v1.d = ld = -LDBL_MIN;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = -LDBL_MIN;
@ -105,29 +105,29 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -105,29 +105,29 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("fpclassify (-LDBL_MIN) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (-LDBL_MIN) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
result = 1;
}
- ld = nextafterl (ld, -LDBL_MIN / 2.0);
- if (fpclassify (ld) != FP_SUBNORMAL)
+ v2 = nextafterl (v1, -LDBL_MIN / 2.0);
+ if (fpclassify (v2) != FP_SUBNORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
printf ("fpclassify (-LDBL_MIN-epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
result = 1;
}
- v2.d = ld = nextafterl (ld, -LDBL_MIN);
- if (fpclassify (ld) != FP_NORMAL)
+ v2 = nextafterl (v2, -LDBL_MIN);
+ if (fpclassify (v2) != FP_NORMAL)
{
printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
printf ("fpclassify (-LDBL_MIN-epsilon+epsilon) failed: %d (%La)\n",
- fpclassify (ld), ld);
+ fpclassify (v2), v2);
result = 1;
result = 1;
}

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
+ if (v1 != v2)
{
@ -152,9 +152,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -152,9 +152,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("-LDBL_MIN: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-LDBL_MIN-epsilon+epsilon != -LDBL_MIN: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- ld = LDBL_MAX;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = LDBL_MAX;
@ -163,7 +163,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -163,7 +163,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("fpclassify (LDBL_MAX) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MAX) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
result = 1;
}
- ld = nextafterl (ld, INFINITY);
- if (fpclassify (ld) != FP_INFINITE)
@ -173,9 +173,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -173,9 +173,9 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("fpclassify (LDBL_MAX+epsilon) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (LDBL_MAX+epsilon) failed: %d (%La)\n",
+ fpclassify (v2), v2);
result = 1;
result = 1;
}

- ld = -LDBL_MAX;
- if (fpclassify (ld) != FP_NORMAL)
+ v1 = -LDBL_MAX;
@ -184,7 +184,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -184,7 +184,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("fpclassify (-LDBL_MAX) failed: %d\n", fpclassify (ld));
+ printf ("fpclassify (-LDBL_MAX) failed: %d (%La)\n",
+ fpclassify (v1), v1);
result = 1;
result = 1;
}
- ld = nextafterl (ld, -INFINITY);
- if (fpclassify (ld) != FP_INFINITE)
@ -195,16 +195,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -195,16 +195,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- fpclassify (ld));
+ printf ("fpclassify (-LDBL_MAX-epsilon) failed: %d (%La)\n",
+ fpclassify (v2), v2);
result = 1;
result = 1;
}

- v1.d = ld = 0.0625;
- ld = nextafterl (ld, 0.0);
- v2.d = ld = nextafterl (ld, 1.0);
+ v1 = 0.0625;
+ v2 = nextafterl (v1, 0.0);
+ v2 = nextafterl (v2, 1.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0625L down: mantissa0 differs: %8x vs %8x\n",
@ -229,16 +229,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -229,16 +229,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0625L down: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("0.0625L-epsilon+epsilon != 0.0625L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- v1.d = ld = 0.0625;
- ld = nextafterl (ld, 1.0);
- v2.d = ld = nextafterl (ld, 0.0);
+ v1 = 0.0625;
+ v2 = nextafterl (v1, 1.0);
+ v2 = nextafterl (v2, 0.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0625L up: mantissa0 differs: %8x vs %8x\n",
@ -263,16 +263,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -263,16 +263,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0625L up: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("0.0625L+epsilon-epsilon != 0.0625L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- v1.d = ld = -0.0625;
- ld = nextafterl (ld, 0.0);
- v2.d = ld = nextafterl (ld, -1.0);
+ v1 = -0.0625;
+ v2 = nextafterl (v1, 0.0);
+ v2 = nextafterl (v2, -1.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("-0.0625L up: mantissa0 differs: %8x vs %8x\n",
@ -297,16 +297,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -297,16 +297,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("-0.0625L up: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-0.0625L+epsilon-epsilon != -0.0625L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- v1.d = ld = -0.0625;
- ld = nextafterl (ld, -1.0);
- v2.d = ld = nextafterl (ld, 0.0);
+ v1 = -0.0625;
+ v2 = nextafterl (v1, -1.0);
+ v2 = nextafterl (v2, 0.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("-0.0625L down: mantissa0 differs: %8x vs %8x\n",
@ -331,16 +331,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -331,16 +331,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("-0.0625L down: negative differs: %d vs %d\n",
- v1.ieee.negative, v2.ieee.negative);
+ printf ("-0.0625L-epsilon+epsilon != -0.0625L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}

- v1.d = ld = 0.0;
- ld = nextafterl (ld, 1.0);
- v2.d = nextafterl (ld, -1.0);
+ v1 = 0.0;
+ v2 = nextafterl (v1, 1.0);
+ v2 = nextafterl (v2, -1.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0L up: mantissa0 differs: %8x vs %8x\n",
@ -359,7 +359,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -359,7 +359,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0L up: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
+ printf ("0.0+epsilon-epsilon != 0.0L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}
- if (0 != v2.ieee.negative)
+ if (signbit (v2))
@ -367,16 +367,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -367,16 +367,16 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0L up: negative differs: 0 vs %d\n",
- v2.ieee.negative);
+ printf ("0.0+epsilon-epsilon is negative\n");
result = 1;
result = 1;
}

- v1.d = ld = 0.0;
- ld = nextafterl (ld, -1.0);
- v2.d = nextafterl (ld, 1.0);
+ v1 = 0.0;
+ v2 = nextafterl (v1, -1.0);
+ v2 = nextafterl (v2, 1.0);

- if (v1.ieee.mantissa0 != v2.ieee.mantissa0)
- {
- printf ("0.0L down: mantissa0 differs: %8x vs %8x\n",
@ -395,7 +395,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -395,7 +395,7 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0L down: exponent differs: %4x vs %4x\n",
- v1.ieee.exponent, v2.ieee.exponent);
+ printf ("0.0-epsilon+epsilon != 0.0L: %La vs %La\n", v2, v1);
result = 1;
result = 1;
}
- if (1 != v2.ieee.negative)
+ if (!signbit (v2))
@ -403,50 +403,50 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis @@ -403,50 +403,50 @@ diff -urN glibc-2.17-c758a686/math/test-misc.c glibc-2.17-c758a686/math/test-mis
- printf ("0.0L down: negative differs: 1 vs %d\n",
- v2.ieee.negative);
+ printf ("0.0-epsilon+epsilon is positive\n");
result = 1;
result = 1;
}

diff -urN glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c
--- glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c 2014-05-27 19:53:21.000000000 -0500
+++ glibc-2.17-c758a686/ports/sysdeps/ia64/fpu/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@@ -25,9 +25,11 @@
/* The "strange" 80 bit format on ia64 has an explicit \
leading digit in the 64 bit mantissa. */ \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
\
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
\
zero_mantissa = num == 0; \
\
\
@@ -49,8 +51,8 @@
\
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
- \
+ exponent = u.ieee.exponent; \
+ \
if (exponent == 0) \
{ \
if (zero_mantissa) \
{ \
if (zero_mantissa) \
diff -urN glibc-2.17-c758a686/stdio-common/printf_fp.c glibc-2.17-c758a686/stdio-common/printf_fp.c
--- glibc-2.17-c758a686/stdio-common/printf_fp.c 2014-05-27 19:53:22.000000000 -0500
+++ glibc-2.17-c758a686/stdio-common/printf_fp.c 2014-05-27 19:53:45.000000000 -0500
@@ -335,8 +335,7 @@
int res;
if (__isnanl (fpnum.ldbl))
{
{
- union ieee854_long_double u = { .d = fpnum.ldbl };
- is_neg = u.ieee.negative != 0;
+ is_neg = signbit (fpnum.ldbl);
if (isupper (info->spec))
{
special = "NAN";
if (isupper (info->spec))
{
special = "NAN";
diff -urN glibc-2.17-c758a686/stdio-common/printf_fphex.c glibc-2.17-c758a686/stdio-common/printf_fphex.c
--- glibc-2.17-c758a686/stdio-common/printf_fphex.c 2014-05-27 19:53:22.000000000 -0500
+++ glibc-2.17-c758a686/stdio-common/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@ -458,41 +458,41 @@ diff -urN glibc-2.17-c758a686/stdio-common/printf_fphex.c glibc-2.17-c758a686/st @@ -458,41 +458,41 @@ diff -urN glibc-2.17-c758a686/stdio-common/printf_fphex.c glibc-2.17-c758a686/st
+ long double ldbl;
}
fpnum;

@@ -162,12 +162,11 @@
#ifndef __NO_LONG_DOUBLE_MATH
if (info->is_long_double && sizeof (long double) > sizeof (double))
{
- fpnum.ldbl.d = *(const long double *) args[0];
+ fpnum.ldbl = *(const long double *) args[0];

/* Check for special values: not a number or infinity. */
- if (__isnanl (fpnum.ldbl.d))
+ if (__isnanl (fpnum.ldbl))
{
{
- negative = fpnum.ldbl.ieee.negative != 0;
if (isupper (info->spec))
{
special = "NAN";
if (isupper (info->spec))
{
special = "NAN";
@@ -181,8 +180,7 @@
}
}
else
{
{
- int res = __isinfl (fpnum.ldbl.d);
- if (res)
+ if (__isinfl (fpnum.ldbl))
{
if (isupper (info->spec))
{
{
if (isupper (info->spec))
{
@@ -194,11 +192,9 @@
special = "inf";
wspecial = L"inf";
}
special = "inf";
wspecial = L"inf";
}
- negative = res < 0;
}
}
- else
- negative = signbit (fpnum.ldbl.d);
}
}
+ negative = signbit (fpnum.ldbl);
}
else
@ -515,43 +515,43 @@ diff -urN glibc-2.17-c758a686/stdio-common/printf_size.c glibc-2.17-c758a686/std @@ -515,43 +515,43 @@ diff -urN glibc-2.17-c758a686/stdio-common/printf_size.c glibc-2.17-c758a686/std
{
- fpnum.ldbl.d = *(const long double *) args[0];
+ fpnum.ldbl = *(const long double *) args[0];

/* Check for special values: not a number or infinity. */
- if (__isnanl (fpnum.ldbl.d))
+ if (__isnanl (fpnum.ldbl))
{
special = "nan";
wspecial = L"nan";
// fpnum_sign = 0; Already zero
}
{
special = "nan";
wspecial = L"nan";
// fpnum_sign = 0; Already zero
}
- else if ((res = __isinfl (fpnum.ldbl.d)))
+ else if ((res = __isinfl (fpnum.ldbl)))
{
fpnum_sign = res;
special = "inf";
wspecial = L"inf";
}
{
fpnum_sign = res;
special = "inf";
wspecial = L"inf";
}
else
- while (fpnum.ldbl.d >= divisor && tag[1] != '\0')
+ while (fpnum.ldbl >= divisor && tag[1] != '\0')
{
{
- fpnum.ldbl.d /= divisor;
+ fpnum.ldbl /= divisor;
++tag;
}
++tag;
}
}
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@@ -24,13 +24,15 @@
digits we use only the implicit digits for the number before \
the decimal point. */ \
digits we use only the implicit digits for the number before \
the decimal point. */ \
unsigned long long int num0, num1; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
\
assert (sizeof (long double) == 16); \
\
\
- num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
- num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \
@ -560,21 +560,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c glibc-2.17 @@ -560,21 +560,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128/printf_fphex.c glibc-2.17
+ | u.ieee.mantissa1); \
+ num1 = (((unsigned long long int) u.ieee.mantissa2) << 32 \
+ | u.ieee.mantissa3); \
\
\
zero_mantissa = (num0|num1) == 0; \
\
\
@@ -75,9 +77,9 @@
*--wnumstr = L'0'; \
} \
\
*--wnumstr = L'0'; \
} \
\
- leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \
+ leading = u.ieee.exponent == 0 ? '0' : '1'; \
\
\
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
\
if (exponent == 0) \
{ \
{ \
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@ -584,69 +584,69 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2 @@ -584,69 +584,69 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c glibc-2
union ibm_extended_long_double u; \
- u.ld = fpnum.ldbl.d; \
+ u.ld = fpnum.ldbl; \
\
\
assert (sizeof (long double) == 16); \
\
\
lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \
hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \
lo <<= 7; /* pre-shift lo to match ieee854. */ \
- /* If the lower double is not a denomal or zero then set the hidden \
+ /* If the lower double is not a denormal or zero then set the hidden \
53rd bit. */ \
53rd bit. */ \
if (u.d[1].ieee.exponent != 0) \
lo |= (1ULL << (52 + 7)); \
lo |= (1ULL << (52 + 7)); \
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-96/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@@ -25,11 +25,13 @@
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
leading digit in the 64 bit mantissa. */ \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
\
assert (sizeof (long double) == 12); \
\
\
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
\
zero_mantissa = num == 0; \
\
\
@@ -62,7 +64,7 @@
\
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
\
if (exponent == 0) \
{ \
{ \
diff -urN glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c
--- glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c 2014-05-27 19:53:20.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/x86_64/fpu/printf_fphex.c 2014-05-27 19:53:45.000000000 -0500
@@ -25,10 +25,11 @@
/* The "strange" 80 bit format on ix86 and m68k has an explicit \
leading digit in the 64 bit mantissa. */ \
leading digit in the 64 bit mantissa. */ \
unsigned long long int num; \
+ union ieee854_long_double u; \
+ u.d = fpnum.ldbl; \
\
\
- \
- num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \
- | fpnum.ldbl.ieee.mantissa1); \
+ num = (((unsigned long long int) u.ieee.mantissa0) << 32 \
+ | u.ieee.mantissa1); \
\
\
zero_mantissa = num == 0; \
\
\
@@ -61,7 +62,7 @@
\
\
/* We have 3 bits from the mantissa in the leading nibble. \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */ \
- exponent = fpnum.ldbl.ieee.exponent; \
+ exponent = u.ieee.exponent; \
\
\
if (exponent == 0) \
{ \
{ \

208
SOURCES/glibc-ppc64le-07.patch

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
# commit 4ebd120cd983c8d2ac7a234884b3ac6805d82973
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:24:05 2013 +0930
#
#
# PowerPC floating point little-endian [2 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00082.html
#
#
# This patch replaces occurrences of GET_LDOUBLE_* and SET_LDOUBLE_*
# macros, and union ieee854_long_double_shape_type in ldbl-128ibm/,
# and a stray one in the 32-bit fpu support. These files have no
# significant changes apart from rewriting the long double bit access.
#
#
# * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_high): Define.
# * sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Rewrite
# all uses of ieee854 long double macros and unions.
@ -41,14 +41,14 @@ @@ -41,14 +41,14 @@
# * sysdeps/ieee754/ldbl-128ibm/s_sinl.c (__sinl): Likewise.
# * sysdeps/ieee754/ldbl-128ibm/s_tanl.c (__tanl): Likewise.
# * sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c (__logbl): Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c 2014-05-27 19:59:00.000000000 -0500
@@ -36,8 +36,12 @@
{
long double t;
int64_t hx;
long double t;
int64_t hx;
- u_int64_t lx;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ uint64_t lx;
@ -57,9 +57,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c glibc-2.17- @@ -57,9 +57,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c glibc-2.17-
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
if(hx<0x3ff0000000000000LL) { /* x < 1 */
return (x-x)/(x-x);
} else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
if(hx<0x3ff0000000000000LL) { /* x < 1 */
return (x-x)/(x-x);
} else if(hx >=0x41b0000000000000LL) { /* x > 2**28 */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c 2014-05-27 19:59:00.000000000 -0500
@ -70,16 +70,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c @@ -70,16 +70,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c
- long double z, r, w, p, q, s, t, f2;
- ieee854_long_double_shape_type u;
+ long double a, z, r, w, p, q, s, t, f2;

- u.value = __builtin_fabsl (x);
- if (u.value == 1.0L)
+ a = __builtin_fabsl (x);
+ if (a == 1.0L)
{
if (x > 0.0L)
return 0.0; /* acos(1) = 0 */
return 0.0; /* acos(1) = 0 */
else
return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */
}
- else if (u.value > 1.0L)
+ else if (a > 1.0L)
@ -91,23 +91,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c @@ -91,23 +91,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c
{
- if (u.value < 6.938893903907228e-18L) /* |x| < 2**-57 */
+ if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */
return pio2_hi + pio2_lo;
return pio2_hi + pio2_lo;
- if (u.value < 0.4375L)
+ if (a < 0.4375L)
{
/* Arcsine of x. */
z = x * x;
{
/* Arcsine of x. */
z = x * x;
@@ -199,7 +198,7 @@
return z;
}
return z;
}
/* .4375 <= |x| < .5 */
- t = u.value - 0.4375L;
+ t = a - 0.4375L;
p = ((((((((((P10 * t
+ P9) * t
+ P8) * t
+ P9) * t
+ P8) * t
@@ -230,9 +229,9 @@
r = acosr4375 + r;
r = acosr4375 + r;
return r;
}
- else if (u.value < 0.625L)
@ -116,8 +116,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c @@ -116,8 +116,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c
- t = u.value - 0.5625L;
+ t = a - 0.5625L;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
+ rS9) * t
+ rS8) * t
@@ -264,7 +263,9 @@
}
else
@ -128,11 +128,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c @@ -128,11 +128,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_acosl.c glibc-2.17-c
+ z = (one - a) * 0.5;
s = __ieee754_sqrtl (z);
/* Compute an extended precision square root from
the Newton iteration s -> 0.5 * (s + z / s).
the Newton iteration s -> 0.5 * (s + z / s).
@@ -273,12 +274,11 @@
Express s = f1 + f2 where f1 * f1 is exactly representable.
w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
s + w has extended precision. */
Express s = f1 + f2 where f1 * f1 is exactly representable.
w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s .
s + w has extended precision. */
- u.value = s;
- u.parts32.w2 = 0;
- u.parts32.w3 = 0;
@ -158,7 +158,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c @@ -158,7 +158,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c
+ long double a, t, w, p, q, c, r, s;
int flag;
- ieee854_long_double_shape_type u;

flag = 0;
- u.value = __builtin_fabsl (x);
- if (u.value == 1.0L) /* |x|>= 1 */
@ -173,12 +173,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c @@ -173,12 +173,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c
{
- if (u.value < 6.938893903907228e-18L) /* |x| < 2**-57 */
+ if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */
{
if (huge + x > one)
return x; /* return x with inexact if x!=0 */
{
if (huge + x > one)
return x; /* return x with inexact if x!=0 */
@@ -155,9 +154,9 @@
flag = 1;
}
flag = 1;
}
}
- else if (u.value < 0.625L)
+ else if (a < 0.625L)
@ -186,8 +186,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c @@ -186,8 +186,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c
- t = u.value - 0.5625;
+ t = a - 0.5625;
p = ((((((((((rS10 * t
+ rS9) * t
+ rS8) * t
+ rS9) * t
+ rS8) * t
@@ -190,7 +189,7 @@
else
{
@ -196,10 +196,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c @@ -196,10 +196,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_asinl.c glibc-2.17-c
+ w = one - a;
t = w * 0.5;
}

@@ -223,17 +222,14 @@
}

s = __ieee754_sqrtl (t);
- if (u.value > 0.975L)
+ if (a > 0.975L)
@ -222,32 +222,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c glibc-2.17- @@ -222,32 +222,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c glibc-2.17-
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c 2014-05-27 19:59:00.000000000 -0500
@@ -40,8 +40,10 @@
{
long double t;
int64_t hx,ix;
long double t;
int64_t hx,ix;
- u_int64_t lx __attribute__ ((unused));
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx&0x7fffffffffffffffLL;
if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
if (ix > 0x3ff0000000000000LL)
ix = hx&0x7fffffffffffffffLL;
if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */
if (ix > 0x3ff0000000000000LL)
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_coshl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_coshl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_coshl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_coshl.c 2014-05-27 19:59:00.000000000 -0500
@@ -41,9 +41,11 @@
{
long double t,w;
int64_t ix;
long double t,w;
int64_t ix;
+ double xhi;

/* High word of |x|. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);
ix &= 0x7fffffffffffffffLL;

ix &= 0x7fffffffffffffffLL;
/* x is INF or NaN */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log2l.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log2l.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log2l.c 2014-05-27 19:58:07.000000000 -0500
@ -259,7 +259,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log2l.c glibc-2.17-c @@ -259,7 +259,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_log2l.c glibc-2.17-c
- int64_t hx, lx;
+ int64_t hx;
+ double xhi;

/* Test for domain */
- GET_LDOUBLE_WORDS64 (hx, lx, x);
- if (((hx & 0x7fffffffffffffffLL) | (lx & 0x7fffffffffffffffLL)) == 0)
@ -279,7 +279,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c glibc-2. @@ -279,7 +279,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c glibc-2.
- u_int64_t lx __attribute__ ((unused));
u_int64_t lxd;
+ double xhi;

- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
@ -291,16 +291,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c glibc-2.17-c @@ -291,16 +291,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c glibc-2.17-c
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c 2014-05-27 19:59:00.000000000 -0500
@@ -38,9 +38,11 @@
{
long double t,w,h;
int64_t ix,jx;
long double t,w,h;
int64_t ix,jx;
+ double xhi;

/* High word of |x|. */
- GET_LDOUBLE_MSW64(jx,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (jx, xhi);
ix = jx&0x7fffffffffffffffLL;

ix = jx&0x7fffffffffffffffLL;
/* x is INF or NaN */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_cosl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_cosl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_cosl.c 2014-05-27 19:58:07.000000000 -0500
@ -320,8 +320,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_cosl.c glibc-2.17-c7 @@ -320,8 +320,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_cosl.c glibc-2.17-c7
tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
@@ -136,7 +139,8 @@
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
@ -349,14 +349,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c glibc-2.17 @@ -349,14 +349,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c glibc-2.17
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
{
@@ -164,7 +167,8 @@
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+ h = hhi;
if (iy)
l = y - (h - x);
l = y - (h - x);
else
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sinl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sinl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sinl.c 2014-05-27 19:58:07.000000000 -0500
@ -374,30 +374,30 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sinl.c glibc-2.17-c7 @@ -374,30 +374,30 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/k_sinl.c glibc-2.17-c7
tix &= ~0x80000000; /* tix = |x|'s high 32 bits */
if (tix < 0x3fc30000) /* |x| < 0.1484375 */
@@ -132,7 +135,8 @@
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
case 2: index = (hix - 0x3fc30000) >> 14; break;
}
*/
- SET_LDOUBLE_WORDS64(h, ((u_int64_t)hix) << 32, 0);
+ INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32);
+ h = hhi;
if (iy)
l = (ix < 0 ? -y : y) - (h - x);
l = (ix < 0 ? -y : y) - (h - x);
else
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c 2014-05-27 19:59:00.000000000 -0500
@@ -38,7 +38,10 @@
{
long double t,w;
int64_t hx,ix;
long double t,w;
int64_t hx,ix;
- GET_LDOUBLE_MSW64(hx,x);
+ double xhi;
+
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
ix = hx&0x7fffffffffffffffLL;
if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */
if(ix< 0x3e20000000000000LL) { /* |x|<2**-29 */
ix = hx&0x7fffffffffffffffLL;
if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */
if(ix< 0x3e20000000000000LL) { /* |x|<2**-29 */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c 2014-05-27 19:59:00.000000000 -0500
@ -410,7 +410,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c @@ -410,7 +410,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c
long double t, u, p, q;
- ieee854_long_double_shape_type s;
+ double xhi;

- s.value = x;
- k = s.parts32.w0;
- if (k & 0x80000000)
@ -420,7 +420,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c @@ -420,7 +420,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS (k, lx, xhi);
+ sign = k & 0x80000000;

/* Check for IEEE special cases. */
k &= 0x7fffffff;
if (k >= 0x7ff00000)
@ -428,45 +428,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c @@ -428,45 +428,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_atanl.c glibc-2.17-c
/* NaN. */
- if ((k & 0xfffff) | s.parts32.w1 )
+ if (((k - 0x7ff00000) | lx) != 0)
return (x + x);

return (x + x);
/* Infinity. */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_cosl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_cosl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_cosl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_cosl.c 2014-05-27 19:59:00.000000000 -0500
@@ -53,9 +53,11 @@
{
long double y[2],z=0.0L;
int64_t n, ix;
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;

/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);

/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
ix &= 0x7fffffffffffffffLL;
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c 2014-05-27 19:59:00.000000000 -0500
@@ -29,10 +29,16 @@
long double __fabsl(long double x)
{
u_int64_t hx, lx;
u_int64_t hx, lx;
- GET_LDOUBLE_WORDS64(hx,lx,x);
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
lx = lx ^ ( hx & 0x8000000000000000LL );
hx = hx & 0x7fffffffffffffffLL;
lx = lx ^ ( hx & 0x8000000000000000LL );
hx = hx & 0x7fffffffffffffffLL;
- SET_LDOUBLE_WORDS64(x,hx,lx);
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
return x;
return x;
}
long_double_symbol (libm, __fabsl, fabsl);
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_finitel.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_finitel.c
@ -499,7 +499,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c glibc- @@ -499,7 +499,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c glibc-
u_int64_t hx, lx;
int retval = FP_NORMAL;
+ double xhi, xlo;

- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
@ -507,13 +507,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c glibc- @@ -507,13 +507,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c glibc-
/* +/-NaN or +/-Inf */
if (hx & 0x000fffffffffffffULL) {
@@ -65,6 +67,7 @@
retval = FP_NORMAL;
} else {
if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) {
retval = FP_NORMAL;
} else {
if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) {
+ EXTRACT_WORDS64 (lx, xlo);
if ((lx & 0x7fffffffffffffff) /* lower is non-zero */
&& ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */
/* +/- denormal */
if ((lx & 0x7fffffffffffffff) /* lower is non-zero */
&& ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */
/* +/- denormal */
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c 2014-05-27 19:59:00.000000000 -0500
@ -547,7 +547,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c glibc-2.17-c @@ -547,7 +547,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_logbl.c glibc-2.17-c
int64_t hx, rhx;
- int64_t lx __attribute__ ((unused));
+ double xhi;

- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (hx, xhi);
@ -562,7 +562,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c glibc-2.1 @@ -562,7 +562,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c glibc-2.1
{
int64_t e;
+ double xhi;

- GET_LDOUBLE_MSW64 (e, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (e, xhi);
@ -577,12 +577,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c glibc-2.17 @@ -577,12 +577,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c glibc-2.17
{
int64_t ix;
+ double xhi;

/* High word of x. */
- GET_LDOUBLE_MSW64 (ix, x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);

/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sinl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sinl.c
@ -590,33 +590,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sinl.c glibc-2.17-c7 @@ -590,33 +590,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sinl.c glibc-2.17-c7
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_sinl.c 2014-05-27 19:59:19.000000000 -0500
@@ -53,9 +53,11 @@
{
long double y[2],z=0.0L;
int64_t n, ix;
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;

/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);

/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
ix &= 0x7fffffffffffffffLL;
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_tanl.c 2014-05-27 19:59:19.000000000 -0500
@@ -53,9 +53,11 @@
{
long double y[2],z=0.0L;
int64_t n, ix;
long double y[2],z=0.0L;
int64_t n, ix;
+ double xhi;

/* High word of x. */
- GET_LDOUBLE_MSW64(ix,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ix, xhi);

/* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL;
ix &= 0x7fffffffffffffffLL;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c 2014-05-27 19:58:07.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c 2014-05-27 19:59:19.000000000 -0500
@ -627,11 +627,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c gli @@ -627,11 +627,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c gli
- double xh, xl;
+ double xh;
double ret;

if (__builtin_expect (x == 0.0L, 0))
/* Raise FE_DIVBYZERO and return -HUGE_VAL[LF]. */
return -1.0L / __builtin_fabsl (x);

- ldbl_unpack (x, &xh, &xl);
+ xh = ldbl_high (x);
/* ret = x & 0x7ff0000000000000; */
@ -643,7 +643,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c gli @@ -643,7 +643,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_logbl.c gli
though it were normalized. */
- int64_t lx, hx;
+ int64_t hx;

- GET_LDOUBLE_WORDS64 (hx, lx, x);
+ EXTRACT_WORDS64 (hx, xh);
return (long double) (-1023 - (__builtin_clzll (hx) - 12));

588
SOURCES/glibc-ppc64le-08.patch

File diff suppressed because it is too large Load Diff

204
SOURCES/glibc-ppc64le-09.patch

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
# commit 650ef4bd7976e36831cba22d838b567d3b5f6e8f
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:25:51 2013 +0930
#
#
# PowerPC floating point little-endian [4 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00084.html
#
#
# Another batch of ieee854 macros and union replacement. These four
# files also have bugs fixed with this patch. The fact that the two
# doubles in an IBM long double may have different signs means that
@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
# flag. The e_hypotl.c tests for large "a" and small "b" are mutually
# exclusive because we've already exited when x/y > 2**120. That allows
# some further small simplifications.
#
#
# [BZ #15734], [BZ #15735]
# * sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite
# all uses of ieee875 long double macros and unions. Simplify test
@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
# (__erfcl): Likewise.
# * math/libm-test.inc: Add tests for errors discovered in IBM long
# double versions of fmodl, remainderl, erfl and erfcl.
#
#
diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-test.inc
--- glibc-2.17-c758a686/math/libm-test.inc 2014-05-27 20:02:29.000000000 -0500
+++ glibc-2.17-c758a686/math/libm-test.inc 2014-05-27 20:09:59.000000000 -0500
@ -53,7 +53,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t @@ -53,7 +53,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t
+ /* The input is not exactly representable as a double. */
+ TEST_f_f (erf, -0x1.fffffffffffff8p-2L, -0.5204998778130465132916303345518417673509L);
+#endif

END (erf);
}
@@ -4071,6 +4075,10 @@
@ -78,7 +78,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t @@ -78,7 +78,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t
+ TEST_ff_f (fmod, 0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, 0x1p-56L);
+ TEST_ff_f (fmod, -0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, -0x1p-56L);
+#endif

END (fmod);
}
@@ -8642,6 +8657,9 @@
@ -88,7 +88,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t @@ -88,7 +88,7 @@ diff -urN glibc-2.17-c758a686/math/libm-test.inc glibc-2.17-c758a686/math/libm-t
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 56
+ TEST_ff_f (remainder, -0x1.80000000000002p1L, 2.0, 0x1.fffffffffffff8p-1L);
+#endif

END (remainder);
}
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
@ -115,19 +115,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c @@ -115,19 +115,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c
+ ldbl_unpack (y, &yhi, &ylo);
+ EXTRACT_WORDS64 (hy, yhi);
+ EXTRACT_WORDS64 (ly, ylo);
sx = hx&0x8000000000000000ULL; /* sign of x */
sx = hx&0x8000000000000000ULL; /* sign of x */
- hx ^=sx; /* |x| */
- hy &= 0x7fffffffffffffffLL; /* |y| */
+ hx ^= sx; /* |x| */
+ sy = hy&0x8000000000000000ULL; /* sign of y */
+ hy ^= sy; /* |y| */

/* purge off exception values */
- if(__builtin_expect((hy|(ly&0x7fffffffffffffff))==0 ||
+ if(__builtin_expect(hy==0 ||
(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
(hy>0x7ff0000000000000LL),0)) /* or y is NaN */
return (x*y)/(x*y);
(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
(hy>0x7ff0000000000000LL),0)) /* or y is NaN */
return (x*y)/(x*y);
- if(__builtin_expect(hx<=hy,0)) {
- if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
- if(lx==ly)
@ -159,8 +159,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c @@ -159,8 +159,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c
+ /* If |x| == |y| return x*0. */
+ if ((lx ^ sx) == (ly ^ sy))
+ return Zero[(uint64_t) sx >> 63];
}

}
- /* determine ix = ilogb(x) */
- if(__builtin_expect(hx<0x0010000000000000LL,0)) { /* subnormal x */
- if(hx==0) {
@ -186,7 +186,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c @@ -186,7 +186,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c
- ldbl_extract_mantissa(&hy, &ly, &temp, y);
+ ldbl_extract_mantissa(&hx, &lx, &ix, x);
+ ldbl_extract_mantissa(&hy, &ly, &iy, y);

- /* set up {hx,lx}, {hy,ly} and align y to x */
- if(__builtin_expect(ix >= -1022, 1))
- hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
@ -233,34 +233,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c @@ -233,34 +233,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c glibc-2.17-c
+ iy -= 1;
+ }
+ }

/* fix point fmod */
n = ix - iy;
n = ix - iy;
@@ -104,7 +111,7 @@
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
else {
hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1;
if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;}
else {
- if((hz|(lz&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ if((hz|lz)==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
hx = hz+hz+(lz>>63); lx = lz+lz;
}
return Zero[(u_int64_t)sx>>63];
hx = hz+hz+(lz>>63); lx = lz+lz;
}
@@ -113,7 +120,7 @@
if(hz>=0) {hx=hz;lx=lz;}

if(hz>=0) {hx=hz;lx=lz;}
/* convert back to floating value and restore the sign */
- if((hx|(lx&0x7fffffffffffffff))==0) /* return sign(x)*0 */
+ if((hx|lx)==0) /* return sign(x)*0 */
return Zero[(u_int64_t)sx>>63];
while(hx<0x0001000000000000LL) { /* normalize x */
hx = hx+hx+(lx>>63); lx = lx+lx;
return Zero[(u_int64_t)sx>>63];
while(hx<0x0001000000000000LL) { /* normalize x */
hx = hx+hx+(lx>>63); lx = lx+lx;
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c 2014-05-27 20:02:27.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c 2014-05-27 20:04:08.000000000 -0500
@@ -45,76 +45,84 @@
#include <math.h>
#include <math_private.h>

-static const long double two600 = 0x1.0p+600L;
-static const long double two1022 = 0x1.0p+1022L;
-
@ -269,39 +269,39 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -269,39 +269,39 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
{
- long double a,b,t1,t2,y1,y2,w,kld;
+ long double a,b,a1,a2,b1,b2,w,kld;
int64_t j,k,ha,hb;
int64_t j,k,ha,hb;
+ double xhi, yhi, hi, lo;

- GET_LDOUBLE_MSW64(ha,x);
+ xhi = ldbl_high (x);
+ EXTRACT_WORDS64 (ha, xhi);
+ yhi = ldbl_high (y);
+ EXTRACT_WORDS64 (hb, yhi);
ha &= 0x7fffffffffffffffLL;
ha &= 0x7fffffffffffffffLL;
- GET_LDOUBLE_MSW64(hb,y);
hb &= 0x7fffffffffffffffLL;
if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
a = fabsl(a); /* a <- |a| */
b = fabsl(b); /* b <- |b| */
hb &= 0x7fffffffffffffffLL;
if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;}
a = fabsl(a); /* a <- |a| */
b = fabsl(b); /* b <- |b| */
- if((ha-hb)>0x780000000000000LL) {return a+b;} /* x/y > 2**120 */
+ if((ha-hb)>0x0780000000000000LL) {return a+b;} /* x/y > 2**120 */
k=0;
kld = 1.0L;
if(ha > 0x5f30000000000000LL) { /* a>2**500 */
if(ha >= 0x7ff0000000000000LL) { /* Inf or NaN */
k=0;
kld = 1.0L;
if(ha > 0x5f30000000000000LL) { /* a>2**500 */
if(ha >= 0x7ff0000000000000LL) { /* Inf or NaN */
- u_int64_t low;
w = a+b; /* for sNaN */
w = a+b; /* for sNaN */
- GET_LDOUBLE_LSW64(low,a);
- if(((ha&0xfffffffffffffLL)|(low&0x7fffffffffffffffLL))==0)
+ if(ha == 0x7ff0000000000000LL)
w = a;
w = a;
- GET_LDOUBLE_LSW64(low,b);
- if(((hb^0x7ff0000000000000LL)|(low&0x7fffffffffffffffLL))==0)
+ if(hb == 0x7ff0000000000000LL)
w = b;
return w;
}
/* scale a and b by 2**-600 */
w = b;
return w;
}
/* scale a and b by 2**-600 */
- ha -= 0x2580000000000000LL; hb -= 0x2580000000000000LL; k += 600;
- a /= two600;
- b /= two600;
@ -311,10 +311,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -311,10 +311,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
+ b *= 0x1p-600L;
+ k = 600;
+ kld = 0x1p+600L;
}
}
- if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */
+ else if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */
if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */
- u_int64_t low;
- GET_LDOUBLE_LSW64(low,b);
- if((hb|(low&0x7fffffffffffffffLL))==0) return a;
@ -328,7 +328,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -328,7 +328,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
+ b *= 0x1p+1022L;
+ k = -1022;
+ kld = 0x1p-1022L;
} else { /* scale a and b by 2^600 */
} else { /* scale a and b by 2^600 */
- ha += 0x2580000000000000LL; /* a *= 2^600 */
- hb += 0x2580000000000000LL; /* b *= 2^600 */
- k -= 600;
@ -339,11 +339,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -339,11 +339,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
+ b *= 0x1p+600L;
+ k = -600;
+ kld = 0x1p-600L;
}
}
}
}
/* medium size a and b */
w = a-b;
if (w>b) {
w = a-b;
if (w>b) {
- SET_LDOUBLE_WORDS64(t1,ha,0);
- t2 = a-t1;
- w = __ieee754_sqrtl(t1*t1-(b*(-b)-t2*(a+t1)));
@ -357,8 +357,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -357,8 +357,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
+ = a1*a1 + a1*a2 + a2*a + b*b
+ = a1*a1 + a2*(a+a1) + b*b */
+ w = __ieee754_sqrtl(a1*a1-(b*(-b)-a2*(a+a1)));
} else {
a = a+a;
} else {
a = a+a;
- SET_LDOUBLE_WORDS64(y1,hb,0);
- y2 = b - y1;
- SET_LDOUBLE_WORDS64(t1,ha+0x0010000000000000LL,0);
@ -379,18 +379,18 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17- @@ -379,18 +379,18 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c glibc-2.17-
+ = w*w + a1*(b1+b2) + a2*b
+ = w*w + a1*b1 + a1*b2 + a2*b */
+ w = __ieee754_sqrtl(a1*b1-(w*(-w)-(a1*b2+a2*b)));
}
if(k!=0)
return w*kld;
}
if(k!=0)
return w*kld;
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c 2014-05-27 20:02:27.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c 2014-05-27 20:04:08.000000000 -0500
@@ -33,18 +33,22 @@
int64_t hx,hp;
u_int64_t sx,lx,lp;
long double p_half;
int64_t hx,hp;
u_int64_t sx,lx,lp;
long double p_half;
+ double xhi, xlo, phi, plo;

- GET_LDOUBLE_WORDS64(hx,lx,x);
- GET_LDOUBLE_WORDS64(hp,lp,p);
+ ldbl_unpack (x, &xhi, &xlo);
@ -399,29 +399,29 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c glibc-2 @@ -399,29 +399,29 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c glibc-2
+ ldbl_unpack (p, &phi, &plo);
+ EXTRACT_WORDS64 (hp, phi);
+ EXTRACT_WORDS64 (lp, plo);
sx = hx&0x8000000000000000ULL;
hp &= 0x7fffffffffffffffLL;
hx &= 0x7fffffffffffffffLL;

sx = hx&0x8000000000000000ULL;
hp &= 0x7fffffffffffffffLL;
hx &= 0x7fffffffffffffffLL;
/* purge off exception values */
- if((hp|(lp&0x7fffffffffffffff))==0) return (x*p)/(x*p); /* p = 0 */
+ if(hp==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7ff0000000000000LL)|| /* x not finite */
if((hx>=0x7ff0000000000000LL)|| /* x not finite */
- ((hp>=0x7ff0000000000000LL)&& /* p is NaN */
- (((hp-0x7ff0000000000000LL)|lp)!=0)))
+ (hp>0x7ff0000000000000LL)) /* p is NaN */
return (x*p)/(x*p);


return (x*p)/(x*p);
@@ -64,8 +68,8 @@
if(x>=p_half) x -= p;
}
}
if(x>=p_half) x -= p;
}
}
- GET_LDOUBLE_MSW64(hx,x);
- SET_LDOUBLE_MSW64(x,hx^sx);
+ if (sx)
+ x = -x;
return x;
return x;
}
strong_alias (__ieee754_remainderl, __remainderl_finite)
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@ -435,33 +435,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -435,33 +435,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
- ieee854_long_double_shape_type u;
+ int32_t i, ix, hx;
+ double xhi;

- u.value = x;
- sign = u.parts32.w0;
- ix = sign & 0x7fffffff;
+ xhi = ldbl_high (x);
+ GET_HIGH_WORD (hx, xhi);
+ ix = hx & 0x7fffffff;

if (ix >= 0x7ff00000)
{ /* erf(nan)=nan */
- i = ((sign & 0xfff00000) >> 31) << 1;
+ i = ((uint32_t) hx >> 31) << 1;
return (long double) (1 - i) + one / x; /* erf(+-inf)=+-1 */
}

@@ -778,7 +778,7 @@
if (ix >= 0x4039A0DE)
{
/* __erfcl (x) underflows if x > 25.6283 */
{
/* __erfcl (x) underflows if x > 25.6283 */
- if (sign)
+ if ((hx & 0x80000000) == 0)
return one-tiny;
else
return tiny-one;
return one-tiny;
else
return tiny-one;
@@ -789,8 +789,9 @@
return (one - y);
}
return (one - y);
}
}
- u.parts32.w0 = ix;
- a = u.value;
@ -474,7 +474,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -474,7 +474,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
@@ -814,7 +815,7 @@
y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2);
}

- if (sign & 0x80000000) /* x < 0 */
+ if (hx & 0x80000000) /* x < 0 */
y = -y;
@ -498,14 +498,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -498,14 +498,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
+ xhi = ldbl_high (x);
+ GET_HIGH_WORD (hx, xhi);
+ ix = hx & 0x7fffffff;

if (ix >= 0x7ff00000)
{ /* erfc(nan)=nan */
/* erfc(+-inf)=0,2 */
- return (long double) (((u_int32_t) sign >> 31) << 1) + one / x;
+ return (long double) ((hx >> 31) << 1) + one / x;
}

if (ix < 0x3fd00000) /* |x| <1/4 */
@@ -846,7 +847,8 @@
}
@ -516,14 +516,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -516,14 +516,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
+ x = -x;
i = 8.0 * x;
switch (i)
{
{
@@ -891,7 +893,7 @@
y += C20a;
break;
}
y += C20a;
break;
}
- if (sign & 0x80000000)
+ if (hx & 0x80000000)
y = 2.0L - y;
y = 2.0L - y;
return y;
}
@@ -899,10 +901,11 @@
@ -532,8 +532,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -532,8 +532,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
/* x < -9 */
- if ((ix >= 0x40220000) && (sign & 0x80000000))
+ if (hx >= 0xc0220000)
return two - tiny;

return two - tiny;
- x = fabsl (x);
+ if ((hx & 0x80000000) != 0)
+ x = -x;
@ -541,9 +541,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -541,9 +541,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
i = 8.0 / x;
switch (i)
@@ -933,21 +936,17 @@
p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
break;
}
p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8);
break;
}
- u.value = x;
- u.parts32.w3 = 0;
- u.parts32.w2 = 0;
@ -551,17 +551,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7 @@ -551,17 +551,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/s_erfl.c glibc-2.17-c7
- z = u.value;
+ z = (float) x;
r = __ieee754_expl (-z * z - 0.5625) *
__ieee754_expl ((z - x) * (z + x) + p);
__ieee754_expl ((z - x) * (z + x) + p);
- if ((sign & 0x80000000) == 0)
+ if ((hx & 0x80000000) == 0)
return r / x;
return r / x;
else
return two - r / x;
return two - r / x;
}
else
{
- if ((sign & 0x80000000) == 0)
+ if ((hx & 0x80000000) == 0)
return tiny * tiny;
return tiny * tiny;
else
return two - tiny;
return two - tiny;

18
SOURCES/glibc-ppc64le-10.patch

@ -1,25 +1,25 @@ @@ -1,25 +1,25 @@
# commit 32c301dfc9b786453e59b61fe4a821a89e1a206b
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:26:39 2013 +0930
#
#
# PowerPC floating point little-endian [5 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00085.html
#
#
# Rid ourselves of ieee854.
#
#
# * sysdeps/ieee754/ldbl-128ibm/ieee754.h (union ieee854_long_double):
# Delete.
# (IEEE854_LONG_DOUBLE_BIAS): Delete.
# * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Don't include ieee854
# version of math_ldbl.h.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h 2014-05-27 22:10:43.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h 2014-05-27 22:11:10.000000000 -0500
@@ -112,61 +112,6 @@
#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */


-union ieee854_long_double
- {
- long double d;
@ -76,7 +76,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c @@ -76,7 +76,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/ieee754.h glibc-2.17-c
-
-
/* IBM extended format for long double.

Each long double is made up of two IEEE doubles. The value of the
diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h 2014-05-27 22:10:43.000000000 -0500
@ -84,8 +84,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17 @@ -84,8 +84,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h glibc-2.17
@@ -2,7 +2,6 @@
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
#endif

-#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
#include <ieee754.h>

static inline void

24
SOURCES/glibc-ppc64le-11.patch

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# commit 62a728aeff93507ce5975f245a5f1d2046fb4503
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:27:19 2013 +0930
#
#
# PowerPC floating point little-endian [6 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00197.html
#
#
# A rewrite to make this code correct for little-endian.
#
#
# * sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c (mynumber): Replace
# union 32-bit int array member with 64-bit int array.
# (t515, tm256): Double rather than long double.
@ -16,13 +16,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -16,13 +16,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
--- glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c 2014-05-27 22:20:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c 2014-05-27 22:21:39.000000000 -0500
@@ -34,15 +34,13 @@

#include <math_private.h>

-typedef unsigned int int4;
-typedef union {int4 i[4]; long double x; double d[2]; } mynumber;
+typedef union {int64_t i[2]; long double x; double d[2]; } mynumber;

-static const mynumber
- t512 = {{0x5ff00000, 0x00000000, 0x00000000, 0x00000000 }}, /* 2^512 */
- tm256 = {{0x2ff00000, 0x00000000, 0x00000000, 0x00000000 }}; /* 2^-256 */
@ -33,7 +33,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -33,7 +33,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
+ tm256 = 0x1p-256,
+ two54 = 0x1p54, /* 0x4350000000000000 */
+ twom54 = 0x1p-54; /* 0x3C90000000000000 */

/*********************************************************************/
/* An ultimate sqrt routine. Given an IEEE double machine number x */
@@ -54,56 +52,53 @@
@ -45,7 +45,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -45,7 +45,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
+ uint64_t k, l;
+ int64_t m, n;
double d;

a.x=x;
- k=a.i[0] & 0x7fffffff;
+ k=a.i[0] & INT64_C(0x7fffffffffffffff);
@ -62,7 +62,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -62,7 +62,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
+ n = (int64_t) ((l - k) * 2) >> 53;
+ m = (a.i[1] >> 52) & 0x7ff;
if (m == 0) {
a.d[1] *= two54;
a.d[1] *= two54;
- m = ((a.i[2] >> 20) & 0x7ff) - 54;
+ m = ((a.i[1] >> 52) & 0x7ff) - 54;
}
@ -77,10 +77,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -77,10 +77,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
+ else if (m <= -54) {
+ a.i[1] &= INT64_C(0x8000000000000000);
} else {
m += 54;
m += 54;
- a.i[2] = (a.i[2] & 0x800fffff) | (m << 20);
+ a.i[1] = (a.i[1] & INT64_C(0x800fffffffffffff)) | (m << 52);
a.d[1] *= twom54;
a.d[1] *= twom54;
}
}
a.i[0] = l;
@ -101,7 +101,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c @@ -101,7 +101,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c glibc-2.17-c
- if (a.i[0] == 0xfff00000 && a.i[1] == 0)
+ if (k>=INT64_C(0x7ff0000000000000)) {
+ if (a.i[0] == INT64_C(0xfff0000000000000))
return (big1-big1)/(big-big); /* sqrt (-Inf) = NaN. */
return (big1-big1)/(big-big); /* sqrt (-Inf) = NaN. */
return x; /* sqrt (NaN) = NaN, sqrt (+Inf) = +Inf. */
}
if (x == 0) return x;

9
SOURCES/glibc-ppc64le-12.patch

@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
# commit 2ca85d2bbbaa60b9c83bf1f57a2801c84e0a3625
# Author: Anton Blanchard <anton@au1.ibm.com>
# Date: Sat Aug 17 18:28:06 2013 +0930
#
#
# PowerPC floating point little-endian [7 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00086.html
#
#
# * sysdeps/powerpc/bits/mathinline.h (__signbitf): Use builtin.
# (__signbit): Likewise. Correct for little-endian.
# (__signbitl): Call __signbit.
# (lrint): Correct for little-endian.
# (lrintf): Call lrint.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h 2014-05-27 22:28:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h 2014-05-27 22:28:37.000000000 -0500
@ -58,7 +58,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h glibc-2.17-c @@ -58,7 +58,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h glibc-2.17-c
- return __u.__ll[1];
+ return __u.__ll;
}

__MATH_INLINE long int lrintf (float __x) __THROW;
__MATH_INLINE long int
__NTH (lrintf (float __x))
@ -72,3 +72,4 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h glibc-2.17-c @@ -72,3 +72,4 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/bits/mathinline.h glibc-2.17-c
+ return lrint ((double) __x);
}
# endif

80
SOURCES/glibc-ppc64le-13.patch

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# commit 4a28b3ca4bc52d9a3ac0d9edb53d3de510e1b77c
# Author: Anton Blanchard <anton@au1.ibm.com>
# Date: Sat Aug 17 18:28:55 2013 +0930
#
#
# PowerPC floating point little-endian [8 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00199.html
#
#
# Corrects floating-point environment code for little-endian.
#
#
# * sysdeps/powerpc/fpu/fenv_libc.h (fenv_union_t): Replace int
# array with long long.
# * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Adjust.
@ -22,50 +22,50 @@ @@ -22,50 +22,50 @@
# * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Adjust.
# * sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Adjust.
# * sysdeps/powerpc/fpu/ftestexcept.c (fetestexcept): Adjust.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrt.c 2014-05-27 22:31:43.000000000 -0500
@@ -145,7 +145,7 @@
feraiseexcept (FE_INVALID_SQRT);

fenv_union_t u = { .fenv = fegetenv_register () };
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
#endif
feraiseexcept (FE_INVALID);
feraiseexcept (FE_INVALID);
x = a_nan.value;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/e_sqrtf.c 2014-05-27 22:31:43.000000000 -0500
@@ -121,7 +121,7 @@
feraiseexcept (FE_INVALID_SQRT);

fenv_union_t u = { .fenv = fegetenv_register () };
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
#endif
feraiseexcept (FE_INVALID);
feraiseexcept (FE_INVALID);
x = a_nan.value;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fclrexcpt.c 2014-05-27 22:31:43.000000000 -0500
@@ -28,8 +28,8 @@
u.fenv = fegetenv_register ();

/* Clear the relevant bits. */
- u.l[1] = u.l[1] & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
- | (excepts & FPSCR_STICKY_BITS));
+ u.l = u.l & ~((-(excepts >> (31 - FPSCR_VX) & 1) & FE_ALL_INVALID)
+ | (excepts & FPSCR_STICKY_BITS));

/* Put the new state in effect. */
fesetenv_register (u.fenv);
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c 2014-05-27 22:31:43.000000000 -0500
@@ -32,15 +32,15 @@

fe.fenv = fegetenv_register ();
if (excepts & FE_INEXACT)
- fe.l[1] &= ~(1 << (31 - FPSCR_XE));
@ -83,13 +83,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c glibc-2.17-c758a @@ -83,13 +83,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fedisblxcpt.c glibc-2.17-c758a
- fe.l[1] &= ~(1 << (31 - FPSCR_VE));
+ fe.l &= ~(1 << (31 - FPSCR_VE));
fesetenv_register (fe.fenv);

new = __fegetexcept ();
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c 2014-05-27 22:31:43.000000000 -0500
@@ -32,15 +32,15 @@

fe.fenv = fegetenv_register ();
if (excepts & FE_INEXACT)
- fe.l[1] |= (1 << (31 - FPSCR_XE));
@ -107,15 +107,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c glibc-2.17-c758a @@ -107,15 +107,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feenablxcpt.c glibc-2.17-c758a
- fe.l[1] |= (1 << (31 - FPSCR_VE));
+ fe.l |= (1 << (31 - FPSCR_VE));
fesetenv_register (fe.fenv);

new = __fegetexcept ();
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c 2014-05-27 22:31:43.000000000 -0500
@@ -27,15 +27,15 @@

fe.fenv = fegetenv_register ();

- if (fe.l[1] & (1 << (31 - FPSCR_XE)))
+ if (fe.l & (1 << (31 - FPSCR_XE)))
result |= FE_INEXACT;
@ -131,26 +131,26 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c glibc-2.17-c758a @@ -131,26 +131,26 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fegetexcept.c glibc-2.17-c758a
- if (fe.l[1] & (1 << (31 - FPSCR_VE)))
+ if (fe.l & (1 << (31 - FPSCR_VE)))
result |= FE_INVALID;

return result;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/feholdexcpt.c 2014-05-27 22:33:09.000000000 -0500
@@ -30,13 +30,12 @@

/* Clear everything except for the rounding modes and non-IEEE arithmetic
flag. */
- new.l[1] = old.l[1] & 7;
- new.l[0] = old.l[0];
+ new.l = old.l & 0xffffffff00000007LL;

/* If the old env had any eabled exceptions, then mask SIGFPE in the
MSR FE0/FE1 bits. This may allow the FPU to run faster because it
always takes the default action and can not generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) != 0)
(void)__fe_mask_env ();

/* Put the new state in effect. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h 2014-05-27 22:31:42.000000000 -0500
@ -162,8 +162,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h glibc-2.17-c758a68 @@ -162,8 +162,8 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fenv_libc.h glibc-2.17-c758a68
- unsigned int l[2];
+ unsigned long long l;
} fenv_union_t;


diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c 2014-05-27 22:35:18.000000000 -0500
@ -174,15 +174,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c glibc-2.17-c758a686 @@ -174,15 +174,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fesetenv.c glibc-2.17-c758a686
- if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
(void)__fe_nomask_env ();

/* If the old env had any enabled exceptions and the new env has no enabled
exceptions, then mask SIGFPE in the MSR FE0/FE1 bits. This may allow the
FPU to run faster because it always takes the default action and can not
FPU to run faster because it always takes the default action and can not
generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
+ if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
(void)__fe_mask_env ();

fesetenv_register (*envp);
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c 2014-05-27 22:31:42.000000000 -0500
@ -193,7 +193,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a @@ -193,7 +193,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a
unchanged. */
- new.l[1] = (old.l[1] & 0x1FFFFF00) | (new.l[1] & 0x1FF80FFF);
+ new.l = (old.l & 0xffffffff1fffff00LL) | (new.l & 0x1ff80fff);

/* If the old env has no eabled exceptions and the new env has any enabled
exceptions, then unmask SIGFPE in the MSR FE0/FE1 bits. This will put
the hardware into "precise mode" and may cause the FPU to run slower on
@ -201,26 +201,26 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a @@ -201,26 +201,26 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/feupdateenv.c glibc-2.17-c758a
- if ((old.l[1] & _FPU_MASK_ALL) == 0 && (new.l[1] & _FPU_MASK_ALL) != 0)
+ if ((old.l & _FPU_MASK_ALL) == 0 && (new.l & _FPU_MASK_ALL) != 0)
(void)__fe_nomask_env ();

/* If the old env had any eabled exceptions and the new env has no enabled
exceptions, then mask SIGFPE in the MSR FE0/FE1 bits. This may allow the
FPU to run faster because it always takes the default action and can not
FPU to run faster because it always takes the default action and can not
generate SIGFPE. */
- if ((old.l[1] & _FPU_MASK_ALL) != 0 && (new.l[1] & _FPU_MASK_ALL) == 0)
+ if ((old.l & _FPU_MASK_ALL) != 0 && (new.l & _FPU_MASK_ALL) == 0)
(void)__fe_mask_env ();

/* Atomically enable and raise (if appropriate) exceptions set in `new'. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fgetexcptflg.c 2014-05-27 22:31:43.000000000 -0500
@@ -28,7 +28,7 @@
u.fenv = fegetenv_register ();

/* Return (all of) it. */
- *flagp = u.l[1] & excepts & FE_ALL_EXCEPT;
+ *flagp = u.l & excepts & FE_ALL_EXCEPT;

/* Success. */
return 0;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c
@ -228,7 +228,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a @@ -228,7 +228,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c 2014-05-27 22:31:43.000000000 -0500
@@ -34,11 +34,11 @@
u.fenv = fegetenv_register ();

/* Add the exceptions */
- u.l[1] = (u.l[1]
- | (excepts & FPSCR_STICKY_BITS)
@ -240,24 +240,24 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a @@ -240,24 +240,24 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fraiseexcpt.c glibc-2.17-c758a
+ /* Turn FE_INVALID into FE_INVALID_SOFTWARE. */
+ | (excepts >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
+ & FE_INVALID_SOFTWARE));

/* Store the new status word (along with the rest of the environment),
triggering any appropriate exceptions. */
@@ -50,7 +50,7 @@
don't have FE_INVALID_SOFTWARE implemented. Detect this
case and raise FE_INVALID_SNAN instead. */
don't have FE_INVALID_SOFTWARE implemented. Detect this
case and raise FE_INVALID_SNAN instead. */
u.fenv = fegetenv_register ();
- if ((u.l[1] & FE_INVALID) == 0)
+ if ((u.l & FE_INVALID) == 0)
set_fpscr_bit (FPSCR_VXSNAN);
set_fpscr_bit (FPSCR_VXSNAN);
}

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c 2014-05-27 22:31:43.000000000 -0500
@@ -32,10 +32,10 @@
flag = *flagp & excepts;

/* Replace the exception status */
- u.l[1] = ((u.l[1] & ~(FPSCR_STICKY_BITS & excepts))
- | (flag & FPSCR_STICKY_BITS)
@ -267,14 +267,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c glibc-2.17-c758 @@ -267,14 +267,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fsetexcptflg.c glibc-2.17-c758
+ | (flag & FPSCR_STICKY_BITS)
+ | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
+ & FE_INVALID_SOFTWARE));

/* Store the new status word (along with the rest of the environment).
This may cause floating-point exceptions if the restored state
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c 2014-05-27 22:31:42.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/ftestexcept.c 2014-05-27 22:31:43.000000000 -0500
@@ -28,6 +28,6 @@

/* The FE_INVALID bit is dealt with correctly by the hardware, so we can
just: */
- return u.l[1] & excepts;

16
SOURCES/glibc-ppc64le-14.patch

@ -1,26 +1,26 @@ @@ -1,26 +1,26 @@
# commit 603e84104cdc709c8e7dcbac54b9a585bf8dff78
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:29:43 2013 +0930
#
#
# PowerPC floating point little-endian [9 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00200.html
#
#
# This works around the fact that vsx is disabled in current
# little-endian gcc. Also, float constants take 4 bytes in memory
# vs. 16 bytes for vector constants, and we don't need to write one lot
# of masks for double (register format) and another for float (mem
# format).
#
#
# * sysdeps/powerpc/fpu/s_float_bitwise.h (__float_and_test28): Don't
# use vector int constants.
# (__float_and_test24, __float_and8, __float_get_exp): Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h 2014-05-27 22:37:18.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h 2014-05-27 22:37:20.000000000 -0500
@@ -23,18 +23,19 @@
#include <math_private.h>

/* Returns (int)(num & 0x7FFFFFF0 == value) */
-static inline
-int __float_and_test28 (float num, float value)
@ -47,7 +47,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c @@ -47,7 +47,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c
int32_t inum;
@@ -46,16 +47,17 @@
}

/* Returns (int)(num & 0x7FFFFF00 == value) */
-static inline
-int __float_and_test24 (float num, float value)
@ -71,7 +71,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c @@ -71,7 +71,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c
int32_t inum;
@@ -67,16 +69,17 @@
}

/* Returns (float)(num & 0x7F800000) */
-static inline
-float __float_and8 (float num)
@ -95,7 +95,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c @@ -95,7 +95,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_float_bitwise.h glibc-2.17-c
int32_t inum;
@@ -88,17 +91,18 @@
}

/* Returns ((int32_t)(num & 0x7F800000) >> 23) */
-static inline
-int32_t __float_get_exp (float num)

20
SOURCES/glibc-ppc64le-15.patch

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
# commit da13146da10360436941e843834c90a9aef5fd7a
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:30:23 2013 +0930
#
#
# PowerPC floating point little-endian [10 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00201.html
#
#
# These two functions oddly test x+1>0 when a double x is >= 0.0, and
# similarly when x is negative. I don't see the point of that since the
# test should always be true. I also don't see any need to convert x+1
@ -12,21 +12,21 @@ @@ -12,21 +12,21 @@
# allows these functions to return any value when the input is outside
# the range of long long, but it's not too hard to prevent xr+1
# overflowing so that's what I've done.
#
#
# (With rounding mode FE_UPWARD, x+1 can be a lot more than what you
# might naively expect, but perhaps that situation was covered by the
# x - xrf < 1.0 test.)
#
#
# * sysdeps/powerpc/fpu/s_llround.c (__llround): Rewrite.
# * sysdeps/powerpc/fpu/s_llroundf.c (__llroundf): Rewrite.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c 2014-05-27 22:38:55.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c 2014-05-27 22:38:58.000000000 -0500
@@ -19,29 +19,28 @@
#include <math.h>
#include <math_ldbl_opt.h>

-/* I think that what this routine is supposed to do is round a value
- to the nearest integer, with values exactly on the boundary rounded
- away from zero. */
@ -36,7 +36,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c glibc-2.17-c758a68 @@ -36,7 +36,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llround.c glibc-2.17-c758a68
+ rounded away from zero, regardless of the current rounding mode.
+ If (long long)x, when x is out of range of a long long, clips at
+ LLONG_MAX or LLONG_MIN, then this implementation also clips. */

long long int
__llround (double x)
{
@ -73,9 +73,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c glibc-2.17-c758a6 @@ -73,9 +73,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c glibc-2.17-c758a6
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c 2014-05-27 22:38:55.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c 2014-05-27 22:38:58.000000000 -0500
@@ -18,28 +18,27 @@

#include <math.h>

-/* I think that what this routine is supposed to do is round a value
- to the nearest integer, with values exactly on the boundary rounded
- away from zero. */
@ -85,7 +85,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c glibc-2.17-c758a6 @@ -85,7 +85,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/s_llroundf.c glibc-2.17-c758a6
+ rounded away from zero, regardless of the current rounding mode.
+ If (long long)x, when x is out of range of a long long, clips at
+ LLONG_MAX or LLONG_MIN, then this implementation also clips. */

long long int
__llroundf (float x)
{

26
SOURCES/glibc-ppc64le-16.patch

@ -1,28 +1,28 @@ @@ -1,28 +1,28 @@
# commit 9c008155b7d5d1bd81d909497850a2ece28aec50
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:31:05 2013 +0930
#
#
# PowerPC floating point little-endian [11 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00202.html
#
#
# Another little-endian fix.
#
#
# * sysdeps/powerpc/fpu_control.h (_FPU_GETCW): Rewrite using
# 64-bit int/double union.
# (_FPU_SETCW): Likewise.
# * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c (_GET_DI_FPSCR): Likewise.
# (_SET_DI_FPSCR, _GET_SI_FPSCR, _SET_SI_FPSCR): Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h
--- glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h 2014-05-27 22:40:18.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h 2014-05-27 22:43:40.000000000 -0500
@@ -45,22 +45,26 @@
#define _FPU_IEEE 0x000000f0

/* Type of the control word. */
-typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int fpu_control_t;

/* Macros for accessing the hardware control word. */
-#define _FPU_GETCW(__cw) ( { \
- union { double d; fpu_control_t cw[2]; } \
@ -54,7 +54,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h glibc-2.17-c758a @@ -54,7 +54,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/fpu_control.h glibc-2.17-c758a
+ __fr = __u.__d; \
+ __asm__ ("mtfsf 255,%0" : : "f" (__fr)); \
+ }

/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c
@ -63,15 +63,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2 @@ -63,15 +63,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2
@@ -83,7 +83,7 @@
return 0;
}

-typedef unsigned long long di_fpscr_t __attribute__ ((__mode__ (__DI__)));
+typedef unsigned int di_fpscr_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int si_fpscr_t __attribute__ ((__mode__ (__SI__)));

#define _FPSCR_RESERVED 0xfffffff8ffffff04ULL
@@ -95,50 +95,51 @@
#define _FPSCR_TEST1_RN 0x0000000000000002ULL

/* Macros for accessing the hardware control word on Power6[x]. */
-# define _GET_DI_FPSCR(__fpscr) ({ \
- union { double d; \
@ -88,7 +88,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2 @@ -88,7 +88,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2
+ (__fpscr) = u.fpscr; \
+ u.fpscr; \
+ })

-/* We make sure to zero fp0 after we use it in order to prevent stale data
+/* We make sure to zero fp after we use it in order to prevent stale data
in an fp register from making a test-case pass erroneously. */
@ -134,7 +134,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2 @@ -134,7 +134,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2
+ (__fpscr) = (si_fpscr_t) u.fpscr; \
+ (si_fpscr_t) u.fpscr; \
+ })

-/* We make sure to zero fp0 after we use it in order to prevent stale data
+/* We make sure to zero fp after we use it in order to prevent stale data
in an fp register from making a test-case pass erroneously. */
@ -158,6 +158,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2 @@ -158,6 +158,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/fpu/tst-setcontext-fpscr.c glibc-2
+ __asm__ ("mtfsf 255,%0" : : "f" (fr)); \
+ fr = 0.0; \
+ }

void prime_special_regs(int which)
{

228
SOURCES/glibc-ppc64le-17.patch

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# commit 7b88401f3b25325b1381798a0eccb3efe7751fec
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:31:45 2013 +0930
#
#
# PowerPC floating point little-endian [12 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00087.html
#
#
# Fixes for little-endian in 32-bit assembly.
#
#
# * sysdeps/powerpc/sysdep.h (LOWORD, HIWORD, HISHORT): Define.
# * sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Load little-endian
# words of double from correct stack offsets.
@ -27,271 +27,271 @@ @@ -27,271 +27,271 @@
# * sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S: Likewise.
# * sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S: Use HISHORT.
# * sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysign.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysign.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysign.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysign.S 2014-05-27 22:45:46.000000000 -0500
@@ -29,7 +29,7 @@
stwu r1,-16(r1)
cfi_adjust_cfa_offset (16)
stfd fp2,8(r1)
stwu r1,-16(r1)
cfi_adjust_cfa_offset (16)
stfd fp2,8(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
cmpwi r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
cmpwi r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_copysignl.S 2014-05-27 22:45:46.000000000 -0500
@@ -30,7 +30,7 @@
fmr fp0,fp1
fabs fp1,fp1
fcmpu cr7,fp0,fp1
fmr fp0,fp1
fabs fp1,fp1
fcmpu cr7,fp0,fp1
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
cmpwi cr6,r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
cmpwi cr6,r3,0
addi r1,r1,16
cfi_adjust_cfa_offset (-16)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lrint.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lrint.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lrint.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lrint.S 2014-05-27 22:45:46.000000000 -0500
@@ -24,10 +24,10 @@
stwu r1,-16(r1)
fctiw fp13,fp1
stfd fp13,8(r1)
stwu r1,-16(r1)
fctiw fp13,fp1
stfd fp13,8(r1)
- nop /* Insure the following load is in a different dispatch group */
+ nop /* Ensure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1)
+ lwz r3,8+LOWORD(r1)
addi r1,r1,16
blr
END (__lrint)
addi r1,r1,16
blr
END (__lrint)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lround.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lround.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lround.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_lround.S 2014-05-27 22:45:46.000000000 -0500
@@ -67,7 +67,7 @@
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1) /* Load return as integer. */
+ lwz r3,8+LOWORD(r1) /* Load return as integer. */
.Lout:
addi r1,r1,16
blr
addi r1,r1,16
blr
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S 2014-05-27 22:48:09.000000000 -0500
@@ -29,8 +29,8 @@
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrint)
addi r1,r1,16
blr
END (__llrint)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S 2014-05-27 22:48:44.000000000 -0500
@@ -28,8 +28,8 @@
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
nop /* Insure the following load is in a different dispatch group */
nop /* to avoid pipe stall on POWER4&5. */
nop
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrintf)
addi r1,r1,16
blr
END (__llrintf)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5/fpu/s_isnan.S 2014-05-27 22:45:46.000000000 -0500
@@ -27,8 +27,8 @@
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
- lwz r4,24(r1)
- lwz r5,28(r1)
+ lwz r4,24+HIWORD(r1)
+ lwz r5,24+LOWORD(r1)
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_llround.S 2014-05-27 22:45:46.000000000 -0500
@@ -39,8 +39,8 @@
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r4,12(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llround)
addi r1,r1,16
blr
END (__llround)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power5+/fpu/s_lround.S 2014-05-27 22:45:46.000000000 -0500
@@ -38,7 +38,7 @@
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
nop /* Ensure the following load is in a different dispatch */
nop /* group to avoid pipe stall on POWER4&5. */
nop
- lwz r3,12(r1)
+ lwz r3,8+LOWORD(r1)
addi r1,r1,16
blr
END (__lround)
addi r1,r1,16
blr
END (__lround)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_isnan.S 2014-05-27 22:45:46.000000000 -0500
@@ -27,8 +27,8 @@
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
ori r1,r1,0
stfd fp1,24(r1) /* copy FPR to GPR */
ori r1,r1,0
- lwz r4,24(r1)
- lwz r5,28(r1)
+ lwz r4,24+HIWORD(r1)
+ lwz r5,24+LOWORD(r1)
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
lis r0,0x7ff0 /* const long r0 0x7ff00000 00000000 */
clrlwi r4,r4,1 /* x = fabs(x) */
cmpw cr7,r4,r0 /* if (fabs(x) =< inf) */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S 2014-05-27 22:46:52.000000000 -0500
@@ -29,8 +29,8 @@
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
ori r1,r1,0
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrint)
addi r1,r1,16
blr
END (__llrint)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S 2014-05-27 22:47:29.000000000 -0500
@@ -28,8 +28,8 @@
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
ori r1,r1,0
- lwz r3,8(r1)
- lwz r4,12(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llrintf)
addi r1,r1,16
blr
END (__llrintf)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/fpu/s_llround.S 2014-05-27 22:45:46.000000000 -0500
@@ -39,8 +39,8 @@
/* Insure the following load is in a different dispatch group by
inserting "group ending nop". */
ori r1,r1,0
ori r1,r1,0
- lwz r4,12(r1)
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1)
+ lwz r4,8+LOWORD(r1)
addi r1,r1,16
blr
END (__llround)
addi r1,r1,16
blr
END (__llround)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_finite.S 2014-05-27 22:45:46.000000000 -0500
@@ -54,9 +54,8 @@
stfd fp1,8(r1) /* Transfer FP to GPR's. */

ori 2,2,0 /* Force a new dispatch group. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r0,8(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r0,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
clrlwi r0,r0,17 /* r0 = abs(r0). */
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r0,0x7ff0 /* r4 == 0x7ff0?. */
clrlwi r0,r0,17 /* r0 = abs(r0). */
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r0,0x7ff0 /* r4 == 0x7ff0?. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isinf.S 2014-05-27 22:45:46.000000000 -0500
@@ -48,14 +48,13 @@
li r3,0
bflr 29 /* If not INF, return. */

li r3,0
bflr 29 /* If not INF, return. */
- /* Either we have -INF/+INF or a denormal. */
+ /* Either we have +INF or -INF. */

stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r4,8(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,8+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
addi r1,r1,16 /* Reset the stack pointer. */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/fpu/s_isnan.S 2014-05-27 22:45:46.000000000 -0500
@@ -53,8 +53,8 @@
stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
stwu r1,-16(r1) /* Allocate stack space. */
stfd fp1,8(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lwz r4,8(r1) /* Load the upper half of the FP value. */
- lwz r5,12(r1) /* Load the lower half of the FP value. */
+ lwz r4,8+HIWORD(r1) /* Load the upper half of the FP value. */
+ lwz r5,8+LOWORD(r1) /* Load the lower half of the FP value. */
addi r1,r1,16 /* Reset the stack pointer. */
lis r0,0x7ff0 /* Load the upper portion for an INF/NaN. */
clrlwi r4,r4,1 /* r4 = abs(r4). */
addi r1,r1,16 /* Reset the stack pointer. */
lis r0,0x7ff0 /* Load the upper portion for an INF/NaN. */
clrlwi r4,r4,1 /* r4 = abs(r4). */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_finite.S 2014-05-27 22:45:46.000000000 -0500
@@ -39,10 +39,8 @@

stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
-
- lhz r4,-16(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
clrlwi r4,r4,17 /* r4 = abs(r4). */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
bltlr cr7 /* LT means finite, other non-finite. */
clrlwi r4,r4,17 /* r4 = abs(r4). */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
bltlr cr7 /* LT means finite, other non-finite. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/fpu/s_isinf.S 2014-05-27 22:45:46.000000000 -0500
@@ -38,9 +38,8 @@

stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
stfd fp1,-16(r1) /* Transfer FP to GPR's. */
ori 2,2,0 /* Force a new dispatch group. */
- lhz r4,-16(r1) /* Fetch the upper portion of the high word of
- the FP value (where the exponent and sign bits
- are). */
+ lhz r4,-16+HISHORT(r1) /* Fetch the upper 16 bits of the FP value
+ (biased exponent and sign bit). */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
beqlr cr7 /* EQ means INF, otherwise -INF. */
cmpwi cr7,r4,0x7ff0 /* r4 == 0x7ff0? */
li r3,1
beqlr cr7 /* EQ means INF, otherwise -INF. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h
--- glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h 2014-05-27 22:45:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h 2014-05-27 22:45:46.000000000 -0500
@@ -144,6 +144,21 @@

#define VRSAVE 256

+/* The 32-bit words of a 64-bit dword are at these offsets in memory. */
+#if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
+# define LOWORD 0
@ -307,6 +307,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h glibc-2.17-c758a686/sysde @@ -307,6 +307,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/sysdep.h glibc-2.17-c758a686/sysde
+#else
+# define HISHORT 0
+#endif

/* This seems to always be the case on PPC. */
#define ALIGNARG(log2) log2

48
SOURCES/glibc-ppc64le-18.patch

@ -1,44 +1,44 @@ @@ -1,44 +1,44 @@
# commit 6a31fe7f9cce72b69fce8fe499a2c6ad492c2311
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:32:18 2013 +0930
#
#
# PowerPC floating point little-endian [13 of 15]
# http://sourceware.org/ml/libc-alpha/2013-08/msg00088.html
#
#
# * sysdeps/powerpc/powerpc32/fpu/s_roundf.S: Increase alignment of
# constants to usual value for .cst8 section, and remove redundant
# high address load.
# * sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S: Use float
# constant for 0x1p52. Load little-endian words of double from
# correct stack offsets.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_roundf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_roundf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_roundf.S 2014-05-27 22:50:13.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/s_roundf.S 2014-05-27 22:50:13.000000000 -0500
@@ -19,7 +19,7 @@
#include <sysdep.h>

.section .rodata.cst8,"aM",@progbits,8
.section .rodata.cst8,"aM",@progbits,8
- .align 2
+ .align 3
.LC0: /* 2**23 */
.long 0x4b000000
.long 0x4b000000
.LC1: /* 0.5 */
@@ -60,7 +60,6 @@
#ifdef SHARED
lfs fp10,.LC1-.LC0(r9)
lfs fp10,.LC1-.LC0(r9)
#else
- lis r9,.LC1@ha
lfs fp10,.LC1@l(r9)
lfs fp10,.LC1@l(r9)
#endif
ble- cr6,.L4
ble- cr6,.L4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S 2014-05-27 22:50:13.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S 2014-05-27 22:50:13.000000000 -0500
@@ -19,12 +19,10 @@
#include <sysdep.h>
#include <math_ldbl_opt.h>

- .section .rodata.cst12,"aM",@progbits,12
+ .section .rodata.cst8,"aM",@progbits,8
.align 3
@ -48,34 +48,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S g @@ -48,34 +48,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S g
- .long 0x3f000000 /* Use this for 0.5 */
+ .LC0: .long (52+127)<<23 /* 0x1p+52 */
+ .long (-1+127)<<23 /* 0.5 */

.section ".text"

.section ".text"
@@ -57,12 +55,12 @@
addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
addi r9,r9,.LC0-got_label@l
mtlr r11
cfi_same_value (lr)
- lfd fp9,0(r9)
- lfs fp10,8(r9)
+ lfs fp9,0(r9)
+ lfs fp10,4(r9)
#else
lis r9,.LC0@ha
lis r9,.LC0@ha
- lfd fp9,.LC0@l(r9) /* Load 2^52 into fpr9. */
- lfs fp10,.LC0@l+8(r9) /* Load 0.5 into fpr10. */
+ lfs fp9,.LC0@l(r9) /* Load 2^52 into fpr9. */
+ lfs fp10,.LC0@l+4(r9) /* Load 0.5 into fpr10. */
#endif
fabs fp2,fp1 /* Get the absolute value of x. */
fsub fp12,fp10,fp10 /* Compute 0.0 into fpr12. */
fabs fp2,fp1 /* Get the absolute value of x. */
fsub fp12,fp10,fp10 /* Compute 0.0 into fpr12. */
@@ -80,8 +78,8 @@
nop
nop
nop
nop
nop
nop
- lwz r4,12(r1) /* Load return as integer. */
- lwz r3,8(r1)
+ lwz r3,8+HIWORD(r1) /* Load return as integer. */
+ lwz r4,8+LOWORD(r1)
.Lout:
addi r1,r1,16
blr
addi r1,r1,16
blr

54
SOURCES/glibc-ppc64le-19.patch

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# commit 76a66d510a3737674563133a420f4fd22da42c1b
# Author: Anton Blanchard <anton@au1.ibm.com>
# Date: Sat Aug 17 18:33:02 2013 +0930
#
#
# PowerPC floating point little-endian [14 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00205.html
#
#
# These all wrongly specified float constants in a 64-bit word.
#
#
# * sysdeps/powerpc/powerpc64/fpu/s_ceilf.S: Correct float constants
# for little-endian.
# * sysdeps/powerpc/powerpc64/fpu/s_floorf.S: Likewise.
@ -20,68 +20,68 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S glibc-2.17 @@ -20,68 +20,68 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S glibc-2.17
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_ceilf.S 2014-05-27 22:52:18.000000000 -0500
@@ -19,8 +19,10 @@
#include <sysdep.h>

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"

.section ".text"
EALIGN (__ceilf, 4, 0)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_floorf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_floorf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_floorf.S 2014-05-27 22:52:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_floorf.S 2014-05-27 22:52:18.000000000 -0500
@@ -19,8 +19,10 @@
#include <sysdep.h>

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"

.section ".text"
EALIGN (__floorf, 4, 0)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S 2014-05-27 22:52:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_nearbyintf.S 2014-05-27 22:52:18.000000000 -0500
@@ -26,8 +26,10 @@
/* float [fp1] nearbyintf(float [fp1]) */

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"

.section ".text"
EALIGN (__nearbyintf, 4, 0)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S 2014-05-27 22:52:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_rintf.S 2014-05-27 22:52:18.000000000 -0500
@@ -19,8 +19,10 @@
#include <sysdep.h>

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"

.section ".text"
EALIGN (__rintf, 4, 0)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S 2014-05-27 22:52:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S 2014-05-27 22:52:18.000000000 -0500
@@ -19,10 +19,12 @@
#include <sysdep.h>

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
@ -90,21 +90,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S glibc-2.1 @@ -90,21 +90,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_roundf.S glibc-2.1
- .tc FD_3f000000_0[TC],0x3f00000000000000
+ .long 0x3f000000
+
.section ".text"

.section ".text"
/* float [fp1] roundf (float x [fp1])
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_truncf.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_truncf.S 2014-05-27 22:52:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_truncf.S 2014-05-27 22:52:18.000000000 -0500
@@ -19,8 +19,10 @@
#include <sysdep.h>

.section ".toc","aw"
.section ".toc","aw"
+ .p2align 3
.LC0: /* 2**23 */
- .tc FD_4b000000_0[TC],0x4b00000000000000
+ .long 0x4b000000
+ .long 0x0
.section ".text"

.section ".text"
/* float [fp1] truncf (float x [fp1])

12
SOURCES/glibc-ppc64le-20.patch

@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
# commit fef13a78ea30d4c26d6bab48d731ebe864ee31b0
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:33:45 2013 +0930
#
#
# PowerPC floating point little-endian [15 of 15]
# http://sourceware.org/ml/libc-alpha/2013-07/msg00206.html
#
#
# The union loses when little-endian.
#
#
# * sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_NOW):
# Don't use a union to pack hi/low value.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h 2014-05-27 22:53:37.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h 2014-05-27 22:53:39.000000000 -0500
@@ -87,18 +87,15 @@

#define HP_TIMING_NOW(Var) \
do { \
- union { long long ll; long ii[2]; } _var; \
@ -39,3 +39,5 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h glibc @@ -39,3 +39,5 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/hp-timing.h glibc
+ : : "cr0"); \
+ Var = ((hp_timing_t) hi << 32) | lo; \
} while (0)

96
SOURCES/glibc-ppc64le-21.patch

@ -1,21 +1,21 @@ @@ -1,21 +1,21 @@
# commit be1e5d311342e08ae1f8013342df27b7ded2c156
# Author: Anton Blanchard <anton@au1.ibm.com>
# Date: Sat Aug 17 18:34:40 2013 +0930
#
#
# PowerPC LE setjmp/longjmp
# http://sourceware.org/ml/libc-alpha/2013-08/msg00089.html
#
#
# Little-endian fixes for setjmp/longjmp. When writing these I noticed
# the setjmp code corrupts the non volatile VMX registers when using an
# unaligned buffer. Anton fixed this, and also simplified it quite a
# bit.
#
#
# The current code uses boilerplate for the case where we want to store
# 16 bytes to an unaligned address. For that we have to do a
# read/modify/write of two aligned 16 byte quantities. In our case we
# are storing a bunch of back to back data (consective VMX registers),
# and only the start and end of the region need the read/modify/write.
#
#
# [BZ #15723]
# * sysdeps/powerpc/jmpbuf-offsets.h: Comment fix.
# * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Correct
@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
# * sysdeps/powerpc/powerpc64/__longjmp-common.S: Correct CR load.
# * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise CR save. Don't
# destroy vmx regs when saving unaligned.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/jmpbuf-offsets.h glibc-2.17-c758a686/sysdeps/powerpc/jmpbuf-offsets.h
--- glibc-2.17-c758a686/sysdeps/powerpc/jmpbuf-offsets.h 2014-05-27 22:55:23.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/jmpbuf-offsets.h 2014-05-27 22:55:27.000000000 -0500
@ -49,14 +49,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S g @@ -49,14 +49,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S g
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S 2014-05-27 22:55:27.000000000 -0500
@@ -46,16 +46,16 @@
# endif
mtlr r6
cfi_same_value (lr)
mtlr r6
cfi_same_value (lr)
- lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r5)
+ lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r5)
# else
lwz r5,_dl_hwcap@got(r5)
mtlr r6
cfi_same_value (lr)
lwz r5,_dl_hwcap@got(r5)
mtlr r6
cfi_same_value (lr)
- lwz r5,4(r5)
+ lwz r5,LOWORD(r5)
# endif
@ -66,19 +66,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S g @@ -66,19 +66,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S g
+ lis r5,(_dl_hwcap+LOWORD)@ha
+ lwz r5,(_dl_hwcap+LOWORD)@l(r5)
# endif
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S 2014-05-27 22:55:23.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S 2014-05-27 22:55:27.000000000 -0500
@@ -97,14 +97,14 @@
# else
lwz r5,_rtld_global_ro@got(r5)
lwz r5,_rtld_global_ro@got(r5)
# endif
- lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r5)
+ lwz r5,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r5)
# else
lwz r5,_dl_hwcap@got(r5)
lwz r5,_dl_hwcap@got(r5)
- lwz r5,4(r5)
+ lwz r5,LOWORD(r5)
# endif
@ -88,14 +88,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S glib @@ -88,14 +88,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S glib
+ lis r6,(_dl_hwcap+LOWORD)@ha
+ lwz r5,(_dl_hwcap+LOWORD)@l(r6)
# endif
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
andis. r5,r5,(PPC_FEATURE_HAS_ALTIVEC >> 16)
beq L(no_vmx)
@@ -114,44 +114,43 @@
stw r0,((JB_VRSAVE)*4)(3)
addi r6,r5,16
beq+ L(aligned_save_vmx)
stw r0,((JB_VRSAVE)*4)(3)
addi r6,r5,16
beq+ L(aligned_save_vmx)
+
lvsr v0,0,r5
lvsr v0,0,r5
- vspltisb v1,-1 /* set v1 to all 1's */
- vspltisb v2,0 /* set v2 to all 0's */
- vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes on left = misalignment */
@ -168,52 +168,52 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S glib @@ -168,52 +168,52 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp-common.S glib
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v2,v31,v0,v3,r5,r6)
+
b L(no_vmx)

b L(no_vmx)
L(aligned_save_vmx):
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S 2014-05-27 22:55:23.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S 2014-05-27 22:55:27.000000000 -0500
@@ -60,7 +60,7 @@
beq L(no_vmx)
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
beq L(no_vmx)
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
- lwz r0,((JB_VRSAVE)*8)(3)
+ lwz r0,((JB_VRSAVE)*8)(3) /* 32-bit VRSAVE. */
mtspr VRSAVE,r0
beq+ L(aligned_restore_vmx)
addi r6,r5,16
mtspr VRSAVE,r0
beq+ L(aligned_restore_vmx)
addi r6,r5,16
@@ -156,7 +156,7 @@
lfd fp21,((JB_FPRS+7)*8)(r3)
ld r22,((JB_GPRS+8)*8)(r3)
lfd fp22,((JB_FPRS+8)*8)(r3)
lfd fp21,((JB_FPRS+7)*8)(r3)
ld r22,((JB_GPRS+8)*8)(r3)
lfd fp22,((JB_FPRS+8)*8)(r3)
- ld r0,(JB_CR*8)(r3)
+ lwz r0,((JB_CR*8)+4)(r3) /* 32-bit CR. */
ld r23,((JB_GPRS+9)*8)(r3)
lfd fp23,((JB_FPRS+9)*8)(r3)
ld r24,((JB_GPRS+10)*8)(r3)
ld r23,((JB_GPRS+9)*8)(r3)
lfd fp23,((JB_FPRS+9)*8)(r3)
ld r24,((JB_GPRS+10)*8)(r3)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-27 22:55:23.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-27 22:55:27.000000000 -0500
@@ -98,7 +98,7 @@
mfcr r0
std r16,((JB_GPRS+2)*8)(3)
stfd fp16,((JB_FPRS+2)*8)(3)
mfcr r0
std r16,((JB_GPRS+2)*8)(3)
stfd fp16,((JB_FPRS+2)*8)(3)
- std r0,(JB_CR*8)(3)
+ stw r0,((JB_CR*8)+4)(3) /* 32-bit CR. */
std r17,((JB_GPRS+3)*8)(3)
stfd fp17,((JB_FPRS+3)*8)(3)
std r18,((JB_GPRS+4)*8)(3)
std r17,((JB_GPRS+3)*8)(3)
stfd fp17,((JB_FPRS+3)*8)(3)
std r18,((JB_GPRS+4)*8)(3)
@@ -142,50 +142,46 @@
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
mfspr r0,VRSAVE
la r5,((JB_VRS)*8)(3)
andi. r6,r5,0xf
mfspr r0,VRSAVE
- stw r0,((JB_VRSAVE)*8)(3)
+ stw r0,((JB_VRSAVE)*8)(3) /* 32-bit VRSAVE. */
addi r6,r5,16
beq+ L(aligned_save_vmx)
addi r6,r5,16
beq+ L(aligned_save_vmx)
+
lvsr v0,0,r5
lvsr v0,0,r5
- vspltisb v1,-1 /* set v1 to all 1's */
- vspltisb v2,0 /* set v2 to all 0's */
- vperm v3,v2,v1,v0 /* v3 contains shift mask with num all 1 bytes
@ -289,6 +289,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2. @@ -289,6 +289,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.
+ vperm v2,v2,v2,v1
+ save_misaligned_vmx(v2,v31,v0,v3,r5,r6)
+
b L(no_vmx)

b L(no_vmx)
L(aligned_save_vmx):

48
SOURCES/glibc-ppc64le-22.patch

@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
# commit 9b874b2f1eb2550e39d3e9c38772e64a767e9de2
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:35:40 2013 +0930
#
#
# PowerPC ugly symbol versioning
# http://sourceware.org/ml/libc-alpha/2013-08/msg00090.html
#
#
# This patch fixes symbol versioning in setjmp/longjmp. The existing
# code uses raw versions, which results in wrong symbol versioning when
# you want to build glibc with a base version of 2.19 for LE.
#
#
# Note that the merging the 64-bit and 32-bit versions in novmx-lonjmp.c
# and pt-longjmp.c doesn't result in GLIBC_2.0 versions for 64-bit, due
# to the base in shlib_versions.
#
#
# * sysdeps/powerpc/longjmp.c: Use proper symbol versioning macros.
# * sysdeps/powerpc/novmx-longjmp.c: Likewise.
# * sysdeps/powerpc/powerpc32/bsd-_setjmp.S: Likewise.
@ -23,14 +23,14 @@ @@ -23,14 +23,14 @@
# * sysdeps/powerpc/powerpc32/setjmp.S: Likewise.
# * sysdeps/powerpc/powerpc64/setjmp.S: Likewise.
# * nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c: Likewise.
#
#
diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
--- glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c 2014-05-27 23:22:12.000000000 -0500
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c 2014-05-27 23:23:44.000000000 -0500
@@ -41,13 +41,8 @@
__novmx__libc_longjmp (env, val);
}

-# if __WORDSIZE == 64
-symbol_version (__novmx_longjmp,longjmp,GLIBC_2.3);
-symbol_version (__novmx_siglongjmp,siglongjmp,GLIBC_2.3);
@ -40,13 +40,13 @@ diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c @@ -40,13 +40,13 @@ diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c
-# endif
+compat_symbol (libpthread, __novmx_longjmp, longjmp, GLIBC_2_0);
+compat_symbol (libpthread, __novmx_siglongjmp, siglongjmp, GLIBC_2_0);
#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */

#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)) */
void
@@ -62,5 +57,5 @@
__libc_siglongjmp (env, val);
}

-versioned_symbol (libc, __vmx_longjmp, longjmp, GLIBC_2_3_4);
-versioned_symbol (libc, __vmx_siglongjmp, siglongjmp, GLIBC_2_3_4);
+versioned_symbol (libpthread, __vmx_longjmp, longjmp, GLIBC_2_3_4);
@ -55,7 +55,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/longjmp.c glibc-2.17-c758a686/sysd @@ -55,7 +55,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/longjmp.c glibc-2.17-c758a686/sysd
--- glibc-2.17-c758a686/sysdeps/powerpc/longjmp.c 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/longjmp.c 2014-05-27 23:22:12.000000000 -0500
@@ -56,6 +56,6 @@

default_symbol_version (__vmx__libc_longjmp, __libc_longjmp, GLIBC_PRIVATE);
default_symbol_version (__vmx__libc_siglongjmp, __libc_siglongjmp, GLIBC_PRIVATE);
-default_symbol_version (__vmx_longjmp, _longjmp, GLIBC_2.3.4);
@ -70,7 +70,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/novmx-longjmp.c glibc-2.17-c758a68 @@ -70,7 +70,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/novmx-longjmp.c glibc-2.17-c758a68
@@ -51,13 +51,7 @@
weak_alias (__novmx__libc_siglongjmp, __novmxlongjmp)
weak_alias (__novmx__libc_siglongjmp, __novmxsiglongjmp)

-# if __WORDSIZE == 64
-symbol_version (__novmx_longjmp,_longjmp,GLIBC_2.3);
-symbol_version (__novmxlongjmp,longjmp,GLIBC_2.3);
@ -89,17 +89,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-_setjmp.S glibc-2.17 @@ -89,17 +89,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-_setjmp.S glibc-2.17
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-_setjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -32,7 +32,7 @@
/* Build a versioned object for libc. */

# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
-symbol_version (__novmx_setjmp,_setjmp,GLIBC_2.0);
+compat_symbol (libc, __novmx_setjmp, _setjmp, GLIBC_2_0);

ENTRY (BP_SYM (__novmx_setjmp))
li r4,0 /* Set second argument to 0. */
li r4,0 /* Set second argument to 0. */
@@ -41,7 +41,7 @@
libc_hidden_def (__novmx_setjmp)
# endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) */

-default_symbol_version (__vmx_setjmp,_setjmp,GLIBC_2.3.4)
+versioned_symbol (libc, __vmx_setjmp, _setjmp, GLIBC_2_3_4)
/* __GI__setjmp prototype is needed for ntpl i.e. _setjmp is defined
@ -109,14 +109,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-setjmp.S glibc-2.17- @@ -109,14 +109,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-setjmp.S glibc-2.17-
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-setjmp.S 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bsd-setjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -27,7 +27,7 @@
b __novmx__sigsetjmp@local
b __novmx__sigsetjmp@local
END (__novmxsetjmp)
strong_alias (__novmxsetjmp, __novmx__setjmp)
-symbol_version (__novmxsetjmp, setjmp, GLIBC_2.0)
+compat_symbol (libc, __novmxsetjmp, setjmp, GLIBC_2_0)

#endif /* defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4) ) */

@@ -37,4 +37,4 @@
END (__vmxsetjmp)
strong_alias (__vmxsetjmp, __vmx__setjmp)
@ -127,14 +127,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp.S glibc-2. @@ -127,14 +127,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp.S glibc-2.
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp.S 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/__longjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -26,14 +26,14 @@

#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__longjmp,__longjmp,GLIBC_2.3.4);
+versioned_symbol (libc, __vmx__longjmp, __longjmp, GLIBC_2_3_4);
# define __longjmp __vmx__longjmp
# include "__longjmp-common.S"

# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
# define __NO_VMX__
# undef JB_SIZE
@ -147,7 +147,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp.S glibc-2.17- @@ -147,7 +147,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp.S glibc-2.17-
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp.S 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/fpu/setjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -26,7 +26,7 @@

#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
@ -173,14 +173,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/mcount.c glibc-2.17-c758 @@ -173,14 +173,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/mcount.c glibc-2.17-c758
GLIBC_PRIVATE version obsolete and add it to GLIBC_2.16 instead. */
-default_symbol_version (___mcount_internal, __mcount_internal, GLIBC_2.16);
+versioned_symbol (libc, ___mcount_internal, __mcount_internal, GLIBC_2_16);

#if SHLIB_COMPAT (libc, GLIBC_2_15, GLIBC_2_16)
strong_alias (___mcount_internal, ___mcount_internal_private);
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/setjmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/setjmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/setjmp.S 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/setjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -25,7 +25,7 @@

#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
@ -201,7 +201,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp.S glibc-2.17-c758 @@ -201,7 +201,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp.S glibc-2.17-c758
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp.S 2014-05-27 23:22:10.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp.S 2014-05-27 23:22:12.000000000 -0500
@@ -26,9 +26,9 @@

#else /* !NOT_IN_libc */
/* Build a versioned object for libc. */
-default_symbol_version (__vmxsetjmp, setjmp, GLIBC_2.3.4)

50
SOURCES/glibc-ppc64le-23.patch

@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
# commit 02f04a6c7fea2b474b026bbce721d8c658d71fda
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:36:11 2013 +0930
#
#
# PowerPC LE _dl_hwcap access
# http://sourceware.org/ml/libc-alpha/2013-08/msg00091.html
#
#
# More LE support, correcting word accesses to _dl_hwcap.
#
#
# * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S: Use
# HIWORD/LOWORD.
# * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S: Ditto.
# * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S: Ditto.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S 2014-05-27 23:25:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S 2014-05-27 23:25:38.000000000 -0500
@@ -151,15 +151,15 @@
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
@ -33,20 +33,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getconte @@ -33,20 +33,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/getconte
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)

andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2014-05-27 23:25:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S 2014-05-27 23:25:38.000000000 -0500
@@ -79,15 +79,15 @@
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
@ -56,20 +56,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setconte @@ -56,20 +56,20 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/setconte
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
#endif

#ifdef __CONTEXT_ENABLE_FPRS
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2014-05-27 23:25:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S 2014-05-27 23:25:38.000000000 -0500
@@ -152,15 +152,15 @@
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
lwz r7,_rtld_global_ro@got(r7)
mtlr r8
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
mtlr r8
lwz r7,_dl_hwcap@got(r7)
mtlr r8
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
@ -79,16 +79,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcont @@ -79,16 +79,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcont
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif

# ifdef __CONTEXT_ENABLE_VRS
@@ -308,14 +308,14 @@
mtlr r8
mtlr r8
# ifdef SHARED
lwz r7,_rtld_global_ro@got(r7)
lwz r7,_rtld_global_ro@got(r7)
- lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r7)
+ lwz r7,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+LOWORD(r7)
# else
lwz r7,_dl_hwcap@got(r7)
lwz r7,_dl_hwcap@got(r7)
- lwz r7,4(r7)
+ lwz r7,LOWORD(r7)
# endif
@ -98,5 +98,5 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcont @@ -98,5 +98,5 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcont
+ lis r7,(_dl_hwcap+LOWORD)@ha
+ lwz r7,(_dl_hwcap+LOWORD)@l(r7)
# endif
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
la r10,(_UC_VREGS)(r31)
andis. r7,r7,(PPC_FEATURE_HAS_ALTIVEC >> 16)
la r10,(_UC_VREGS)(r31)

32
SOURCES/glibc-ppc64le-24.patch

@ -1,47 +1,47 @@ @@ -1,47 +1,47 @@
# commit 0b2c2ace3601d5d59cf89130b16840e7f132f7a6
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:36:45 2013 +0930
#
#
# PowerPC makecontext
# http://sourceware.org/ml/libc-alpha/2013-08/msg00092.html
#
#
# Use conditional form of branch and link to avoid destroying the cpu
# link stack used to predict blr return addresses.
#
#
# * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S: Use
# conditional form of branch and link when obtaining pc.
# * sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2014-05-28 12:25:49.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S 2014-05-28 12:25:51.000000000 -0500
@@ -47,7 +47,9 @@
#ifdef PIC
mflr r0
cfi_register(lr,r0)
mflr r0
cfi_register(lr,r0)
- bl 1f
+ /* Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(exitcode)-1b
mtlr r0
addi r6,r6,L(exitcode)-1b
mtlr r0
@@ -136,7 +138,9 @@
#ifdef PIC
mflr r0
cfi_register(lr,r0)
mflr r0
cfi_register(lr,r0)
- bl 1f
+ /* Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,1f
1: mflr r6
addi r6,r6,L(novec_exitcode)-1b
mtlr r0
addi r6,r6,L(novec_exitcode)-1b
mtlr r0
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-28 12:25:49.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-28 12:25:51.000000000 -0500
@@ -124,8 +124,10 @@

/* If the target function returns we need to do some cleanup. We use a
code trick to get the address of our cleanup function into the link
- register. Do not add any code between here and L(exitcode). */
@ -50,6 +50,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont @@ -50,6 +50,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont
+ Use this conditional form of branch and link to avoid destroying
+ the cpu link stack used to predict blr return addresses. */
+ bcl 20,31,L(gotexitcodeaddr);

/* This is the helper code which gets called if a function which
is registered with 'makecontext' returns. In this case we
/* This is the helper code which gets called if a function which
is registered with 'makecontext' returns. In this case we

256
SOURCES/glibc-ppc64le-25.patch

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
# commit db9b4570c5dc550074140ac1d1677077fba29a26
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:40:11 2013 +0930
#
#
# PowerPC LE strlen
# http://sourceware.org/ml/libc-alpha/2013-08/msg00097.html
#
#
# This is the first of nine patches adding little-endian support to the
# existing optimised string and memory functions. I did spend some
# time with a power7 simulator looking at cycle by cycle behaviour for
@ -14,50 +14,50 @@ @@ -14,50 +14,50 @@
# loops unchanged, so I'm banking on previous authors having done a
# good job on big-endian.. As with most code you stare at long enough,
# I found some improvements for big-endian too.
#
#
# Little-endian support for strlen. Like most of the string functions,
# I leave the main word or multiple-word loops substantially unchanged,
# just needing to modify the tail.
#
#
# Removing the branch in the power7 functions is just a tidy. .align
# produces a branch anyway. Modifying regs in the non-power7 functions
# is to suit the new little-endian tail.
#
#
# * sysdeps/powerpc/powerpc64/power7/strlen.S (strlen): Add little-endian
# support. Don't branch over align.
# * sysdeps/powerpc/powerpc32/power7/strlen.S: Likewise.
# * sysdeps/powerpc/powerpc64/strlen.S (strlen): Add little-endian support.
# Rearrange tmp reg use to suit. Comment.
# * sysdeps/powerpc/powerpc32/strlen.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S 2014-05-28 12:28:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S 2014-05-28 12:28:45.000000000 -0500
@@ -31,7 +31,11 @@
li r0,0 /* Word with null chars to use with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
lwz r12,0(r4) /* Load word from memory. */
li r0,0 /* Word with null chars to use with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
lwz r12,0(r4) /* Load word from memory. */
+#ifdef __LITTLE_ENDIAN__
+ slw r5,r5,r6
+#else
srw r5,r5,r6 /* MASK = MASK >> padding. */
srw r5,r5,r6 /* MASK = MASK >> padding. */
+#endif
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in WORD1. */
cmpwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in WORD1. */
cmpwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
@@ -49,9 +53,6 @@
cmpb r10,r12,r0
cmpwi cr7,r10,0
bne cr7,L(done)
cmpb r10,r12,r0
cmpwi cr7,r10,0
bne cr7,L(done)
- b L(loop) /* We branch here (rather than falling through)
- to skip the nops due to heavy alignment
- of the loop below. */

/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
@@ -88,9 +89,15 @@
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the length. */
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the length. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
+#ifdef __LITTLE_ENDIAN__
@ -67,11 +67,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S glibc-2. @@ -67,11 +67,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strlen.S glibc-2.
+#else
+ cntlzw r0,r10 /* Count leading zeros before the match. */
+#endif
subf r5,r3,r4
subf r5,r3,r4
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
+ srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r5,r0 /* Compute final length. */
blr
add r3,r5,r0 /* Compute final length. */
blr
END (BP_SYM (strlen))
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S 2014-05-28 12:28:44.000000000 -0500
@ -87,13 +87,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758 @@ -87,13 +87,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758
+ of no consequence since the least significant match is the one
+ we're interested in, but big-endian needs method 2 to find which
+ byte matches.

2) Given a word 'x', we can test to see _which_ byte was zero by
calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f).
@@ -74,7 +79,7 @@

ENTRY (BP_SYM (strlen))

-#define rTMP1 r0
+#define rTMP4 r0
#define rRTN r3 /* incoming STR arg, outgoing result */
@ -109,13 +109,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758 @@ -109,13 +109,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758
+#define rTMP1 r10
+#define rTMP2 r11
+#define rTMP3 r12

CHECK_BOUNDS_LOW (rRTN, rTMP1, rTMP2)

CHECK_BOUNDS_LOW (rRTN, rTMP1, rTMP2)
@@ -96,15 +101,20 @@
lwz rWORD1, 0(rSTR)
li rMASK, -1
addi r7F7F, r7F7F, 0x7f7f
lwz rWORD1, 0(rSTR)
li rMASK, -1
addi r7F7F, r7F7F, 0x7f7f
-/* That's the setup done, now do the first pair of words.
- We make an exception and use method (2) on the first two words, to reduce
- overhead. */
@ -126,54 +126,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758 @@ -126,54 +126,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758
+#ifdef __LITTLE_ENDIAN__
+ slw rMASK, rMASK, rPADN
+#else
srw rMASK, rMASK, rPADN
srw rMASK, rMASK, rPADN
+#endif
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor rTMP1, rTMP2, rTMP1
- and. rWORD1, rTMP1, rMASK
+ nor rTMP3, rTMP2, rTMP1
+ and. rTMP3, rTMP3, rMASK
mtcrf 0x01, rRTN
bne L(done0)
lis rFEFE, -0x101
mtcrf 0x01, rRTN
bne L(done0)
lis rFEFE, -0x101
@@ -113,11 +123,12 @@
bt 29, L(loop)

bt 29, L(loop)
/* Handle second word of pair. */
+/* Perhaps use method (1) here for little-endian, saving one instruction? */
lwzu rWORD1, 4(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
lwzu rWORD1, 4(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor. rWORD1, rTMP2, rTMP1
+ nor. rTMP3, rTMP2, rTMP1
bne L(done0)

bne L(done0)
/* The loop. */
@@ -131,29 +142,53 @@
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
- and. rTMP1, rTMP3, rTMP4
+ and. rTMP3, rTMP3, rTMP4
beq L(loop)

beq L(loop)
+#ifndef __LITTLE_ENDIAN__
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP4, rTMP1
+ andc rTMP3, rTMP4, rTMP1
b L(done0)

b L(done0)
L(done1):
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 4
add rTMP1, rTMP1, r7F7F
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 4
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP2, rTMP1
+ andc rTMP3, rTMP2, rTMP1

/* When we get to here, rSTR points to the first word in the string that
- contains a zero byte, and the most significant set bit in rWORD1 is in that
- byte. */
@ -182,11 +182,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758 @@ -182,11 +182,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strlen.S glibc-2.17-c758
L(done0):
- cntlzw rTMP3, rWORD1
+ cntlzw rTMP3, rTMP3
subf rTMP1, rRTN, rSTR
srwi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
/* GKM FIXME: check high bound. */
blr
subf rTMP1, rRTN, rSTR
srwi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
/* GKM FIXME: check high bound. */
blr
+#else
+
+L(done0):
@ -216,30 +216,30 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S glibc-2. @@ -216,30 +216,30 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S glibc-2.
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S 2014-05-28 12:28:44.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S 2014-05-28 12:28:45.000000000 -0500
@@ -32,7 +32,11 @@
with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
ld r12,0(r4) /* Load doubleword from memory. */
with cmpb. */
li r5,-1 /* MASK = 0xffffffffffffffff. */
ld r12,0(r4) /* Load doubleword from memory. */
+#ifdef __LITTLE_ENDIAN__
+ sld r5,r5,r6
+#else
srd r5,r5,r6 /* MASK = MASK >> padding. */
srd r5,r5,r6 /* MASK = MASK >> padding. */
+#endif
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in DWORD1. */
cmpdi cr7,r10,0 /* If r10 == 0, no null's have been found. */
orc r9,r12,r5 /* Mask bits that are not part of the string. */
cmpb r10,r9,r0 /* Check for null bytes in DWORD1. */
cmpdi cr7,r10,0 /* If r10 == 0, no null's have been found. */
@@ -50,9 +54,6 @@
cmpb r10,r12,r0
cmpdi cr7,r10,0
bne cr7,L(done)
cmpb r10,r12,r0
cmpdi cr7,r10,0
bne cr7,L(done)
- b L(loop) /* We branch here (rather than falling through)
- to skip the nops due to heavy alignment
- of the loop below. */

/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
/* Main loop to look for the end of the string. Since it's a
small loop (< 8 instructions), align it to 32-bytes. */
@@ -89,9 +90,15 @@
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length. */
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length. */
L(done):
- cntlzd r0,r10 /* Count leading zeroes before the match. */
+#ifdef __LITTLE_ENDIAN__
@ -249,11 +249,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S glibc-2. @@ -249,11 +249,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strlen.S glibc-2.
+#else
+ cntlzd r0,r10 /* Count leading zeros before the match. */
+#endif
subf r5,r3,r4
subf r5,r3,r4
- srdi r0,r0,3 /* Convert leading zeroes to bytes. */
+ srdi r0,r0,3 /* Convert leading/trailing zeros to bytes. */
add r3,r5,r0 /* Compute final length. */
blr
add r3,r5,r0 /* Compute final length. */
blr
END (BP_SYM (strlen))
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S 2014-05-28 12:28:44.000000000 -0500
@ -269,22 +269,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758 @@ -269,22 +269,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758
+ of no consequence since the least significant match is the one
+ we're interested in, but big-endian needs method 2 to find which
+ byte matches.

2) Given a word 'x', we can test to see _which_ byte was zero by
calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f).
@@ -64,7 +69,7 @@
Answer:
1) Added a Data Cache Block Touch early to prefetch the first 128
byte cache line. Adding dcbt instructions to the loop would not be
1) Added a Data Cache Block Touch early to prefetch the first 128
byte cache line. Adding dcbt instructions to the loop would not be
- effective since most strings will be shorter than the cache line.*/
+ effective since most strings will be shorter than the cache line. */

/* Some notes on register usage: Under the SVR4 ABI, we can use registers
0 and 3 through 12 (so long as we don't call any procedures) without
@@ -80,7 +85,7 @@
ENTRY (BP_SYM (strlen))
CALL_MCOUNT 1

CALL_MCOUNT 1
-#define rTMP1 r0
+#define rTMP4 r0
#define rRTN r3 /* incoming STR arg, outgoing result */
@ -300,15 +300,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758 @@ -300,15 +300,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758
+#define rTMP1 r10
+#define rTMP2 r11
+#define rTMP3 r12

/* Note: The Bounded pointer support in this code is broken. This code
was inherited from PPC32 and that support was never completed.
@@ -109,30 +114,36 @@
addi r7F7F, r7F7F, 0x7f7f
li rMASK, -1
insrdi r7F7F, r7F7F, 32, 0
addi r7F7F, r7F7F, 0x7f7f
li rMASK, -1
insrdi r7F7F, r7F7F, 32, 0
-/* That's the setup done, now do the first pair of doublewords.
- We make an exception and use method (2) on the first two doublewords,
- We make an exception and use method (2) on the first two doublewords,
- to reduce overhead. */
- srd rMASK, rMASK, rPADN
+/* We use method (2) on the first two doublewords, because rFEFE isn't
@ -320,57 +320,57 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758 @@ -320,57 +320,57 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758
+#else
+ srd rMASK, rMASK, rPADN
+#endif
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
lis rFEFE, -0x101
add rTMP1, rTMP1, r7F7F
addi rFEFE, rFEFE, -0x101
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
lis rFEFE, -0x101
add rTMP1, rTMP1, r7F7F
addi rFEFE, rFEFE, -0x101
- nor rTMP1, rTMP2, rTMP1
- and. rWORD1, rTMP1, rMASK
+ nor rTMP3, rTMP2, rTMP1
+ and. rTMP3, rTMP3, rMASK
mtcrf 0x01, rRTN
bne L(done0)
mtcrf 0x01, rRTN
bne L(done0)
- sldi rTMP1, rFEFE, 32
- add rFEFE, rFEFE, rTMP1
+ sldi rTMP1, rFEFE, 32
+ add rFEFE, rFEFE, rTMP1
/* Are we now aligned to a doubleword boundary? */
bt 28, L(loop)

bt 28, L(loop)
/* Handle second doubleword of pair. */
+/* Perhaps use method (1) here for little-endian, saving one instruction? */
ldu rWORD1, 8(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
ldu rWORD1, 8(rSTR)
and rTMP1, r7F7F, rWORD1
or rTMP2, r7F7F, rWORD1
add rTMP1, rTMP1, r7F7F
- nor. rWORD1, rTMP2, rTMP1
+ nor. rTMP3, rTMP2, rTMP1
bne L(done0)

bne L(done0)
/* The loop. */
@@ -146,29 +157,53 @@
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
add rTMP3, rFEFE, rWORD2
nor rTMP4, r7F7F, rWORD2
bne L(done1)
- and. rTMP1, rTMP3, rTMP4
+ and. rTMP3, rTMP3, rTMP4
beq L(loop)

beq L(loop)
+#ifndef __LITTLE_ENDIAN__
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
and rTMP1, r7F7F, rWORD2
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP4, rTMP1
+ andc rTMP3, rTMP4, rTMP1
b L(done0)

b L(done0)
L(done1):
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 8
add rTMP1, rTMP1, r7F7F
and rTMP1, r7F7F, rWORD1
subi rSTR, rSTR, 8
add rTMP1, rTMP1, r7F7F
- andc rWORD1, rTMP2, rTMP1
+ andc rTMP3, rTMP2, rTMP1

/* When we get to here, rSTR points to the first doubleword in the string that
- contains a zero byte, and the most significant set bit in rWORD1 is in that
- byte. */
@ -379,11 +379,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758 @@ -379,11 +379,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strlen.S glibc-2.17-c758
L(done0):
- cntlzd rTMP3, rWORD1
+ cntlzd rTMP3, rTMP3
subf rTMP1, rRTN, rSTR
srdi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
/* GKM FIXME: check high bound. */
blr
subf rTMP1, rRTN, rSTR
srdi rTMP3, rTMP3, 3
add rRTN, rTMP1, rTMP3
/* GKM FIXME: check high bound. */
blr
+#else
+
+L(done0):

228
SOURCES/glibc-ppc64le-26.patch

@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
# commit 33ee81de05e83ce12f32a491270bb4c1611399c7
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:40:48 2013 +0930
#
#
# PowerPC LE strnlen
# http://sourceware.org/ml/libc-alpha/2013-08/msg00098.html
#
#
# The existing strnlen code has a number of defects, so this patch is more
# than just adding little-endian support. The changes here are similar to
# those for memchr.
#
#
# * sysdeps/powerpc/powerpc64/power7/strnlen.S (strnlen): Add
# little-endian support. Remove unnecessary "are we done" tests.
# Handle "s" wrapping around zero and extremely large "size".
@ -16,17 +16,17 @@ @@ -16,17 +16,17 @@
# loop inline rather than by using small_loop. Correct comments.
# Delete "zero" tail, use "end_max" instead.
# * sysdeps/powerpc/powerpc32/power7/strnlen.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S 2014-05-28 12:40:17.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S 2014-05-28 12:44:52.000000000 -0500
@@ -30,51 +30,47 @@
add r7,r3,r4 /* Calculate the last acceptable address. */
cmplwi r4,16
li r0,0 /* Word with null chars. */
add r7,r3,r4 /* Calculate the last acceptable address. */
cmplwi r4,16
li r0,0 /* Word with null chars. */
+ addi r7,r7,-1
ble L(small_range)

ble L(small_range)
- cmplw cr7,r3,r7 /* Is the address equal or less than r3? If
- it's equal or less, it means size is either 0
- or a negative number. */
@ -34,38 +34,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2 @@ -34,38 +34,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2
-
- li r7,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ slw r10,r10,r6
+#else
slw r10,r10,r6
srw r10,r10,r6
slw r10,r10,r6
srw r10,r10,r6
+#endif
cmplwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)

cmplwi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
- bge cr6,L(end_max)
-
+ clrrwi r7,r7,2 /* Address of last word. */
mtcrf 0x01,r8
/* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */

bt 29,L(loop_setup)

mtcrf 0x01,r8
/* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
bt 29,L(loop_setup)
- /* Handle DWORD2 of pair. */
+ /* Handle WORD2 of pair. */
lwzu r12,4(r8)
cmpb r10,r12,r0
cmplwi cr7,r10,0
bne cr7,L(done)

lwzu r12,4(r8)
cmpb r10,r12,r0
cmplwi cr7,r10,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,4
- cmplw cr6,r9,r7
@ -80,19 +80,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2 @@ -80,19 +80,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2
+ be at r8 + 4 + 8 * cnt - 4. Solving for cnt gives
+ cnt = (r7 - r8) / 8 */
+ sub r5,r7,r8
srwi r6,r5,3 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
srwi r6,r5,3 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for the null byte backwards in the string. Since
+
+ /* Main loop to look for the null byte in the string. Since
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
L(loop):
@@ -90,15 +86,18 @@
cmplwi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
cmplwi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for null in the whole range. Just return
- the original size. */
@ -108,16 +108,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2 @@ -108,16 +108,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2
+ cmpb r10,r12,r0
+ cmplwi cr6,r10,0
+ bne cr6,L(done)

L(end_max):
- sub r3,r7,r3
+ mr r3,r4
blr

/* OK, one (or both) of the words contains a null byte. Check
blr
/* OK, one (or both) of the words contains a null byte. Check
@@ -123,49 +122,56 @@
We need to make sure the null char is *before* the end of the
range. */
We need to make sure the null char is *before* the end of the
range. */
L(done):
- cntlzw r0,r10 /* Count leading zeroes before the match. */
- srwi r0,r0,3 /* Convert leading zeroes to bytes. */
@ -144,45 +144,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2 @@ -144,45 +144,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strnlen.S glibc-2
+ cmplw r3,r4
+ blelr
+ mr r3,r4
blr

blr
-/* Deals with size <= 32. */
+/* Deals with size <= 16. */
.align 4
.align 4
L(small_range):
cmplwi r4,0
cmplwi r4,0
- beq L(zero)
+ beq L(end_max)
+
+ clrrwi r7,r7,2 /* Address of last word. */

rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in WORD1. */
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
cmpb r10,r12,r0 /* Check for null bytes in WORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ slw r10,r10,r6
+#else
slw r10,r10,r6
srw r10,r10,r6
slw r10,r10,r6
srw r10,r10,r6
+#endif
cmplwi cr7,r10,0
bne cr7,L(done)

cmplwi cr7,r10,0
bne cr7,L(done)
- addi r9,r8,4
- cmplw r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmplw r8,r7
+ beq L(end_max)

.p2align 5
.p2align 5
L(loop_small):
lwzu r12,4(r8)
cmpb r10,r12,r0
lwzu r12,4(r8)
cmpb r10,r12,r0
- addi r9,r8,4
cmplwi cr6,r10,0
bne cr6,L(done)
cmplwi cr6,r10,0
bne cr6,L(done)
- cmplw r9,r7
- bge L(end_max)
- b L(loop_small)
@ -199,18 +199,18 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2 @@ -199,18 +199,18 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S 2014-05-28 13:24:41.000000000 -0500
@@ -26,33 +26,29 @@
ENTRY (BP_SYM (__strnlen))
CALL_MCOUNT 2
dcbt 0,r3
CALL_MCOUNT 2
dcbt 0,r3
- clrrdi r8,r3,3
+ clrrdi r8,r3,3
add r7,r3,r4 /* Calculate the last acceptable address. */
cmpldi r4,32
li r0,0 /* Doubleword with null chars. */
add r7,r3,r4 /* Calculate the last acceptable address. */
cmpldi r4,32
li r0,0 /* Doubleword with null chars. */
+ addi r7,r7,-1
+
/* If we have less than 33 bytes to search, skip to a faster code. */
ble L(small_range)

/* If we have less than 33 bytes to search, skip to a faster code. */
ble L(small_range)
- cmpld cr7,r3,r7 /* Is the address equal or less than r3? If
- it's equal or less, it means size is either 0
- or a negative number. */
@ -218,32 +218,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2 @@ -218,32 +218,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2
-
- li r7,-1 /* Make r11 the biggest if r4 <= 0. */
-L(proceed):
rlwinm r6,r3,3,26,28 /* Calculate padding. */
ld r12,0(r8) /* Load doubleword from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
rlwinm r6,r3,3,26,28 /* Calculate padding. */
ld r12,0(r8) /* Load doubleword from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ sld r10,r10,r6
+#else
sld r10,r10,r6
srd r10,r10,r6
sld r10,r10,r6
srd r10,r10,r6
+#endif
cmpldi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)

cmpldi cr7,r10,0 /* If r10 == 0, no null's have been found. */
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,8
- cmpld cr6,r9,r7
- bge cr6,L(end_max)
-
+ clrrdi r7,r7,3 /* Address of last doubleword. */
mtcrf 0x01,r8
/* Are we now aligned to a quadword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
mtcrf 0x01,r8
/* Are we now aligned to a quadword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */
@@ -65,17 +61,18 @@
cmpldi cr7,r10,0
bne cr7,L(done)

cmpldi cr7,r10,0
bne cr7,L(done)
- /* Are we done already? */
- addi r9,r8,8
- cmpld cr6,r9,r7
@ -258,19 +258,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2 @@ -258,19 +258,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2
+ be at r8 + 8 + 16 * cnt - 8. Solving for cnt gives
+ cnt = (r7 - r8) / 16 */
+ sub r5,r7,r8
srdi r6,r5,4 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
srdi r6,r5,4 /* Number of loop iterations. */
mtctr r6 /* Setup the counter. */
- b L(loop)
- /* Main loop to look for the null byte backwards in the string. Since
+
+ /* Main loop to look for the null byte in the string. Since
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
it's a small loop (< 8 instructions), align it to 32-bytes. */
.p2align 5
L(loop):
@@ -91,15 +88,18 @@
cmpldi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
cmpldi cr7,r5,0
bne cr7,L(found)
bdnz L(loop)
- /* We're here because the counter reached 0, and that means we
- didn't have any matches for null in the whole range. Just return
- the original size. */
@ -286,17 +286,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2 @@ -286,17 +286,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2
+ cmpb r10,r12,r0
+ cmpldi cr6,r10,0
+ bne cr6,L(done)

L(end_max):
- sub r3,r7,r3
+ mr r3,r4
blr

/* OK, one (or both) of the doublewords contains a null byte. Check
blr
/* OK, one (or both) of the doublewords contains a null byte. Check
@@ -121,52 +121,59 @@
/* r10 has the output of the cmpb instruction, that is, it contains
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length.
/* r10 has the output of the cmpb instruction, that is, it contains
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the length.
- We need to make sure the null char is *before* the start of the
- range (since we're going backwards). */
+ We need to make sure the null char is *before* the end of the
@ -327,45 +327,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2 @@ -327,45 +327,45 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strnlen.S glibc-2
+ cmpld r3,r4
+ blelr
+ mr r3,r4
blr

blr
/* Deals with size <= 32. */
.align 4
.align 4
L(small_range):
cmpldi r4,0
cmpldi r4,0
- beq L(zero)
+ beq L(end_max)
+
+ clrrdi r7,r7,3 /* Address of last doubleword. */

rlwinm r6,r3,3,26,28 /* Calculate padding. */
rlwinm r6,r3,3,26,28 /* Calculate padding. */
- ld r12,0(r8) /* Load word from memory. */
+ ld r12,0(r8) /* Load doubleword from memory. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
cmpb r10,r12,r0 /* Check for null bytes in DWORD1. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ sld r10,r10,r6
+#else
sld r10,r10,r6
srd r10,r10,r6
sld r10,r10,r6
srd r10,r10,r6
+#endif
cmpldi cr7,r10,0
bne cr7,L(done)

cmpldi cr7,r10,0
bne cr7,L(done)
- addi r9,r8,8
- cmpld r9,r7
- bge L(end_max)
- b L(loop_small)
+ cmpld r8,r7
+ beq L(end_max)

.p2align 5
.p2align 5
L(loop_small):
ldu r12,8(r8)
cmpb r10,r12,r0
ldu r12,8(r8)
cmpb r10,r12,r0
- addi r9,r8,8
cmpldi cr6,r10,0
bne cr6,L(done)
cmpldi cr6,r10,0
bne cr6,L(done)
- cmpld r9,r7
- bge L(end_max)
- b L(loop_small)

410
SOURCES/glibc-ppc64le-27.patch

@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
# commit 8a7413f9b036da83ffde491a37d9d2340bc321a7
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:41:17 2013 +0930
#
#
# PowerPC LE strcmp and strncmp
# http://sourceware.org/ml/libc-alpha/2013-08/msg00099.html
#
#
# More little-endian support. I leave the main strcmp loops unchanged,
# (well, except for renumbering rTMP to something other than r0 since
# it's needed in an addi insn) and modify the tail for little-endian.
#
#
# I noticed some of the big-endian tail code was a little untidy so have
# cleaned that up too.
#
#
# * sysdeps/powerpc/powerpc64/strcmp.S (rTMP2): Define as r0.
# (rTMP): Define as r11.
# (strcmp): Add little-endian support. Optimise tail.
@ -22,14 +22,14 @@ @@ -22,14 +22,14 @@
# * sysdeps/powerpc/powerpc32/power4/strncmp.S: Likewise.
# * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise.
# * sysdeps/powerpc/powerpc32/power7/strncmp.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -26,7 +26,7 @@

EALIGN (BP_SYM(strncmp), 4, 0)

-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -40,13 +40,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2 @@ -40,13 +40,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -80,12 +81,45 @@
we don't compare two strings as different because of gunk beyond
the end of the strings... */

+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ slwi rTMP, rTMP, 1
@ -82,32 +82,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2 @@ -82,32 +82,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
@@ -93,28 +127,20 @@
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
- blt- cr1, L(equal)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+ cr1
L(equal):
li rRTN, 0
blr

li rRTN, 0
blr
L(different):
- lwzu rWORD1, -4(rSTR1)
+ lwz rWORD1, -4(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
- blt- L(highbit)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
@ -118,19 +118,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2 @@ -118,19 +118,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/strncmp.S glibc-2
- srwi rWORD1, rWORD1, 24
- sub rRTN, rWORD1, rWORD2
+ ori rRTN, rWORD2, 1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -28,7 +28,7 @@

EALIGN (BP_SYM(strncmp),5,0)

-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -141,9 +141,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2 @@ -141,9 +141,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
nop
dcbt 0,rSTR1
nop
@@ -83,13 +84,45 @@
/* OK. We've hit the end of the string. We need to be careful that
we don't compare two strings as different because of gunk beyond
@ -180,35 +180,35 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2 @@ -180,35 +180,35 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2
+ bgelr
+ ori rRTN, rTMP2, 1
+ blr

+#else
L(endstring):
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
-
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzw rBITDIF,rBITDIF
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzw rBITDIF,rBITDIF
@@ -97,28 +130,20 @@
addi rNEG,rNEG,7
cmpw cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
addi rNEG,rNEG,7
cmpw cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
- blt cr1,L(equal)
- srawi rRTN,rRTN,31
- ori rRTN,rRTN,1
- blr
+ bgelr cr1
L(equal):
li rRTN,0
blr

li rRTN,0
blr
L(different):
- lwzu rWORD1,-4(rSTR1)
+ lwz rWORD1,-4(rSTR1)
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
- blt L(highbit)
- srawi rRTN,rRTN,31
- ori rRTN,rRTN,1
@ -219,19 +219,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2 @@ -219,19 +219,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strncmp.S glibc-2
- srwi rWORD1,rWORD1,24
- sub rRTN,rWORD1,rWORD2
+ ori rRTN, rWORD2, 1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -26,7 +26,7 @@

EALIGN (BP_SYM (strcmp), 4, 0)

-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -242,13 +242,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758 @@ -242,13 +242,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758
#define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r10 /* bits that differ in s1 & s2 words */
+#define rTMP r11

CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
@@ -64,10 +65,45 @@
and. rTMP, rTMP, rNEG
cmpw cr1, rWORD1, rWORD2
beq+ L(g0)
and. rTMP, rTMP, rNEG
cmpw cr1, rWORD1, rWORD2
beq+ L(g0)
-L(endstring):
+
/* OK. We've hit the end of the string. We need to be careful that
@ -289,25 +289,25 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758 @@ -289,25 +289,25 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcmp.S glibc-2.17-c758
+
+#else
+L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
@@ -94,7 +130,7 @@
ori rRTN, rWORD2, 1
/* GKM FIXME: check high bounds. */
blr
ori rRTN, rWORD2, 1
/* GKM FIXME: check high bounds. */
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -26,7 +26,7 @@

EALIGN (BP_SYM(strncmp), 4, 0)

-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -318,13 +318,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75 @@ -318,13 +318,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -78,12 +79,45 @@
we don't compare two strings as different because of gunk beyond
the end of the strings... */

+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ slwi rTMP, rTMP, 1
@ -360,32 +360,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75 @@ -360,32 +360,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzw rBITDIF, rBITDIF
@@ -91,28 +125,20 @@
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
addi rNEG, rNEG, 7
cmpw cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
- blt- cr1, L(equal)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
- blr
+ bgelr+ cr1
L(equal):
li rRTN, 0
blr

li rRTN, 0
blr
L(different):
- lwzu rWORD1, -4(rSTR1)
+ lwz rWORD1, -4(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
- blt- L(highbit)
- srawi rRTN, rRTN, 31
- ori rRTN, rRTN, 1
@ -396,19 +396,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75 @@ -396,19 +396,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strncmp.S glibc-2.17-c75
- srwi rWORD1, rWORD1, 24
- sub rRTN, rWORD1, rWORD2
+ ori rRTN, rWORD2, 1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -27,7 +27,7 @@
EALIGN (BP_SYM(strncmp), 4, 0)
CALL_MCOUNT 3

CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -419,13 +419,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2 @@ -419,13 +419,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -84,12 +85,59 @@
we don't compare two strings as different because of gunk beyond
the end of the strings... */

+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
@ -475,54 +475,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2 @@ -475,54 +475,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/strncmp.S glibc-2
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -98,7 +146,7 @@
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(equal):
@@ -106,7 +154,7 @@
blr

blr
L(different):
- ldu rWORD1, -8(rSTR1)
+ ld rWORD1, -8(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
@@ -114,11 +162,10 @@
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S 2014-05-28 13:27:02.000000000 -0500
@@ -29,7 +29,7 @@
EALIGN (BP_SYM(strncmp),5,0)
CALL_MCOUNT 3

CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -533,13 +533,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2 @@ -533,13 +533,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
nop
dcbt 0,rSTR1
nop
@@ -88,12 +89,57 @@
we don't compare two strings as different because of gunk beyond
the end of the strings... */

+#ifdef __LITTLE_ENDIAN__
+L(endstring):
+ addi rTMP2, rTMP, -1
@ -587,54 +587,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2 @@ -587,54 +587,54 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strncmp.S glibc-2
+
+#else
L(endstring):
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
and rTMP,r7F7F,rWORD1
beq cr1,L(equal)
add rTMP,rTMP,r7F7F
xor. rBITDIF,rWORD1,rWORD2
-
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzd rBITDIF,rBITDIF
andc rNEG,rNEG,rTMP
blt L(highbit)
cntlzd rBITDIF,rBITDIF
@@ -102,7 +148,7 @@
cmpd cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
blt cr1,L(equal)
cmpd cr1,rNEG,rBITDIF
sub rRTN,rWORD1,rWORD2
blt cr1,L(equal)
- sradi rRTN,rRTN,63
+ sradi rRTN,rRTN,63 /* must return an int. */
ori rRTN,rRTN,1
blr
ori rRTN,rRTN,1
blr
L(equal):
@@ -110,7 +156,7 @@
blr

blr
L(different):
- ldu rWORD1,-8(rSTR1)
+ ld rWORD1,-8(rSTR1)
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
blt L(highbit)
xor. rBITDIF,rWORD1,rWORD2
sub rRTN,rWORD1,rWORD2
blt L(highbit)
@@ -118,11 +164,10 @@
ori rRTN,rRTN,1
blr
ori rRTN,rRTN,1
blr
L(highbit):
- srdi rWORD2,rWORD2,56
- srdi rWORD1,rWORD1,56
- sub rRTN,rWORD1,rWORD2
+ sradi rRTN,rWORD2,63
+ ori rRTN,rRTN,1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S 2014-05-28 13:37:15.000000000 -0500
@@ -27,7 +27,7 @@
EALIGN (BP_SYM(strcmp), 4, 0)
CALL_MCOUNT 2

CALL_MCOUNT 2
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -645,17 +645,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758 @@ -645,17 +645,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758
#define rNEG r9 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r10 /* bits that differ in s1 & s2 words */
+#define rTMP r11

CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
CHECK_BOUNDS_LOW (rSTR1, rTMP, rHIGH1)
CHECK_BOUNDS_LOW (rSTR2, rTMP, rHIGH2)
@@ -72,19 +73,66 @@
ldu rWORD2, 8(rSTR2)
ldu rWORD2, 8(rSTR2)
L(g1): add rTMP, rFEFE, rWORD1
nor rNEG, r7F7F, rWORD1
nor rNEG, r7F7F, rWORD1
-
and. rTMP, rTMP, rNEG
cmpd cr1, rWORD1, rWORD2
beq+ L(g0)
and. rTMP, rTMP, rNEG
cmpd cr1, rWORD1, rWORD2
beq+ L(g0)
-L(endstring):
+
/* OK. We've hit the end of the string. We need to be careful that
@ -710,46 +710,46 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758 @@ -710,46 +710,46 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcmp.S glibc-2.17-c758
+
+#else
+L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -93,7 +141,7 @@
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(equal):
@@ -110,12 +158,11 @@
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
/* GKM FIXME: check high bounds. */
blr
/* GKM FIXME: check high bounds. */
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S 2014-05-28 13:26:59.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S 2014-05-28 13:38:31.000000000 -0500
@@ -27,7 +27,7 @@
EALIGN (BP_SYM(strncmp), 4, 0)
CALL_MCOUNT 3

CALL_MCOUNT 3
-#define rTMP r0
+#define rTMP2 r0
#define rRTN r3
@ -760,14 +760,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c75 @@ -760,14 +760,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c75
#define rNEG r10 /* ~(word in s1 | 0x7f7f7f7f7f7f7f7f) */
#define rBITDIF r11 /* bits that differ in s1 & s2 words */
+#define rTMP r12

dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
dcbt 0,rSTR1
or rTMP, rSTR2, rSTR1
@@ -81,13 +82,60 @@
/* OK. We've hit the end of the string. We need to be careful that
we don't compare two strings as different because of gunk beyond
the end of the strings... */
-
-
+
+#ifdef __LITTLE_ENDIAN__
+L(endstring):
@ -818,44 +818,44 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c75 @@ -818,44 +818,44 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strncmp.S glibc-2.17-c75
+
+#else
L(endstring):
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
and rTMP, r7F7F, rWORD1
beq cr1, L(equal)
add rTMP, rTMP, r7F7F
xor. rBITDIF, rWORD1, rWORD2
-
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
andc rNEG, rNEG, rTMP
blt- L(highbit)
cntlzd rBITDIF, rBITDIF
@@ -96,7 +144,7 @@
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
cmpd cr1, rNEG, rBITDIF
sub rRTN, rWORD1, rWORD2
blt- cr1, L(equal)
- sradi rRTN, rRTN, 63
+ sradi rRTN, rRTN, 63 /* must return an int. */
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(equal):
@@ -104,7 +152,7 @@
blr

blr
L(different):
- ldu rWORD1, -8(rSTR1)
+ ld rWORD1, -8(rSTR1)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
xor. rBITDIF, rWORD1, rWORD2
sub rRTN, rWORD1, rWORD2
blt- L(highbit)
@@ -112,11 +160,10 @@
ori rRTN, rRTN, 1
blr
ori rRTN, rRTN, 1
blr
L(highbit):
- srdi rWORD2, rWORD2, 56
- srdi rWORD1, rWORD1, 56
- sub rRTN, rWORD1, rWORD2
+ sradi rRTN, rWORD2, 63
+ ori rRTN, rRTN, 1
blr
blr
-
+#endif

/* Oh well. In this case, we just do a byte-by-byte comparison. */
.align 4
.align 4

88
SOURCES/glibc-ppc64le-28.patch

@ -1,27 +1,27 @@ @@ -1,27 +1,27 @@
# commit 43b84013714c46e6dcae4a5564c5527777ad5e08
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:45:31 2013 +0930
#
#
# PowerPC LE strcpy
# http://sourceware.org/ml/libc-alpha/2013-08/msg00100.html
#
#
# The strcpy changes for little-endian are quite straight-forward, just
# a matter of rotating the last word differently.
#
#
# I'll note that the powerpc64 version of stpcpy is just begging to be
# converted to use 64-bit loads and stores..
#
#
# * sysdeps/powerpc/powerpc64/strcpy.S: Add little-endian support:
# * sysdeps/powerpc/powerpc32/strcpy.S: Likewise.
# * sysdeps/powerpc/powerpc64/stpcpy.S: Likewise.
# * sysdeps/powerpc/powerpc32/stpcpy.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
@@ -74,7 +74,22 @@

mr rALT, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
@ -40,23 +40,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S glibc-2.17-c758 @@ -40,23 +40,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/stpcpy.S glibc-2.17-c758
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -87,6 +102,7 @@
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
STORE_RETURN_VALUE (rDEST)
blr
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
STORE_RETURN_VALUE (rDEST)
blr
+#endif

/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S 2014-05-28 13:40:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S 2014-05-28 13:40:01.000000000 -0500
@@ -78,7 +78,22 @@

mr rALT, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
@ -75,23 +75,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S glibc-2.17-c758 @@ -75,23 +75,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strcpy.S glibc-2.17-c758
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stb rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
stb rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -90,6 +105,7 @@
stb rALT, 7(rDEST)
/* GKM FIXME: check high bound. */
blr
stb rALT, 7(rDEST)
/* GKM FIXME: check high bound. */
blr
+#endif

/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S 2014-05-28 13:40:01.000000000 -0500
@@ -75,7 +75,22 @@

mr rALT, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
-L(g1): rlwinm. rTMP, rALT, 8, 24, 31
+L(g1):
@ -110,22 +110,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S glibc-2.17-c758 @@ -110,22 +110,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/stpcpy.S glibc-2.17-c758
+ blr
+#else
+ rlwinm. rTMP, rALT, 8, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
stbu rTMP, 4(rDEST)
beqlr-
rlwinm. rTMP, rALT, 16, 24, 31
@@ -88,6 +103,7 @@
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
STORE_RETURN_VALUE (rDEST)
blr
CHECK_BOUNDS_HIGH (rDEST, rHIGH, twlgt)
STORE_RETURN_VALUE (rDEST)
blr
+#endif

/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
.align 4
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S 2014-05-28 13:40:01.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S 2014-05-28 13:40:01.000000000 -0500
@@ -90,6 +90,32 @@
mr rALT, rWORD
mr rALT, rWORD
/* We've hit the end of the string. Do the rest byte-by-byte. */
L(g1):
+#ifdef __LITTLE_ENDIAN__
@ -154,14 +154,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S glibc-2.17-c758 @@ -154,14 +154,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strcpy.S glibc-2.17-c758
+ stb rTMP, 15(rDEST)
+ blr
+#else
extrdi. rTMP, rALT, 8, 0
stb rTMP, 8(rDEST)
beqlr-
extrdi. rTMP, rALT, 8, 0
stb rTMP, 8(rDEST)
beqlr-
@@ -114,6 +140,7 @@
stb rALT, 15(rDEST)
/* GKM FIXME: check high bound. */
blr
stb rALT, 15(rDEST)
/* GKM FIXME: check high bound. */
blr
+#endif

/* Oh well. In this case, we just do a byte-by-byte copy. */
.align 4
.align 4

500
SOURCES/glibc-ppc64le-29.patch

@ -1,21 +1,21 @@ @@ -1,21 +1,21 @@
# commit 664318c3eb07032e2bfcf47cb2aa3c89280c19e7
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:46:05 2013 +0930
#
#
# PowerPC LE strchr
# http://sourceware.org/ml/libc-alpha/2013-08/msg00101.html
#
#
# Adds little-endian support to optimised strchr assembly. I've also
# tweaked the big-endian code a little. In power7/strchr.S there's a
# check in the tail of the function that we didn't match 0 before
# finding a c match, done by comparing leading zero counts. It's just
# as valid, and quicker, to compare the raw output from cmpb.
#
#
# Another little tweak is to use rldimi/insrdi in place of rlwimi for
# the power7 strchr functions. Since rlwimi is cracked, it is a few
# cycles slower. rldimi can be used on the 32-bit power7 functions
# too.
#
#
# * sysdeps/powerpc/powerpc64/power7/strchr.S (strchr): Add little-endian
# support. Correct typos, formatting. Optimize tail. Use insrdi
# rather than rlwimi.
@ -29,26 +29,26 @@ @@ -29,26 +29,26 @@
# (strchr): Add little-endian support. Comment. Move cntlzd
# earlier in tail.
# * sysdeps/powerpc/powerpc32/strchr.S: Likewise.
#
#
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S.orig
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S
@@ -37,8 +37,8 @@ ENTRY (BP_SYM(strchr))
beq cr7,L(null_match)

/* Replicate byte to word. */
beq cr7,L(null_match)
/* Replicate byte to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32

/* Now r4 has a word of c bytes and r0 has
a word of null bytes. */
/* Now r4 has a word of c bytes and r0 has
a word of null bytes. */
@@ -48,11 +48,17 @@ ENTRY (BP_SYM(strchr))

/* Move the words left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
/* Move the words left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
@ -56,40 +56,40 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S @@ -56,40 +56,40 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S
+ slw r10,r10,r6
+ slw r11,r11,r6
+#else
slw r10,r10,r6
slw r11,r11,r6
srw r10,r10,r6
srw r11,r11,r6
slw r10,r10,r6
slw r11,r11,r6
srw r10,r10,r6
srw r11,r11,r6
+#endif
or r5,r10,r11 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
or r5,r10,r11 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -67,7 +73,7 @@ ENTRY (BP_SYM(strchr))

/* Handle WORD2 of pair. */
lwzu r12,4(r8)
/* Handle WORD2 of pair. */
lwzu r12,4(r8)
- cmpb r10,r12,r4
+ cmpb r10,r12,r4
cmpb r11,r12,r0
or r5,r10,r11
cmpwi cr7,r5,0
cmpb r11,r12,r0
or r5,r10,r11
cmpwi cr7,r5,0
@@ -102,22 +108,31 @@ L(loop):
bne cr6,L(done)

/* The c/null byte must be in the second word. Adjust the address
bne cr6,L(done)
/* The c/null byte must be in the second word. Adjust the address
- again and move the result of cmpb to r10 so we can calculate the
- pointer. */
+ again and move the result of cmpb to r10/r11 so we can calculate
+ the pointer. */

mr r10,r6
mr r11,r7
addi r8,r8,4

mr r10,r6
mr r11,r7
addi r8,r8,4
- /* r5 has the output of the cmpb instruction, that is, it contains
+ /* r10/r11 have the output of the cmpb instructions, that is,
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
L(done):
- cntlzw r4,r10 /* Count leading zeroes before c matches. */
- cntlzw r0,r11 /* Count leading zeroes before null matches. */
@ -105,17 +105,17 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S @@ -105,17 +105,17 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S
+#else
+ cntlzw r0,r10 /* Count leading zeros before c matches. */
+ cmplw cr7,r11,r10
bgt cr7,L(no_match)
bgt cr7,L(no_match)
- srwi r0,r4,3 /* Convert leading zeroes to bytes. */
+#endif
+ srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
@@ -135,10 +150,14 @@ L(null_match):
cmpb r5,r12,r0 /* Compare each byte against null bytes. */

/* Move the words left and right to discard the bits that are
cmpb r5,r12,r0 /* Compare each byte against null bytes. */
/* Move the words left and right to discard the bits that are
- not part of the string and to bring them back as zeros. */
-
+ not part of the string and bring them back as zeros. */
@ -123,104 +123,104 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S @@ -123,104 +123,104 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchr.S
+ srw r5,r5,r6
+ slw r5,r5,r6
+#else
slw r5,r5,r6
srw r5,r5,r6
slw r5,r5,r6
srw r5,r5,r6
+#endif
cmpwi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
cmpwi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
@@ -193,7 +212,13 @@ L(loop_null):
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the pointer. */
0xff in the same position as the null byte in the original
word from the string. Use that to calculate the pointer. */
L(done_null):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntw r0,r0
+#else
cntlzw r0,r5 /* Count leading zeros before the match. */
cntlzw r0,r5 /* Count leading zeros before the match. */
+#endif
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchrnul.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchrnul.S.orig
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/strchrnul.S
@@ -29,8 +29,8 @@ ENTRY (BP_SYM(__strchrnul))
clrrwi r8,r3,2 /* Align the address to word boundary. */

/* Replicate byte to word. */
clrrwi r8,r3,2 /* Align the address to word boundary. */
/* Replicate byte to word. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32

rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
rlwinm r6,r3,3,27,28 /* Calculate padding. */
lwz r12,0(r8) /* Load word from memory. */
@@ -45,10 +45,17 @@ ENTRY (BP_SYM(__strchrnul))

/* Move the words left and right to discard the bits that are
not part of the string and bring them back as zeros. */
/* Move the words left and right to discard the bits that are
not part of the string and bring them back as zeros. */
+#ifdef __LITTLE_ENDIAN__
+ srw r10,r10,r6
+ srw r9,r9,r6
+ slw r10,r10,r6
+ slw r9,r9,r6
+#else
slw r10,r10,r6
slw r9,r9,r6
srw r10,r10,r6
srw r9,r9,r6
slw r10,r10,r6
slw r9,r9,r6
srw r10,r10,r6
srw r9,r9,r6
+#endif
or r5,r9,r10 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
or r5,r9,r10 /* OR the results to speed things up. */
cmpwi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -56,7 +63,7 @@ ENTRY (BP_SYM(__strchrnul))

mtcrf 0x01,r8

mtcrf 0x01,r8
- /* Are we now aligned to a quadword boundary? If so, skip to
+ /* Are we now aligned to a doubleword boundary? If so, skip to
the main loop. Otherwise, go through the alignment code. */

bt 29,L(loop)
the main loop. Otherwise, go through the alignment code. */
bt 29,L(loop)
@@ -78,7 +85,7 @@ L(loop):
single register for speed. This is an attempt
to speed up the null-checking process for bigger strings. */
lwz r12,4(r8)
single register for speed. This is an attempt
to speed up the null-checking process for bigger strings. */
lwz r12,4(r8)
- lwzu r11,8(r8)
+ lwzu r11,8(r8)
cmpb r10,r12,r0
cmpb r9,r12,r4
cmpb r6,r11,r0
cmpb r10,r12,r0
cmpb r9,r12,r4
cmpb r6,r11,r0
@@ -97,9 +104,9 @@ L(loop):
addi r8,r8,-4
bne cr6,L(done)

addi r8,r8,-4
bne cr6,L(done)
- /* The c/null byte must be in the second word. Adjust the
- address again and move the result of cmpb to r10 so we can calculate
- the pointer. */
+ /* The c/null byte must be in the second word. Adjust the address
+ again and move the result of cmpb to r5 so we can calculate the
+ pointer. */
mr r5,r10
addi r8,r8,4

mr r5,r10
addi r8,r8,4
@@ -107,7 +114,13 @@ L(loop):
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
0xff in the same position as the c/null byte in the original
word from the string. Use that to calculate the pointer. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntw r0,r0
+#else
cntlzw r0,r5 /* Count leading zeros before the match. */
cntlzw r0,r5 /* Count leading zeros before the match. */
+#endif
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
srwi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S.orig
@ -231,29 +231,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S @@ -231,29 +231,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
#define rTMP3 r12
+#define rTMP4 rIGN
+#define rTMP5 rMASK

CHECK_BOUNDS_LOW (rSTR, rTMP1, rTMP2)
STORE_RETURN_BOUNDS (rTMP1, rTMP2)
CHECK_BOUNDS_LOW (rSTR, rTMP1, rTMP2)
STORE_RETURN_BOUNDS (rTMP1, rTMP2)
@@ -59,53 +61,74 @@ ENTRY (BP_SYM (strchr))
addi r7F7F, r7F7F, 0x7f7f
addi r7F7F, r7F7F, 0x7f7f
/* Test the first (partial?) word. */
lwz rWORD, 0(rSTR)
lwz rWORD, 0(rSTR)
+#ifdef __LITTLE_ENDIAN__
+ slw rMASK, rMASK, rIGN
+#else
srw rMASK, rMASK, rIGN
srw rMASK, rMASK, rIGN
+#endif
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2
xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)

xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)
/* The loop. */

-L(loop):lwzu rWORD, 4(rSTR)
- and. rTMP1, rTMP1, rTMP2
+L(loop):
@ -264,15 +264,15 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S @@ -264,15 +264,15 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
- nor rTMP2, r7F7F, rWORD
+ add rTMP1, rFEFE, rWORD /* x - 0x01010101. */
+ nor rTMP2, r7F7F, rWORD /* ~(x | 0x7f7f7f7f) == ~x & 0x80808080. */
bne L(foundit)
bne L(foundit)
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2 /* (x - 0x01010101) & ~x & 0x80808080. */
/* Start test for the bytes we're looking for. */
xor rTMP3, rCHR, rWORD
xor rTMP3, rCHR, rWORD
L(loopentry):
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
+
/* There is a zero byte in the word, but may also be a matching byte (either
before or after the zero byte). In fact, we may be looking for a
@ -282,9 +282,9 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S @@ -282,9 +282,9 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
- and. rTMP1, rTMP1, rTMP2
+ zero byte, in which case we return a match. */
+ and. rTMP5, rTMP1, rTMP2
li rRTN, 0
STORE_RETURN_VALUE (rSTR)
beqlr
li rRTN, 0
STORE_RETURN_VALUE (rSTR)
beqlr
-/* It did happen. Decide which one was first...
- I'm not sure if this is actually faster than a sequence of
- rotates, compares, and branches (we use it anyway because it's shorter). */
@ -307,29 +307,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S @@ -307,29 +307,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
+/* I think we could reduce this by two instructions by keeping the "nor"
+ results from the loop for reuse here. See strlen.S tail. Similarly
+ one instruction could be pruned from L(foundit). */
and rFEFE, r7F7F, rWORD
and rFEFE, r7F7F, rWORD
- or rMASK, r7F7F, rWORD
+ or rTMP5, r7F7F, rWORD
and rTMP1, r7F7F, rTMP3
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rWORD, rMASK, rFEFE
- nor rTMP2, rIGN, rTMP1
+ nor rWORD, rTMP5, rFEFE
+ nor rTMP2, rTMP4, rTMP1
+ cntlzw rCLZB, rTMP2
cmplw rWORD, rTMP2
bgtlr
cmplw rWORD, rTMP2
bgtlr
- cntlzw rCLZB, rTMP2
+#endif
srwi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge)
srwi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge)
@@ -113,13 +136,21 @@ L(missed):
blr

blr
L(foundit):
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
@ -338,38 +338,38 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S @@ -338,38 +338,38 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/strchr.S
+ subfic rCLZB, rCLZB, 32-7-32
+ srawi rCLZB, rCLZB, 3
+#else
and rTMP1, r7F7F, rTMP3
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rTMP1, rTMP1, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rTMP2, rIGN, rTMP1
+ nor rTMP2, rTMP4, rTMP1
cntlzw rCLZB, rTMP2
subi rSTR, rSTR, 4
srwi rCLZB, rCLZB, 3
cntlzw rCLZB, rTMP2
subi rSTR, rSTR, 4
srwi rCLZB, rCLZB, 3
+#endif
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge)
STORE_RETURN_VALUE (rSTR)
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, twlge)
STORE_RETURN_VALUE (rSTR)
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S.orig
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S
@@ -37,8 +37,8 @@ ENTRY (BP_SYM(strchr))
beq cr7,L(null_match)

/* Replicate byte to doubleword. */
beq cr7,L(null_match)
/* Replicate byte to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0

/* Now r4 has a doubleword of c bytes and r0 has
insrdi r4,r4,32,0
/* Now r4 has a doubleword of c bytes and r0 has
@@ -49,11 +49,17 @@ ENTRY (BP_SYM(strchr))

/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
@ -377,22 +377,22 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S @@ -377,22 +377,22 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S
+ sld r10,r10,r6
+ sld r11,r11,r6
+#else
sld r10,r10,r6
sld r11,r11,r6
srd r10,r10,r6
srd r11,r11,r6
sld r10,r10,r6
sld r11,r11,r6
srd r10,r10,r6
srd r11,r11,r6
+#endif
or r5,r10,r11 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
or r5,r10,r11 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -110,15 +116,24 @@ L(loop):
mr r11,r7
addi r8,r8,8

mr r11,r7
addi r8,r8,8
- /* r5 has the output of the cmpb instruction, that is, it contains
+ /* r10/r11 have the output of the cmpb instructions, that is,
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done):
- cntlzd r4,r10 /* Count leading zeroes before c matches. */
- cntlzd r0,r11 /* Count leading zeroes before null matches. */
@ -404,7 +404,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S @@ -404,7 +404,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S
+ addi r4,r11,-1
+ andc r4,r4,r11
+ cmpld cr7,r3,r4
bgt cr7,L(no_match)
bgt cr7,L(no_match)
- srdi r0,r4,3 /* Convert leading zeroes to bytes. */
+#else
+ cntlzd r0,r10 /* Count leading zeros before c matches. */
@ -412,94 +412,94 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S @@ -412,94 +412,94 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchr.S
+ bgt cr7,L(no_match)
+#endif
+ srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
add r3,r8,r0 /* Return address of the matching c byte
or null in case c was not found. */
blr
@@ -137,9 +152,13 @@ L(null_match):

/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
/* Move the doublewords left and right to discard the bits that are
not part of the string and bring them back as zeros. */
-
+#ifdef __LITTLE_ENDIAN__
+ srd r5,r5,r6
+ sld r5,r5,r6
+#else
sld r5,r5,r6
srd r5,r5,r6
sld r5,r5,r6
srd r5,r5,r6
+#endif
cmpdi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
cmpdi cr7,r5,0 /* If r10 == 0, no c or null bytes
have been found. */
bne cr7,L(done_null)
@@ -194,7 +213,13 @@ L(loop_null):
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the pointer. */
0xff in the same position as the null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done_null):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntd r0,r0
+#else
cntlzd r0,r5 /* Count leading zeros before the match. */
cntlzd r0,r5 /* Count leading zeros before the match. */
+#endif
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of the matching null byte. */
blr
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchrnul.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchrnul.S.orig
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/strchrnul.S
@@ -29,8 +29,8 @@ ENTRY (BP_SYM(__strchrnul))
clrrdi r8,r3,3 /* Align the address to doubleword boundary. */

/* Replicate byte to doubleword. */
clrrdi r8,r3,3 /* Align the address to doubleword boundary. */
/* Replicate byte to doubleword. */
- rlwimi r4,r4,8,16,23
- rlwimi r4,r4,16,0,15
+ insrdi r4,r4,8,48
+ insrdi r4,r4,16,32
insrdi r4,r4,32,0

rlwinm r6,r3,3,26,28 /* Calculate padding. */
insrdi r4,r4,32,0
rlwinm r6,r3,3,26,28 /* Calculate padding. */
@@ -46,10 +46,17 @@ ENTRY (BP_SYM(__strchrnul))

/* Move the doublewords left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
/* Move the doublewords left and right to discard the bits that are
not part of the string and to bring them back as zeros. */
+#ifdef __LITTLE_ENDIAN__
+ srd r10,r10,r6
+ srd r9,r9,r6
+ sld r10,r10,r6
+ sld r9,r9,r6
+#else
sld r10,r10,r6
sld r9,r9,r6
srd r10,r10,r6
srd r9,r9,r6
sld r10,r10,r6
sld r9,r9,r6
srd r10,r10,r6
srd r9,r9,r6
+#endif
or r5,r9,r10 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
or r5,r9,r10 /* OR the results to speed things up. */
cmpdi cr7,r5,0 /* If r5 == 0, no c or null bytes
have been found. */
@@ -99,7 +106,7 @@ L(loop):
bne cr6,L(done)

/* The c/null byte must be in the second doubleword. Adjust the
bne cr6,L(done)
/* The c/null byte must be in the second doubleword. Adjust the
- address again and move the result of cmpb to r10 so we can calculate
+ address again and move the result of cmpb to r5 so we can calculate
the pointer. */
mr r5,r10
addi r8,r8,8
the pointer. */
mr r5,r10
addi r8,r8,8
@@ -108,7 +115,13 @@ L(loop):
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
0xff in the same position as the c/null byte in the original
doubleword from the string. Use that to calculate the pointer. */
L(done):
+#ifdef __LITTLE_ENDIAN__
+ addi r0,r5,-1
+ andc r0,r0,r5
+ popcntd r0,r0
+#else
cntlzd r0,r5 /* Count leading zeros before the match. */
cntlzd r0,r5 /* Count leading zeros before the match. */
+#endif
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
srdi r0,r0,3 /* Convert leading zeros to bytes. */
add r3,r8,r0 /* Return address of matching c/null byte. */
blr
Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
===================================================================
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S.orig
@ -510,39 +510,39 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S @@ -510,39 +510,39 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
#define rTMP3 r12
+#define rTMP4 rIGN
+#define rTMP5 rMASK

CHECK_BOUNDS_LOW (rSTR, rTMP1, rTMP2)
STORE_RETURN_BOUNDS (rTMP1, rTMP2)

dcbt 0,rRTN
CHECK_BOUNDS_LOW (rSTR, rTMP1, rTMP2)
STORE_RETURN_BOUNDS (rTMP1, rTMP2)
dcbt 0,rRTN
- rlwimi rCHR, rCHR, 8, 16, 23
+ insrdi rCHR, rCHR, 8, 48
li rMASK, -1
li rMASK, -1
- rlwimi rCHR, rCHR, 16, 0, 15
+ insrdi rCHR, rCHR, 16, 32
rlwinm rIGN, rRTN, 3, 26, 28
insrdi rCHR, rCHR, 32, 0
lis rFEFE, -0x101
rlwinm rIGN, rRTN, 3, 26, 28
insrdi rCHR, rCHR, 32, 0
lis rFEFE, -0x101
@@ -70,53 +72,74 @@ ENTRY (BP_SYM (strchr))
add rFEFE, rFEFE, rTMP1
add rFEFE, rFEFE, rTMP1
/* Test the first (partial?) word. */
ld rWORD, 0(rSTR)
ld rWORD, 0(rSTR)
+#ifdef __LITTLE_ENDIAN__
+ sld rMASK, rMASK, rIGN
+#else
srd rMASK, rMASK, rIGN
srd rMASK, rMASK, rIGN
+#endif
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
orc rWORD, rWORD, rMASK
add rTMP1, rFEFE, rWORD
nor rTMP2, r7F7F, rWORD
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2
xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)

xor rTMP3, rCHR, rWORD
orc rTMP3, rTMP3, rMASK
b L(loopentry)
/* The loop. */

-L(loop):ldu rWORD, 8(rSTR)
- and. rTMP1, rTMP1, rTMP2
+L(loop):
@ -553,15 +553,15 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S @@ -553,15 +553,15 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
- nor rTMP2, r7F7F, rWORD
+ add rTMP1, rFEFE, rWORD /* x - 0x01010101. */
+ nor rTMP2, r7F7F, rWORD /* ~(x | 0x7f7f7f7f) == ~x & 0x80808080. */
bne L(foundit)
bne L(foundit)
- and. rTMP1, rTMP1, rTMP2
+ and. rTMP4, rTMP1, rTMP2 /* (x - 0x01010101) & ~x & 0x80808080. */
/* Start test for the bytes we're looking for. */
xor rTMP3, rCHR, rWORD
xor rTMP3, rCHR, rWORD
L(loopentry):
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
add rTMP1, rFEFE, rTMP3
nor rTMP2, r7F7F, rTMP3
beq L(loop)
+
/* There is a zero byte in the word, but may also be a matching byte (either
before or after the zero byte). In fact, we may be looking for a
@ -571,9 +571,9 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S @@ -571,9 +571,9 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
- and. rTMP1, rTMP1, rTMP2
+ zero byte, in which case we return a match. */
+ and. rTMP5, rTMP1, rTMP2
li rRTN, 0
STORE_RETURN_VALUE (rSTR)
beqlr
li rRTN, 0
STORE_RETURN_VALUE (rSTR)
beqlr
-/* It did happen. Decide which one was first...
- I'm not sure if this is actually faster than a sequence of
- rotates, compares, and branches (we use it anyway because it's shorter). */
@ -596,29 +596,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S @@ -596,29 +596,29 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
+/* I think we could reduce this by two instructions by keeping the "nor"
+ results from the loop for reuse here. See strlen.S tail. Similarly
+ one instruction could be pruned from L(foundit). */
and rFEFE, r7F7F, rWORD
and rFEFE, r7F7F, rWORD
- or rMASK, r7F7F, rWORD
+ or rTMP5, r7F7F, rWORD
and rTMP1, r7F7F, rTMP3
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
add rFEFE, rFEFE, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rWORD, rMASK, rFEFE
- nor rTMP2, rIGN, rTMP1
+ nor rWORD, rTMP5, rFEFE
+ nor rTMP2, rTMP4, rTMP1
+ cntlzd rCLZB, rTMP2
cmpld rWORD, rTMP2
bgtlr
cmpld rWORD, rTMP2
bgtlr
- cntlzd rCLZB, rTMP2
+#endif
srdi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, tdlge)
srdi rCLZB, rCLZB, 3
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, tdlge)
@@ -124,13 +147,21 @@ L(missed):
blr

blr
L(foundit):
+#ifdef __LITTLE_ENDIAN__
+ addi rTMP1, rTMP5, -1
@ -627,16 +627,16 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S @@ -627,16 +627,16 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/strchr.S
+ subfic rCLZB, rCLZB, 64-7-64
+ sradi rCLZB, rCLZB, 3
+#else
and rTMP1, r7F7F, rTMP3
and rTMP1, r7F7F, rTMP3
- or rIGN, r7F7F, rTMP3
+ or rTMP4, r7F7F, rTMP3
add rTMP1, rTMP1, r7F7F
add rTMP1, rTMP1, r7F7F
- nor rTMP2, rIGN, rTMP1
+ nor rTMP2, rTMP4, rTMP1
cntlzd rCLZB, rTMP2
subi rSTR, rSTR, 8
srdi rCLZB, rCLZB, 3
cntlzd rCLZB, rTMP2
subi rSTR, rSTR, 8
srdi rCLZB, rCLZB, 3
+#endif
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, tdlge)
STORE_RETURN_VALUE (rSTR)
add rRTN, rSTR, rCLZB
CHECK_BOUNDS_HIGH_RTN (rSTR, rTMP2, tdlge)
STORE_RETURN_VALUE (rSTR)

2424
SOURCES/glibc-ppc64le-30.patch

File diff suppressed because it is too large Load Diff

558
SOURCES/glibc-ppc64le-31.patch

File diff suppressed because it is too large Load Diff

218
SOURCES/glibc-ppc64le-32.patch

@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
# commit 3be87c77d24c4456ccca4034363b6d1814cd0c84
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:47:59 2013 +0930
#
#
# PowerPC LE memset
# http://sourceware.org/ml/libc-alpha/2013-08/msg00104.html
#
#
# One of the things I noticed when looking at power7 timing is that rlwimi
# is cracked and the two resulting insns have a register dependency.
# That makes it a little slower than the equivalent rldimi.
#
#
# * sysdeps/powerpc/powerpc64/memset.S: Replace rlwimi with
# insrdi. Formatting.
# * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise.
@ -17,156 +17,156 @@ @@ -17,156 +17,156 @@
# * sysdeps/powerpc/powerpc32/power4/memset.S: Likewise.
# * sysdeps/powerpc/powerpc32/power6/memset.S: Likewise.
# * sysdeps/powerpc/powerpc32/power7/memset.S: Likewise.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power4/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -52,7 +52,7 @@

/* Align to word boundary. */
cmplwi cr5, rLEN, 31
cmplwi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
@@ -67,7 +67,7 @@
/* Handle the case of size < 31. */
L(aligned):
mtcrf 0x01, rLEN
mtcrf 0x01, rLEN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
ble cr5, L(medium)
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x1C
andi. rALIGN, rMEMP, 0x1C
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power6/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -50,7 +50,7 @@
ble- cr1, L(small)
ble- cr1, L(small)
/* Align to word boundary. */
cmplwi cr5, rLEN, 31
cmplwi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
beq+ L(aligned)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 4
@@ -66,7 +66,7 @@
/* Handle the case of size < 31. */
L(aligned):
mtcrf 0x01, rLEN
mtcrf 0x01, rLEN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
ble cr5, L(medium)
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x1C
andi. rALIGN, rMEMP, 0x1C
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/power7/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -37,8 +37,8 @@
cfi_offset(31,-8)

/* Replicate byte to word. */
cfi_offset(31,-8)
/* Replicate byte to word. */
- rlwimi 4,4,8,16,23
- rlwimi 4,4,16,0,15
+ insrdi 4,4,8,48
+ insrdi 4,4,16,32

ble cr6,L(small) /* If length <= 8, use short copy code. */

ble cr6,L(small) /* If length <= 8, use short copy code. */
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -73,14 +73,14 @@

/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
bf+ 31, L(g2)
@@ -102,14 +102,14 @@

/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -230,7 +230,7 @@
/* Memset of 0-31 bytes. */
.align 5
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
add rMEMP, rMEMP, rLEN
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -68,14 +68,14 @@

/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
bf+ 31, L(g2)
@@ -97,14 +97,14 @@

/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -164,24 +164,24 @@
L(getCacheAligned):
cmpldi cr1,rLEN,32
andi. rTMP,rMEMP,127
cmpldi cr1,rLEN,32
andi. rTMP,rMEMP,127
- blt cr1,L(handletail32)
- beq L(cacheAligned)
+ blt cr1,L(handletail32)
+ beq L(cacheAligned)
addi rMEMP,rMEMP,32
addi rLEN,rLEN,-32
addi rMEMP,rMEMP,32
addi rLEN,rLEN,-32
- std rCHR,-32(rMEMP)
- std rCHR,-24(rMEMP)
- std rCHR,-16(rMEMP)
@ -177,96 +177,96 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S glibc-2. @@ -177,96 +177,96 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power4/memset.S glibc-2.
+ std rCHR,-16(rMEMP)
+ std rCHR,-8(rMEMP)
+ b L(getCacheAligned)

/* Now we are aligned to the cache line and can use dcbz. */
L(cacheAligned):
cmpld cr1,rLEN,rCLS
cmpld cr1,rLEN,rCLS
- blt cr1,L(handletail32)
+ blt cr1,L(handletail32)
dcbz 0,rMEMP
subf rLEN,rCLS,rLEN
dcbz 0,rMEMP
subf rLEN,rCLS,rLEN
- add rMEMP,rMEMP,rCLS
- b L(cacheAligned)
+ add rMEMP,rMEMP,rCLS
+ b L(cacheAligned)

/* We are here because the cache line size was set and was not 32-bytes
and the remainder (rLEN) is less than the actual cache line size.
@@ -218,7 +218,7 @@
/* Memset of 0-31 bytes. */
.align 5
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
add rMEMP, rMEMP, rLEN
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power6/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -65,14 +65,14 @@

/* Align to doubleword boundary. */
cmpldi cr5, rLEN, 31
cmpldi cr5, rLEN, 31
- rlwimi rCHR, rCHR, 8, 16, 23 /* Replicate byte to halfword. */
+ insrdi rCHR, rCHR, 8, 48 /* Replicate byte to halfword. */
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
beq+ L(aligned2)
mtcrf 0x01, rMEMP0
subfic rALIGN, rALIGN, 8
cror 28,30,31 /* Detect odd word aligned. */
add rMEMP, rMEMP, rALIGN
sub rLEN, rLEN, rALIGN
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
bt 29, L(g4)
bt 29, L(g4)
/* Process the even word of doubleword. */
bf+ 31, L(g2)
bf+ 31, L(g2)
@@ -94,14 +94,14 @@

/* Handle the case of size < 31. */
L(aligned2):
- rlwimi rCHR, rCHR, 16, 0, 15 /* Replicate halfword to word. */
+ insrdi rCHR, rCHR, 16, 32 /* Replicate halfword to word. */
L(aligned):
mtcrf 0x01, rLEN
ble cr5, L(medium)
mtcrf 0x01, rLEN
ble cr5, L(medium)
/* Align to 32-byte boundary. */
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
andi. rALIGN, rMEMP, 0x18
subfic rALIGN, rALIGN, 0x20
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
beq L(caligned)
mtcrf 0x01, rALIGN
add rMEMP, rMEMP, rALIGN
@@ -362,7 +362,7 @@
/* Memset of 0-31 bytes. */
.align 5
.align 5
L(medium):
- insrdi rCHR,rCHR,32,0 /* Replicate word to double word. */
+ insrdi rCHR, rCHR, 32, 0 /* Replicate word to double word. */
cmpldi cr1, rLEN, 16
cmpldi cr1, rLEN, 16
L(medium_tail2):
add rMEMP, rMEMP, rLEN
add rMEMP, rMEMP, rLEN
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S 2014-05-29 13:07:41.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/power7/memset.S 2014-05-29 13:07:46.000000000 -0500
@@ -34,8 +34,8 @@
mr 10,3

/* Replicate byte to word. */
mr 10,3
/* Replicate byte to word. */
- rlwimi 4,4,8,16,23
- rlwimi 4,4,16,0,15
+ insrdi 4,4,8,48
+ insrdi 4,4,16,32
ble cr6,L(small) /* If length <= 8, use short copy code. */

neg 0,3
ble cr6,L(small) /* If length <= 8, use short copy code. */
neg 0,3
@@ -323,7 +323,7 @@
clrldi 0,0,62
beq L(medium_aligned)

clrldi 0,0,62
beq L(medium_aligned)
- /* Force 4-bytes alignment for SRC. */
+ /* Force 4-bytes alignment for DST. */
mtocrf 0x01,0
subf 5,0,5
mtocrf 0x01,0
subf 5,0,5
1: /* Copy 1 byte. */

590
SOURCES/glibc-ppc64le-33.patch

File diff suppressed because it is too large Load Diff

16
SOURCES/glibc-ppc64le-34.patch

@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
# commit 8f9ebb08af1368962d9f24c4cfacb55cf8eee560
# Author: Alan Modra <amodra@gmail.com>
# Date: Thu Oct 3 14:03:03 2013 +0930
#
#
# PowerPC LE configury
# http://sourceware.org/ml/libc-alpha/2013-08/msg00096.html
#
#
# This adds the basic configury bits for powerpc64le and powerpcle.
#
#
# * configure.in: Map powerpc64le and powerpcle to base_machine/machine.
# * configure: Regenerate.
# * nptl/shlib-versions: Powerpc*le starts at 2.18.
# * shlib-versions: Likewise.
#
#
# commit 0ff8246327401ae8779e2697d5c7348611cdbf8a
# Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
# Date: Tue Feb 4 09:49:08 2014 -0200
#
#
# PowerPC: Change powerpc64le start ABI to 2.17.
#
#
diff -urN glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure
--- glibc-2.17-c758a686/configure 2014-05-26 19:52:31.000000000 -0500
+++ glibc-2.17-c758a686/configure 2014-05-26 19:54:13.000000000 -0500
@ -59,10 +59,10 @@ diff -urN glibc-2.17-c758a686/shlib-versions glibc-2.17-c758a686/shlib-versions @@ -59,10 +59,10 @@ diff -urN glibc-2.17-c758a686/shlib-versions glibc-2.17-c758a686/shlib-versions
--- glibc-2.17-c758a686/shlib-versions 2014-05-26 19:52:31.000000000 -0500
+++ glibc-2.17-c758a686/shlib-versions 2014-05-26 19:53:31.000000000 -0500
@@ -23,6 +23,7 @@

s390x-.*-linux.* DEFAULT GLIBC_2.2
powerpc64-.*-linux.* DEFAULT GLIBC_2.3
+powerpc.*le-.*-linux.* DEFAULT GLIBC_2.17
.*-.*-gnu-gnu.* DEFAULT GLIBC_2.2.6

# Configuration ABI Identifier for ABI data files

32
SOURCES/glibc-ppc64le-35.patch

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
# commit 5162e7dd96efcd9b45c1dc1471a964d45278b1e1
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:41:52 2013 -0600
#
#
# PowerPC64: Fix incorrect CFI in *context routines
#
#
# The context established by "makecontext" has a link register pointing
# back to an error path within the makecontext routine. This is currently
# covered by the CFI FDE for makecontext itself, which is simply wrong
@ -11,42 +11,42 @@ @@ -11,42 +11,42 @@
# doing a backtrace) in a routine inside a context created by makecontext,
# this can lead to uninitialized stack slots being accessed, causing the
# unwinder to crash in the worst case.
#
#
# Similarly, during parts of the "setcontext" routine, when the stack
# pointer has already been switched to point to the new context, the
# address range is still covered by the CFI FDE for setcontext. When
# trying to unwind in that situation (e.g. backtrace from an async
# signal handler for profiling), it is again possible that the unwinder
# crashes.
#
#
# Theses are all problems in existing code, but the changes in stack
# frame layout appear to make the "worst case" much more likely in
# the ELFv2 ABI context. This causes regressions e.g. in the libgo
# testsuite on ELFv2.
#
#
# This patch fixes this by ending the makecontext/setcontext FDEs
# before those problematic parts of the assembler, similar to what
# is already done on other platforms. This fixes the libgo
# regression on ELFv2.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-29 13:16:16.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-29 13:16:17.000000000 -0500
@@ -129,6 +129,10 @@
the cpu link stack used to predict blr return addresses. */
bcl 20,31,L(gotexitcodeaddr);

+ /* End FDE now, because while executing on the context's stack
+ the unwind info would be wrong otherwise. */
+ cfi_endproc
+
/* This is the helper code which gets called if a function which
is registered with 'makecontext' returns. In this case we
have to install the context listed in the uc_link element of
/* This is the helper code which gets called if a function which
is registered with 'makecontext' returns. In this case we
have to install the context listed in the uc_link element of
@@ -157,6 +161,11 @@
#endif
b L(do_exit)

b L(do_exit)
+ /* Re-establish FDE for the rest of the actual makecontext routine. */
+ cfi_startproc
+ cfi_offset (lr, FRAME_LR_SAVE)
@ -61,7 +61,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte @@ -61,7 +61,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte
@@ -129,6 +129,10 @@
lfd fp1,(SIGCONTEXT_FP_REGS+(PT_R1*8))(r31)
lfd fp0,(SIGCONTEXT_FP_REGS+(PT_R0*8))(r31)

+ /* End FDE now, because the unwind info would be wrong while
+ we're reloading registers to switch to the new context. */
+ cfi_endproc
@ -72,7 +72,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte @@ -72,7 +72,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte
@@ -177,6 +181,11 @@
ld r31,(SIGCONTEXT_GP_REGS+(PT_R31*8))(r31)
bctr

+ /* Re-establish FDE for the rest of the actual setcontext routine. */
+ cfi_startproc
+ cfi_offset (lr, FRAME_LR_SAVE)
@ -84,7 +84,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte @@ -84,7 +84,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte
@@ -403,6 +412,10 @@
lfd fp1,(SIGCONTEXT_FP_REGS+(PT_R1*8))(r31)
lfd fp0,(SIGCONTEXT_FP_REGS+(PT_R0*8))(r31)

+ /* End FDE now, because the unwind info would be wrong while
+ we're reloading registers to switch to the new context. */
+ cfi_endproc
@ -95,7 +95,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte @@ -95,7 +95,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/setconte
@@ -451,6 +464,11 @@
ld r31,(SIGCONTEXT_GP_REGS+(PT_R31*8))(r31)
bctr

+ /* Re-establish FDE for the rest of the actual setcontext routine. */
+ cfi_startproc
+ cfi_offset (lr, FRAME_LR_SAVE)

38
SOURCES/glibc-ppc64le-36.patch

@ -1,24 +1,24 @@ @@ -1,24 +1,24 @@
# commit 7ec07d9a7b501f1b7d740fda02ba5f39d6d684e5
# Author: Alan Modra <amodra@gmail.com>
# Date: Wed Dec 4 06:44:06 2013 -0600
#
#
# PowerPC64: Report overflow on @h and @ha relocations
#
#
# This patch updates glibc in accordance with the binutils patch checked in here:
# https://sourceware.org/ml/binutils/2013-10/msg00372.html
#
#
# This changes the various R_PPC64_..._HI and _HA relocations to report
# 32-bit overflows. The motivation is that existing uses of @h / @ha
# are to build up 32-bit offsets (for the "medium model" TOC access
# that GCC now defaults to), and we'd really like to see failures at
# link / load time rather than silent truncations.
#
#
# For those rare cases where a modifier is needed to build up a 64-bit
# constant, new relocations _HIGH / _HIGHA are supported.
#
#
# The patch also fixes a bug in overflow checking for the R_PPC64_ADDR30
# and R_PPC64_ADDR32 relocations.
#
#
diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
--- glibc-2.17-c758a686/elf/elf.h 2014-05-29 13:17:35.000000000 -0500
+++ glibc-2.17-c758a686/elf/elf.h 2014-05-29 13:17:35.000000000 -0500
@ -37,14 +37,14 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h @@ -37,14 +37,14 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
+#define R_PPC64_TPREL16_HIGHA 113
+#define R_PPC64_DTPREL16_HIGH 114
+#define R_PPC64_DTPREL16_HIGHA 115

/* GNU extension to support local ifunc. */
#define R_PPC64_JMP_IREL 247
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 13:17:34.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 13:17:35.000000000 -0500
@@ -663,11 +663,25 @@

case R_PPC64_TPREL16_HI:
value = elf_machine_tprel (map, sym_map, sym, reloc);
+ if (dont_expect (value + 0x80000000 >= 0x100000000LL))
@ -56,7 +56,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -56,7 +56,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ value = elf_machine_tprel (map, sym_map, sym, reloc);
*(Elf64_Half *) reloc_addr = PPC_HI (value);
break;

case R_PPC64_TPREL16_HA:
value = elf_machine_tprel (map, sym_map, sym, reloc);
+ if (dont_expect (value + 0x80008000 >= 0x100000000LL))
@ -68,38 +68,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -68,38 +68,38 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ value = elf_machine_tprel (map, sym_map, sym, reloc);
*(Elf64_Half *) reloc_addr = PPC_HA (value);
break;

@@ -703,17 +717,23 @@
break;

case R_PPC64_ADDR16_HI:
+ if (dont_expect (value + 0x80000000 >= 0x100000000LL))
+ _dl_reloc_overflow (map, "R_PPC64_ADDR16_HI", reloc_addr, refsym);
+ case R_PPC64_ADDR16_HIGH:
*(Elf64_Half *) reloc_addr = PPC_HI (value);
break;

case R_PPC64_ADDR16_HA:
+ if (dont_expect (value + 0x80008000 >= 0x100000000LL))
+ _dl_reloc_overflow (map, "R_PPC64_ADDR16_HA", reloc_addr, refsym);
+ case R_PPC64_ADDR16_HIGHA:
*(Elf64_Half *) reloc_addr = PPC_HA (value);
break;

case R_PPC64_ADDR30:
{
Elf64_Addr delta = value - (Elf64_Xword) reloc_addr;
Elf64_Addr delta = value - (Elf64_Xword) reloc_addr;
- if (dont_expect ((delta + 0x80000000) >= 0x10000000
+ if (dont_expect ((delta + 0x80000000) >= 0x100000000LL
|| (delta & 3) != 0))
_dl_reloc_overflow (map, "R_PPC64_ADDR30", reloc_addr, refsym);
BIT_INSERT (*(Elf64_Word *) reloc_addr, delta, 0xfffffffc);
|| (delta & 3) != 0))
_dl_reloc_overflow (map, "R_PPC64_ADDR30", reloc_addr, refsym);
BIT_INSERT (*(Elf64_Word *) reloc_addr, delta, 0xfffffffc);
@@ -762,7 +782,7 @@
return;

case R_PPC64_ADDR32:
- if (dont_expect ((value + 0x80000000) >= 0x10000000))
+ if (dont_expect ((value + 0x80000000) >= 0x100000000LL))
_dl_reloc_overflow (map, "R_PPC64_ADDR32", reloc_addr, refsym);
_dl_reloc_overflow (map, "R_PPC64_ADDR32", reloc_addr, refsym);
*(Elf64_Word *) reloc_addr = value;
return;

10
SOURCES/glibc-ppc64le-37.patch

@ -1,22 +1,22 @@ @@ -1,22 +1,22 @@
# commit b525166bb93b060e1146f0263b76a9c1e7455b06
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:45:56 2013 -0600
#
#
# PowerPC64: Add __private_ss field to TCB header
#
#
# The TCB header on Intel contains a field __private_ss that is used
# to efficiently implement the -fsplit-stack GCC feature.
#
#
# In order to prepare for a possible future implementation of that
# feature on powerpc64, we'd like to reserve a similar field in
# the TCB header as well. (It would be good if this went in with
# or before the ELFv2 patches to ensure that this field will be
# available always in the ELFv2 environment.)
#
#
# The field needs to be added at the front of tcbhead_t structure
# to avoid changing the ABI; see the recent discussion when adding
# the EBB fields.
#
#
diff -urN glibc-2.17-c758a686/nptl/sysdeps/powerpc/tls.h glibc-2.17-c758a686/nptl/sysdeps/powerpc/tls.h
--- glibc-2.17-c758a686/nptl/sysdeps/powerpc/tls.h 2014-05-29 13:19:25.000000000 -0500
+++ glibc-2.17-c758a686/nptl/sysdeps/powerpc/tls.h 2014-05-29 13:19:25.000000000 -0500

118
SOURCES/glibc-ppc64le-38.patch

@ -1,27 +1,27 @@ @@ -1,27 +1,27 @@
# commit d31beafa8e4ca69faa4cf362784796ef17299341
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:49:15 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 1/6: Code refactoring
#
#
# This is the first patch to support the new ELFv2 ABI in glibc.
#
#
# As preparation, this patch simply refactors some of the powerpc64 assembler
# code to move all code related to creating function descriptors (.opd section)
# or using function descriptors (function pointer call) into a central place
# in sysdep.h.
#
#
# Note that most locations creating .opd entries were already using macros
# in sysdep.h, this patch simply extends this to the remaining places.
#
#
# No relevant change in generated code expected.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 13:56:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 13:56:37.000000000 -0500
@@ -60,18 +60,8 @@
.LC0:
.tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
.tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
#endif
- .type BODY_LABEL (_init), @function
- .globl _init
@ -34,15 +34,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6 @@ -34,15 +34,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6
-#else
- .type _init, @function
-#endif
.section ".init", "ax", @progbits
.section ".init", "ax", @progbits
+ ENTRY_2(_init)
.align ALIGNARG (2)
.align ALIGNARG (2)
BODY_LABEL (_init):
mflr 0
mflr 0
@@ -87,18 +77,8 @@
nop
nop
1:

- .type BODY_LABEL (_fini), @function
- .globl _fini
- .section ".opd", "aw"
@ -54,11 +54,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6 @@ -54,11 +54,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6
-#else
- .type _fini, @function
-#endif
.section ".fini", "ax", @progbits
.section ".fini", "ax", @progbits
+ ENTRY_2(_fini)
.align ALIGNARG (2)
.align ALIGNARG (2)
BODY_LABEL (_fini):
mflr 0
mflr 0
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 13:56:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 13:56:37.000000000 -0500
@ -113,9 +113,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -113,9 +113,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 13:56:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 13:56:37.000000000 -0500
@@ -71,12 +71,8 @@
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
-/* Load the target address, toc and static chain reg from the function
- descriptor returned by fixup. */
- ld r0,0(r3)
@ -124,13 +124,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -124,13 +124,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
- ld r11,16(r3)
+/* Prepare for calling the function returned by fixup. */
+ PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
ld r3,INT_PARMS+0(r1)
/* Unwind the stack frame, and jump. */
addi r1,r1,FRAME_SIZE
addi r1,r1,FRAME_SIZE
@@ -322,13 +318,9 @@
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
-/* Load the target address, toc and static chain reg from the function
- descriptor returned by fixup. */
- ld r0,0(r3)
@ -138,35 +138,35 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -138,35 +138,35 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
- ld r11,16(r3)
+/* Prepare for calling the function returned by fixup. */
+ PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
ld r3,INT_PARMS+0(r1)
- mtctr r0
/* Load the floating point registers. */
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)
@@ -386,14 +378,10 @@
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
-/* Load the target address, toc and static chain reg from the function
- descriptor returned by fixup. */
- ld r0,0(r3)
+/* Prepare for calling the function returned by fixup. */
std r2,40(r1)
std r2,40(r1)
- ld r2,8(r3)
- ld r11,16(r3)
+ PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
ld r3,INT_PARMS+0(r1)
- mtctr r0
/* Load the floating point registers. */
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h 2014-05-29 13:56:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h 2014-05-29 13:56:37.000000000 -0500
@@ -74,6 +74,14 @@
#endif
.endm

.endm
+/* Macro to prepare for calling via a function pointer. */
+ .macro PPC64_LOAD_FUNCPTR PTR
+ ld r12,0(\PTR)
@ -180,32 +180,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -180,32 +180,32 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
#else
@@ -81,7 +89,6 @@
#endif

#define ENTRY_1(name) \
- .section ".text"; \
.type BODY_LABEL(name),@function; \
.globl name; \
.section ".opd","aw"; \
.type BODY_LABEL(name),@function; \
.globl name; \
.section ".opd","aw"; \
@@ -110,6 +117,7 @@
#endif

#define ENTRY(name) \
+ .section ".text"; \
ENTRY_2(name) \
.align ALIGNARG(2); \
ENTRY_2(name) \
.align ALIGNARG(2); \
BODY_LABEL(name): \
@@ -127,6 +135,7 @@
/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes
past a 2^alignt boundary. */
#define EALIGN(name, alignt, words) \
+ .section ".text"; \
ENTRY_2(name) \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
ENTRY_2(name) \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
@@ -286,24 +295,42 @@

#else /* !__ASSEMBLER__ */

+#define PPC64_LOAD_FUNCPTR(ptr) \
+ "ld 12,0(" #ptr ");\n" \
+ "ld 2,8(" #ptr ");\n" \
@ -217,7 +217,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -217,7 +217,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
#else
# define OPD_ENT(name) ".quad " BODY_PREFIX #name ", .TOC.@tocbase, 0;"
#endif

+#define ENTRY_1(name) \
+ ".type " BODY_PREFIX #name ",@function;\n" \
+ ".globl " #name ";\n" \
@ -231,11 +231,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -231,11 +231,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
# define DOT_PREFIX "."
# define BODY_PREFIX "."
# define ENTRY_2(name) \
".globl " BODY_PREFIX #name ";\n" \
".globl " BODY_PREFIX #name ";\n" \
+ ENTRY_1(name) "\n" \
".size " #name ", 24;"
".size " #name ", 24;"
# define END_2(name) \
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
#else
# define DOT_PREFIX ""
# define BODY_PREFIX ".LY"
@ -244,19 +244,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -244,19 +244,19 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+ ".type " #name ",@function;\n" \
+ ENTRY_1(name)
# define END_2(name) \
".size " #name ",.-" BODY_PREFIX #name ";\n" \
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
".size " #name ",.-" BODY_PREFIX #name ";\n" \
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S 2014-05-29 13:56:35.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S 2014-05-29 13:56:37.000000000 -0500
@@ -104,9 +104,7 @@

std r2,40(r1)
/* Call procedure. */
std r2,40(r1)
/* Call procedure. */
- ld r0,0(r30)
- ld r2,8(r30)
- mtctr r0
+ PPC64_LOAD_FUNCPTR r30
mr r3,r31
bctrl
ld r2,40(r1)
mr r3,r31
bctrl
ld r2,40(r1)

214
SOURCES/glibc-ppc64le-39.patch

@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
# commit 696caf1d002ff059ddd20fd5eaccd76229c14850
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:51:11 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 2/6: Remove function descriptors
#
#
# This patch adds support for the ELFv2 ABI feature to remove function
# descriptors. See this GCC patch for in-depth discussion:
# http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html
#
#
# This mostly involves two types of changes: updating assembler source
# files to the new logic, and updating the dynamic loader.
#
#
# After the refactoring in the previous patch, most of the assembler source
# changes can be handled simply by providing ELFv2 versions of the
# macros in sysdep.h. One somewhat non-obvious change is in __GI__setjmp:
@ -18,28 +18,28 @@ @@ -18,28 +18,28 @@
# point. This is no longer safe in the ELFv2 since ENTRY defines both
# a global and a local entry point, and you cannot simply fall through
# to a global entry point as it requires r12 to be set up.
#
#
# Also, makecontext needs to be updated to set up registers according to
# the new ABI for calling into the context's start routine.
#
#
# The dynamic linker changes mostly consist of removing special code
# to handle function descriptors. We also need to support the new PLT
# and glink format used by the the ELFv2 linker, see:
# https://sourceware.org/ml/binutils/2013-10/msg00376.html
#
#
# In addition, the dynamic linker now verifies that the dynamic libraries
# it loads match its own ABI.
#
#
# The hack in VDSO_IFUNC_RET to "synthesize" a function descriptor
# for vDSO routines is also no longer necessary for ELFv2.
#
#
diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
--- glibc-2.17-c758a686/elf/elf.h 2014-05-29 13:58:25.000000000 -0500
+++ glibc-2.17-c758a686/elf/elf.h 2014-05-29 13:58:25.000000000 -0500
@@ -2263,6 +2263,12 @@
#define R_PPC64_REL16_HI 251 /* half16 (sym+add-.)@h */
#define R_PPC64_REL16_HA 252 /* half16 (sym+add-.)@ha */

+/* e_flags bits specifying ABI.
+ 1 for original function descriptor using ABI,
+ 2 for revised ABI without function descriptors,
@ -53,21 +53,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6 @@ -53,21 +53,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a6
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 13:58:25.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 13:58:25.000000000 -0500
@@ -64,6 +64,7 @@
ENTRY_2(_init)
.align ALIGNARG (2)
ENTRY_2(_init)
.align ALIGNARG (2)
BODY_LABEL (_init):
+ LOCALENTRY(_init)
mflr 0
std 0, 16(r1)
stdu r1, -112(r1)
mflr 0
std 0, 16(r1)
stdu r1, -112(r1)
@@ -81,6 +82,7 @@
ENTRY_2(_fini)
.align ALIGNARG (2)
ENTRY_2(_fini)
.align ALIGNARG (2)
BODY_LABEL (_fini):
+ LOCALENTRY(_fini)
mflr 0
std 0, 16(r1)
stdu r1, -112(r1)
mflr 0
std 0, 16(r1)
stdu r1, -112(r1)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-irel.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-irel.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-irel.h 2014-05-29 13:58:25.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-irel.h 2014-05-29 13:58:25.000000000 -0500
@ -89,7 +89,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -89,7 +89,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
@@ -31,6 +31,7 @@
in l_info array. */
#define DT_PPC64(x) (DT_PPC64_##x - DT_LOPROC + DT_NUM)

+#if _CALL_ELF != 2
/* A PowerPC64 function descriptor. The .plt (procedure linkage
table) and .opd (official procedure descriptor) sections are
@ -99,9 +99,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -99,9 +99,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
Elf64_Addr fd_aux;
} Elf64_FuncDesc;
+#endif

#define ELF_MULT_MACHINES_SUPPORTED

@@ -47,6 +49,18 @@
static inline int
elf_machine_matches_host (const Elf64_Ehdr *ehdr)
@ -120,7 +120,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -120,7 +120,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+
return ehdr->e_machine == EM_PPC64;
}

@@ -124,6 +138,7 @@
" .align 2\n" \
" " ENTRY_2(_start) "\n" \
@ -140,7 +140,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -140,7 +140,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
@@ -256,8 +272,22 @@
relocations behave "normally", ie. always use the real address
like PLT relocations. So always set ELF_RTYPE_CLASS_PLT. */

+#if _CALL_ELF != 2
#define elf_machine_type_class(type) \
(ELF_RTYPE_CLASS_PLT | (((type) == R_PPC64_COPY) * ELF_RTYPE_CLASS_COPY))
@ -157,12 +157,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -157,12 +157,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ || IS_PPC64_TLS_RELOC (type)) * ELF_RTYPE_CLASS_PLT) \
+ | (((type) == R_PPC64_COPY) * ELF_RTYPE_CLASS_COPY))
+#endif

/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
#define ELF_MACHINE_JMP_SLOT R_PPC64_JMP_SLOT
@@ -266,8 +296,19 @@
#define ELF_MACHINE_NO_REL 1

/* Stuff for the PLT. */
+#if _CALL_ELF != 2
#define PLT_INITIAL_ENTRY_WORDS 3
@ -177,41 +177,41 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -177,41 +177,41 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+#define GLINK_INITIAL_ENTRY_WORDS 8
+#define GLINK_ENTRY_WORDS(I) 1
+#endif

#define PPC_DCBST(where) asm volatile ("dcbst 0,%0" : : "r"(where) : "memory")
#define PPC_DCBT(where) asm volatile ("dcbt 0,%0" : : "r"(where) : "memory")
@@ -312,17 +353,12 @@

if (lazy)
{
{
- /* The function descriptor of the appropriate trampline
- routine is used to set the 1st and 2nd doubleword of the
- plt_reserve. */
- Elf64_FuncDesc *resolve_fd;
Elf64_Word glink_offset;
Elf64_Word glink_offset;
- /* the plt_reserve area is the 1st 3 doublewords of the PLT */
- Elf64_FuncDesc *plt_reserve = (Elf64_FuncDesc *) plt;
Elf64_Word offset;
Elf64_Word offset;
+ Elf64_Addr dlrr;

- resolve_fd = (Elf64_FuncDesc *) (profile ? _dl_profile_resolve
- : _dl_runtime_resolve);
+ dlrr = (Elf64_Addr) (profile ? _dl_profile_resolve
+ : _dl_runtime_resolve);
if (profile && GLRO(dl_profile) != NULL
&& _dl_name_match_p (GLRO(dl_profile), map))
/* This is the object we are looking for. Say that we really
if (profile && GLRO(dl_profile) != NULL
&& _dl_name_match_p (GLRO(dl_profile), map))
/* This is the object we are looking for. Say that we really
@@ -330,20 +366,33 @@
GL(dl_profile_map) = map;


GL(dl_profile_map) = map;
+#if _CALL_ELF != 2
/* We need to stuff the address/TOC of _dl_runtime_resolve
into doublewords 0 and 1 of plt_reserve. Then we need to
stuff the map address into doubleword 2 of plt_reserve.
This allows the GLINK0 code to transfer control to the
correct trampoline which will transfer control to fixup
in dl-machine.c. */
/* We need to stuff the address/TOC of _dl_runtime_resolve
into doublewords 0 and 1 of plt_reserve. Then we need to
stuff the map address into doubleword 2 of plt_reserve.
This allows the GLINK0 code to transfer control to the
correct trampoline which will transfer control to fixup
in dl-machine.c. */
- plt_reserve->fd_func = resolve_fd->fd_func;
- plt_reserve->fd_toc = resolve_fd->fd_toc;
- plt_reserve->fd_aux = (Elf64_Addr) map;
@ -240,12 +240,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -240,12 +240,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ plt[0] = dlrr;
+ plt[1] = (Elf64_Addr) map;
#endif

/* Set up the lazy PLT entries. */
/* Set up the lazy PLT entries. */
@@ -354,14 +403,8 @@
{

plt[offset] = (Elf64_Xword) &glink[glink_offset];
{
plt[offset] = (Elf64_Xword) &glink[glink_offset];
- offset += 3;
- /* The first 32k entries of glink can set an index and
- branch using two instructions; Past that point,
@ -256,12 +256,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -256,12 +256,12 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
- glink_offset += 3;
+ offset += PLT_ENTRY_WORDS;
+ glink_offset += GLINK_ENTRY_WORDS (i);
}

/* Now, we've modified data. We need to write the changes from
}
/* Now, we've modified data. We need to write the changes from
@@ -389,6 +432,7 @@
const Elf64_Rela *reloc,
Elf64_Addr *reloc_addr, Elf64_Addr finaladdr)
const Elf64_Rela *reloc,
Elf64_Addr *reloc_addr, Elf64_Addr finaladdr)
{
+#if _CALL_ELF != 2
Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr;
@ -274,7 +274,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -274,7 +274,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+#else
+ *reloc_addr = finaladdr;
+#endif

return finaladdr;
}
@@ -433,6 +480,7 @@
@ -284,7 +284,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -284,7 +284,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+#if _CALL_ELF != 2
Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr;
Elf64_FuncDesc *rel = (Elf64_FuncDesc *) finaladdr;

@@ -443,6 +491,9 @@
PPC_DCBST (&plt->fd_aux);
PPC_DCBST (&plt->fd_toc);
@ -293,11 +293,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -293,11 +293,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ *reloc_addr = finaladdr;
+#endif
}

/* Return the final value of a plt relocation. */
@@ -512,6 +563,7 @@
resolve_ifunc (Elf64_Addr value,
const struct link_map *map, const struct link_map *sym_map)
const struct link_map *map, const struct link_map *sym_map)
{
+#if _CALL_ELF != 2
#ifndef RESOLVE_CONFLICT_FIND_MAP
@ -310,7 +310,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -310,7 +310,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+#endif
return ((Elf64_Addr (*) (unsigned long int)) value) (GLRO(dl_hwcap));
}

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-29 13:58:25.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-29 14:00:27.000000000 -0500
@ -320,7 +320,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2. @@ -320,7 +320,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.
HAVE_CLEANUP_JMP_BUF is defined. */
-ENTRY (BP_SYM (__GI__setjmp))
+ENTRY (__GI__setjmp)
std r2,40(r1) /* Save the callers TOC in the save area. */
std r2,40(r1) /* Save the callers TOC in the save area. */
- cfi_endproc
-END_2 (BP_SYM (__GI__setjmp))
-/* Fall thru. */
@ -329,40 +329,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2. @@ -329,40 +329,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.
+ b JUMPTARGET (GLUE(__sigsetjmp,_ent))
+END (__GI__setjmp)
#endif

-ENTRY (BP_SYM (_setjmp))
+ENTRY (_setjmp)
CALL_MCOUNT 1
li r4,0 /* Set second argument to 0. */
b JUMPTARGET (GLUE(__sigsetjmp,_ent))
CALL_MCOUNT 1
li r4,0 /* Set second argument to 0. */
b JUMPTARGET (GLUE(__sigsetjmp,_ent))
-END (BP_SYM (_setjmp))
+END (_setjmp)
libc_hidden_def (_setjmp)

-ENTRY (BP_SYM (__sigsetjmp))
+ENTRY (__sigsetjmp)
CALL_MCOUNT 2
CALL_MCOUNT 2
JUMPTARGET(GLUE(__sigsetjmp,_ent)):
CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
@@ -215,18 +216,18 @@
li r3,0
blr
li r3,0
blr
#elif defined SHARED
- b JUMPTARGET (BP_SYM (__sigjmp_save))
+ b JUMPTARGET (__sigjmp_save)
#else
mflr r0
std r0,16(r1)
stdu r1,-112(r1)
cfi_adjust_cfa_offset(112)
cfi_offset(lr,16)
mflr r0
std r0,16(r1)
stdu r1,-112(r1)
cfi_adjust_cfa_offset(112)
cfi_offset(lr,16)
- bl JUMPTARGET (BP_SYM (__sigjmp_save))
+ bl JUMPTARGET (__sigjmp_save)
nop
ld r0,112+16(r1)
addi r1,r1,112
mtlr r0
blr
nop
ld r0,112+16(r1)
addi r1,r1,112
mtlr r0
blr
#endif
-END (BP_SYM (__sigsetjmp))
+END (__sigsetjmp)
@ -371,16 +371,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -371,16 +371,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h 2014-05-29 13:58:25.000000000 -0500
@@ -74,6 +74,8 @@
#endif
.endm

.endm
+#if _CALL_ELF != 2
+
/* Macro to prepare for calling via a function pointer. */
.macro PPC64_LOAD_FUNCPTR PTR
ld r12,0(\PTR)
.macro PPC64_LOAD_FUNCPTR PTR
ld r12,0(\PTR)
@@ -115,13 +117,37 @@
.size name,.-BODY_LABEL(name); \
.size BODY_LABEL(name),.-BODY_LABEL(name);
.size name,.-BODY_LABEL(name); \
.size BODY_LABEL(name),.-BODY_LABEL(name);
#endif
+#define LOCALENTRY(name)
+
@ -405,40 +405,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -405,40 +405,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+ .localentry name,.-name;
+
+#endif /* _CALL_ELF */

#define ENTRY(name) \
.section ".text"; \
ENTRY_2(name) \
.align ALIGNARG(2); \
.section ".text"; \
ENTRY_2(name) \
.align ALIGNARG(2); \
BODY_LABEL(name): \
- cfi_startproc;
+ cfi_startproc; \
+ LOCALENTRY(name)

#define EALIGN_W_0 /* No words to insert. */
#define EALIGN_W_1 nop
@@ -140,7 +166,8 @@
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
.align ALIGNARG(alignt); \
EALIGN_W_##words; \
BODY_LABEL(name): \
- cfi_startproc;
+ cfi_startproc; \
+ LOCALENTRY(name)

/* Local labels stripped out by the linker. */
#undef L
@@ -295,6 +322,8 @@

#else /* !__ASSEMBLER__ */

+#if _CALL_ELF != 2
+
#define PPC64_LOAD_FUNCPTR(ptr) \
"ld 12,0(" #ptr ");\n" \
"ld 2,8(" #ptr ");\n" \
"ld 12,0(" #ptr ");\n" \
"ld 2,8(" #ptr ");\n" \
@@ -335,5 +364,26 @@
".size " #name ",.-" BODY_PREFIX #name ";\n" \
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
".size " #name ",.-" BODY_PREFIX #name ";\n" \
".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
#endif
+#define LOCALENTRY(name)
+
@ -461,15 +461,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -461,15 +461,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+ ".localentry " #name ",.-" #name ";"
+
+#endif /* _CALL_ELF */

#endif /* __ASSEMBLER__ */
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h 2014-05-29 13:58:24.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h 2014-05-29 13:58:25.000000000 -0500
@@ -23,6 +23,8 @@

/* Now define our stuff. */

+#if _CALL_ELF != 2
+
static __always_inline bool
@ -478,7 +478,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs @@ -478,7 +478,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs
@@ -73,4 +75,6 @@
#define DL_ADDR_SYM_MATCH(L, SYM, MATCHSYM, ADDR) \
_dl_ppc64_addr_sym_match (L, SYM, MATCHSYM, ADDR)

+#endif
+
#endif /* ldsodefs.h */
@ -486,9 +486,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont @@ -486,9 +486,9 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-29 13:58:24.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S 2014-05-29 13:58:25.000000000 -0500
@@ -111,6 +111,7 @@

L(noparms):

+#if _CALL_ELF != 2
/* Load the function address and TOC from the function descriptor
and store them in the ucontext as NIP and r2. Store the 3rd
@ -503,6 +503,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont @@ -503,6 +503,6 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecont
+ std r4,(SIGCONTEXT_GP_REGS+(PT_NIP*8))(r3)
+ std r4,(SIGCONTEXT_GP_REGS+(PT_R12*8))(r3)
+#endif

/* If the target function returns we need to do some cleanup. We use a
code trick to get the address of our cleanup function into the link

40
SOURCES/glibc-ppc64le-40.patch

@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
# commit 122b66defdb9e4ded3ccc5c2b290f0520c6fa3cd
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:52:40 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimization
#
#
# This is a follow-on to the previous patch to support the ELFv2 ABI in the
# dynamic loader, split off into its own patch since it is just an optional
# optimization.
#
#
# In the ELFv2 ABI, most functions define both a global and a local entry
# point; the local entry requires r2 to be already set up by the caller
# to point to the callee's TOC; while the global entry does not require
# the caller to know about the callee's TOC, but it needs to set up r12
# to the callee's entry point address.
#
#
# Now, when setting up a PLT slot, the dynamic linker will usually need
# to enter the target function's global entry point. However, if the
# linker can prove that the target function is in the same DSO as the
@ -21,12 +21,12 @@ @@ -21,12 +21,12 @@
# linker will let ld.so know via a DT_PPC64_OPT entry), then it is
# possible to actually enter the local entry point address into the
# PLT slot, for a slight improvement in performance.
#
#
# Note that this uncovered a problem on the first call via _dl_runtime_resolve,
# because that routine neglected to restore the caller's TOC before calling
# the target function for the first time, since it assumed that function
# would always reload its own TOC anyway ...
#
#
diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
--- glibc-2.17-c758a686/elf/elf.h 2014-05-29 14:08:44.000000000 -0500
+++ glibc-2.17-c758a686/elf/elf.h 2014-05-29 14:08:44.000000000 -0500
@ -36,7 +36,7 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h @@ -36,7 +36,7 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
+#define DT_PPC64_OPT (DT_LOPROC + 3)
#define DT_PPC64_NUM 3

+/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */
+#define PPC64_OPT_TLS 1
+#define PPC64_OPT_MULTI_TOC 2
@ -47,16 +47,16 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h @@ -47,16 +47,16 @@ diff -urN glibc-2.17-c758a686/elf/elf.h glibc-2.17-c758a686/elf/elf.h
+#define PPC64_LOCAL_ENTRY_OFFSET(other) \
+ (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
+

/* ARM specific declarations */

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 14:08:40.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 14:08:44.000000000 -0500
@@ -425,6 +425,42 @@
return lazy;
}

+#if _CALL_ELF == 2
+/* If the PLT entry whose reloc is 'reloc' resolves to a function in
+ the same object, return the target function's local entry point
@ -103,10 +103,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -103,10 +103,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+ finaladdr += ppc64_local_entry_offset (map, sym_map, reloc);
*reloc_addr = finaladdr;
#endif

@@ -478,7 +515,9 @@
}

static inline void __attribute__ ((always_inline))
-elf_machine_plt_conflict (Elf64_Addr *reloc_addr, Elf64_Addr finaladdr)
+elf_machine_plt_conflict (struct link_map *map, lookup_t sym_map,
@ -137,23 +137,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -137,23 +137,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 14:08:44.000000000 -0500
@@ -74,6 +74,10 @@
/* Prepare for calling the function returned by fixup. */
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
+#if _CALL_ELF == 2
+/* Restore the caller's TOC in case we jump to a local entry point. */
+ ld r2,FRAME_SIZE+40(r1)
+#endif
/* Unwind the stack frame, and jump. */
addi r1,r1,FRAME_SIZE
bctr
addi r1,r1,FRAME_SIZE
bctr
@@ -321,6 +325,10 @@
/* Prepare for calling the function returned by fixup. */
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
+#if _CALL_ELF == 2
+/* Restore the caller's TOC in case we jump to a local entry point. */
+ ld r2,FRAME_SIZE+40(r1)
+#endif
/* Load the floating point registers. */
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)
lfd fp1,FPR_PARMS+0(r1)
lfd fp2,FPR_PARMS+8(r1)

438
SOURCES/glibc-ppc64le-41.patch

@ -1,31 +1,31 @@ @@ -1,31 +1,31 @@
# commit 8b8a692cfd7d80f1ee7c8b9ab356a259367dd187
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:55:03 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 4/6: Stack frame layout changes
#
#
# This updates glibc for the changes in the ELFv2 relating to the
# stack frame layout. These are described in more detail here:
# http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01149.html
# http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01146.html
#
#
# Specifically, the "compiler and linker doublewords" were removed,
# which has the effect that the save slot for the TOC register is
# now at offset 24 rather than 40 to the stack pointer.
#
#
# In addition, a function may now no longer necessarily assume that
# its caller has set up a 64-byte register save area its use.
#
#
# To address the first change, the patch goes through all assembler
# files and replaces immediate offsets in instructions accessing the
# ABI-defined stack slots by symbolic offsets. Those already were
# defined in ucontext_i.sym and used in some of the context routines,
# but that doesn't really seem like the right place for those defines.
#
#
# The patch instead defines those symbolic offsets in sysdeps.h,
# in two variants for the old and new ABI, and uses them systematically
# in all assembler files, not just the context routines.
#
#
# The second change only affected a few assembler files that used
# the save area to temporarily store some registers. In those
# cases where this happens within a leaf function, this patch
@ -33,14 +33,14 @@ @@ -33,14 +33,14 @@
# below the stack pointer. Otherwise, the functions already allocate
# a stack frame, and the patch changes them to add extra space in
# these frames as temporary space for the ELFv2 ABI.
#
#
diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
--- glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h 2014-05-29 14:10:00.000000000 -0500
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h 2014-05-29 14:10:00.000000000 -0500
@@ -31,6 +31,14 @@
# define DASHDASHPFX(str) __##str
# endif

+#if _CALL_ELF == 2
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16+48)
+#define CANCEL_PARM_SAVE (FRAME_MIN_SIZE+16)
@ -95,81 +95,81 @@ diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sys @@ -95,81 +95,81 @@ diff -urN glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sys
+ cfi_adjust_cfa_offset (-CANCEL_FRAMESIZE); \
cfi_restore (lr); \
cfi_restore (cr)

# define DOCARGS_0
# define UNDOCARGS_0

-# define DOCARGS_1 std 3,128+48(1); DOCARGS_0
-# define UNDOCARGS_1 ld 3,128+48(1); UNDOCARGS_0
+# define DOCARGS_1 std 3,CANCEL_PARM_SAVE(1); DOCARGS_0
+# define UNDOCARGS_1 ld 3,CANCEL_PARM_SAVE(1); UNDOCARGS_0

-# define DOCARGS_2 std 4,128+56(1); DOCARGS_1
-# define UNDOCARGS_2 ld 4,128+56(1); UNDOCARGS_1
+# define DOCARGS_2 std 4,CANCEL_PARM_SAVE+8(1); DOCARGS_1
+# define UNDOCARGS_2 ld 4,CANCEL_PARM_SAVE+8(1); UNDOCARGS_1

-# define DOCARGS_3 std 5,128+64(1); DOCARGS_2
-# define UNDOCARGS_3 ld 5,128+64(1); UNDOCARGS_2
+# define DOCARGS_3 std 5,CANCEL_PARM_SAVE+16(1); DOCARGS_2
+# define UNDOCARGS_3 ld 5,CANCEL_PARM_SAVE+16(1); UNDOCARGS_2

-# define DOCARGS_4 std 6,128+72(1); DOCARGS_3
-# define UNDOCARGS_4 ld 6,128+72(1); UNDOCARGS_3
+# define DOCARGS_4 std 6,CANCEL_PARM_SAVE+24(1); DOCARGS_3
+# define UNDOCARGS_4 ld 6,CANCEL_PARM_SAVE+24(1); UNDOCARGS_3

-# define DOCARGS_5 std 7,128+80(1); DOCARGS_4
-# define UNDOCARGS_5 ld 7,128+80(1); UNDOCARGS_4
+# define DOCARGS_5 std 7,CANCEL_PARM_SAVE+32(1); DOCARGS_4
+# define UNDOCARGS_5 ld 7,CANCEL_PARM_SAVE+32(1); UNDOCARGS_4

-# define DOCARGS_6 std 8,128+88(1); DOCARGS_5
-# define UNDOCARGS_6 ld 8,128+88(1); UNDOCARGS_5
+# define DOCARGS_6 std 8,CANCEL_PARM_SAVE+40(1); DOCARGS_5
+# define UNDOCARGS_6 ld 8,CANCEL_PARM_SAVE+40(1); UNDOCARGS_5

# ifdef IS_IN_libpthread
# ifdef SHARED
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/__longjmp-common.S 2014-05-29 14:10:00.000000000 -0500
@@ -133,7 +133,7 @@
ld r14,((JB_GPRS+0)*8)(r3)
lfd fp14,((JB_FPRS+0)*8)(r3)
ld r14,((JB_GPRS+0)*8)(r3)
lfd fp14,((JB_FPRS+0)*8)(r3)
#if defined SHARED && !defined IS_IN_rtld
- std r2,40(r1) /* Restore the callers TOC save area. */
+ std r2,FRAME_TOC_SAVE(r1) /* Restore the callers TOC save area. */
#endif
ld r15,((JB_GPRS+1)*8)(r3)
lfd fp15,((JB_FPRS+1)*8)(r3)
ld r15,((JB_GPRS+1)*8)(r3)
lfd fp15,((JB_FPRS+1)*8)(r3)
@@ -151,7 +151,7 @@
PTR_DEMANGLE2 (r0, r25)
PTR_DEMANGLE2 (r0, r25)
#endif
mtlr r0
mtlr r0
-/* std r2,40(r1) Restore the TOC save area. */
+/* std r2,FRAME_TOC_SAVE(r1) Restore the TOC save area. */
ld r21,((JB_GPRS+7)*8)(r3)
lfd fp21,((JB_FPRS+7)*8)(r3)
ld r22,((JB_GPRS+8)*8)(r3)
ld r21,((JB_GPRS+7)*8)(r3)
lfd fp21,((JB_FPRS+7)*8)(r3)
ld r22,((JB_GPRS+8)*8)(r3)
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crti.S 2014-05-29 14:10:00.000000000 -0500
@@ -66,8 +66,8 @@
BODY_LABEL (_init):
LOCALENTRY(_init)
mflr 0
LOCALENTRY(_init)
mflr 0
- std 0, 16(r1)
- stdu r1, -112(r1)
+ std 0, FRAME_LR_SAVE(r1)
+ stdu r1, -FRAME_MIN_SIZE_PARM(r1)
#if PREINIT_FUNCTION_WEAK
addis r9, r2, .LC0@toc@ha
ld r0, .LC0@toc@l(r9)
addis r9, r2, .LC0@toc@ha
ld r0, .LC0@toc@l(r9)
@@ -84,5 +84,5 @@
BODY_LABEL (_fini):
LOCALENTRY(_fini)
mflr 0
LOCALENTRY(_fini)
mflr 0
- std 0, 16(r1)
- stdu r1, -112(r1)
+ std 0, FRAME_LR_SAVE(r1)
@ -179,29 +179,29 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S glibc-2.17-c758a6 @@ -179,29 +179,29 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S glibc-2.17-c758a6
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/crtn.S 2014-05-29 14:10:00.000000000 -0500
@@ -39,13 +39,13 @@
#include <sysdep.h>

.section .init,"ax",@progbits
.section .init,"ax",@progbits
- addi r1, r1, 112
- ld r0, 16(r1)
+ addi r1, r1, FRAME_MIN_SIZE_PARM
+ ld r0, FRAME_LR_SAVE(r1)
mtlr r0
blr

.section .fini,"ax",@progbits
mtlr r0
blr
.section .fini,"ax",@progbits
- addi r1, r1, 112
- ld r0, 16(r1)
+ addi r1, r1, FRAME_MIN_SIZE_PARM
+ ld r0, FRAME_LR_SAVE(r1)
mtlr r0
blr
mtlr r0
blr
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 14:10:00.000000000 -0500
@@ -26,13 +26,13 @@
parm1 (r3) and the index (r0) need to be converted to an offset
(index * 24) in parm2 (r4). */

-#define FRAME_SIZE 176
+#define FRAME_SIZE (FRAME_MIN_SIZE+64)
/* We need to save the registers used to pass parameters, ie. r3 thru
@ -212,60 +212,60 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -212,60 +212,60 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
-#define INT_PARMS 112
+#define INT_PARMS FRAME_MIN_SIZE
EALIGN(_dl_runtime_resolve, 4, 0)
stdu r1,-FRAME_SIZE(r1)
cfi_adjust_cfa_offset (FRAME_SIZE)
stdu r1,-FRAME_SIZE(r1)
cfi_adjust_cfa_offset (FRAME_SIZE)
@@ -48,25 +48,25 @@
mflr r0
std r8,INT_PARMS+40(r1)
mflr r0
std r8,INT_PARMS+40(r1)
/* Store the LR in the LR Save area. */
- std r0,FRAME_SIZE+16(r1)
- cfi_offset (lr, 16)
+ std r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
+ cfi_offset (lr, FRAME_LR_SAVE)
mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
/* I'm almost certain we don't have to save cr... be safe. */
- std r0,FRAME_SIZE+8(r1)
+ std r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
bl JUMPTARGET(_dl_fixup)
bl JUMPTARGET(_dl_fixup)
#ifndef SHARED
nop
nop
#endif
/* Put the registers back. */
- ld r0,FRAME_SIZE+16(r1)
+ ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+8(r1)
+ ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
@@ -76,7 +76,7 @@
ld r3,INT_PARMS+0(r1)
ld r3,INT_PARMS+0(r1)
#if _CALL_ELF == 2
/* Restore the caller's TOC in case we jump to a local entry point. */
- ld r2,FRAME_SIZE+40(r1)
+ ld r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
#endif
/* Unwind the stack frame, and jump. */
addi r1,r1,FRAME_SIZE
addi r1,r1,FRAME_SIZE
@@ -86,6 +86,7 @@
#undef INT_PARMS

/* Stack layout:
/* Stack layout:
+ (Note: some of these are not required for the ELFv2 ABI.)
+592 previous backchain
+584 spill_r31
+576 spill_r30
+592 previous backchain
+584 spill_r31
+576 spill_r30
@@ -147,10 +148,11 @@
+64 parm3
+56 parm2
+48 parm1
+64 parm3
+56 parm2
+48 parm1
- * Parameter save area, Allocated by the call, at least 8 double words
- +40 TOC save area
- +32 Reserved for linker
@ -275,101 +275,101 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -275,101 +275,101 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ +40 v1 ABI: TOC save area
+ +32 v1 ABI: Reserved for linker
+ +24 v1 ABI: Reserved for compiler / v2 ABI: TOC save area
+16 LR save area
+8 CR save area
r1+0 stack back chain
+16 LR save area
+8 CR save area
r1+0 stack back chain
@@ -206,15 +208,15 @@
/* Store the LR in the LR Save area of the previous frame. */
/* XXX Do we have to do this? */
la r8,FRAME_SIZE(r1)
la r8,FRAME_SIZE(r1)
- std r5,FRAME_SIZE+16(r1)
- cfi_offset (lr, 16)
+ std r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
+ cfi_offset (lr, FRAME_LR_SAVE)
std r5,CALLING_LR(r1)
mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
std r8,CALLING_SP(r1)
std r5,CALLING_LR(r1)
mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
std r8,CALLING_SP(r1)
/* I'm almost certain we don't have to save cr... be safe. */
- std r0,FRAME_SIZE+8(r1)
+ std r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r12,.LC__dl_hwcap@toc(r2)
ld r12,.LC__dl_hwcap@toc(r2)
#ifdef SHARED
/* Load _rtld_local_ro._dl_hwcap. */
/* Load _rtld_local_ro._dl_hwcap. */
@@ -311,13 +313,13 @@
lvx v12,r11,r10
lvx v13,r11,r9
lvx v12,r11,r10
lvx v13,r11,r9
L(restoreFXR):
- ld r0,FRAME_SIZE+16(r1)
+ ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+8(r1)
+ ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
@@ -327,7 +329,7 @@
ld r3,INT_PARMS+0(r1)
ld r3,INT_PARMS+0(r1)
#if _CALL_ELF == 2
/* Restore the caller's TOC in case we jump to a local entry point. */
- ld r2,FRAME_SIZE+40(r1)
+ ld r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
#endif
/* Load the floating point registers. */
lfd fp1,FPR_PARMS+0(r1)
lfd fp1,FPR_PARMS+0(r1)
@@ -375,19 +377,19 @@
lvx v12,r11,r10
lvx v13,r11,r9
lvx v12,r11,r10
lvx v13,r11,r9
L(restoreFXR2):
- ld r0,FRAME_SIZE+16(r1)
+ ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r10,INT_PARMS+56(r1)
ld r9,INT_PARMS+48(r1)
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+8(r1)
+ ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
mtcrf 0xFF,r0
/* Prepare for calling the function returned by fixup. */
- std r2,40(r1)
+ std r2,FRAME_TOC_SAVE(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
/* Load the floating point registers. */
@@ -406,7 +408,7 @@
lfd fp13,FPR_PARMS+96(r1)
lfd fp13,FPR_PARMS+96(r1)
/* Call the target function. */
bctrl
bctrl
- ld r2,40(r1)
+ ld r2,FRAME_TOC_SAVE(r1)
lwz r12,VR_VRSAVE(r1)
lwz r12,VR_VRSAVE(r1)
/* But return here and store the return values. */
std r3,INT_RTN(r1)
std r3,INT_RTN(r1)
@@ -441,7 +443,7 @@
beq L(pltexitreturn)
lvx v2,0,r10
beq L(pltexitreturn)
lvx v2,0,r10
L(pltexitreturn):
- ld r0,FRAME_SIZE+16(r1)
+ ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ld r31,584(r1)
ld r30,576(r1)
mtlr r0
ld r31,584(r1)
ld r30,576(r1)
mtlr r0
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S 2014-05-29 14:10:00.000000000 -0500
@@ -24,16 +24,16 @@
ENTRY(_mcount)
mflr r4
ld r11, 0(r1)
mflr r4
ld r11, 0(r1)
- stdu r1,-112(r1)
- cfi_adjust_cfa_offset (112)
- std r4, 128(r1)
@ -380,16 +380,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S glibc-2.17- @@ -380,16 +380,16 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/ppc-mcount.S glibc-2.17-
+ std r4, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
+ cfi_offset (lr, FRAME_LR_SAVE)
+ ld r3, FRAME_LR_SAVE(r11)
bl JUMPTARGET(__mcount_internal)
nop
bl JUMPTARGET(__mcount_internal)
nop
- ld r0, 128(r1)
+ ld r0, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
mtlr r0
mtlr r0
- addi r1,r1,112
+ addi r1,r1,FRAME_MIN_SIZE
blr
blr
END(_mcount)

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S 2014-05-29 14:10:00.000000000 -0500
@ -399,22 +399,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2. @@ -399,22 +399,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.
ENTRY (__GI__setjmp)
- std r2,40(r1) /* Save the callers TOC in the save area. */
+ std r2,FRAME_TOC_SAVE(r1) /* Save the callers TOC in the save area. */
CALL_MCOUNT 1
li r4,0 /* Set second argument to 0. */
b JUMPTARGET (GLUE(__sigsetjmp,_ent))
CALL_MCOUNT 1
li r4,0 /* Set second argument to 0. */
b JUMPTARGET (GLUE(__sigsetjmp,_ent))
@@ -83,7 +83,7 @@
#endif
mflr r0
mflr r0
#if defined SHARED && !defined IS_IN_rtld
- ld r5,40(r1) /* Retrieve the callers TOC. */
+ ld r5,FRAME_TOC_SAVE(r1) /* Retrieve the callers TOC. */
std r5,(JB_GPR2*8)(3)
std r5,(JB_GPR2*8)(3)
#else
std r2,(JB_GPR2*8)(3)
std r2,(JB_GPR2*8)(3)
@@ -219,14 +219,14 @@
b JUMPTARGET (__sigjmp_save)
b JUMPTARGET (__sigjmp_save)
#else
mflr r0
mflr r0
- std r0,16(r1)
- stdu r1,-112(r1)
- cfi_adjust_cfa_offset(112)
@ -423,22 +423,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2. @@ -423,22 +423,22 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/setjmp-common.S glibc-2.
+ stdu r1,-FRAME_MIN_SIZE(r1)
+ cfi_adjust_cfa_offset(FRAME_MIN_SIZE)
+ cfi_offset(lr,FRAME_LR_SAVE)
bl JUMPTARGET (__sigjmp_save)
nop
bl JUMPTARGET (__sigjmp_save)
nop
- ld r0,112+16(r1)
- addi r1,r1,112
+ ld r0,FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
+ addi r1,r1,FRAME_MIN_SIZE
mtlr r0
blr
mtlr r0
blr
#endif
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h 2014-05-29 14:10:00.000000000 -0500
@@ -20,25 +20,67 @@

#ifdef __ASSEMBLER__

+/* Stack frame offsets. */
+#if _CALL_ELF != 2
+#define FRAME_MIN_SIZE 112
@ -482,34 +482,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -482,34 +482,34 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+#else
+#define call_mcount_parm_offset FRAME_PARM_SAVE
+#endif
.macro SAVE_ARG NARG
.if \NARG
SAVE_ARG \NARG-1
.macro SAVE_ARG NARG
.if \NARG
SAVE_ARG \NARG-1
- std 2+\NARG,40+8*(\NARG)(1)
+ std 2+\NARG,call_mcount_parm_offset-8+8*(\NARG)(1)
.endif
.endm

.macro REST_ARG NARG
.if \NARG
REST_ARG \NARG-1
.endif
.endm
.macro REST_ARG NARG
.if \NARG
REST_ARG \NARG-1
- ld 2+\NARG,112+40+8*(\NARG)(1)
+ ld 2+\NARG,FRAME_MIN_SIZE_PARM+call_mcount_parm_offset-8+8*(\NARG)(1)
.endif
.endm

.macro CFI_SAVE_ARG NARG
.if \NARG
CFI_SAVE_ARG \NARG-1
.endif
.endm
.macro CFI_SAVE_ARG NARG
.if \NARG
CFI_SAVE_ARG \NARG-1
- cfi_offset(2+\NARG,40+8*(\NARG))
+ cfi_offset(2+\NARG,call_mcount_parm_offset-8+8*(\NARG))
.endif
.endm

.endif
.endm
@@ -55,20 +97,20 @@
#ifdef PROF
mflr r0
SAVE_ARG \NARG
mflr r0
SAVE_ARG \NARG
- std r0,16(r1)
- stdu r1,-112(r1)
- cfi_adjust_cfa_offset(112)
@ -518,21 +518,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758 @@ -518,21 +518,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/sysdep.h glibc-2.17-c758
+ stdu r1,-FRAME_MIN_SIZE_PARM(r1)
+ cfi_adjust_cfa_offset(FRAME_MIN_SIZE_PARM)
+ cfi_offset(lr,FRAME_LR_SAVE)
CFI_SAVE_ARG \NARG
bl JUMPTARGET (_mcount)
CFI_SAVE_ARG \NARG
bl JUMPTARGET (_mcount)
#ifndef SHARED
nop
nop
#endif
- ld r0,128(r1)
+ ld r0,FRAME_MIN_SIZE_PARM+FRAME_LR_SAVE(r1)
REST_ARG \NARG
mtlr r0
REST_ARG \NARG
mtlr r0
- addi r1,r1,112
- cfi_adjust_cfa_offset(-112)
+ addi r1,r1,FRAME_MIN_SIZE_PARM
+ cfi_adjust_cfa_offset(-FRAME_MIN_SIZE_PARM)
cfi_restore(lr)
CFI_REST_ARG \NARG
cfi_restore(lr)
CFI_REST_ARG \NARG
#endif
@@ -267,15 +309,15 @@
.else; \
@ -561,60 +561,60 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____long @@ -561,60 +561,60 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____long
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S 2014-05-29 14:10:00.000000000 -0500
@@ -33,24 +33,24 @@
cmpld reg, r1; \
bge+ .Lok; \
mflr r0; \
cmpld reg, r1; \
bge+ .Lok; \
mflr r0; \
- std r0,16(r1); \
+ std r0,FRAME_LR_SAVE(r1); \
mr r31,r3; \
mr r30,r4; \
mr r31,r3; \
mr r30,r4; \
- stdu r1,-144(r1); \
+ stdu r1,-FRAME_MIN_SIZE-32(r1); \
cfi_remember_state; \
cfi_remember_state; \
- cfi_adjust_cfa_offset (144); \
- cfi_offset (lr, 16); \
+ cfi_adjust_cfa_offset (FRAME_MIN_SIZE+32); \
+ cfi_offset (lr, FRAME_LR_SAVE); \
li r3,0; \
li r3,0; \
- addi r4,r1,112; \
+ addi r4,r1,FRAME_MIN_SIZE; \
li r0,__NR_sigaltstack; \
sc; \
/* Without working sigaltstack we cannot perform the test. */ \
bso .Lok2; \
li r0,__NR_sigaltstack; \
sc; \
/* Without working sigaltstack we cannot perform the test. */ \
bso .Lok2; \
- lwz r0,112+8(r1); \
+ lwz r0,FRAME_MIN_SIZE+8(r1); \
andi. r4,r0,1; \
beq .Lfail; \
andi. r4,r0,1; \
beq .Lfail; \
- ld r0,112+16(r1); \
- ld r4,112(r1); \
+ ld r0,FRAME_MIN_SIZE+16(r1); \
+ ld r4,FRAME_MIN_SIZE(r1); \
add r4,r4,r0; \
sub r3,r3,reg; \
cmpld r3,r0; \
add r4,r4,r0; \
sub r3,r3,reg; \
cmpld r3,r0; \
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S 2014-05-29 14:10:00.000000000 -0500
@@ -31,9 +31,9 @@
CALL_MCOUNT 1
DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em. */

CALL_MCOUNT 1
DISCARD_BOUNDS (r3) /* the bounds are meaningless, so toss 'em. */
- std r3,48(r1)
+ std r3,-8(r1)
DO_CALL(SYS_ify(brk))
DO_CALL(SYS_ify(brk))
- ld r6,48(r1)
+ ld r6,-8(r1)
ld r5,.LC__curbrk@toc(r2)
std r3,0(r5)
cmpld r6,r3
ld r5,.LC__curbrk@toc(r2)
std r3,0(r5)
cmpld r6,r3
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S 2014-05-29 14:10:00.000000000 -0500
@@ -45,22 +45,22 @@
cror cr0*4+eq,cr1*4+eq,cr0*4+eq
beq- cr0,L(badargs)

cror cr0*4+eq,cr1*4+eq,cr0*4+eq
beq- cr0,L(badargs)
- /* Save some regs in parm save area. */
+ /* Save some regs in the "red zone". */
#ifdef RESET_PID
@ -633,33 +633,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S @@ -633,33 +633,33 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
- cfi_offset(r31,64)
+ cfi_offset(r30,-16)
+ cfi_offset(r31,-8)

/* Set up stack frame for child. */
clrrdi r4,r4,4
li r0,0
/* Set up stack frame for child. */
clrrdi r4,r4,4
li r0,0
- stdu r0,-112(r4) /* min stack frame is 112 bytes per ABI */
+ stdu r0,-FRAME_MIN_SIZE_PARM(r4)

/* Save fn, args, stack across syscall. */
mr r30,r3 /* Function in r30. */
/* Save fn, args, stack across syscall. */
mr r30,r3 /* Function in r30. */
@@ -102,12 +102,12 @@
L(oldpid):
#endif

- std r2,40(r1)
+ std r2,FRAME_TOC_SAVE(r1)
/* Call procedure. */
PPC64_LOAD_FUNCPTR r30
mr r3,r31
bctrl
/* Call procedure. */
PPC64_LOAD_FUNCPTR r30
mr r3,r31
bctrl
- ld r2,40(r1)
+ ld r2,FRAME_TOC_SAVE(r1)
/* Call _exit with result from procedure. */
/* Call _exit with result from procedure. */
#ifdef SHARED
b JUMPTARGET(__GI__exit)
b JUMPTARGET(__GI__exit)
@@ -126,15 +126,15 @@
L(parent):
/* Parent. Restore registers & return. */
/* Parent. Restore registers & return. */
#ifdef RESET_PID
- cfi_offset(r29,48)
+ cfi_offset(r29,-24)
@ -677,7 +677,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S @@ -677,7 +677,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+ ld r30,-16(r1)
+ ld r31,-8(r1)
#ifdef RESET_PID
cfi_restore(r29)
cfi_restore(r29)
#endif
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S 2014-05-29 14:09:56.000000000 -0500
@ -685,7 +685,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -685,7 +685,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
@@ -46,8 +46,13 @@
# endif
#endif

-#define FRAMESIZE 128
-#define stackblock FRAMESIZE+48 /* offset to parm save area. */
+#if _CALL_ELF == 2
@ -695,24 +695,24 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -695,24 +695,24 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
+#define FRAMESIZE (FRAME_MIN_SIZE+16)
+#define stackblock (FRAMESIZE+FRAME_PARM_SAVE) /* offset to parm save area. */
+#endif

.text
.text
ENTRY(__socket)
@@ -98,22 +103,22 @@
.Lsocket_cancel:
cfi_adjust_cfa_offset(FRAMESIZE)
mflr r9
cfi_adjust_cfa_offset(FRAMESIZE)
mflr r9
- std r9,FRAMESIZE+16(r1)
- cfi_offset (lr, 16)
+ std r9,FRAMESIZE+FRAME_LR_SAVE(r1)
+ cfi_offset (lr, FRAME_LR_SAVE)
CENABLE
CENABLE
- std r3,120(r1)
+ std r3,FRAME_MIN_SIZE+8(r1)
li r3,P(SOCKOP_,socket)
addi r4,r1,stackblock
DO_CALL(SYS_ify(socketcall))
mfcr r0
li r3,P(SOCKOP_,socket)
addi r4,r1,stackblock
DO_CALL(SYS_ify(socketcall))
mfcr r0
- std r3,112(r1)
- std r0,FRAMESIZE+8(r1)
- cfi_offset (cr, 8)
@ -721,23 +721,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S @@ -721,23 +721,23 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
+ std r0,FRAMESIZE+FRAME_CR_SAVE(r1)
+ cfi_offset (cr, FRAME_CR_SAVE)
+ ld r3,FRAME_MIN_SIZE+8(r1)
CDISABLE
CDISABLE
- ld r4,FRAMESIZE+16(r1)
- ld r0,FRAMESIZE+8(r1)
- ld r3,112(r1)
+ ld r4,FRAMESIZE+FRAME_LR_SAVE(r1)
+ ld r0,FRAMESIZE+FRAME_CR_SAVE(r1)
+ ld r3,FRAME_MIN_SIZE(r1)
mtlr r4
mtcr r0
addi r1,r1,FRAMESIZE
mtlr r4
mtcr r0
addi r1,r1,FRAMESIZE
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym 2014-05-29 14:09:56.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym 2014-05-29 14:10:00.000000000 -0500
@@ -8,27 +8,6 @@
SIG_SETMASK


--- Offsets of the fields in the powerpc64 ABI stack frame.
--- XXX Do these correspond to some struct?
-

196
SOURCES/glibc-ppc64le-42.patch

@ -1,47 +1,47 @@ @@ -1,47 +1,47 @@
# commit 61cd8fe4017c251617dd300818917e61a12ab48e
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 06:59:37 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 5/6: LD_AUDIT interface changes
#
#
# The ELFv2 ABI changes the calling convention by passing and returning
# structures in registers in more cases than the old ABI:
# http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01145.html
# http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01147.html
#
#
# For the most part, this does not affect glibc, since glibc assembler
# files do not use structure parameters / return values. However, one
# place is affected: the LD_AUDIT interface provides a structure to
# the audit routine that contains all registers holding function
# argument and return values for the intercepted PLT call.
#
#
# Since the new ABI now sometimes uses registers to return values
# that were never used for this purpose in the old ABI, this structure
# has to be extended. To force audit routines to be modified for the
# new ABI if necessary, the patch defines v2 variants of the la_ppc64
# types and routines.
#
#
# In addition, the patch contains two unrelated changes to the
# PLT trampoline routines: it fixes a bug where FPR return values
# were stored in the wrong place, and it removes the unnecessary
# save/restore of CR.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/bits/link.h glibc-2.17-c758a686/sysdeps/powerpc/bits/link.h
--- glibc-2.17-c758a686/sysdeps/powerpc/bits/link.h 2014-05-29 14:11:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/bits/link.h 2014-05-29 14:11:20.000000000 -0500
@@ -63,7 +63,7 @@

__END_DECLS

-#else
+#elif _CALL_ELF != 2

/* Registers for entry into PLT on PPC64. */
typedef struct La_ppc64_regs
@@ -107,4 +107,48 @@

__END_DECLS

+#else
+
+/* Registers for entry into PLT on PPC64 in the ELFv2 ABI. */
@ -96,13 +96,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys @@ -96,13 +96,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys
struct La_ppc64_retval;
+struct La_ppc64v2_regs;
+struct La_ppc64v2_retval;

#define ARCH_PLTENTER_MEMBERS \
Elf32_Addr (*ppc32_gnu_pltenter) (Elf32_Sym *, unsigned int, uintptr_t *, \
@@ -34,7 +36,12 @@
Elf64_Addr (*ppc64_gnu_pltenter) (Elf64_Sym *, unsigned int, uintptr_t *, \
uintptr_t *, struct La_ppc64_regs *, \
unsigned int *, const char *name, \
uintptr_t *, struct La_ppc64_regs *, \
unsigned int *, const char *name, \
- long int *framesizep)
+ long int *framesizep); \
+ Elf64_Addr (*ppc64v2_gnu_pltenter) (Elf64_Sym *, unsigned int, \
@ -110,13 +110,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys @@ -110,13 +110,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys
+ struct La_ppc64v2_regs *, \
+ unsigned int *, const char *name, \
+ long int *framesizep)

#define ARCH_PLTEXIT_MEMBERS \
unsigned int (*ppc32_gnu_pltexit) (Elf32_Sym *, unsigned int, \
@@ -47,7 +54,14 @@
uintptr_t *, \
uintptr_t *, \
const struct La_ppc64_regs *, \
uintptr_t *, \
uintptr_t *, \
const struct La_ppc64_regs *, \
- struct La_ppc64_retval *, const char *)
+ struct La_ppc64_retval *, \
+ const char *); \
@ -126,15 +126,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys @@ -126,15 +126,15 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/ldsodefs.h glibc-2.17-c758a686/sys
+ const struct La_ppc64v2_regs *,\
+ struct La_ppc64v2_retval *, \
+ const char *)

#include_next <ldsodefs.h>

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 14:11:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h 2014-05-29 14:11:20.000000000 -0500
@@ -546,8 +546,13 @@


/* Names of the architecture-specific auditing callback functions. */
+#if _CALL_ELF != 2
#define ARCH_LA_PLTENTER ppc64_gnu_pltenter
@ -143,40 +143,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17- @@ -143,40 +143,40 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-machine.h glibc-2.17-
+#define ARCH_LA_PLTENTER ppc64v2_gnu_pltenter
+#define ARCH_LA_PLTEXIT ppc64v2_gnu_pltexit
+#endif

#endif /* dl_machine_h */

diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 14:11:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S 2014-05-29 14:11:20.000000000 -0500
@@ -50,11 +50,8 @@
/* Store the LR in the LR Save area. */
std r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
cfi_offset (lr, FRAME_LR_SAVE)
std r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
cfi_offset (lr, FRAME_LR_SAVE)
- mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
-/* I'm almost certain we don't have to save cr... be safe. */
- std r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
bl JUMPTARGET(_dl_fixup)
bl JUMPTARGET(_dl_fixup)
#ifndef SHARED
nop
nop
@@ -66,11 +63,9 @@
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
- mtcrf 0xFF,r0
/* Prepare for calling the function returned by fixup. */
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
@@ -85,18 +80,30 @@
#undef FRAME_SIZE
#undef INT_PARMS

- /* Stack layout:
- (Note: some of these are not required for the ELFv2 ABI.)
- +592 previous backchain
@ -213,13 +213,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -213,13 +213,13 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ +528 fp1 +528 fp1
+ +520 r4 +520 r4
+ +512 r3 +512 r3
return values
return values
+504 free
+496 stackframe
+496 stackframe
@@ -157,10 +164,15 @@
+8 CR save area
r1+0 stack back chain
*/
+8 CR save area
r1+0 stack back chain
*/
-#define FRAME_SIZE 592
+#if _CALL_ELF == 2
+# define FRAME_SIZE 752
@ -235,73 +235,73 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -235,73 +235,73 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
#define CALLING_LR 488
#define CALLING_SP 480
@@ -205,18 +217,14 @@
mflr r5
std r7,INT_PARMS+32(r1)
std r8,INT_PARMS+40(r1)
mflr r5
std r7,INT_PARMS+32(r1)
std r8,INT_PARMS+40(r1)
-/* Store the LR in the LR Save area of the previous frame. */
-/* XXX Do we have to do this? */
+/* Store the LR in the LR Save area. */
la r8,FRAME_SIZE(r1)
std r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
cfi_offset (lr, FRAME_LR_SAVE)
std r5,CALLING_LR(r1)
la r8,FRAME_SIZE(r1)
std r5,FRAME_SIZE+FRAME_LR_SAVE(r1)
cfi_offset (lr, FRAME_LR_SAVE)
std r5,CALLING_LR(r1)
- mfcr r0
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
std r8,CALLING_SP(r1)
std r9,INT_PARMS+48(r1)
std r10,INT_PARMS+56(r1)
std r8,CALLING_SP(r1)
-/* I'm almost certain we don't have to save cr... be safe. */
- std r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r12,.LC__dl_hwcap@toc(r2)
ld r12,.LC__dl_hwcap@toc(r2)
#ifdef SHARED
/* Load _rtld_local_ro._dl_hwcap. */
/* Load _rtld_local_ro._dl_hwcap. */
@@ -319,11 +327,9 @@
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
- mtcrf 0xFF,r0
/* Prepare for calling the function returned by fixup. */
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
PPC64_LOAD_FUNCPTR r3
ld r3,INT_PARMS+0(r1)
@@ -346,10 +352,11 @@
lfd fp12,FPR_PARMS+88(r1)
lfd fp13,FPR_PARMS+96(r1)
lfd fp12,FPR_PARMS+88(r1)
lfd fp13,FPR_PARMS+96(r1)
/* Unwind the stack frame, and jump. */
- ld r31,584(r1)
- ld r30,576(r1)
+ ld r31,FRAME_SIZE-8(r1)
+ ld r30,FRAME_SIZE-16(r1)
addi r1,r1,FRAME_SIZE
bctr
addi r1,r1,FRAME_SIZE
bctr
+
L(do_pltexit):
la r10,(VR_PARMS+0)(r1)
la r9,(VR_PARMS+16)(r1)
la r10,(VR_PARMS+0)(r1)
la r9,(VR_PARMS+16)(r1)
@@ -383,11 +390,9 @@
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
ld r8,INT_PARMS+40(r1)
ld r7,INT_PARMS+32(r1)
mtlr r0
- ld r0,FRAME_SIZE+FRAME_CR_SAVE(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
ld r6,INT_PARMS+24(r1)
ld r5,INT_PARMS+16(r1)
ld r4,INT_PARMS+8(r1)
- mtcrf 0xFF,r0
/* Prepare for calling the function returned by fixup. */
std r2,FRAME_TOC_SAVE(r1)
PPC64_LOAD_FUNCPTR r3
std r2,FRAME_TOC_SAVE(r1)
PPC64_LOAD_FUNCPTR r3
@@ -413,16 +418,37 @@
/* But return here and store the return values. */
std r3,INT_RTN(r1)
std r4,INT_RTN+8(r1)
std r3,INT_RTN(r1)
std r4,INT_RTN+8(r1)
- stfd fp1,FPR_PARMS+0(r1)
- stfd fp2,FPR_PARMS+8(r1)
+ stfd fp1,FPR_RTN+0(r1)
+ stfd fp2,FPR_RTN+8(r1)
cmpdi cr0,r12,0
la r10,VR_RTN(r1)
cmpdi cr0,r12,0
la r10,VR_RTN(r1)
- stfd fp3,FPR_PARMS+16(r1)
- stfd fp4,FPR_PARMS+24(r1)
+ stfd fp3,FPR_RTN+16(r1)
@ -317,10 +317,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -317,10 +317,10 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ stfd fp9,FPR_RTN+64(r1)
+ stfd fp10,FPR_RTN+72(r1)
+#endif
mr r3,r31
mr r4,r30
beq L(callpltexit)
stvx v2,0,r10
mr r3,r31
mr r4,r30
beq L(callpltexit)
stvx v2,0,r10
+#if _CALL_ELF == 2
+ stvx v3,0,r12
+ stvx v4,r5,r10
@ -332,17 +332,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -332,17 +332,17 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ stvx v9,r5,r12
+#endif
L(callpltexit):
addi r5,r1,INT_PARMS
addi r6,r1,INT_RTN
addi r5,r1,INT_PARMS
addi r6,r1,INT_RTN
@@ -434,18 +460,39 @@
lwz r12,VR_VRSAVE(r1)
ld r3,INT_RTN(r1)
ld r4,INT_RTN+8(r1)
lwz r12,VR_VRSAVE(r1)
ld r3,INT_RTN(r1)
ld r4,INT_RTN+8(r1)
- lfd fp1,FPR_PARMS+0(r1)
- lfd fp2,FPR_PARMS+8(r1)
+ lfd fp1,FPR_RTN+0(r1)
+ lfd fp2,FPR_RTN+8(r1)
cmpdi cr0,r12,0
cmpdi cr0,r12,0
- la r10,VR_RTN(r1)
- lfd fp3,FPR_PARMS+16(r1)
- lfd fp4,FPR_PARMS+24(r1)
@ -360,7 +360,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -360,7 +360,7 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ lfd fp9,FPR_RTN+64(r1)
+ lfd fp10,FPR_RTN+72(r1)
+#endif
beq L(pltexitreturn)
beq L(pltexitreturn)
- lvx v2,0,r10
+ lvx v2,0,r11
+#if _CALL_ELF == 2
@ -374,21 +374,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2. @@ -374,21 +374,21 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/dl-trampoline.S glibc-2.
+ lvx v9,r30,r12
+#endif
L(pltexitreturn):
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
ld r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
- ld r31,584(r1)
- ld r30,576(r1)
+ ld r31,FRAME_SIZE-8(r1)
+ ld r30,FRAME_SIZE-16(r1)
mtlr r0
ld r1,0(r1)
blr
mtlr r0
ld r1,0(r1)
blr
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/tst-audit.h glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/tst-audit.h
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/tst-audit.h 2014-05-29 14:11:12.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/tst-audit.h 2014-05-29 14:11:20.000000000 -0500
@@ -18,8 +18,16 @@
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */

+#if _CALL_ELF != 2
#define pltenter la_ppc64_gnu_pltenter
#define pltexit la_ppc64_gnu_pltexit

14
SOURCES/glibc-ppc64le-43.patch

@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
# commit 5b118558f9fb0620508d51c34c2cb5ba4f1f01c2
# Author: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
# Date: Wed Dec 4 07:08:48 2013 -0600
#
#
# PowerPC64 ELFv2 ABI 6/6: Bump ld.so soname version number
#
#
# To avoid having a ELFv2 binary accidentally picking up an old ABI ld.so,
# this patch bumps the soname to ld64.so.2.
#
#
# In theory (or for testing purposes) this will also allow co-installing
# ld.so versions for both ABIs on the same system. Note that the kernel
# will already be able to load executables of both ABIs. However, there
# is currently no plan to use that theoretical possibility in a any
# supported distribution environment ...
#
#
# Note that in order to check which ABI to use, we need to invoke the
# compiler to check the _CALL_ELF macro; this is done in a new configure
# check in sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac,
# replacing the hard-coded value of default-abi in the Makefile.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile 2014-05-29 14:12:25.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile 2014-05-29 14:12:30.000000000 -0500
@ -35,14 +35,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile glibc-2.1 @@ -35,14 +35,14 @@ diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/Makefile glibc-2.1
+abi-64-v2-options := -D__powerpc64__ -U_CALL_ELF -D_CALL_ELF=2
+abi-64-v2-condition := __WORDSIZE == 64 && _CALL_ELF == 2
+abi-64-v2-ld-soname := ld64.so.2

ifeq ($(subdir),rt)
librt-routines += rt-sysdep
diff -urN glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/ldconfig.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/ldconfig.h 2014-05-29 14:12:25.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/ldconfig.h 2014-05-29 14:12:30.000000000 -0500
@@ -20,7 +20,8 @@

#define SYSDEP_KNOWN_INTERPRETER_NAMES \
{ "/lib/ld.so.1", FLAG_ELF_LIBC6 }, \
- { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 },

18
SOURCES/glibc-ppc64le-44.patch

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
# commit c859b32e9d76afe8a3f20bb9528961a573c06937
# Author: Alan Modra <amodra@gmail.com>
# Date: Tue Apr 1 14:07:42 2014 +1030
#
#
# Fix s_copysign stack temp for PowerPC64 ELFv2
#
#
# [BZ #16786]
# * sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Don't trash stack.
#
#
diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
--- glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S 2014-05-29 14:13:47.000000000 -0500
+++ glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S 2014-05-29 14:13:50.000000000 -0500
@ -16,11 +16,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S glibc-2 @@ -16,11 +16,11 @@ diff -urN glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/fpu/s_copysign.S glibc-2
with the sign bit of y. */
- stfd fp2,56(r1)
+ stfd fp2,-8(r1)
nop
nop
nop
nop
nop
nop
- ld r3,56(r1)
+ ld r3,-8(r1)
cmpdi r3,0
blt L(0)
fabs fp1,fp1
cmpdi r3,0
blt L(0)
fabs fp1,fp1

10
SOURCES/glibc-rh1000923.patch

@ -3,7 +3,7 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com> @@ -3,7 +3,7 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Mon Aug 26 15:42:29 2013 +0530

Initialize res_hconf in nscd

Fixes BZ #15890.

diff -pruN glibc-2.17-c758a686/nscd/aicache.c glibc-2.17-c758a686/nscd/aicache.c
@ -14,19 +14,19 @@ diff -pruN glibc-2.17-c758a686/nscd/aicache.c glibc-2.17-c758a686/nscd/aicache.c @@ -14,19 +14,19 @@ diff -pruN glibc-2.17-c758a686/nscd/aicache.c glibc-2.17-c758a686/nscd/aicache.c
#include <unistd.h>
#include <sys/mman.h>
+#include <resolv/res_hconf.h>

#include "dbg_log.h"
#include "nscd.h"
@@ -100,8 +101,11 @@ addhstaiX (struct database_dyn *db, int
no_more = __nss_database_lookup ("hosts", NULL,
"dns [!UNAVAIL=return] files", &nip);

"dns [!UNAVAIL=return] files", &nip);
+ /* Initialize configurations. */
+ if (__builtin_expect (!_res_hconf.initialized, 0))
+ _res_hconf_init ();
if (__res_maybe_init (&_res, 0) == -1)
- no_more = 1;
+ no_more = 1;

/* If we are looking for both IPv4 and IPv6 address we don't want
the lookup functions to automatically promote IPv4 addresses to

12
SOURCES/glibc-rh1008298.patch

@ -5,7 +5,7 @@ index 3148c5f..f7718a9 100644 @@ -5,7 +5,7 @@ index 3148c5f..f7718a9 100644
@@ -3015,6 +3015,13 @@ __libc_memalign(size_t alignment, size_t bytes)
/* Otherwise, ensure that it is at least a minimum chunk size */
if (alignment < MINSIZE) alignment = MINSIZE;

+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - alignment - MINSIZE)
+ {
@ -17,9 +17,9 @@ index 3148c5f..f7718a9 100644 @@ -17,9 +17,9 @@ index 3148c5f..f7718a9 100644
if(!ar_ptr)
return 0;
@@ -3046,6 +3046,13 @@ __libc_valloc(size_t bytes)

size_t pagesz = GLRO(dl_pagesize);

+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - pagesz - MINSIZE)
+ {
@ -28,12 +28,12 @@ index 3148c5f..f7718a9 100644 @@ -28,12 +28,12 @@ index 3148c5f..f7718a9 100644
+ }
+
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
const __malloc_ptr_t)) =
const __malloc_ptr_t)) =
force_reg (__memalign_hook);
@@ -3082,6 +3082,13 @@ __libc_pvalloc(size_t bytes)
size_t page_mask = GLRO(dl_pagesize) - 1;
size_t rounded_bytes = (bytes + page_mask) & ~(page_mask);

+ /* Check for overflow. */
+ if (bytes > SIZE_MAX - 2*pagesz - MINSIZE)
+ {
@ -42,5 +42,5 @@ index 3148c5f..f7718a9 100644 @@ -42,5 +42,5 @@ index 3148c5f..f7718a9 100644
+ }
+
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
const __malloc_ptr_t)) =
const __malloc_ptr_t)) =
force_reg (__memalign_hook);

18
SOURCES/glibc-rh1020637.patch

@ -22,14 +22,14 @@ index 68a5af4..52192a2 100644 @@ -22,14 +22,14 @@ index 68a5af4..52192a2 100644
--- glibc-2.17-c758a686/sysdeps/s390/dl-tls.h
+++ glibc-2.17-c758a686/sysdeps/s390/dl-tls.h
@@ -26,11 +26,26 @@ typedef struct


#ifdef SHARED
-/* This is the prototype for the GNU version. */
-extern void *__tls_get_addr (tls_index *ti) attribute_hidden;
+
extern unsigned long __tls_get_offset (unsigned long got_offset);

# ifdef IS_IN_rtld
+
+# include <shlib-compat.h>
@ -58,10 +58,10 @@ index 68a5af4..52192a2 100644 @@ -58,10 +58,10 @@ index 68a5af4..52192a2 100644
+# else /* IS_IN_rtld */
+extern void *__tls_get_addr_internal (tls_index *ti);
+# endif /* !IS_IN_rtld */

# define GET_ADDR_OFFSET \
(ti->ti_offset - (unsigned long) __builtin_thread_pointer ())

-# define __TLS_GET_ADDR(__ti) \
- ({ extern char _GLOBAL_OFFSET_TABLE_[] attribute_hidden; \
- (void *) __tls_get_offset ((char *) (__ti) - _GLOBAL_OFFSET_TABLE_) \
@ -74,15 +74,15 @@ index 68a5af4..52192a2 100644 @@ -74,15 +74,15 @@ index 68a5af4..52192a2 100644
+# define __TLS_GET_ADDR(__ti) \
+ ({ (void *) __tls_get_addr_internal ((char *) (__ti)) \
+ + (unsigned long) __builtin_thread_pointer (); })

#endif

diff --git glibc-2.17-c758a686/sysdeps/s390/s390-32/tls-macros.h glibc-2.17-c758a686/sysdeps/s390/s390-32/tls-macros.h
index 8a0ad58..a592d81 100644
--- glibc-2.17-c758a686/sysdeps/s390/s390-32/tls-macros.h
+++ glibc-2.17-c758a686/sysdeps/s390/s390-32/tls-macros.h
@@ -8,12 +8,15 @@

#ifdef PIC
# define TLS_IE(x) \
- ({ unsigned long __offset; \
@ -107,7 +107,7 @@ index be8aa6c..3c59436 100644 @@ -107,7 +107,7 @@ index be8aa6c..3c59436 100644
--- glibc-2.17-c758a686/sysdeps/s390/s390-64/tls-macros.h
+++ glibc-2.17-c758a686/sysdeps/s390/s390-64/tls-macros.h
@@ -8,12 +8,13 @@

#ifdef PIC
# define TLS_IE(x) \
- ({ unsigned long __offset; \

16
SOURCES/glibc-rh1025612.patch

@ -3,9 +3,9 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com> @@ -3,9 +3,9 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Fri Oct 25 10:22:12 2013 +0530

Fix stack overflow due to large AF_INET6 requests

Resolves #16072 (CVE-2013-4458).

This patch fixes another stack overflow in getaddrinfo when it is
called with AF_INET6. The AF_UNSPEC case was fixed as CVE-2013-1914,
but the AF_INET6 case went undetected back then.
@ -15,7 +15,7 @@ index e6ce4cf..8ff74b4 100644 @@ -15,7 +15,7 @@ index e6ce4cf..8ff74b4 100644
--- glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
+++ glibc-2.17-c758a686/sysdeps/posix/getaddrinfo.c
@@ -197,7 +197,22 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
&rc, &herrno, NULL, &localcanon)); \
&rc, &herrno, NULL, &localcanon)); \
if (rc != ERANGE || herrno != NETDB_INTERNAL) \
break; \
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); \
@ -39,12 +39,12 @@ index e6ce4cf..8ff74b4 100644 @@ -39,12 +39,12 @@ index e6ce4cf..8ff74b4 100644
if (status == NSS_STATUS_SUCCESS && rc == 0) \
h = &th; \
@@ -209,7 +224,8 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
{ \
__set_h_errno (herrno); \
_res.options |= old_res_options & RES_USE_INET6; \
{ \
__set_h_errno (herrno); \
_res.options |= old_res_options & RES_USE_INET6; \
- return -EAI_SYSTEM; \
+ result = -EAI_SYSTEM; \
+ goto free_and_return; \
} \
} \
if (herrno == TRY_AGAIN) \
no_data = EAI_AGAIN; \
no_data = EAI_AGAIN; \

14
SOURCES/glibc-rh1025934.patch

@ -13,7 +13,7 @@ index 0866c44..ba55b04 100644 @@ -13,7 +13,7 @@ index 0866c44..ba55b04 100644
@@ -44,35 +44,31 @@
/* Global variable to tell if the kernel has SELinux support. */
int selinux_enabled;

-/* Define mappings of access vector permissions to request types. */
-static const access_vector_t perms[LASTREQ] =
+/* Define mappings of request type to AVC permission name. */
@ -68,11 +68,11 @@ index 0866c44..ba55b04 100644 @@ -68,11 +68,11 @@ index 0866c44..ba55b04 100644
+ [INNETGR] = "getnetgrp",
+ [GETFDNETGR] = "shmemnetgrp",
};

/* Store an entry ref to speed AVC decisions. */
@@ -344,7 +340,18 @@ nscd_avc_init (void)


/* Check the permission from the caller (via getpeercon) to nscd.
- Returns 0 if access is allowed, 1 if denied, and -1 on error. */
+ Returns 0 if access is allowed, 1 if denied, and -1 on error.
@ -121,13 +121,13 @@ index 0866c44..ba55b04 100644 @@ -121,13 +121,13 @@ index 0866c44..ba55b04 100644
+ found and AVC does not deny unknown values then allow it. */
+ if ((sc_nscd == 0 || perm == 0) && avc_deny_unknown == 0)
+ return 0;

if (getpeercon (fd, &scon) < 0)
{
@@ -372,15 +406,7 @@ nscd_request_avc_has_perm (int fd, request_type req)
goto out;
}

-#ifndef NSCD__GETSERV
- if (perms[req] == 0)
- {
@ -138,6 +138,6 @@ index 0866c44..ba55b04 100644 @@ -138,6 +138,6 @@ index 0866c44..ba55b04 100644
-
- rc = avc_has_perm (ssid, tsid, SECCLASS_NSCD, perms[req], &aeref, NULL) < 0;
+ rc = avc_has_perm (ssid, tsid, sc_nscd, perm, &aeref, NULL) < 0;

out:
if (scon)

30
SOURCES/glibc-rh1027101.patch

@ -3,16 +3,16 @@ Author: Maxim Kuvyrkov <maxim@kugelworks.com> @@ -3,16 +3,16 @@ Author: Maxim Kuvyrkov <maxim@kugelworks.com>
Date: Tue Dec 24 09:44:50 2013 +1300

Fix race in free() of fastbin chunk: BZ #15073

Perform sanity check only if we have_lock. Due to lockless nature of fastbins
we need to be careful derefencing pointers to fastbin entries (chunksize(old)
in this case) in multithreaded environments.

The fix is to add have_lock to the if-condition checks. The rest of the patch
only makes code more readable.

* malloc/malloc.c (_int_free): Perform sanity check only if we
have_lock.
* malloc/malloc.c (_int_free): Perform sanity check only if we
have_lock.

Index: b/malloc/malloc.c
===================================================================
@ -21,7 +21,7 @@ Index: b/malloc/malloc.c @@ -21,7 +21,7 @@ Index: b/malloc/malloc.c
@@ -3909,25 +3909,29 @@ _int_free(mstate av, mchunkptr p, int ha
unsigned int idx = fastbin_index(size);
fb = &fastbin (av, idx);

- mchunkptr fd;
- mchunkptr old = *fb;
+ /* Atomically link P to its fastbin: P->FD = *FB; *FB = P; */
@ -33,26 +33,26 @@ Index: b/malloc/malloc.c @@ -33,26 +33,26 @@ Index: b/malloc/malloc.c
- record we are going to add (i.e., double free). */
+ /* Check that the top of the bin is not the record we are going to add
+ (i.e., double free). */
if (__builtin_expect (old == p, 0))
{
errstr = "double free or corruption (fasttop)";
goto errout;
}
if (__builtin_expect (old == p, 0))
{
errstr = "double free or corruption (fasttop)";
goto errout;
}
- if (old != NULL)
+ /* Check that size of fastbin chunk at the top is the same as
+ size of the chunk that we are adding. We can dereference OLD
+ only if we have the lock, otherwise it might have already been
+ deallocated. See use of OLD_IDX below for the actual check. */
+ if (have_lock && old != NULL)
old_idx = fastbin_index(chunksize(old));
old_idx = fastbin_index(chunksize(old));
- p->fd = fd = old;
+ p->fd = old2 = old;
}
- while ((old = catomic_compare_and_exchange_val_rel (fb, p, fd)) != fd);
+ while ((old = catomic_compare_and_exchange_val_rel (fb, p, old2)) != old2);

- if (fd != NULL && __builtin_expect (old_idx != idx, 0))
+ if (have_lock && old != NULL && __builtin_expect (old_idx != idx, 0))
{
errstr = "invalid fastbin entry (free)";
goto errout;
errstr = "invalid fastbin entry (free)";
goto errout;

64
SOURCES/glibc-rh1027348-1.patch

@ -8,7 +8,7 @@ Author: Torvald Riegel <triegel@redhat.com> @@ -8,7 +8,7 @@ Author: Torvald Riegel <triegel@redhat.com>
Date: Sat Oct 18 01:02:59 2014 +0200

Add arch-specific configuration for C11 atomics support.

This sets __HAVE_64B_ATOMICS if provided. It also sets
USE_ATOMIC_COMPILER_BUILTINS to true if the existing atomic ops use the
__atomic* builtins (aarch64, mips partially) or if this has been
@ -22,10 +22,10 @@ Index: glibc-2.17-c758a686/ports/sysdeps/aarch64/bits/atomic.h @@ -22,10 +22,10 @@ Index: glibc-2.17-c758a686/ports/sysdeps/aarch64/bits/atomic.h
@@ -36,6 +36,8 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 1

/* Compare and exchange.
For all "bool" routines, we return FALSE if exchange succesful. */
Index: glibc-2.17-c758a686/ports/sysdeps/alpha/bits/atomic.h
@ -35,11 +35,11 @@ Index: glibc-2.17-c758a686/ports/sysdeps/alpha/bits/atomic.h @@ -35,11 +35,11 @@ Index: glibc-2.17-c758a686/ports/sysdeps/alpha/bits/atomic.h
@@ -42,6 +42,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#ifdef UP
# define __MB /* nothing */
Index: glibc-2.17-c758a686/ports/sysdeps/arm/bits/atomic.h
@ -49,12 +49,12 @@ Index: glibc-2.17-c758a686/ports/sysdeps/arm/bits/atomic.h @@ -49,12 +49,12 @@ Index: glibc-2.17-c758a686/ports/sysdeps/arm/bits/atomic.h
@@ -33,6 +33,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
void __arm_link_error (void);

/* Use the atomic builtins provided by GCC in case the backend provides
Index: glibc-2.17-c758a686/sysdeps/i386/i486/bits/atomic.h
===================================================================
@ -63,11 +63,11 @@ Index: glibc-2.17-c758a686/sysdeps/i386/i486/bits/atomic.h @@ -63,11 +63,11 @@ Index: glibc-2.17-c758a686/sysdeps/i386/i486/bits/atomic.h
@@ -54,6 +54,9 @@ typedef uintmax_t uatomic_max_t;
# endif
#endif

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
__sync_val_compare_and_swap (mem, oldval, newval)
Index: glibc-2.17-c758a686/ports/sysdeps/ia64/bits/atomic.h
@ -77,11 +77,11 @@ Index: glibc-2.17-c758a686/ports/sysdeps/ia64/bits/atomic.h @@ -77,11 +77,11 @@ Index: glibc-2.17-c758a686/ports/sysdeps/ia64/bits/atomic.h
@@ -43,6 +43,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#define __arch_compare_and_exchange_bool_8_acq(mem, newval, oldval) \
(abort (), 0)
Index: glibc-2.17-c758a686/ports/sysdeps/m68k/coldfire/bits/atomic.h
@ -91,7 +91,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/m68k/coldfire/bits/atomic.h @@ -91,7 +91,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/m68k/coldfire/bits/atomic.h
@@ -49,6 +49,10 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+/* If we have just non-atomic operations, we can as well make them wide. */
+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
@ -106,7 +106,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/m68k/m680x0/m68020/bits/atomic.h @@ -106,7 +106,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/m68k/m680x0/m68020/bits/atomic.h
@@ -44,6 +44,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
@ -120,7 +120,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/mips/bits/atomic.h @@ -120,7 +120,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/mips/bits/atomic.h
@@ -43,6 +43,12 @@ typedef uintmax_t uatomic_max_t;
#define MIPS_PUSH_MIPS2
#endif

+#if _MIPS_SIM == _ABIO32
+#define __HAVE_64B_ATOMICS 0
+#else
@ -133,16 +133,16 @@ Index: glibc-2.17-c758a686/ports/sysdeps/mips/bits/atomic.h @@ -133,16 +133,16 @@ Index: glibc-2.17-c758a686/ports/sysdeps/mips/bits/atomic.h
@@ -82,6 +88,8 @@ typedef uintmax_t uatomic_max_t;
/* The __atomic_* builtins are available in GCC 4.7 and later, but MIPS
support for their efficient implementation was added only in GCC 4.8. */

+#define USE_ATOMIC_COMPILER_BUILTINS 1
+
/* Compare and exchange.
For all "bool" routines, we return FALSE if exchange succesful. */

@@ -204,6 +212,8 @@ typedef uintmax_t uatomic_max_t;
/* This implementation using inline assembly will be removed once glibc
requires GCC 4.8 or later to build. */

+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
/* Compare and exchange. For all of the "xxx" routines, we expect a
@ -155,7 +155,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bits/atomic.h @@ -155,7 +155,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc32/bits/atomic.h
@@ -33,6 +33,9 @@
# define MUTEX_HINT_REL
#endif

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
@ -169,7 +169,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/bits/atomic.h @@ -169,7 +169,7 @@ Index: glibc-2.17-c758a686/sysdeps/powerpc/powerpc64/bits/atomic.h
@@ -33,6 +33,9 @@
# define MUTEX_HINT_REL
#endif

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
@ -183,22 +183,22 @@ Index: glibc-2.17-c758a686/sysdeps/s390/bits/atomic.h @@ -183,22 +183,22 @@ Index: glibc-2.17-c758a686/sysdeps/s390/bits/atomic.h
@@ -43,6 +43,8 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
(abort (), (__typeof (*mem)) 0)
@@ -59,6 +61,7 @@ typedef uintmax_t uatomic_max_t;
__archold; })

#ifdef __s390x__
+# define __HAVE_64B_ATOMICS 1
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __typeof (mem) __archmem = (mem); \
__typeof (*mem) __archold = (oldval); \
@@ -67,6 +70,7 @@ typedef uintmax_t uatomic_max_t;
: "d" ((long) (newval)), "m" (*__archmem) : "cc", "memory" ); \
: "d" ((long) (newval)), "m" (*__archmem) : "cc", "memory" ); \
__archold; })
#else
+# define __HAVE_64B_ATOMICS 0
@ -212,11 +212,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc32/bits/atomic.h @@ -212,11 +212,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc32/bits/atomic.h
@@ -47,6 +47,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

/* We have no compare and swap, just test and set.
The following implementation contends on 64 global locks
Index: glibc-2.17-c758a686/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
@ -226,11 +226,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h @@ -226,11 +226,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc32/sparcv9/bits/atomic.h
@@ -44,6 +44,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
(abort (), (__typeof (*mem)) 0)
Index: glibc-2.17-c758a686/sysdeps/sparc/sparc64/bits/atomic.h
@ -240,11 +240,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc64/bits/atomic.h @@ -240,11 +240,11 @@ Index: glibc-2.17-c758a686/sysdeps/sparc/sparc64/bits/atomic.h
@@ -44,6 +44,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 1
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+

#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
(abort (), (__typeof (*mem)) 0)
Index: glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
@ -254,7 +254,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h @@ -254,7 +254,7 @@ Index: glibc-2.17-c758a686/ports/sysdeps/unix/sysv/linux/hppa/bits/atomic.h
@@ -44,6 +44,9 @@ typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;

+#define __HAVE_64B_ATOMICS 0
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+
@ -268,13 +268,13 @@ Index: glibc-2.17-c758a686/sysdeps/x86_64/bits/atomic.h @@ -268,13 +268,13 @@ Index: glibc-2.17-c758a686/sysdeps/x86_64/bits/atomic.h
@@ -55,6 +55,12 @@ typedef uintmax_t uatomic_max_t;
# endif
#endif

+#define __HAVE_64B_ATOMICS 1
+#if __GNUC_PREREQ (4, 7)
+#define USE_ATOMIC_COMPILER_BUILTINS 1
+#else
+#define USE_ATOMIC_COMPILER_BUILTINS 0
+#endif

#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \
__sync_val_compare_and_swap (mem, oldval, newval)

4
SOURCES/glibc-rh1027348-2.patch

@ -11,7 +11,7 @@ Index: glibc-2.17-c758a686/include/atomic.h @@ -11,7 +11,7 @@ Index: glibc-2.17-c758a686/include/atomic.h
@@ -542,6 +542,218 @@
({ __typeof (x) __x; __asm ("" : "=r" (__x) : "0" (x)); __x; })
#endif

+/* This is equal to 1 iff the architecture supports 64b atomic operations. */
+#ifndef __HAVE_64B_ATOMICS
+#error Unable to determine if 64-bit atomics are present.
@ -224,6 +224,6 @@ Index: glibc-2.17-c758a686/include/atomic.h @@ -224,6 +224,6 @@ Index: glibc-2.17-c758a686/include/atomic.h
+
+#endif /* !USE_ATOMIC_COMPILER_BUILTINS */
+

#ifndef atomic_delay
# define atomic_delay() do { /* nothing */ } while (0)

22
SOURCES/glibc-rh1027348-3.patch

@ -9,13 +9,13 @@ Index: glibc-2.17-c758a686/nptl/Makefile @@ -9,13 +9,13 @@ Index: glibc-2.17-c758a686/nptl/Makefile
--- glibc-2.17-c758a686.orig/nptl/Makefile
+++ glibc-2.17-c758a686/nptl/Makefile
@@ -224,6 +224,7 @@ tests = tst-typesizes \
tst-key1 tst-key2 tst-key3 tst-key4 \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
tst-key1 tst-key2 tst-key3 tst-key4 \
tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
+ tst-sem15 \
tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
tst-align tst-align2 tst-align3 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
tst-align tst-align2 tst-align3 \
tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
Index: glibc-2.17-c758a686/nptl/tst-sem15.c
===================================================================
--- /dev/null
@ -130,15 +130,15 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -130,15 +130,15 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
{
- if ((v << SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
+ if ((v >> SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
{
__set_errno (EOVERFLOW);
return -1;
}
{
__set_errno (EOVERFLOW);
return -1;
}
}
- while (!atomic_compare_exchange_weak_release (&isem->value,
- &v, v + (1 << SEM_VALUE_SHIFT)));
+ while (!atomic_compare_exchange_weak_release
+ (&isem->value, &v, v + (1 << SEM_VALUE_SHIFT)));

/* If there is any potentially blocked waiter, wake one of them. */
if ((v & SEM_NWAITERS_MASK) != 0)

20
SOURCES/glibc-rh1027348-4.patch

@ -3,11 +3,11 @@ Author: Joseph Myers <joseph@codesourcery.com> @@ -3,11 +3,11 @@ Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Mar 18 17:05:38 2015 +0000

Make sem_timedwait use FUTEX_CLOCK_REALTIME (bug 18138).

sem_timedwait converts absolute timeouts to relative to pass them to
the futex syscall. (Before the recent reimplementation, on x86_64 it
used FUTEX_CLOCK_REALTIME, but not on other architectures.)

Correctly implementing POSIX requirements, however, requires use of
FUTEX_CLOCK_REALTIME; passing a relative timeout to the kernel does
not conform to POSIX. The POSIX specification for sem_timedwait says
@ -23,7 +23,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000 @@ -23,7 +23,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000
timeout is passed to the kernel, it is interpreted according to the
CLOCK_MONOTONIC clock, and so fails to meet that POSIX requirement in
the event of clock changes.

This patch makes sem_timedwait use lll_futex_timed_wait_bitset with
FUTEX_CLOCK_REALTIME when possible, as done in some other places in
NPTL. FUTEX_CLOCK_REALTIME is always available for supported Linux
@ -33,7 +33,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000 @@ -33,7 +33,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000
unreviewed
<https://sourceware.org/ml/libc-alpha/2014-12/msg00655.html> that
removes the hppa lowlevellock.h completely).

In the FUTEX_CLOCK_REALTIME case, the glibc code still needs to check
for negative tv_sec and handle that as timeout, because the Linux
kernel returns EINVAL not ETIMEDOUT for that case, so resulting in
@ -41,7 +41,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000 @@ -41,7 +41,7 @@ Date: Wed Mar 18 17:05:38 2015 +0000
check. If we're trying to distinguish between Linux-specific and
generic-futex NPTL code, I suppose having this in an nptl/ file isn't
ideal, but there doesn't seem to be any better place at present.

It's not possible to add a testcase for this issue to the testsuite
because of the requirement to change the system clock as part of a
test (this is a case where testing would require some form of
@ -49,10 +49,10 @@ Date: Wed Mar 18 17:05:38 2015 +0000 @@ -49,10 +49,10 @@ Date: Wed Mar 18 17:05:38 2015 +0000
is isolated from that of the host; I'm not sure what forms of
containers, short of a full virtual machine, provide that clock
isolation).

Tested for x86_64. Also tested for powerpc with the testcase included
in the bug.

[BZ #18138]
* nptl/sem_waitcommon.c: Include <kernel-features.h>.
(futex_abstimed_wait)
@ -67,7 +67,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c @@ -67,7 +67,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c
@@ -17,6 +17,7 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

+#include <kernel-features.h>
#include <errno.h>
#include <sysdep.h>
@ -92,7 +92,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c @@ -92,7 +92,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c
rt.tv_nsec = nsec;
+#endif
if (cancel)
oldtype = __pthread_enable_asynccancel ();
oldtype = __pthread_enable_asynccancel ();
+#if (defined __ASSUME_FUTEX_CLOCK_REALTIME \
+ && defined lll_futex_timed_wait_bitset)
+ err = lll_futex_timed_wait_bitset (futex, expected, abstime,
@ -101,5 +101,5 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c @@ -101,5 +101,5 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c
err = lll_futex_timed_wait (futex, expected, &rt, private);
+#endif
if (cancel)
__pthread_disable_asynccancel (oldtype);
__pthread_disable_asynccancel (oldtype);
}

146
SOURCES/glibc-rh1027348.patch

@ -5,7 +5,7 @@ Author: Carlos O'Donell <carlos@systemhalted.org> @@ -5,7 +5,7 @@ Author: Carlos O'Donell <carlos@systemhalted.org>
Date: Wed Jan 21 00:46:16 2015 -0500

Fix semaphore destruction (bug 12674).

This commit fixes semaphore destruction by either using 64b atomic
operations (where available), or by using two separate fields when only
32b atomic operations are available. In the latter case, we keep a
@ -13,9 +13,9 @@ Date: Wed Jan 21 00:46:16 2015 -0500 @@ -13,9 +13,9 @@ Date: Wed Jan 21 00:46:16 2015 -0500
bit of the field that counts the number of available tokens, thus
allowing sem_post to atomically both add a token and determine whether
it needs to call futex_wake.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00155.html
https://sourceware.org/ml/libc-alpha/2014-12/msg00155.html

Notes:
* For x86_64 and i686, rather than movign to the generic lll_futex_wake
@ -80,14 +80,14 @@ Index: glibc-2.17-c758a686/nptl/Makefile @@ -80,14 +80,14 @@ Index: glibc-2.17-c758a686/nptl/Makefile
--- glibc-2.17-c758a686.orig/nptl/Makefile
+++ glibc-2.17-c758a686/nptl/Makefile
@@ -95,7 +95,7 @@ libpthread-routines = nptl-init vars eve
sem_init sem_destroy \
sem_open sem_close sem_unlink \
sem_getvalue \
sem_init sem_destroy \
sem_open sem_close sem_unlink \
sem_getvalue \
- sem_wait sem_trywait sem_timedwait sem_post \
+ sem_wait sem_timedwait sem_post \
cleanup cleanup_defer cleanup_compat \
cleanup_defer_compat unwind \
pt-longjmp pt-cleanup\
cleanup cleanup_defer cleanup_compat \
cleanup_defer_compat unwind \
pt-longjmp pt-cleanup\
Index: glibc-2.17-c758a686/nptl/sem_getvalue.c
===================================================================
--- glibc-2.17-c758a686.orig/nptl/sem_getvalue.c
@ -97,8 +97,8 @@ Index: glibc-2.17-c758a686/nptl/sem_getvalue.c @@ -97,8 +97,8 @@ Index: glibc-2.17-c758a686/nptl/sem_getvalue.c
#include <shlib-compat.h>
#include "semaphoreP.h"
+#include <atomic.h>


int
-__new_sem_getvalue (sem, sval)
- sem_t *sem;
@ -106,21 +106,21 @@ Index: glibc-2.17-c758a686/nptl/sem_getvalue.c @@ -106,21 +106,21 @@ Index: glibc-2.17-c758a686/nptl/sem_getvalue.c
+__new_sem_getvalue (sem_t *sem, int *sval)
{
struct new_sem *isem = (struct new_sem *) sem;

/* XXX Check for valid SEM parameter. */
+ /* FIXME This uses relaxed MO, even though POSIX specifies that this function
+ should be linearizable. However, its debatable whether linearizability
+ is the right requirement. We need to follow up with POSIX and, if
+ necessary, use a stronger MO here and elsewhere (e.g., potentially
+ release MO in all places where we consume a token). */

- *sval = isem->value;
+#if __HAVE_64B_ATOMICS
+ *sval = atomic_load_relaxed (&isem->data) & SEM_VALUE_MASK;
+#else
+ *sval = atomic_load_relaxed (&isem->value) >> SEM_VALUE_SHIFT;
+#endif

return 0;
}
versioned_symbol (libpthread, __new_sem_getvalue, sem_getvalue, GLIBC_2_1);
@ -140,14 +140,14 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c @@ -140,14 +140,14 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c
--- glibc-2.17-c758a686.orig/nptl/sem_init.c
+++ glibc-2.17-c758a686/nptl/sem_init.c
@@ -18,17 +18,28 @@

#include <errno.h>
#include <semaphore.h>
-#include <lowlevellock.h>
#include <shlib-compat.h>
#include "semaphoreP.h"
#include <kernel-features.h>

+/* Returns FUTEX_PRIVATE if pshared is zero and private futexes are supported;
+ returns FUTEX_SHARED otherwise.
+ TODO Remove when cleaning up the futex API throughout glibc. */
@ -163,7 +163,7 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c @@ -163,7 +163,7 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c
+ ^ FUTEX_PRIVATE_FLAG;
+#endif
+}

int
-__new_sem_init (sem, pshared, value)
- sem_t *sem;
@ -176,7 +176,7 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c @@ -176,7 +176,7 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c
@@ -40,16 +51,15 @@ __new_sem_init (sem, pshared, value)
/* Map to the internal type. */
struct new_sem *isem = (struct new_sem *) sem;

- /* Use the values the user provided. */
- isem->value = value;
-#ifdef __ASSUME_PRIVATE_FUTEX
@ -190,10 +190,10 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c @@ -190,10 +190,10 @@ Index: glibc-2.17-c758a686/nptl/sem_init.c
+ isem->value = value << SEM_VALUE_SHIFT;
+ isem->nwaiters = 0;
#endif

- isem->nwaiters = 0;
+ isem->private = futex_private_if_supported (pshared);

return 0;
}
Index: glibc-2.17-c758a686/nptl/sem_open.c
@ -201,9 +201,9 @@ Index: glibc-2.17-c758a686/nptl/sem_open.c @@ -201,9 +201,9 @@ Index: glibc-2.17-c758a686/nptl/sem_open.c
--- glibc-2.17-c758a686.orig/nptl/sem_open.c
+++ glibc-2.17-c758a686/nptl/sem_open.c
@@ -307,9 +307,14 @@ sem_open (const char *name, int oflag, .
struct new_sem newsem;
struct new_sem newsem;
} sem;

- sem.newsem.value = value;
- sem.newsem.private = 0;
+#if __HAVE_64B_ATOMICS
@ -214,7 +214,7 @@ Index: glibc-2.17-c758a686/nptl/sem_open.c @@ -214,7 +214,7 @@ Index: glibc-2.17-c758a686/nptl/sem_open.c
+#endif
+ /* This always is a shared semaphore. */
+ sem.newsem.private = LLL_SHARED;

/* Initialize the remaining bytes as well. */
memset ((char *) &sem.initsem + sizeof (struct new_sem), '\0',
Index: glibc-2.17-c758a686/nptl/tst-sem11.c
@ -237,7 +237,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem11.c @@ -237,7 +237,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem11.c
@@ -68,7 +71,11 @@ main (void)
goto again;
}

+#if __HAVE_64B_ATOMICS
+ if ((u.ns.data >> SEM_NWAITERS_SHIFT) != 0)
+#else
@ -266,7 +266,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem13.c @@ -266,7 +266,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem13.c
+ printf ("sem_timedwait modified nwaiters: %d\n", nwaiters);
return 1;
}

@@ -52,9 +57,14 @@ do_test (void)
perror ("2nd sem_timedwait did not fail with ETIMEDOUT");
return 1;
@ -283,7 +283,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem13.c @@ -283,7 +283,7 @@ Index: glibc-2.17-c758a686/nptl/tst-sem13.c
+ printf ("2nd sem_timedwait modified nwaiters: %d\n", nwaiters);
return 1;
}

Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
===================================================================
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/i386/i486/sem_post.S
@ -1390,12 +1390,12 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -1390,12 +1390,12 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/internaltypes.h
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/internaltypes.h
@@ -20,6 +20,8 @@
#define _INTERNALTYPES_H 1

#include <stdint.h>
+#include <atomic.h>
+#include <endian.h>


struct pthread_attr
@@ -141,9 +143,29 @@ struct pthread_key_struct
/* Semaphore variable structure. */
@ -1426,7 +1426,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -1426,7 +1426,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/internaltypes.h
+ unsigned int nwaiters;
+#endif
};

struct old_sem
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/powerpc/sem_post.c
===================================================================
@ -1509,9 +1509,9 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1509,9 +1509,9 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/sem_post.c
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -25,34 +25,78 @@

#include <shlib-compat.h>

+/* Wrapper for lll_futex_wake, with error checking.
+ TODO Remove when cleaning up the futex API throughout glibc. */
+static __always_inline void
@ -1544,7 +1544,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1544,7 +1544,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
{
struct new_sem *isem = (struct new_sem *) sem;
+ int private = isem->private;

- __typeof (isem->value) cur;
+#if __HAVE_64B_ATOMICS
+ /* Add a token to the semaphore. We use release MO to make sure that a
@ -1558,14 +1558,14 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1558,14 +1558,14 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
- cur = isem->value;
- if (isem->value == SEM_VALUE_MAX)
+ if ((d & SEM_VALUE_MASK) == SEM_VALUE_MAX)
{
__set_errno (EOVERFLOW);
return -1;
}
{
__set_errno (EOVERFLOW);
return -1;
}
}
- while (atomic_compare_and_exchange_bool_rel (&isem->value, cur + 1, cur));
+ while (!atomic_compare_exchange_weak_release (&isem->data, &d, d + 1));

- atomic_full_barrier ();
- if (isem->nwaiters > 0)
+ /* If there is any potentially blocked waiter, wake one of them. */
@ -1580,11 +1580,11 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1580,11 +1580,11 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
- isem->private ^ FUTEX_PRIVATE_FLAG);
- if (__builtin_expect (err, 0) < 0)
+ if ((v << SEM_VALUE_SHIFT) == SEM_VALUE_MAX)
{
{
- __set_errno (-err);
+ __set_errno (EOVERFLOW);
return -1;
}
return -1;
}
}
+ while (!atomic_compare_exchange_weak_release (&isem->value,
+ &v, v + (1 << SEM_VALUE_SHIFT)));
@ -1600,7 +1600,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c @@ -1600,7 +1600,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_post.c
@@ -65,6 +109,9 @@ __old_sem_post (sem_t *sem)
{
int *futex = (int *) sem;

+ /* We must need to synchronize with consumers of this token, so the atomic
+ increment must have release MO semantics. */
+ atomic_write_barrier ();
@ -1618,11 +1618,11 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -1618,11 +1618,11 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
+ Copyright (C) 2003-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Mackerras <paulus@au.ibm.com>, 2003.

@@ -17,42 +17,13 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

-#include <errno.h>
-#include <sysdep.h>
-#include <lowlevellock.h>
@ -1651,7 +1651,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -1651,7 +1651,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
- return err;
-}
+#include "sem_waitcommon.c"

+/* This is in a separate file because because sem_timedwait is only provided
+ if __USE_XOPEN2K is defined. */
int
@ -1662,13 +1662,13 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -1662,13 +1662,13 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
-
- if (atomic_decrement_if_positive (&isem->value) > 0)
- return 0;

if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
{
@@ -60,57 +31,8 @@ sem_timedwait (sem_t *sem, const struct
return -1;
}

- atomic_increment (&isem->nwaiters);
-
- pthread_cleanup_push (__sem_wait_cleanup, isem);
@ -1788,7 +1788,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c @@ -1788,7 +1788,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c
@@ -17,79 +17,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

-#include <errno.h>
-#include <sysdep.h>
-#include <lowlevellock.h>
@ -1823,7 +1823,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c @@ -1823,7 +1823,7 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c
- return err;
-}
+#include "sem_waitcommon.c"

int
__new_sem_wait (sem_t *sem)
{
@ -1864,13 +1864,13 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c @@ -1864,13 +1864,13 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/sem_wait.c
+ return __new_sem_wait_slow((struct new_sem *) sem, NULL);
}
versioned_symbol (libpthread, __new_sem_wait, sem_wait, GLIBC_2_1);

-
#if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_1)
int
attribute_compat_text_section
@@ -120,3 +59,34 @@ __old_sem_wait (sem_t *sem)

compat_symbol (libpthread, __old_sem_wait, sem_wait, GLIBC_2_0);
#endif
+
@ -3849,22 +3849,22 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/Makefile @@ -3849,22 +3849,22 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/Makefile
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/Makefile
@@ -24,8 +24,7 @@ libpthread-sysdep_routines += pt-fork pt

gen-as-const-headers += lowlevelcond.sym lowlevelrwlock.sym \
lowlevelbarrier.sym unwindbuf.sym \
lowlevelbarrier.sym unwindbuf.sym \
- lowlevelrobustlock.sym pthread-pi-defines.sym \
- structsem.sym
+ lowlevelrobustlock.sym pthread-pi-defines.sym
endif

ifeq ($(subdir),posix)
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
===================================================================
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -225,17 +225,18 @@ LLL_STUB_UNWIND_INFO_END


#define lll_futex_wake(futex, nr, private) \
- do { \
- int __ignore; \
@ -3875,23 +3875,23 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -3875,23 +3875,23 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
__asm __volatile ("syscall" \
- : "=a" (__ignore) \
+ : "=a" (__status) \
: "0" (SYS_futex), "D" (futex), \
"S" (__lll_private_flag (FUTEX_WAKE, private)), \
"d" (_nr) \
: "memory", "cc", "r10", "r11", "cx"); \
: "0" (SYS_futex), "D" (futex), \
"S" (__lll_private_flag (FUTEX_WAKE, private)), \
"d" (_nr) \
: "memory", "cc", "r10", "r11", "cx"); \
- } while (0)
+ __status; \
+ })


/* NB: in the lll_trylock macro we simply return the value in %eax
Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
===================================================================
--- glibc-2.17-c758a686.orig/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -224,20 +224,21 @@ LLL_STUB_UNWIND_INFO_END


#define lll_futex_wake(futex, nr, private) \
- do { \
- int __ignore; \
@ -3900,18 +3900,18 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -3900,18 +3900,18 @@ Index: glibc-2.17-c758a686/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
register __typeof (nr) _nr asm ("edx") = (nr); \
LIBC_PROBE (lll_futex_wake, 3, futex, nr, private); \
__asm __volatile (LLL_EBX_LOAD \
LLL_ENTER_KERNEL \
LLL_EBX_LOAD \
LLL_ENTER_KERNEL \
LLL_EBX_LOAD \
- : "=a" (__ignore) \
+ : "=a" (__status) \
: "0" (SYS_futex), LLL_EBX_REG (futex), \
"c" (__lll_private_flag (FUTEX_WAKE, private)), \
"d" (_nr), \
"i" (0) /* phony, to align next arg's number */, \
"i" (offsetof (tcbhead_t, sysinfo))); \
: "0" (SYS_futex), LLL_EBX_REG (futex), \
"c" (__lll_private_flag (FUTEX_WAKE, private)), \
"d" (_nr), \
"i" (0) /* phony, to align next arg's number */, \
"i" (offsetof (tcbhead_t, sysinfo))); \
- } while (0)
+ __status; \
+ })


/* NB: in the lll_trylock macro we simply return the value in %eax

16
SOURCES/glibc-rh1028652.patch

@ -5,35 +5,35 @@ @@ -5,35 +5,35 @@
# commit f7c399cff5bd04ee9dc117fb6b0f39597dc047c6
# Author: Alan Modra <amodra@gmail.com>
# Date: Sat Aug 17 18:37:18 2013 +0930
#
#
# PowerPC SIGSTKSZ
# http://sourceware.org/ml/libc-alpha/2013-08/msg00093.html
#
#
# This copies the sparc version of sigstack.h, which gives powerpc
# #define MINSIGSTKSZ 4096
# #define SIGSTKSZ 16384
#
#
# Before the VSX changes, struct rt_sigframe size was 1920 plus 128 for
# __SIGNAL_FRAMESIZE giving ppc64 exactly the default MINSIGSTKSZ of
# 2048.
#
#
# After VSX, ucontext increased by 256 bytes. Oops, we're over
# MINSIGSTKSZ, so powerpc has been using the wrong value for quite a
# while. Add another ucontext for TM and rt_sigframe is now at 3872,
# giving actual MINSIGSTKSZ of 4000.
#
#
# The glibc testcase that I was looking at was tst-cancel21, which
# allocates 2*SIGSTKSZ (not because the test is trying to be
# conservative, but because the test actually has nested signal stack
# frames). We blew the allocation by 48 bytes when using current
# mainline gcc to compile glibc (le ppc64).
#
#
# The required stack depth in _dl_lookup_symbol_x from the top of the
# next signal frame was 10944 bytes. I guess you'd want to add 288 to
# that, implying an actual SIGSTKSZ of 11232.
#
#
# * sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h: New file.
#
#
diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/bits/sigstack.h
new file mode 100644
index 0000000..33be9e8

42
SOURCES/glibc-rh1032435.patch

@ -3,12 +3,12 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com> @@ -3,12 +3,12 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Wed Oct 30 16:13:37 2013 +0530

Fix reads for sizes larger than INT_MAX in AF_INET lookup

Currently for AF_INET lookups from the hosts file, buffer sizes larger
than INT_MAX silently overflow and may result in access beyond bounds
of a buffer. This happens when the number of results in an AF_INET
lookup in /etc/hosts are very large.

There are two aspects to the problem. One problem is that the size
computed from the buffer size is stored into an int, which results in
overflow for large sizes. Additionally, even if this size was
@ -45,7 +45,7 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c @@ -45,7 +45,7 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
}
-/* Parsing the database file into `struct STRUCTURE' data structures. */

+typedef enum
+{
+ gcr_ok = 0,
@ -94,7 +94,7 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c @@ -94,7 +94,7 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
+/* Parsing the database file into `struct STRUCTURE' data structures. */
static enum nss_status
internal_getent (struct STRUCTURE *result,
char *buffer, size_t buflen, int *errnop H_ERRNO_PROTO
char *buffer, size_t buflen, int *errnop H_ERRNO_PROTO
@@ -188,7 +233,7 @@
{
char *p;
@ -102,39 +102,39 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c @@ -102,39 +102,39 @@ diff -u b/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
- int linebuflen = buffer + buflen - data->linebuffer;
+ size_t linebuflen = buffer + buflen - data->linebuffer;
int parse_result;

if (buflen < sizeof *data + 2)
@@ -200,17 +245,16 @@

do
{
- /* Terminate the line so that we can test for overflow. */
- ((unsigned char *) data->linebuffer)[linebuflen - 1] = '\xff';
+ get_contents_ret r = get_contents (data->linebuffer, linebuflen, stream);

- p = fgets_unlocked (data->linebuffer, linebuflen, stream);
- if (p == NULL)
+ if (r == gcr_error)
{
/* End of file or read error. */
H_ERRNO_SET (HOST_NOT_FOUND);
return NSS_STATUS_NOTFOUND;
}
{
/* End of file or read error. */
H_ERRNO_SET (HOST_NOT_FOUND);
return NSS_STATUS_NOTFOUND;
}
- else if (((unsigned char *) data->linebuffer)[linebuflen - 1] != 0xff)
+
+ if (r == gcr_overflow)
{
/* The line is too long. Give the user the opportunity to
enlarge the buffer. */
{
/* The line is too long. Give the user the opportunity to
enlarge the buffer. */
@@ -219,7 +263,8 @@
return NSS_STATUS_TRYAGAIN;
}

return NSS_STATUS_TRYAGAIN;
}
- /* Skip leading blanks. */
+ /* Everything OK. Now skip leading blanks. */
+ p = data->linebuffer;
while (isspace (*p))
++p;
++p;
}

diff a/nss/bug17079.c b/nss/bug17079.c
@ -382,9 +382,9 @@ diff a/nss/Makefile b/nss/Makefile @@ -382,9 +382,9 @@ diff a/nss/Makefile b/nss/Makefile
+++ b/nss/Makefile
@@ -39,6 +39,6 @@
extra-objs += $(makedb-modules:=.o)

-tests = test-netdb tst-nss-test1
+tests = test-netdb tst-nss-test1 bug17079
xtests = bug-erange

include ../Makeconfig

12
SOURCES/glibc-rh1039496.patch

@ -4,10 +4,10 @@ diff -urNglibc-2.17-c758a686/libio/tst-widetext.inputglibc-2.17-c758a686/libio/t @@ -4,10 +4,10 @@ diff -urNglibc-2.17-c758a686/libio/tst-widetext.inputglibc-2.17-c758a686/libio/t
@@ -126,7 +126,7 @@
઀◌઄અઆઇઈઉઊઋઌઍ઎એઐઑ઒ઓઔકખગઘઙચછજઝઞટઠડઢણતથદધન઩પફબભમયર઱લળ઴વશષસહ઺઻◌િ
૆◌૎૏ૐ૑૒૓૔૕૖૗૘૙૚૛૜૝૞૟ૠૡ૤૥૦૧૨૩૪૫૬૭૮૯૰૱૲૳૴૵૶૷૸ૹ૿

-Oriya (U+0B00-U+0B7F):
+Odia (U+0B00-U+0B7F):

଀◌଄ଅଆଇଈଉଊଋଌ଍଎ଏଐ଑଒ଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନ଩ପଫବଭମଯର଱ଲଳ଴ଵଶଷସହ଺଻◌ି
୅୆୉୊୎୏୐୑୒୓୔୘୙୚୛ଡ଼ଢ଼୞ୟୠୡ୤୥୦୧୨୩୪୫୬୭୮୯୰ୱ୲୳୴୵୶୷୸୹୺୻୼୽୾୿
diff -urNglibc-2.17-c758a686/locale/iso-639.defglibc-2.17-c758a686/locale/iso-639.def
@ -67,11 +67,11 @@ diff -urNglibc-2.17-c758a686/localedata/locales/or_INglibc-2.17-c758a686/localed @@ -67,11 +67,11 @@ diff -urNglibc-2.17-c758a686/localedata/locales/or_INglibc-2.17-c758a686/localed
@@ -1,19 +1,19 @@
comment_char %
escape_char /

-% Oriya locale for India.
+% Odia locale for India.
% Contributed by Masahide Washizawa <washi at jp ibm com>

%%%%%%%%%%%%%
LC_IDENTIFICATION
-title "Oriya language locale for India"
@ -90,11 +90,11 @@ diff -urNglibc-2.17-c758a686/localedata/locales/or_INglibc-2.17-c758a686/localed @@ -90,11 +90,11 @@ diff -urNglibc-2.17-c758a686/localedata/locales/or_INglibc-2.17-c758a686/localed
@@ -35,10 +35,10 @@
LC_CTYPE
copy "i18n"

-% Oriya uses the alternate digits U+0B66..U+0B6F
+% Odia uses the alternate digits U+0B66..U+0B6F
outdigit <U0B66>..<U0B6F>

-% This is used in the scanf family of functions to read Oriya numbers
+% This is used in the scanf family of functions to read Odia numbers
% using "%Id" and such.

26
SOURCES/glibc-rh1039970.patch

@ -10,7 +10,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -10,7 +10,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
@@ -65,6 +65,55 @@ struct dataset
char strdata[0];
};

+/* Sends a notfound message and prepares a notfound dataset to write to the
+ cache. Returns true if there was enough memory to allocate the dataset and
+ returns the dataset in DATASETP, total bytes to write in TOTALP and the
@ -60,7 +60,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -60,7 +60,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
+ *datasetp = dataset;
+ return cacheable;
+}

static time_t
addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
@@ -84,6 +133,7 @@ addgetnetgrentX (struct database_dyn *db
@ -68,7 +68,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -68,7 +68,7 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
bool cacheable = false;
ssize_t total;
+ bool found = false;

char *key_copy = NULL;
struct __netgrent data;
@@ -103,35 +153,8 @@ addgetnetgrentX (struct database_dyn *db
@ -108,19 +108,19 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -108,19 +108,19 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
+ &key_copy);
goto writeout;
}

@@ -167,6 +190,7 @@ addgetnetgrentX (struct database_dyn *db

if (status == NSS_STATUS_SUCCESS)
{
if (status == NSS_STATUS_SUCCESS)
{
+ found = true;
union
{
enum nss_status (*f) (struct __netgrent *, char *, size_t,
union
{
enum nss_status (*f) (struct __netgrent *, char *, size_t,
@@ -325,6 +349,15 @@ addgetnetgrentX (struct database_dyn *db
}
}
}

+ /* No results. Return a failure and write out a notfound record in the
+ cache. */
+ if (!found)
@ -131,5 +131,5 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -131,5 +131,5 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
+ }
+
total = buffilled;

/* Fill in the dataset. */

12
SOURCES/glibc-rh1046199.patch

@ -8,9 +8,9 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -8,9 +8,9 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
--- glibc-2.17-c758a686/nscd/netgroupcache.c 2013-12-20 04:38:40.432000000 -0500
+++ glibc-2.17-c758a686/nscd/netgroupcache.c 2013-12-20 04:37:29.945000000 -0500
@@ -204,9 +204,10 @@ addgetnetgrentX (struct database_dyn *db
int e;
status = getfct.f (&data, buffer + buffilled,
buflen - buffilled, &e);
int e;
status = getfct.f (&data, buffer + buffilled,
buflen - buffilled, &e);
- if (status == NSS_STATUS_RETURN)
- /* This was the last one for this group. Look
- at next group if available. */
@ -18,6 +18,6 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net @@ -18,6 +18,6 @@ diff -pruN glibc-2.17-c758a686/nscd/netgroupcache.c glibc-2.17-c758a686/nscd/net
+ || status == NSS_STATUS_NOTFOUND)
+ /* This was either the last one for this group or the
+ group was empty. Look at next group if available. */
break;
if (status == NSS_STATUS_SUCCESS)
{
break;
if (status == NSS_STATUS_SUCCESS)
{

12
SOURCES/glibc-rh1047983.patch

@ -3,7 +3,7 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com> @@ -3,7 +3,7 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Thu Nov 28 17:18:12 2013 +0530

Get canonical name in getaddrinfo from hosts file for AF_INET (fixes 16077)

AF_INET lookup in hosts file uses _nss_files_gethostbyname2_r, which
is not capable of returning a canonical name if it has found one.
This change adds _nss_files_gethostbyname3_r, which wraps around
@ -29,7 +29,7 @@ index 6db2535..957c9aa 100644 @@ -29,7 +29,7 @@ index 6db2535..957c9aa 100644
@@ -97,262 +97,12 @@ LINE_PARSER
STRING_FIELD (result->h_name, isspace, 1);
})

-
-
-#define HOST_DB_LOOKUP(name, keysize, keypattern, break_if_match, proto...) \
@ -273,7 +273,7 @@ index 6db2535..957c9aa 100644 @@ -273,7 +273,7 @@ index 6db2535..957c9aa 100644
- LOOKUP_NAME_CASE (h_name, h_aliases)
- }, const char *name)
#undef EXTRA_ARGS_VALUE

-
-/* XXX Is using _res to determine whether we want to convert IPv4 addresses
- to IPv6 addresses really the right thing to do? */
@ -290,9 +290,9 @@ index 6db2535..957c9aa 100644 @@ -290,9 +290,9 @@ index 6db2535..957c9aa 100644
gethostbyaddr() function is an IPv6 address. */
#define EXTRA_ARGS_VALUE \
@@ -365,6 +115,263 @@ DB_LOOKUP (hostbyaddr, ,,,
}, const void *addr, socklen_t len, int af)
}, const void *addr, socklen_t len, int af)
#undef EXTRA_ARGS_VALUE

+enum nss_status
+_nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
+ char *buffer, size_t buflen, int *errnop,
@ -550,6 +550,6 @@ index 6db2535..957c9aa 100644 @@ -550,6 +550,6 @@ index 6db2535..957c9aa 100644
+ return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
+ errnop, herrnop, NULL, NULL);
+}

enum nss_status
_nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,

24
SOURCES/glibc-rh1048036.patch

@ -3,18 +3,18 @@ index 87d3cdc..877fc1f 100644 @@ -3,18 +3,18 @@ index 87d3cdc..877fc1f 100644
--- glibc-2.17-c758a686/libio/wfileops.c
+++ glibc-2.17-c758a686/libio/wfileops.c
@@ -715,7 +715,7 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
- fp->_wide_data->_IO_write_base) / clen;
else
{
- fp->_wide_data->_IO_write_base) / clen;
else
{
- enum __codecvt_result status;
+ enum __codecvt_result status = __codecvt_ok;
delta = (fp->_wide_data->_IO_write_ptr
- fp->_wide_data->_IO_write_base);
const wchar_t *write_base = fp->_wide_data->_IO_write_base;
delta = (fp->_wide_data->_IO_write_ptr
- fp->_wide_data->_IO_write_base);
const wchar_t *write_base = fp->_wide_data->_IO_write_base;
@@ -728,9 +728,12 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
flush buffers for every ftell. */
do
{
flush buffers for every ftell. */
do
{
- /* Ugh, no point trying to avoid the flush. Just do it
- and go back to how it was with the read mode. */
- if (delta > 0 && new_write_ptr == fp->_IO_buf_end)
@ -24,6 +24,6 @@ index 87d3cdc..877fc1f 100644 @@ -24,6 +24,6 @@ index 87d3cdc..877fc1f 100644
+ the read mode. */
+ if (status == __codecvt_partial
+ || (delta > 0 && new_write_ptr == fp->_IO_buf_end))
{
if (_IO_switch_to_wget_mode (fp))
return WEOF;
{
if (_IO_switch_to_wget_mode (fp))
return WEOF;

198
SOURCES/glibc-rh1048123.patch

@ -9,14 +9,14 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com> @@ -9,14 +9,14 @@ Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Mon Mar 3 22:51:39 2014 +0530

nscd: Improved support for tracking startup failure in nscd service (BZ #16639)

Currently, the nscd parent process parses commandline options and
configuration, forks on startup and immediately exits with a success.
If the child process encounters some error after this, it goes
undetected and any services started up after it may have to repeatedly
check to make sure that the nscd service did actually start up and is
serving requests.

To make this process more reliable, I have added a pipe between the
parent and child process, through which the child process sends a
notification to the parent informing it of its status. The parent
@ -25,7 +25,7 @@ Date: Mon Mar 3 22:51:39 2014 +0530 @@ -25,7 +25,7 @@ Date: Mon Mar 3 22:51:39 2014 +0530
status (0), the parent exits with a success status. Similarly for
error conditions, the child sends the non-zero status code, which the
parent passes on as the exit code.

This, along with setting the nscd service type to forking in its
systemd configuration file, allows systemd to be certain that the nscd
service is ready and is accepting connections.
@ -36,26 +36,26 @@ index f463f45..180ae77 100644 @@ -36,26 +36,26 @@ index f463f45..180ae77 100644
--- glibc-2.17-c758a686/nscd/connections.c
+++ glibc-2.17-c758a686/nscd/connections.c
@@ -649,8 +649,8 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
close (fd);
}
else if (errno == EACCES)
close (fd);
}
else if (errno == EACCES)
- error (EXIT_FAILURE, 0, _("cannot access '%s'"),
- dbs[cnt].db_filename);
+ do_exit (EXIT_FAILURE, 0, _("cannot access '%s'"),
+ dbs[cnt].db_filename);
}

if (dbs[cnt].head == NULL)
}
if (dbs[cnt].head == NULL)
@@ -699,8 +699,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
{
dbg_log (_("database for %s corrupted or simultaneously used; remove %s manually if necessary and restart"),
dbnames[cnt], dbs[cnt].db_filename);
{
dbg_log (_("database for %s corrupted or simultaneously used; remove %s manually if necessary and restart"),
dbnames[cnt], dbs[cnt].db_filename);
- // XXX Correct way to terminate?
- exit (1);
+ do_exit (1, 0, NULL);
}

if (dbs[cnt].persistent)
}
if (dbs[cnt].persistent)
@@ -867,7 +866,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
if (sock < 0)
{
@ -72,83 +72,83 @@ index f463f45..180ae77 100644 @@ -72,83 +72,83 @@ index f463f45..180ae77 100644
- exit (errno == EACCES ? 4 : 1);
+ do_exit (errno == EACCES ? 4 : 1, 0, NULL);
}

#ifndef __ASSUME_SOCK_CLOEXEC
@@ -888,7 +887,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
{
dbg_log (_("cannot change socket to nonblocking mode: %s"),
strerror (errno));
{
dbg_log (_("cannot change socket to nonblocking mode: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}

}
/* The descriptor needs to be closed on exec. */
@@ -896,7 +895,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
}
#endif
@@ -909,7 +908,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
{
dbg_log (_("cannot enable socket to accept connections: %s"),
strerror (errno));
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}

#ifdef HAVE_NETLINK
@@ -953,7 +952,7 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
dbg_log (_("\
dbg_log (_("\
cannot change socket to nonblocking mode: %s"),
strerror (errno));
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}

/* The descriptor needs to be closed on exec. */
}
/* The descriptor needs to be closed on exec. */
@@ -962,7 +961,7 @@ cannot change socket to nonblocking mode: %s"),
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
}
}
# endif
@@ -2392,7 +2391,7 @@ start_threads (void)
if (pthread_cond_init (&dbs[i].prune_cond, &condattr) != 0)
{
dbg_log (_("could not initialize conditional variable"));
{
dbg_log (_("could not initialize conditional variable"));
- exit (1);
+ do_exit (1, 0, NULL);
}

}
pthread_t th;
@@ -2400,7 +2399,7 @@ start_threads (void)
&& pthread_create (&th, &attr, nscd_run_prune, (void *) i) != 0)
{
dbg_log (_("could not start clean-up thread; terminating"));
&& pthread_create (&th, &attr, nscd_run_prune, (void *) i) != 0)
{
dbg_log (_("could not start clean-up thread; terminating"));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
}

@@ -2414,13 +2413,17 @@ start_threads (void)
if (i == 0)
{
dbg_log (_("could not start any worker thread; terminating"));
if (i == 0)
{
dbg_log (_("could not start any worker thread; terminating"));
- exit (1);
+ do_exit (1, 0, NULL);
}

break;
}
}
break;
}
}

+ /* Now it is safe to let the parent know that we're doing fine and it can
+ exit. */
+ notify_parent (0);
@ -165,7 +165,7 @@ index f463f45..180ae77 100644 @@ -165,7 +165,7 @@ index f463f45..180ae77 100644
+ do_exit (EXIT_FAILURE, 0,
+ _("Failed to run nscd as user '%s'"), server_user);
}

server_uid = pwd->pw_uid;
@@ -2483,7 +2486,8 @@ begin_drop_privileges (void)
{
@ -175,7 +175,7 @@ index f463f45..180ae77 100644 @@ -175,7 +175,7 @@ index f463f45..180ae77 100644
+ do_exit (EXIT_FAILURE, errno,
+ _("initial getgrouplist failed"));
}

server_groups = (gid_t *) xmalloc (server_ngroups * sizeof (gid_t));
@@ -2492,7 +2496,7 @@ begin_drop_privileges (void)
== -1)
@ -185,7 +185,7 @@ index f463f45..180ae77 100644 @@ -185,7 +185,7 @@ index f463f45..180ae77 100644
+ do_exit (EXIT_FAILURE, errno, _("getgrouplist failed"));
}
}

@@ -2510,7 +2514,7 @@ finish_drop_privileges (void)
if (setgroups (server_ngroups, server_groups) == -1)
{
@ -193,7 +193,7 @@ index f463f45..180ae77 100644 @@ -193,7 +193,7 @@ index f463f45..180ae77 100644
- error (EXIT_FAILURE, errno, _("setgroups failed"));
+ do_exit (EXIT_FAILURE, errno, _("setgroups failed"));
}

int res;
@@ -2521,8 +2525,7 @@ finish_drop_privileges (void)
if (res == -1)
@ -203,7 +203,7 @@ index f463f45..180ae77 100644 @@ -203,7 +203,7 @@ index f463f45..180ae77 100644
- exit (4);
+ do_exit (4, errno, "setgid");
}

if (paranoia)
@@ -2532,8 +2535,7 @@ finish_drop_privileges (void)
if (res == -1)
@ -213,7 +213,7 @@ index f463f45..180ae77 100644 @@ -213,7 +213,7 @@ index f463f45..180ae77 100644
- exit (4);
+ do_exit (4, errno, "setuid");
}

#if defined HAVE_LIBAUDIT && defined HAVE_LIBCAP
diff --git glibc-2.17-c758a686/nscd/nscd.c glibc-2.17-c758a686/nscd/nscd.c
index 63d9d83..5680378 100644
@ -225,39 +225,39 @@ index 63d9d83..5680378 100644 @@ -225,39 +225,39 @@ index 63d9d83..5680378 100644
#include <sys/un.h>
+#include <sys/wait.h>
+#include <stdarg.h>

#include "dbg_log.h"
#include "nscd.h"
@@ -101,6 +103,7 @@ gid_t old_gid;

static int check_pid (const char *file);
static int write_pid (const char *file);
+static int monitor_child (int fd);

/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
@@ -142,6 +145,7 @@ static struct argp argp =

/* True if only statistics are requested. */
static bool get_stats;
+static int parent_fd = -1;

int
main (int argc, char **argv)
@@ -196,11 +200,27 @@ main (int argc, char **argv)
/* Behave like a daemon. */
if (run_mode == RUN_DAEMONIZE)
{
{
+ int fd[2];
+
+ if (pipe (fd) != 0)
+ error (EXIT_FAILURE, errno,
+ _("cannot create a pipe to talk to the child"));
+
pid = fork ();
if (pid == -1)
error (EXIT_FAILURE, errno, _("cannot fork"));
if (pid != 0)
pid = fork ();
if (pid == -1)
error (EXIT_FAILURE, errno, _("cannot fork"));
if (pid != 0)
- exit (0);
+ {
+ /* The parent only reads from the child. */
@ -270,27 +270,27 @@ index 63d9d83..5680378 100644 @@ -270,27 +270,27 @@ index 63d9d83..5680378 100644
+ close (fd[0]);
+ parent_fd = fd[1];
+ }
}

}
int nullfd = open (_PATH_DEVNULL, O_RDWR);
@@ -242,7 +262,8 @@ main (int argc, char **argv)
char *endp;
long int fdn = strtol (dirent->d_name, &endp, 10);

char *endp;
long int fdn = strtol (dirent->d_name, &endp, 10);
- if (*endp == '\0' && fdn != dfdn && fdn >= min_close_fd)
+ if (*endp == '\0' && fdn != dfdn && fdn >= min_close_fd
+ && fdn != parent_fd)
close ((int) fdn);
}

close ((int) fdn);
}
@@ -250,22 +271,14 @@ main (int argc, char **argv)
}
}
else
for (i = min_close_fd; i < getdtablesize (); i++)
for (i = min_close_fd; i < getdtablesize (); i++)
- close (i);
+ if (i != parent_fd)
+ close (i);

- if (run_mode == RUN_DAEMONIZE)
- {
- pid = fork ();
@ -301,17 +301,17 @@ index 63d9d83..5680378 100644 @@ -301,17 +301,17 @@ index 63d9d83..5680378 100644
- }
-
setsid ();

if (chdir ("/") != 0)
- error (EXIT_FAILURE, errno,
- _("cannot change current working directory to \"/\""));
+ do_exit (EXIT_FAILURE, errno,
+ _("cannot change current working directory to \"/\""));

openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);

@@ -592,3 +614,79 @@ write_pid (const char *file)

return result;
}
+
@ -400,7 +400,7 @@ index 972f462..529b3f5 100644 @@ -400,7 +400,7 @@ index 972f462..529b3f5 100644
extern int nscd_open_socket (void);
+void notify_parent (int child_ret);
+void do_exit (int child_ret, int errnum, const char *format, ...);

/* connections.c */
extern void nscd_init (void);
diff --git glibc-2.17-c758a686/nscd/selinux.c glibc-2.17-c758a686/nscd/selinux.c
@ -415,15 +415,15 @@ index e477254..46b0ea9 100644 @@ -415,15 +415,15 @@ index e477254..46b0ea9 100644
+ do_exit (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed"));
/* NOTREACHED */
}

@@ -194,7 +194,7 @@ preserve_capabilities (void)
cap_free (tmp_caps);

cap_free (tmp_caps);
dbg_log (_("Failed to initialize drop of capabilities"));
- error (EXIT_FAILURE, 0, _("cap_init failed"));
+ do_exit (EXIT_FAILURE, 0, _("cap_init failed"));
}

/* There is no reason why these should not work. */
@@ -216,7 +216,7 @@ preserve_capabilities (void)
{
@ -432,7 +432,7 @@ index e477254..46b0ea9 100644 @@ -432,7 +432,7 @@ index e477254..46b0ea9 100644
- error (EXIT_FAILURE, 0, _("cap_set_proc failed"));
+ do_exit (EXIT_FAILURE, 0, _("cap_set_proc failed"));
}

return new_caps;
@@ -233,7 +233,7 @@ install_real_capabilities (cap_t new_caps)
{
@ -442,7 +442,7 @@ index e477254..46b0ea9 100644 @@ -442,7 +442,7 @@ index e477254..46b0ea9 100644
+ do_exit (EXIT_FAILURE, 0, _("cap_set_proc failed"));
/* NOTREACHED */
}

@@ -242,7 +242,7 @@ install_real_capabilities (cap_t new_caps)
if (prctl (PR_SET_KEEPCAPS, 0) == -1)
{
@ -460,28 +460,28 @@ index e477254..46b0ea9 100644 @@ -460,28 +460,28 @@ index e477254..46b0ea9 100644
+ do_exit (EXIT_FAILURE, 0, NULL);
}
}

@@ -272,7 +272,7 @@ avc_create_thread (void (*run) (void))
rc =
pthread_create (&avc_notify_thread, NULL, (void *(*) (void *)) run, NULL);
if (rc != 0)
- error (EXIT_FAILURE, rc, _("Failed to start AVC thread"));
+ do_exit (EXIT_FAILURE, rc, _("Failed to start AVC thread"));

return &avc_notify_thread;
}
@@ -294,7 +294,7 @@ avc_alloc_lock (void)

avc_mutex = malloc (sizeof (pthread_mutex_t));
if (avc_mutex == NULL)
- error (EXIT_FAILURE, errno, _("Failed to create AVC lock"));
+ do_exit (EXIT_FAILURE, errno, _("Failed to create AVC lock"));
pthread_mutex_init (avc_mutex, NULL);

return avc_mutex;
@@ -334,7 +334,7 @@ nscd_avc_init (void)
avc_entry_ref_init (&aeref);

if (avc_init ("avc", NULL, &log_cb, &thread_cb, &lock_cb) < 0)
- error (EXIT_FAILURE, errno, _("Failed to start AVC"));
+ do_exit (EXIT_FAILURE, errno, _("Failed to start AVC"));
@ -496,7 +496,7 @@ index e477254..46b0ea9 100644 @@ -496,7 +496,7 @@ index e477254..46b0ea9 100644
[Unit]
Description=Name Service Cache Daemon
After=syslog.target

[Service]
+Type=forking
EnvironmentFile=-/etc/sysconfig/nscd
@ -510,6 +510,6 @@ index e477254..46b0ea9 100644 @@ -510,6 +510,6 @@ index e477254..46b0ea9 100644
ExecReload=/usr/sbin/nscd -i netgroup
Restart=always
+PIDFile=/run/nscd/nscd.pid

[Install]
WantedBy=multi-user.target

78
SOURCES/glibc-rh1063681.patch

@ -3,9 +3,9 @@ index 22dbcae..488ee51 100644 @@ -3,9 +3,9 @@ index 22dbcae..488ee51 100644
--- glibc-2.17-c758a686/libio/Makefile
+++ glibc-2.17-c758a686/libio/Makefile
@@ -60,7 +60,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
tst-wmemstream1 tst-wmemstream2 \
bug-memstream1 bug-wmemstream1 \
tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
- tst-fwrite-error
+ tst-fwrite-error tst-ftell-active-handler
ifeq (yes,$(build-shared))
@ -18,7 +18,7 @@ index a3499be..2e7bc8d 100644 @@ -18,7 +18,7 @@ index a3499be..2e7bc8d 100644
@@ -929,6 +929,93 @@ _IO_file_sync_mmap (_IO_FILE *fp)
return 0;
}

+/* Get the current file offset using a system call. This is the safest method
+ to get the current file offset, since we are sure that we get the current
+ state of the file. Before the stream handle is activated (by using fread,
@ -106,7 +106,7 @@ index a3499be..2e7bc8d 100644 @@ -106,7 +106,7 @@ index a3499be..2e7bc8d 100644
+ return result;
+}
+

_IO_off64_t
_IO_new_file_seekoff (fp, offset, dir, mode)
@@ -940,6 +1027,13 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
@ -125,8 +125,8 @@ index a3499be..2e7bc8d 100644 @@ -125,8 +125,8 @@ index a3499be..2e7bc8d 100644
int must_be_exact = (fp->_IO_read_base == fp->_IO_read_end
@@ -948,9 +1042,6 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
bool was_writing = (fp->_IO_write_ptr > fp->_IO_write_base
|| _IO_in_put_mode (fp));

|| _IO_in_put_mode (fp));
- if (mode == 0)
- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
-
@ -140,7 +140,7 @@ index a3499be..2e7bc8d 100644 @@ -140,7 +140,7 @@ index a3499be..2e7bc8d 100644
- else if (was_writing && _IO_switch_to_get_mode (fp))
+ if (was_writing && _IO_switch_to_get_mode (fp))
return EOF;

if (fp->_IO_buf_base == NULL)
@@ -978,30 +1069,10 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
{
@ -157,7 +157,7 @@ index a3499be..2e7bc8d 100644 @@ -157,7 +157,7 @@ index a3499be..2e7bc8d 100644
- offset -= fp->_IO_read_end - fp->_IO_write_ptr;
- }
+ offset -= fp->_IO_read_end - fp->_IO_read_ptr;

if (fp->_offset == _IO_pos_BAD)
- {
- if (mode != 0)
@ -178,7 +178,7 @@ index a3499be..2e7bc8d 100644 @@ -178,7 +178,7 @@ index a3499be..2e7bc8d 100644
@@ -1028,10 +1099,6 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
}
/* At this point, dir==_IO_seek_set. */

- /* If we are only interested in the current position we've found it now. */
- if (mode == 0)
- return offset;
@ -199,7 +199,7 @@ index 066ff19..3f266f7 100644 @@ -199,7 +199,7 @@ index 066ff19..3f266f7 100644
- call _IO_file_attach or else it will allocate a buffer immediately. */
_IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd,
#ifdef _G_HAVE_MMAP
(use_mmap && (read_write & _IO_NO_WRITES))
(use_mmap && (read_write & _IO_NO_WRITES))
@@ -159,13 +156,12 @@ _IO_new_fdopen (fd, mode)
#if !_IO_UNIFIED_JUMPTABLES
new_f->fp.vtable = NULL;
@ -218,14 +218,14 @@ index 066ff19..3f266f7 100644 @@ -218,14 +218,14 @@ index 066ff19..3f266f7 100644
+ valid offset. */
+ new_f->fp.file._fileno = fd;
new_f->fp.file._flags &= ~_IO_DELETE_DONT_CLOSE;

_IO_mask_flags (&new_f->fp.file, read_write,
diff --git glibc-2.17-c758a686/libio/iofwide.c glibc-2.17-c758a686/libio/iofwide.c
index 5cff632..64187e4 100644
--- glibc-2.17-c758a686/libio/iofwide.c
+++ glibc-2.17-c758a686/libio/iofwide.c
@@ -199,12 +199,6 @@ _IO_fwide (fp, mode)

/* From now on use the wide character callback functions. */
((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
-
@ -235,7 +235,7 @@ index 5cff632..64187e4 100644 @@ -235,7 +235,7 @@ index 5cff632..64187e4 100644
- which allows the functions without knowing the position. */
- fp->_offset = _IO_SYSSEEK (fp, 0, _IO_seek_cur);
}

/* Set the mode now. */
diff --git glibc-2.17-c758a686/libio/libioP.h glibc-2.17-c758a686/libio/libioP.h
index 4ca723c..8a7b85b 100644
@ -246,9 +246,9 @@ index 4ca723c..8a7b85b 100644 @@ -246,9 +246,9 @@ index 4ca723c..8a7b85b 100644
extern void _IO_unsave_wmarkers (_IO_FILE *) __THROW;
extern unsigned _IO_adjust_wcolumn (unsigned, const wchar_t *, int) __THROW;
+extern _IO_off64_t get_file_offset (_IO_FILE *fp);

/* Marker-related function. */

diff --git glibc-2.17-c758a686/libio/tst-ftell-active-handler.c glibc-2.17-c758a686/libio/tst-ftell-active-handler.c
new file mode 100644
index 0000000..175e904
@ -646,7 +646,7 @@ index 9cebe77..8b2e108 100644 @@ -646,7 +646,7 @@ index 9cebe77..8b2e108 100644
@@ -596,29 +596,25 @@ done:
return 0;
}

-_IO_off64_t
-_IO_wfile_seekoff (fp, offset, dir, mode)
- _IO_FILE *fp;
@ -669,7 +669,7 @@ index 9cebe77..8b2e108 100644 @@ -669,7 +669,7 @@ index 9cebe77..8b2e108 100644
- == fp->_wide_data->_IO_write_ptr));
+ _IO_off64_t result, offset = 0;
+ bool use_cached_offset = false;

- bool was_writing = ((fp->_wide_data->_IO_write_ptr
- > fp->_wide_data->_IO_write_base)
- || _IO_in_put_mode (fp));
@ -687,12 +687,12 @@ index 9cebe77..8b2e108 100644 @@ -687,12 +687,12 @@ index 9cebe77..8b2e108 100644
+ || _IO_in_put_mode (fp));
+
/* XXX For wide stream with backup store it is not very
reasonable to determine the offset. The pushed-back
character might require a state change and we need not be
reasonable to determine the offset. The pushed-back
character might require a state change and we need not be
@@ -633,14 +629,142 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
return -1;
}

return -1;
}
- /* There is no more data in the backup buffer. We can
- switch back. */
- _IO_switch_to_main_wget_area (fp);
@ -769,8 +769,8 @@ index 9cebe77..8b2e108 100644 @@ -769,8 +769,8 @@ index 9cebe77..8b2e108 100644
+ /* _IO_read_end coincides with fp._offset, so the actual file
+ position is fp._offset - (_IO_read_end - new_write_ptr). */
+ offset -= fp->_IO_read_end - fp->_IO_write_ptr;
}

}
- dir = _IO_seek_cur, offset = 0; /* Don't move any pointers. */
+ /* It is safe to use the cached offset when available if there is
+ unbuffered data (indicating that the file handle is active) and
@ -791,7 +791,7 @@ index 9cebe77..8b2e108 100644 @@ -791,7 +791,7 @@ index 9cebe77..8b2e108 100644
+ == (_IO_IS_APPENDING | _IO_NO_READS)
+ && was_writing));
}

+ if (use_cached_offset)
+ result = fp->_offset;
+ else
@ -843,20 +843,20 @@ index 9cebe77..8b2e108 100644 @@ -843,20 +843,20 @@ index 9cebe77..8b2e108 100644
- else if (was_writing && _IO_switch_to_wget_mode (fp))
+ if (was_writing && _IO_switch_to_wget_mode (fp))
return WEOF;

if (fp->_wide_data->_IO_buf_base == NULL)
@@ -693,7 +817,6 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
{
int nread;

{
int nread;
- flushed:
delta = (fp->_wide_data->_IO_read_ptr
- fp->_wide_data->_IO_read_base);
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
delta = (fp->_wide_data->_IO_read_ptr
- fp->_wide_data->_IO_read_base);
fp->_wide_data->_IO_state = fp->_wide_data->_IO_last_state;
@@ -706,80 +829,9 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
}
}
offset -= fp->_IO_read_end - fp->_IO_read_base - nread;
}
}
- else
- {
- char *new_write_ptr = fp->_IO_write_ptr;
@ -918,7 +918,7 @@ index 9cebe77..8b2e108 100644 @@ -918,7 +918,7 @@ index 9cebe77..8b2e108 100644
- _IO_buf_base and this adjustment is for unbuffered output. */
- offset -= fp->_IO_read_end - new_write_ptr;
- }

if (fp->_offset == _IO_pos_BAD)
- {
- if (mode != 0)
@ -932,13 +932,13 @@ index 9cebe77..8b2e108 100644 @@ -932,13 +932,13 @@ index 9cebe77..8b2e108 100644
- }
- }
+ goto dumb;

/* Make offset absolute, assuming current pointer is file_ptr(). */
offset += fp->_offset;
@@ -802,10 +854,6 @@ _IO_wfile_seekoff (fp, offset, dir, mode)
}
/* At this point, dir==_IO_seek_set. */

- /* If we are only interested in the current position we've found it now. */
- if (mode == 0)
- return offset;

20
SOURCES/glibc-rh1064063.patch

@ -3,31 +3,31 @@ Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com> @@ -3,31 +3,31 @@ Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date: Mon Jan 11 17:24:04 2016 -0500

Fix race in tst-mqueue5

The check is done on line 117 by a thread spawned
from do_child(), forked from do_test(). This test
generates a signal in the forked process.

Either thread may handle the signal, and on ppc,
it happens to be done on do_child, on the thread
which is not doing the check on line 117.

This exposes a race condition whereby the test
incorrectly fails as the signal is caught during
or after the check.

This is mitigated by ensuring the signal is blocked
in the child thread while thread is running.

2016-01-15 Martin Sebor <msebor@redhat.com>

[BZ #19432]
[BZ #19432]
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index aa74fa3..25042bc 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -116,7 +116,7 @@ thr (void *arg)

if (rtmin_cnt != 2)
{
- puts ("SIGRTMIN signal in child did not arrive");
@ -38,7 +38,7 @@ index aa74fa3..25042bc 100644 @@ -38,7 +38,7 @@ index aa74fa3..25042bc 100644
@@ -403,6 +403,16 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
result = 1;
}

+ /* Ensure the thr thread gets the signal, not us. */
+ sigset_t set;
+ sigemptyset (&set);
@ -50,12 +50,12 @@ index aa74fa3..25042bc 100644 @@ -50,12 +50,12 @@ index aa74fa3..25042bc 100644
+ }
+
(void) pthread_barrier_wait (b2);

/* Parent calls mqsend (q), which should wake up mqrecv (q)
@@ -514,7 +524,14 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
result = 1;
}

- void *thr_ret;
+ /* Reenable test signals before cleaning up the thread. */
+ if (pthread_sigmask (SIG_UNBLOCK, &set, NULL))

22
SOURCES/glibc-rh1064066.patch

@ -2,31 +2,31 @@ @@ -2,31 +2,31 @@
+++ glibc-2.17-c758a686/math/libm-test.inc 2015-04-07 12:00:03.102360299 -0400
@@ -521,7 +521,8 @@
}


-static void __attribute__ ((noinline))
+/* Attributes work around suspected gcc 4.8 bug #1209619. */
+static void __attribute__ ((noclone, noinline))
check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
FLOAT max_ulp, int xfail, int exceptions,
FLOAT *curr_max_error)
FLOAT max_ulp, int xfail, int exceptions,
FLOAT *curr_max_error)
@@ -610,7 +611,8 @@
}


-static void __attribute__ ((noinline))
+/* Attributes work around suspected gcc 4.8 bug #1209619. */
+static void __attribute__ ((noclone, noinline))
check_float (const char *test_name, FLOAT computed, FLOAT expected,
FLOAT max_ulp, int xfail, int exceptions)
FLOAT max_ulp, int xfail, int exceptions)
{
@@ -619,7 +621,8 @@
}


-static void __attribute__ ((noinline))
+/* Attributes work around suspected gcc 4.8 bug #1209619. */
+static void __attribute__ ((noclone, noinline))
check_complex (const char *test_name, __complex__ FLOAT computed,
__complex__ FLOAT expected,
__complex__ FLOAT max_ulp, __complex__ int xfail,
__complex__ FLOAT expected,
__complex__ FLOAT max_ulp, __complex__ int xfail,

9
SOURCES/glibc-rh1064945.patch

@ -3,7 +3,7 @@ Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com> @@ -3,7 +3,7 @@ Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Jan 16 06:53:18 2014 -0600

PowerPC: Fix ftime gettimeofday internal call returning bogus data

This patches fixes BZ#16430 by setting a different symbol for internal
GLIBC calls that points to ifunc resolvers. For PPC32, if the symbol
is defined as hidden (which is the case for gettimeofday and time) the
@ -42,9 +42,9 @@ index 29a5e08..2085b68 100644 @@ -42,9 +42,9 @@ index 29a5e08..2085b68 100644
+}
+asm ("__GI___gettimeofday = __gettimeofday_vsyscall");
+#endif

#else

diff --git glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
index 089d0b6..023bc02 100644
--- glibc-2.17-c758a686/sysdeps/unix/sysv/linux/powerpc/time.c
@ -73,5 +73,6 @@ index 089d0b6..023bc02 100644 @@ -73,5 +73,6 @@ index 089d0b6..023bc02 100644
+}
+asm ("__GI_time = __time_vsyscall");
+#endif

#else

34
SOURCES/glibc-rh1067755.patch

@ -8,7 +8,7 @@ index 2b4fd9a..fba60bd 100644 @@ -8,7 +8,7 @@ index 2b4fd9a..fba60bd 100644
#include <stackguard-macros.h>
+#include <tls.h>
#include <unistd.h>

static const char *command;
diff --git glibc-2.17-c758a686/include/errno.h glibc-2.17-c758a686/include/errno.h
index 98c6080..f1b93a8 100644
@ -17,27 +17,27 @@ index 98c6080..f1b93a8 100644 @@ -17,27 +17,27 @@ index 98c6080..f1b93a8 100644
@@ -17,7 +17,7 @@
# define errno rtld_errno
extern int rtld_errno attribute_hidden;

-# else
+# elif !defined NOT_IN_libc || defined IN_LIB

# include <tls.h>

@@ -29,7 +29,7 @@ extern int rtld_errno attribute_hidden;
# endif
extern __thread int errno attribute_tls_model_ie;

-# endif /* RTLD_PRIVATE_ERRNO */
+# endif /* !NOT_IN_libc || IN_LIB */

# define __set_errno(val) (errno = (val))

diff --git glibc-2.17-c758a686/include/netdb.h glibc-2.17-c758a686/include/netdb.h
index 3f2ae06..8a569ba 100644
--- glibc-2.17-c758a686/include/netdb.h
+++ glibc-2.17-c758a686/include/netdb.h
@@ -3,18 +3,20 @@

#ifndef _ISOMAC
/* Macros for accessing h_errno from inside libc. */
-# undef h_errno
@ -65,7 +65,7 @@ index 3f2ae06..8a569ba 100644 @@ -65,7 +65,7 @@ index 3f2ae06..8a569ba 100644
+# endif /* _LIBC_REENTRANT */
+# endif /* !NOT_IN_libc || IN_LIB */
# define __set_h_errno(x) (h_errno = (x))

libc_hidden_proto (hstrerror)
diff --git glibc-2.17-c758a686/nptl/tst-cancel14.c glibc-2.17-c758a686/nptl/tst-cancel14.c
index fbaed49..ca9042d 100644
@ -76,8 +76,8 @@ index fbaed49..ca9042d 100644 @@ -76,8 +76,8 @@ index fbaed49..ca9042d 100644
#include <string.h>
#include <unistd.h>
+#include <sys/time.h>


static pthread_barrier_t bar;
diff --git glibc-2.17-c758a686/nptl/tst-cancel15.c glibc-2.17-c758a686/nptl/tst-cancel15.c
index 0119cc7..3f320ad 100644
@ -88,15 +88,15 @@ index 0119cc7..3f320ad 100644 @@ -88,15 +88,15 @@ index 0119cc7..3f320ad 100644
#include <string.h>
#include <unistd.h>
+#include <sys/time.h>


static pthread_barrier_t bar;
diff --git glibc-2.17-c758a686/nptl/tst-mutex9.c glibc-2.17-c758a686/nptl/tst-mutex9.c
index adb3b61..1d689bd 100644
--- glibc-2.17-c758a686/nptl/tst-mutex9.c
+++ glibc-2.17-c758a686/nptl/tst-mutex9.c
@@ -18,10 +18,13 @@

#include <errno.h>
#include <pthread.h>
+#include <stdint.h>
@ -107,8 +107,8 @@ index adb3b61..1d689bd 100644 @@ -107,8 +107,8 @@ index adb3b61..1d689bd 100644
#include <sys/mman.h>
+#include <sys/time.h>
#include <sys/wait.h>


diff --git glibc-2.17-c758a686/nptl/tst-stackguard1.c glibc-2.17-c758a686/nptl/tst-stackguard1.c
index f0f707f..57a48ad 100644
--- glibc-2.17-c758a686/nptl/tst-stackguard1.c
@ -119,5 +119,5 @@ index f0f707f..57a48ad 100644 @@ -119,5 +119,5 @@ index f0f707f..57a48ad 100644
#include <stackguard-macros.h>
+#include <tls.h>
#include <unistd.h>

static const char *command;

6
SOURCES/glibc-rh1070458.patch

@ -22,16 +22,16 @@ diff -ruNp glibc-2.17-c758a686/ports/sysdeps/aarch64/machine-gmon.h glibc-2.17-c @@ -22,16 +22,16 @@ diff -ruNp glibc-2.17-c758a686/ports/sysdeps/aarch64/machine-gmon.h glibc-2.17-c
+/* AArch64 definitions for profiling support.
+ Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.

The GNU C Library is free software; you can redistribute it and/or
@@ -13,13 +13,22 @@
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
+ License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

-#define _MCOUNT_DECL(from, self) \
- void __mcount_internal (u_long from, u_long self)
-

4
SOURCES/glibc-rh1070471.patch

@ -20,7 +20,7 @@ diff -ruNp glibc-2.17-c758a686/bits/wchar.h glibc-2.17-c758a686/bits/wchar.h @@ -20,7 +20,7 @@ diff -ruNp glibc-2.17-c758a686/bits/wchar.h glibc-2.17-c758a686/bits/wchar.h
@@ -19,7 +19,31 @@
#ifndef _BITS_WCHAR_H
#define _BITS_WCHAR_H 1

-#define __WCHAR_MIN (-2147483647 - 1)
-#define __WCHAR_MAX (2147483647)
+/* The fallback definitions, for when __WCHAR_MAX__ or __WCHAR_MIN__
@ -49,5 +49,5 @@ diff -ruNp glibc-2.17-c758a686/bits/wchar.h glibc-2.17-c758a686/bits/wchar.h @@ -49,5 +49,5 @@ diff -ruNp glibc-2.17-c758a686/bits/wchar.h glibc-2.17-c758a686/bits/wchar.h
+#else
+# define __WCHAR_MIN (-__WCHAR_MAX - 1)
+#endif

#endif /* bits/wchar.h */

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save