[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r24694 - in /fsf/trunk/libc: ./ benchtests/ debug/ elf/ manual/ math/ nptl/ nptl/sysdeps/powerpc/ nptl/sysdeps/unix/sysv/lin...



Author: eglibc
Date: Thu Dec  5 00:02:16 2013
New Revision: 24694

Log:
Import glibc-mainline for 2013-12-05

Added:
    fsf/trunk/libc/benchtests/sincos-inputs
    fsf/trunk/libc/manual/install-plain.texi
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
Removed:
    fsf/trunk/libc/benchtests/bench-sincos.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/Makefile
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/Makefile
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/benchtests/README
    fsf/trunk/libc/debug/stpncpy_chk.c
    fsf/trunk/libc/elf/elf.h
    fsf/trunk/libc/manual/install.texi
    fsf/trunk/libc/manual/time.texi
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/math/w_j0.c
    fsf/trunk/libc/math/w_j0f.c
    fsf/trunk/libc/math/w_j0l.c
    fsf/trunk/libc/math/w_j1.c
    fsf/trunk/libc/math/w_j1f.c
    fsf/trunk/libc/math/w_j1l.c
    fsf/trunk/libc/math/w_jn.c
    fsf/trunk/libc/math/w_jnf.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/powerpc/tls.h
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
    fsf/trunk/libc/scripts/bench.pl
    fsf/trunk/libc/stdlib/longlong.h
    fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/ieee754/k_standard.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_jnl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
    fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_jnl.c
    fsf/trunk/libc/sysdeps/powerpc/bits/link.h
    fsf/trunk/libc/sysdeps/powerpc/fpu/libm-test-ulps
    fsf/trunk/libc/sysdeps/powerpc/ldsodefs.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/crti.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/crtn.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-trampoline.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/ppc-mcount.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/setjmp-common.S
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/sysdep.h
    fsf/trunk/libc/sysdeps/powerpc/powerpc64/tst-audit.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/setcontext.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
    fsf/trunk/libc/sysdeps/x86_64/fpu/libm-test-ulps
    fsf/trunk/libc/time/strptime_l.c
    fsf/trunk/libc/time/tst-strptime.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Dec  5 00:02:16 2013
@@ -1,3 +1,259 @@
+2013-12-05  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* benchtests/README: Add note about output arguments.
+	* benchtests/bench-sincos.c: Remove file.
+	* benchtests/sincos-inputs: New file.
+	* scripts/bench.pl: Identify output arguments and define
+	static variables for them.
+
+	* debug/stpncpy_chk.c (__stpncpy_chk): Remove unused variables.
+
+	[BZ #15941]
+	* Makefile (INSTALL): Add install-plain.texi as the primary
+	dependency.
+	* manual/install-plain.texi: New file.
+	* manual/install.texi: Include node directive only for
+	non-plaintext output.
+
+2013-12-04  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
+
+	* stdlib/longlong.h: Update from GCC.
+
+	[BZ #6807]
+	[BZ #15901]
+	* math/w_j0.c (y0): Raise FE_DIVBYZERO on zero argument.
+	* math/w_j0f.c (y0f): Likewise.
+	* math/w_j0l.c (__y0l): Likewise.
+	* math/w_j1.c (y1): Likewise.
+	* math/w_j1f.c (y1f): Likewise.
+	* math/w_j1l.c (__y1l): Likewise
+	* math/w_jn.c (yn): Likewise.
+	* math/w_jnf.c (ynf): Likewise.
+	* sysdeps/ieee754/k_standard.c (__kernel_standard): Use ERANGE for
+	Bessel function pole errors in _POSIX_ mode.  Use NAN as return
+	value for Bessel function domain errors outside _SVID_ mode.
+	Adjust sign of return value for yn (negative integer, 0).
+	* sysdeps/ieee754/ldbl-128/e_jnl.c (__ieee754_ynl): Use division
+	by zero in return for negative x and set sign appropriately for
+	negative n.
+	* sysdeps/ieee754/ldbl-128ibm/e_jnl.c (__ieee754_ynl): Likewise.
+	* sysdeps/ieee754/ldbl-96/e_jnl.c (__ieee754_ynl): Likewise.
+	* math/libm-test.inc (y0_test_data): Add more tests and adjust
+	expectations in error cases.
+	(y1_test_data): Likewise.
+	(yn_test_data): Likewise.
+	* sysdeps/i386/fpu/libm-test-ulps: Update.
+	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
+
+2013-11-12  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/powerpc/Makefile (abi-variants): Rename
+	"64" to "64-v1".  Add "64-v2".
+	(abi-64-options): Rename to ...
+	(abi-64-v1-options): ... this.   Redefine _CALL_ELF.
+	(abi-64-condition): Rename to ...
+	(abi-64-v1-condition): ... this.  Add _CALL_ELF check.,
+	(abi-64-ld-soname): Rename to ...
+	(abi-64-v1-ld-soname): ... this.
+	(abi-64-v2-options): Define.
+	(abi-64-v2-condition): Likewise.
+	(abi-64-v2-ld-soname): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/ldconfig.h
+	(SYSDEP_KNOWN_INTERPRETER_NAMES): Add "/lib64/ld64.so.2".
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/Makefile: Delete file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac: New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure: Generate.
+
+2013-11-12  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+	    Alan Modra  <amodra@xxxxxxxxx>
+
+	* sysdeps/powerpc/bits/link.h (La_ppc64v2_regs, La_ppc64v2_retval):
+	New versions for use with the ELFv2 ABI.
+	(la_ppc64v2_gnu_pltenter, la_ppc64v2_gnu_pltexit): Add prototypes.
+	* sysdeps/powerpc/lsdodefs.h (struct La_ppc64v2_regs): Add forward
+	declaration.
+	(struct La_ppc64v2_retval): Likewise.
+	(ARCH_PLTENTER_MEMBERS): Add ppc64v2_gnu_pltenter.
+	(ARCH_PLTEXIT_MEMBERS): Add ppc64v2_gnu_pltexit.
+	* sysdeps/powerpc/powerpc64/dl-machine.h (ARCH_LA_PLTENTER): Define
+	to ppc64v2_gnu_pltenter if _CALL_ELF == 2.
+	(ARCH_LA_PLTEXIT): Define to ppc64v2_gnu_pltexit if _CALL_ELF == 2.
+	* sysdeps/powerpc/powerpc64/dl-trampoline.S (_dl_runtime_resolve):
+	Do not save or restore CR.
+	(FRAME_SIZE, VR_RTN): Provide updated values for _CALL_ELF == 2.
+	(_dl_profile_resolve): Do no save or restore CR.  Support extended
+	return values for ELFv2 ABI.  Fix location of FPR return registers.
+	* sysdeps/powerpc/powerpc64/tst-audit.h (pltenter, pltexit): Provide
+	updated values for _CALL_ELF == 2.
+	(La_regs, La_retval, int_retval): Likewise.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc64/sysdep.h (FRAME_MIN_SIZE): Define.
+	(FRAME_MIN_SIZE_PARM): Likewise.
+	(FRAME_BACKCHAIN): Likewise.
+	(FRAME_CR_SAVE): Likewise.
+	(FRAME_LR_SAVE): Likewise.
+	(FRAME_TOC_SAVE): Likewise.
+	(FRAME_PARM_SAVE): Likewise.
+	(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
+	FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
+	FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Likewise.
+	(call_mcount_parm_offset): New macro.
+	(SAVE_ARG, REST_ARG, CFI_SAVE_ARG): Use it.
+	(PROF): Use symbolic stack frame offsets.
+	(TAIL_CALL_SYSCALL_ERROR): Likewise.
+	* sysdeps/powerpc/powerpc64/dl-trampoline.S (FRAME_SIZE, INT_PARMS):
+	Redefine in terms of FRAME_MIN_SIZE.
+	(_dl_runtime_resolve): Use symbolic stack frame offsets.
+	(_dl_profile_resolve): Likewise.  Update comment.
+	* sysdeps/powerpc/powerpc64/setjmp-common.S (__GI__setjmp): Use
+	symbols stack frame offsets.
+	(__sigsetjmp): Likewise.
+	* sysdeps/powerpc/powerpc64/__longjmp-common.S (__longjmp): Likewise.
+	* sysdeps/powerpc/powerpc64/ppc-mcount.S (_mcount): Likewise.
+	* sysdeps/powerpc/powerpc64/crti.S (_init, _fini): Likewise.
+	* sysdeps/powerpc/powerpc64/crtn.S (_init, _fini): Likewise.
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
+	(FRAME_BACKCHAIN): Remove.
+	(FRAME_CR_SAVE): Likewise.
+	(FRAME_LR_SAVE): Likewise.
+	(FRAME_COMPILER_DW): Likewise.
+	(FRAME_LINKER_DW): Likewise.
+	(FRAME_TOC_SAVE): Likewise.
+	(FRAME_PARM_SAVE): Likewise.
+	(FRAME_PARM1_SAVE, FRAME_PARM2_SAVE, FRAME_PARM3_SAVE,
+	FRAME_PARM4_SAVE, FRAME_PARM5_SAVE, FRAME_PARM6_SAVE,
+	FRAME_PARM7_SAVE, FRAME_PARM8_SAVE, FRAME_PARM9_SAVE): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/____longjmp_chk.S
+	(CHECK_SP): Use symbolic stack frame offsets.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/brk.S (__brk): Use "red
+	zone" instead of caller's parameter save area for temp storage.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (__clone):
+	Likewise.  Also, use symbolic stack frame offsets.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S (FRAMESIZE,
+	stackblock): Redefine for _CALL_ELF == 2 to save parameters into
+	our own stack frame instead of the caller's.
+	(__socket): Use symbolic stack frame offsets.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+	    Alan Modra  <amodra@xxxxxxxxx>
+
+	* elf/elf.h (DT_PPC64_OPT, PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC):
+	Define.
+	(STO_PPC64_LOCAL_BIT, STO_PPC64_LOCAL_MASK,
+	PPC64_LOCAL_ENTRY_OFFSET): Define.
+	* sysdeps/powerpc/powerpc64/dl-machine.h (ppc64_local_entry_offset):
+	New function.
+	(elf_machine_fixup_plt): Call it.
+	(elf_machine_plt_conflict): Likewise.  Add map, sym_map, and
+	reloc arguments.
+	(elf_machine_rela): Update call to elf_machine_plt_conflict.
+	* sysdeps/powerpc/powerpc64/dl-trampoline.S (_dl_runtime_resolve,
+	_dl_profile_resolve) [_CALL_ELF == 2]: Restore caller's TOC into
+	r2 before calling target.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+	    Alan Modra  <amodra@xxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc64/sysdep.h [_CALL_ELF == 2]
+	(PPC64_LOAD_FUNCPTR, DOT_LABEL, BODY_LABEL, ENTRY_2, END_2): New
+	versions of macros to support ELFv2 ABI.
+	(LOCALENTRY): New macro.
+	(ENTRY, EALIGN): Use it.
+	* sysdeps/powerpc/powerpc64/crti.S (_init, _fini): Use LOCALENTRY.
+	* sysdeps/powerpc/powerpc64/setjmp-common.S (__GI__setjmp): Do not
+	fall through into ENTRY entry point.
+	* libc/sysdeps/powerpc/powerpc64/dl-machine.h (Elf64_FuncDesc):
+	Only define if _CALL_ELF != 2.
+
+	(elf_machine_matches_host): Verify ABI version matches.
+	(RTLD_START): Use LOCALENTRY.
+	(elf_machine_type_class): Use SHN_UNDEF PLT handling for ELFv2 ABI.
+	(PLT_INITIAL_ENTRY_WORDS): New version for _CALL_ELF != 2.
+	(PLT_ENTRY_WORDS): New macro.
+	(GLINK_INITIAL_ENTRY_WORDS, GLINK_ENTRY_WORDS): Likewise.
+	(elf_machine_runtime_setup): Support ELFv2 ABI.
+	(elf_machine_fixup_plt): Likewise.
+	(elf_machine_plt_conflict): Likewise.
+	(resolve_ifunc): Likewise.
+	* sysdeps/powerpc/powerpc64/dl-irel.h (elf_irela): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h (VDSO_IFUNC_RET):
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ldsodefs.h
+	(DL_ADDR_SYM_MATCH): Only define if _CALL_ELF != 2.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+	(makecontext): Support ELFv2 ABI.
+	* elf/elf.h (EF_PPC64_ABI): Define.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc64/sysdep.h [ASSEMBLER] (PPC64_LOAD_FUNCPTR):
+	New assembler macro.
+	[ASSEMBLER] (ENTRY_1): Do not switch to .text section here ...
+	[ASSEMBLER] (ENTRY): ... but instead here ...
+	[ASSEMBLER] (EALIGN): ... and here.
+	[!ASSEMBLER] (PPC64_LOAD_FUNCPTR): New macro.
+	[!ASSEMBLER] (ENTRY_1): New macro; set up .opd entry.
+	[!ASSEMBLER] (ENTRY_2): Use it.
+	* sysdeps/powerpc/powerpc64/dl-machine.h (RTLD_START): Update for
+	ENTRY_2 changes.  Use PPC64_LOAD_FUNCPTR.
+	* sysdeps/powerpc/powerpc64/dl-trampoline.S (_dl_runtime_resolve,
+	_dl_profile_resolve): Use PPC64_LOAD_FUNCPTR.
+	* sysdeps/powerpc/powerpc64/crti.S (_init, _fini): Use ENTRY_2.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S (clone):
+	Use PPC64_LOAD_FUNCPTR.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/powerpc/tls.h (tcbhead_t): Add __private_ss field.
+
+2013-12-04  Alan Modra  <amodra@xxxxxxxxx>
+
+	* elf/elf.h (R_PPC64_TLSGD, R_PPC64_TLSLD, R_PPC64_TOCSAVE): Define.
+	(R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA): Likewise.
+	(R_PPC64_TPREL16_HIGH, R_PPC64_TPREL16_HIGHA): Likewise.
+	(R_PPC64_DTPREL16_HIGH, R_PPC64_DTPREL16_HIGHA): Likewise.
+
+	* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Add
+	overflow checking for R_PPC64_ADDR16_HI, R_PPC64_ADDR16_HA,
+	R_PPC64_TPREL16_HI, and R_PPC64_TPREL16_HA.
+	Support new R_PPC64_ADDR16_HIGH, R_PPC64_ADDR16_HIGHA,
+	R_PPC64_TPREL16_HIGH, and R_PPC64_TPREL16_HIGHA relocations.
+	Fix overflow checking for R_PPC64_ADDR30 and R_PPC64_ADDR32.
+
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S
+	(__makecontext): Fix incorrect CFI when backtracing out of
+	context created via makecontext.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/secontext.S
+	(__setcontext): Fix incorrect CFI during switch to new context.
+	(__novec_setcontext): Likewise.
+
+2013-12-04  OndÃÂej BÃÂlka  <neleai@xxxxxxxxx>
+
+	[BZ #4772]
+	* time/strptime_l.c (__strptime_internal): Allow modifiers
+	in strptime.
+	* time/tst-strptime.c (day_tests): Add testcase.
+
+
+2013-12-04  Siddhesh Poyarekar  <siddhesh@xxxxxxxxxx>
+
+	* scripts/bench.pl: Skip over blank lines.
+
+2013-12-04  Paul Eggert  <eggert@xxxxxxxxxxx>
+
+	[BZ #926]
+	* manual/time.texi (Calendar Time): Clarify what timezone functions
+	use.
+
+2013-12-04  Adhemerval Zanella  <azanella@xxxxxxxxxxxxxxxxxx>
+
+	* sysdeps/powerpc/fpu/libm-test-ulps: Update.
+
 2013-12-04  OndÃÂej BÃÂlka  <neleai@xxxxxxxxx>
 
 	* debug/memcpy_chk.c (__memcpy_chk): Use call instead of custom

Modified: fsf/trunk/libc/Makefile
==============================================================================
--- fsf/trunk/libc/Makefile (original)
+++ fsf/trunk/libc/Makefile Thu Dec  5 00:02:16 2013
@@ -377,8 +377,8 @@
 	fi
 endif
 
-INSTALL: manual/install.texi manual/macros.texi \
-	 $(common-objpfx)manual/pkgvers.texi
+INSTALL: manual/install-plain.texi manual/macros.texi \
+	 $(common-objpfx)manual/pkgvers.texi manual/install.texi
 	makeinfo --no-validate --plaintext --no-number-sections \
 		 -I$(common-objpfx)manual $< -o $@-tmp
 	$(AWK) 'NF == 0 { ++n; next } \

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Thu Dec  5 00:02:16 2013
@@ -9,18 +9,19 @@
 
 * The following bugs are resolved with this release:
 
-  156, 387, 431, 832, 2801, 6786, 6787, 7003, 9954, 10253, 10278, 11087,
-  11157, 11214, 13028, 13982, 13985, 14029, 14032, 14143, 14155, 14547,
-  14699, 14752, 14876, 14910, 15004, 15048, 15218, 15268, 15277, 15308,
-  15362, 15374, 15400, 15425, 15427, 15483, 15522, 15531, 15532, 15601,
-  15608, 15609, 15610, 15632, 15640, 15670, 15672, 15680, 15681, 15723,
-  15734, 15735, 15736, 15748, 15749, 15754, 15760, 15763, 15764, 15797,
-  15799, 15825, 15844, 15847, 15849, 15855, 15856, 15857, 15859, 15867,
-  15886, 15887, 15890, 15892, 15893, 15895, 15897, 15905, 15909, 15917,
-  15919, 15921, 15923, 15939, 15948, 15963, 15966, 15985, 15988, 15997,
-  16032, 16034, 16036, 16037, 16041, 16055, 16071, 16072, 16074, 16077,
-  16078, 16103, 16112, 16143, 16144, 16146, 16150, 16151, 16153, 16167,
-  16172, 16195, 16214, 16245, 16271, 16283, 16289.
+  156, 387, 431, 832, 926, 2801, 4772, 6786, 6787, 6807, 7003, 9954, 10253,
+  10278, 11087, 11157, 11214, 12486, 13028, 13982, 13985, 14029, 14032,
+  14143, 14155, 14547, 14699, 14752, 14876, 14910, 15004, 15048, 15218,
+  15268, 15277, 15308, 15362, 15374, 15400, 15425, 15427, 15483, 15522,
+  15531, 15532, 15601, 15608, 15609, 15610, 15632, 15640, 15670, 15672,
+  15680, 15681, 15723, 15734, 15735, 15736, 15748, 15749, 15754, 15760,
+  15763, 15764, 15797, 15799, 15825, 15844, 15847, 15849, 15855, 15856,
+  15857, 15859, 15867, 15886, 15887, 15890, 15892, 15893, 15895, 15897,
+  15901, 15905, 15909, 15915, 15917, 15919, 15921, 15923, 15939, 15941,
+  15948, 15963, 15966, 15985, 15988, 15997, 16032, 16034, 16036, 16037,
+  16038, 16041, 16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112,
+  16143, 16144, 16146, 16150, 16151, 16153, 16167, 16172, 16195, 16214,
+  16245, 16271, 16274, 16283, 16289.
 
 * The public headers no longer use __unused nor __block.  This change is to
   support compiling programs that are derived from BSD sources and use

Modified: fsf/trunk/libc/benchtests/README
==============================================================================
--- fsf/trunk/libc/benchtests/README (original)
+++ fsf/trunk/libc/benchtests/README Thu Dec  5 00:02:16 2013
@@ -48,7 +48,8 @@
 
   - args: This should be assigned a colon separated list of types of the input
     arguments.  This directive may be skipped if the function does not take any
-    inputs.
+    inputs.  One may identify output arguments by nesting them in <>.  The
+    generator will create variables to get outputs from the calling function.
   - ret: This should be assigned the type that the function returns.  This
     directive may be skipped if the function does not return a value.
   - includes: This should be assigned a comma-separated list of headers that

Removed: fsf/trunk/libc/benchtests/bench-sincos.c
==============================================================================
--- fsf/trunk/libc/benchtests/bench-sincos.c (original)
+++ fsf/trunk/libc/benchtests/bench-sincos.c (removed)
@@ -1,86 +1,0 @@
-/* Copyright (C) 2013 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
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-extern void sincos (double, double *, double *);
-
-#define CALL_BENCH_FUNC(v, i, j, k) sincos ( variants[v].in[i].arg0, &j, &k);
-
-struct args
-{
-  volatile double arg0;
-};
-
-struct args in0[12] =
-{
-  { 0.9 },
-  { 2.3 },
-  { 3.7 },
-  { 3.9 },
-  { 4.0 },
-  { 4.7 },
-  { 5.9 },
-
-  { 0x1.000000cf4a2a1p0 },
-  { 0x1.0000010b239a8p0 },
-  { 0x1.00000162a932ap0 },
-  { 0x1.000002d452a11p0 },
-  { 0x1.000005bc7d86cp0 }
-};
-
-struct args in1[12] =
-{
-  { 0.93340582292648832662962377071381 },
-  { 2.3328432680770916363144351635128 },
-  { 3.7439477503636453548097051680088 },
-  { 3.9225160069792437411706487182528 },
-  { 4.0711651639931289992091478779912 },
-  { 4.7858438478542097982426639646292 },
-  { 5.9840767662578002727968851104379 },
-
-  { 0x1.000000cf4a2a2p0 },
-  { 0x1.0000010b239a9p0 },
-  { 0x1.00000162a932bp0 },
-  { 0x1.000002d452a10p0 },
-  { 0x1.000005bc7d86dp0 }
-};
-
-struct _variants
-{
-  const char *name;
-  int count;
-  struct args *in;
-};
-
-struct _variants variants[2] =
-  {
-    {"sincos()", 12, in0},
-    {"sincos(768bits)", 12, in1},
-  };
-
-#define NUM_VARIANTS 2
-#define NUM_SAMPLES(i) (variants[i].count)
-#define VARIANT(i) (variants[i].name)
-
-#define BENCH_FUNC(v, j) \
-({									      \
-  volatile double iptr;							      \
-  volatile double iptr2;						      \
-   CALL_BENCH_FUNC (v, j, iptr, iptr2);					      \
-})
-
-#define FUNCNAME "sincos"
-#include "bench-skeleton.c"

Added: fsf/trunk/libc/benchtests/sincos-inputs
==============================================================================
--- fsf/trunk/libc/benchtests/sincos-inputs (added)
+++ fsf/trunk/libc/benchtests/sincos-inputs Thu Dec  5 00:02:16 2013
@@ -1,0 +1,27 @@
+## includes: math.h
+## args: double:<double *>:<double *>
+0.9
+2.3
+3.7
+3.9
+4.0
+4.7
+5.9
+0x1.000000cf4a2a1p0
+0x1.0000010b239a8p0
+0x1.00000162a932ap0
+0x1.000002d452a11p0
+0x1.000005bc7d86cp0
+## name: 768bits
+0.93340582292648832662962377071381
+2.3328432680770916363144351635128
+3.7439477503636453548097051680088
+3.9225160069792437411706487182528
+4.0711651639931289992091478779912
+4.7858438478542097982426639646292
+5.9840767662578002727968851104379
+0x1.000000cf4a2a2p0
+0x1.0000010b239a9p0
+0x1.00000162a932bp0
+0x1.000002d452a10p0
+0x1.000005bc7d86dp0

Modified: fsf/trunk/libc/debug/stpncpy_chk.c
==============================================================================
--- fsf/trunk/libc/debug/stpncpy_chk.c (original)
+++ fsf/trunk/libc/debug/stpncpy_chk.c Thu Dec  5 00:02:16 2013
@@ -25,9 +25,6 @@
 char *
 __stpncpy_chk (char *dest, const char *src, size_t n, size_t destlen)
 {
-  char c;
-  char *s = dest;
-
   if (__builtin_expect (destlen < n, 0))
     __chk_fail ();
 

Modified: fsf/trunk/libc/elf/elf.h
==============================================================================
--- fsf/trunk/libc/elf/elf.h (original)
+++ fsf/trunk/libc/elf/elf.h Thu Dec  5 00:02:16 2013
@@ -2252,6 +2252,17 @@
 #define R_PPC64_DTPREL16_HIGHERA 104 /* half16	(sym+add)@dtprel@highera */
 #define R_PPC64_DTPREL16_HIGHEST 105 /* half16	(sym+add)@dtprel@highest */
 #define R_PPC64_DTPREL16_HIGHESTA 106 /* half16	(sym+add)@dtprel@highesta */
+#define R_PPC64_TLSGD		107 /* none	(sym+add)@tlsgd */
+#define R_PPC64_TLSLD		108 /* none	(sym+add)@tlsld */
+#define R_PPC64_TOCSAVE		109 /* none */
+
+/* Added when HA and HI relocs were changed to report overflows.  */
+#define R_PPC64_ADDR16_HIGH	110
+#define R_PPC64_ADDR16_HIGHA	111
+#define R_PPC64_TPREL16_HIGH	112
+#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
@@ -2261,11 +2272,28 @@
 #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,
+   0 for unspecified or not using any features affected by the differences.  */
+#define EF_PPC64_ABI	3
+
 /* PowerPC64 specific values for the Dyn d_tag field.  */
 #define DT_PPC64_GLINK  (DT_LOPROC + 0)
 #define DT_PPC64_OPD	(DT_LOPROC + 1)
 #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
+
+/* PowerPC64 specific values for the Elf64_Sym st_other field.  */
+#define STO_PPC64_LOCAL_BIT	5
+#define STO_PPC64_LOCAL_MASK	(7 << STO_PPC64_LOCAL_BIT)
+#define PPC64_LOCAL_ENTRY_OFFSET(other)				\
+ (((1 << (((other) & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT)) >> 2) << 2)
 
 
 /* ARM specific declarations */

Added: fsf/trunk/libc/manual/install-plain.texi
==============================================================================
--- fsf/trunk/libc/manual/install-plain.texi (added)
+++ fsf/trunk/libc/manual/install-plain.texi Thu Dec  5 00:02:16 2013
@@ -1,0 +1,5 @@
+@c This is for making the `INSTALL' file for the distribution.
+@c Makeinfo ignores it when processing the file from the include.
+@setfilename INSTALL
+@set plain
+@include install.texi

Modified: fsf/trunk/libc/manual/install.texi
==============================================================================
--- fsf/trunk/libc/manual/install.texi (original)
+++ fsf/trunk/libc/manual/install.texi Thu Dec  5 00:02:16 2013
@@ -1,10 +1,10 @@
-@c This is for making the `INSTALL' file for the distribution.
-@c Makeinfo ignores it when processing the file from the include.
-@setfilename INSTALL
 @include macros.texi
 @include pkgvers.texi
 
+@ifclear plain
 @node Installation, Maintenance, Library Summary, Top
+@end ifclear
+
 @c %MENU% How to install the GNU C Library
 @appendix Installing @theglibc{}
 

Modified: fsf/trunk/libc/manual/time.texi
==============================================================================
--- fsf/trunk/libc/manual/time.texi (original)
+++ fsf/trunk/libc/manual/time.texi Thu Dec  5 00:02:16 2013
@@ -687,9 +687,8 @@
 as a broken-down time; typically this is because the year cannot fit into
 an @code{int}.
 
-Calling @code{localtime} has one other effect: it sets the variable
-@code{tzname} with information about the current time zone.  @xref{Time
-Zone Functions}.
+Calling @code{localtime} also sets the current time zone as if
+@code{tzset} were called.  @xref{Time Zone Functions}.
 @end deftypefun
 
 Using the @code{localtime} function is a big problem in multi-threaded
@@ -739,25 +738,28 @@
 @comment time.h
 @comment ISO
 @deftypefun time_t mktime (struct tm *@var{brokentime})
-The @code{mktime} function is used to convert a broken-down time structure
-to a simple time representation.  It also ``normalizes'' the contents of
-the broken-down time structure, by filling in the day of week and day of
-year based on the other date and time components.
+The @code{mktime} function converts a broken-down time structure to a
+simple time representation.  It also normalizes the contents of the
+broken-down time structure, and fills in some components based on the
+values of the others.
 
 The @code{mktime} function ignores the specified contents of the
-@code{tm_wday} and @code{tm_yday} members of the broken-down time
+@code{tm_wday}, @code{tm_yday}, @code{tm_gmtoff}, and @code{tm_zone}
+members of the broken-down time
 structure.  It uses the values of the other components to determine the
 calendar time; it's permissible for these components to have
 unnormalized values outside their normal ranges.  The last thing that
 @code{mktime} does is adjust the components of the @var{brokentime}
-structure (including the @code{tm_wday} and @code{tm_yday}).
+structure, including the members that were initally ignored.
 
 If the specified broken-down time cannot be represented as a simple time,
 @code{mktime} returns a value of @code{(time_t)(-1)} and does not modify
 the contents of @var{brokentime}.
 
-Calling @code{mktime} also sets the variable @code{tzname} with
-information about the current time zone.  @xref{Time Zone Functions}.
+Calling @code{mktime} also sets the current time zone as if
+@code{tzset} were called; @code{mktime} uses this information instead
+of @var{brokentime}'s initial @code{tm_gmtoff} and @code{tm_zone}
+members.  @xref{Time Zone Functions}.
 @end deftypefun
 
 @comment time.h
@@ -1053,8 +1055,8 @@
 asctime (localtime (@var{time}))
 @end smallexample
 
-@code{ctime} sets the variable @code{tzname}, because @code{localtime}
-does so.  @xref{Time Zone Functions}.
+Calling @code{ctime} also sets the current time zone as if
+@code{tzset} were called.  @xref{Time Zone Functions}.
 @end deftypefun
 
 @comment time.h
@@ -1081,7 +1083,8 @@
 Input}), but the conversion specifications that can appear in the format
 template @var{template} are specialized for printing components of the date
 and time @var{brokentime} according to the locale currently specified for
-time conversion (@pxref{Locales}).
+time conversion (@pxref{Locales}) and the current time zone
+(@pxref{Time Zone Functions}).
 
 Ordinary characters appearing in the @var{template} are copied to the
 output string @var{s}; this can include multibyte character sequences.
@@ -1392,9 +1395,10 @@
 If @var{s} is a null pointer, @code{strftime} does not actually write
 anything, but instead returns the number of characters it would have written.
 
-According to POSIX.1 every call to @code{strftime} implies a call to
-@code{tzset}.  So the contents of the environment variable @code{TZ}
-is examined before any output is produced.
+Calling @code{strftime} also sets the current time zone as if
+@code{tzset} were called; @code{strftime} uses this information
+instead of @var{brokentime}'s @code{tm_gmtoff} and @code{tm_zone}
+members.  @xref{Time Zone Functions}.
 
 For an example of @code{strftime}, see @ref{Time Functions Example}.
 @end deftypefun

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Thu Dec  5 00:02:16 2013
@@ -14278,9 +14278,11 @@
 static const struct test_f_f_data y0_test_data[] =
   {
     /* y0 is the Bessel function of the second kind of order 0 */
-    TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_f_f (y0, -max_value, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_f_f (y0, 0.0, minus_infty),
+    TEST_f_f (y0, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y0, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y0, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y0, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_f_f (y0, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
     TEST_f_f (y0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
     TEST_f_f (y0, plus_infty, 0),
 
@@ -14329,9 +14331,11 @@
 static const struct test_f_f_data y1_test_data[] =
   {
     /* y1 is the Bessel function of the second kind of order 1 */
-    TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_f_f (y1, -max_value, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_f_f (y1, 0.0, minus_infty),
+    TEST_f_f (y1, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y1, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y1, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_f_f (y1, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_f_f (y1, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
     TEST_f_f (y1, plus_infty, 0),
     TEST_f_f (y1, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
 
@@ -14381,9 +14385,11 @@
   {
     /* yn is the Bessel function of the second kind of order n */
     /* yn (0, x) == y0 (x)  */
-    TEST_if_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_if_f (yn, 0, -max_value, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_if_f (yn, 0, 0.0, minus_infty),
+    TEST_if_f (yn, 0, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 0, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 0, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 0, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, 0, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
     TEST_if_f (yn, 0, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
     TEST_if_f (yn, 0, plus_infty, 0),
 
@@ -14396,8 +14402,11 @@
     TEST_if_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L),
 
     /* yn (1, x) == y1 (x)  */
-    TEST_if_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION|ERRNO_EDOM),
-    TEST_if_f (yn, 1, 0.0, minus_infty),
+    TEST_if_f (yn, 1, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 1, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 1, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 1, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, 1, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
     TEST_if_f (yn, 1, plus_infty, 0),
     TEST_if_f (yn, 1, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
 
@@ -14409,7 +14418,40 @@
     TEST_if_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L),
     TEST_if_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L),
 
+    /* yn (-1, x) == -y1 (x).  */
+    TEST_if_f (yn, -1, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -1, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -1, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -1, 0.0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, -1, -0.0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, -1, plus_infty, minus_zero),
+    TEST_if_f (yn, -1, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
+    TEST_if_f (yn, -1, 1.0, 0.781212821300288716547150000047964821L),
+
+    /* yn (2, x).  */
+    TEST_if_f (yn, 2, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 2, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 2, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 2, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, 2, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, 2, plus_infty, 0),
+    TEST_if_f (yn, 2, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
+
+    /* yn (-2, x) == yn (2, x).  */
+    TEST_if_f (yn, -2, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -2, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -2, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, -2, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, -2, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, -2, plus_infty, 0),
+    TEST_if_f (yn, -2, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
+
     /* yn (3, x)  */
+    TEST_if_f (yn, 3, -1.0, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 3, -max_value, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 3, minus_infty, qnan_value, INVALID_EXCEPTION|ERRNO_EDOM),
+    TEST_if_f (yn, 3, 0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
+    TEST_if_f (yn, 3, -0.0, minus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE),
     TEST_if_f (yn, 3, plus_infty, 0),
     TEST_if_f (yn, 3, qnan_value, qnan_value, NO_INEXACT_EXCEPTION),
 
@@ -14428,6 +14470,8 @@
     TEST_if_f (yn, 10, 1.0, -121618014.278689189288130426667971145L),
     TEST_if_f (yn, 10, 2.0, -129184.542208039282635913145923304214L),
     TEST_if_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L),
+
+    TEST_if_f (yn, -10, 1.0, -121618014.278689189288130426667971145L),
 
     /* Check whether yn returns correct value for LDBL_MIN, DBL_MIN,
        and FLT_MIN.  See Bug 14173.  */

Modified: fsf/trunk/libc/math/w_j0.c
==============================================================================
--- fsf/trunk/libc/math/w_j0.c (original)
+++ fsf/trunk/libc/math/w_j0.c Thu Dec  5 00:02:16 2013
@@ -51,8 +51,11 @@
 	  return __kernel_standard (x, x, 9);
 	}
       else if (x == 0.0)
-	/* d = -one/(x-x) */
-	return __kernel_standard (x, x, 8);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard (x, x, 8);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y0(x>X_TLOSS) */
 	return __kernel_standard (x, x, 35);

Modified: fsf/trunk/libc/math/w_j0f.c
==============================================================================
--- fsf/trunk/libc/math/w_j0f.c (original)
+++ fsf/trunk/libc/math/w_j0f.c Thu Dec  5 00:02:16 2013
@@ -49,8 +49,11 @@
 	  return __kernel_standard_f (x, x, 109);
 	}
       else if (x == 0.0f)
-	/* d = -one/(x-x) */
-	return __kernel_standard_f (x, x, 108);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard_f (x, x, 108);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y0(x>X_TLOSS) */
 	return __kernel_standard_f (x, x, 135);

Modified: fsf/trunk/libc/math/w_j0l.c
==============================================================================
--- fsf/trunk/libc/math/w_j0l.c (original)
+++ fsf/trunk/libc/math/w_j0l.c Thu Dec  5 00:02:16 2013
@@ -49,8 +49,11 @@
 	  return __kernel_standard_l (x, x, 209);
 	}
       else if (x == 0.0L)
-	/* d = -one/(x-x) */
-	return __kernel_standard_l (x, x, 208);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard_l (x, x, 208);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y0(x>X_TLOSS) */
 	return __kernel_standard_l (x, x, 235);

Modified: fsf/trunk/libc/math/w_j1.c
==============================================================================
--- fsf/trunk/libc/math/w_j1.c (original)
+++ fsf/trunk/libc/math/w_j1.c Thu Dec  5 00:02:16 2013
@@ -51,8 +51,11 @@
 	  return __kernel_standard (x, x, 11);
 	}
       else if (x == 0.0)
-	/* d = -one/(x-x) */
-	return __kernel_standard (x, x, 10);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard (x, x, 10);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y1(x>X_TLOSS) */
 	return __kernel_standard (x, x, 37);

Modified: fsf/trunk/libc/math/w_j1f.c
==============================================================================
--- fsf/trunk/libc/math/w_j1f.c (original)
+++ fsf/trunk/libc/math/w_j1f.c Thu Dec  5 00:02:16 2013
@@ -49,8 +49,11 @@
 	  return __kernel_standard_f (x, x, 111);
 	}
       else if (x == 0.0f)
-	/* d = -one/(x-x) */
-	return __kernel_standard_f (x, x, 110);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard_f (x, x, 110);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y1(x>X_TLOSS) */
 	return __kernel_standard_f (x, x, 137);

Modified: fsf/trunk/libc/math/w_j1l.c
==============================================================================
--- fsf/trunk/libc/math/w_j1l.c (original)
+++ fsf/trunk/libc/math/w_j1l.c Thu Dec  5 00:02:16 2013
@@ -49,8 +49,11 @@
 	  return __kernel_standard_l (x, x, 211);
 	}
       else if (x == 0.0L)
-	/* d = -one/(x-x) */
-	return __kernel_standard_l (x, x, 210);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard_l (x, x, 210);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* y1(x>X_TLOSS) */
 	return __kernel_standard_l (x, x, 237);

Modified: fsf/trunk/libc/math/w_jn.c
==============================================================================
--- fsf/trunk/libc/math/w_jn.c (original)
+++ fsf/trunk/libc/math/w_jn.c Thu Dec  5 00:02:16 2013
@@ -51,8 +51,11 @@
 	  return __kernel_standard (n, x, 13);
 	}
       else if (x == 0.0)
-	/* d = -one/(x-x) */
-	return __kernel_standard (n, x, 12);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard (n, x, 12);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* yn(n,x>X_TLOSS) */
 	return __kernel_standard (n, x, 39);

Modified: fsf/trunk/libc/math/w_jnf.c
==============================================================================
--- fsf/trunk/libc/math/w_jnf.c (original)
+++ fsf/trunk/libc/math/w_jnf.c Thu Dec  5 00:02:16 2013
@@ -49,8 +49,11 @@
 	  return __kernel_standard_f (n, x, 113);
 	}
       else if (x == 0.0)
-	/* d = -one/(x-x) */
-	return __kernel_standard_f (n, x, 112);
+	{
+	  /* d = -one/(x-x) */
+	  feraiseexcept (FE_DIVBYZERO);
+	  return __kernel_standard_f (n, x, 112);
+	}
       else if (_LIB_VERSION != _POSIX_)
 	/* yn(n,x>X_TLOSS) */
 	return __kernel_standard_f (n, x, 139);

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Thu Dec  5 00:02:16 2013
@@ -1,3 +1,16 @@
+2013-12-04  Ulrich Weigand  <Ulrich.Weigand@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
+	(CANCEL_FRAMESIZE, CANCEL_PARM_SAVE): New macros to save parameters
+	into our own stack frame instead of the caller's.
+	(PSEUDO): Use them.  Use symbolic stack frame offsets.
+	(DOCARGS_1, UNDOCARGS_1): Use CANCEL_PARM_SAVE.
+	(DOCARGS_2, UNDOCARGS_2): Likewise.
+	(DOCARGS_3, UNDOCARGS_3): Likewise.
+	(DOCARGS_4, UNDOCARGS_4): Likewise.
+	(DOCARGS_5, UNDOCARGS_5): Likewise.
+	(DOCARGS_6, UNDOCARGS_6): Likewise.
+
 2013-11-26  OndÃÂej BÃÂlka  <neleai@xxxxxxxxx>
 	* sysdeps/i386/tls.h: Use __glibc_reserved instead __unused.
 	* sysdeps/x86_64/tls.h: Likewise.

Modified: fsf/trunk/libc/nptl/sysdeps/powerpc/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/powerpc/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/powerpc/tls.h Thu Dec  5 00:02:16 2013
@@ -61,6 +61,8 @@
    are private.  */
 typedef struct
 {
+  /* GCC split stack support.  */
+  void *__private_ss;
   /* Reservation for the Event-Based Branching ABI.  */
   uintptr_t ebb_handler;
   uintptr_t ebb_ctx_pointer;

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h Thu Dec  5 00:02:16 2013
@@ -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)
+#else
+#define CANCEL_FRAMESIZE (FRAME_MIN_SIZE+16)
+#define CANCEL_PARM_SAVE (CANCEL_FRAMESIZE+FRAME_PARM_SAVE)
+#endif
+
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				\
   .section ".text";							\
@@ -44,52 +52,52 @@
     PSEUDO_RET;								\
   .size DASHDASHPFX(syscall_name##_nocancel),.-DASHDASHPFX(syscall_name##_nocancel);	\
   .Lpseudo_cancel:							\
-    stdu 1,-128(1);							\
-    cfi_adjust_cfa_offset (128);					\
+    stdu 1,-CANCEL_FRAMESIZE(1);					\
+    cfi_adjust_cfa_offset (CANCEL_FRAMESIZE);				\
     mflr 9;								\
-    std  9,128+16(1);							\
-    cfi_offset (lr, 16);						\
+    std  9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1);				\
+    cfi_offset (lr, FRAME_LR_SAVE);					\
     DOCARGS_##args;	/* save syscall args around CENABLE.  */	\
     CENABLE;								\
-    std  3,112(1);	/* store CENABLE return value (MASK).  */	\
+    std  3,FRAME_MIN_SIZE(1); /* store CENABLE return value (MASK).  */	\
     UNDOCARGS_##args;	/* restore syscall args.  */			\
     DO_CALL (SYS_ify (syscall_name));					\
     mfcr 0;		/* save CR/R3 around CDISABLE.  */		\
-    std  3,120(1);							\
-    std  0,128+8(1);							\
-    cfi_offset (cr, 8);							\
-    ld   3,112(1);	/* pass MASK to CDISABLE.  */			\
+    std  3,FRAME_MIN_SIZE+8(1);						\
+    std  0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1);				\
+    cfi_offset (cr, FRAME_CR_SAVE);					\
+    ld   3,FRAME_MIN_SIZE(1); /* pass MASK to CDISABLE.  */		\
     CDISABLE;								\
-    ld   9,128+16(1);							\
-    ld   0,128+8(1);	/* restore CR/R3. */				\
-    ld   3,120(1);							\
+    ld   9,CANCEL_FRAMESIZE+FRAME_LR_SAVE(1);				\
+    ld   0,CANCEL_FRAMESIZE+FRAME_CR_SAVE(1); /* restore CR/R3. */	\
+    ld   3,FRAME_MIN_SIZE+8(1);						\
     mtlr 9;								\
     mtcr 0;								\
-    addi 1,1,128;							\
-    cfi_adjust_cfa_offset (-128);					\
+    addi 1,1,CANCEL_FRAMESIZE;						\
+    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

Modified: fsf/trunk/libc/scripts/bench.pl
==============================================================================
--- fsf/trunk/libc/scripts/bench.pl (original)
+++ fsf/trunk/libc/scripts/bench.pl Thu Dec  5 00:02:16 2013
@@ -83,8 +83,8 @@
     }
   }
 
-  # Skip over comments.
-  if (/^#/) {
+  # Skip over comments and blank lines.
+  if (/^#/ || /^$/) {
     next LINE;
   }
   push (@curvals, $_);
@@ -93,6 +93,13 @@
 
 my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
 
+# Output variables.  These include the return value as well as any pointers
+# that may get passed into the function, denoted by the <> around the type.
+my $outvars = "";
+
+if ($ret ne "void") {
+  $outvars = "static volatile $ret ret;\n";
+}
 
 # Print the definitions and macros.
 foreach $incl (@include_headers) {
@@ -124,8 +131,18 @@
       $bench_func = "$bench_func,";
     }
 
-    $arg_struct = "$arg_struct volatile $arg arg$num;";
-    $bench_func = "$bench_func variants[v].in[i].arg$num";
+    $_ = $arg;
+    if (/<(.*)\*>/) {
+      # Output variables.  These have to be pointers, so dereference once by
+      # dropping one *.
+      $outvars = $outvars . "static $1 out$num;\n";
+      $bench_func = "$bench_func &out$num";
+    }
+    else {
+      $arg_struct = "$arg_struct volatile $arg arg$num;";
+      $bench_func = "$bench_func variants[v].in[i].arg$num";
+    }
+
     $num = $num + 1;
   }
 
@@ -172,12 +189,12 @@
   print "#define VARIANT(v) FUNCNAME \"()\"\n"
 }
 
-
+# Print the output variable definitions.
+print "$outvars\n";
 
 # In some cases not storing a return value seems to result in the function call
 # being optimized out.
 if ($ret ne "void") {
-  print "static volatile $ret ret;\n";
   $getret = "ret = ";
 }
 

Modified: fsf/trunk/libc/stdlib/longlong.h
==============================================================================
--- fsf/trunk/libc/stdlib/longlong.h (original)
+++ fsf/trunk/libc/stdlib/longlong.h Thu Dec  5 00:02:16 2013
@@ -188,16 +188,20 @@
 	     "rIJ" ((USItype) (bh)),					\
 	     "r" ((USItype) (al)),					\
 	     "rIJ" ((USItype) (bl)))
-/* Call libgcc routine.  */
-#define umul_ppmm(w1, w0, u, v) \
-do {									\
-  DWunion __w;								\
-  __w.ll = __umulsidi3 (u, v);						\
-  w1 = __w.s.high;							\
-  w0 = __w.s.low;							\
-} while (0)
-#define __umulsidi3 __umulsidi3
-UDItype __umulsidi3 (USItype, USItype);
+
+#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
+#ifdef __ARC_NORM__
+#define count_leading_zeros(count, x) \
+  do									\
+    {									\
+      SItype c_;							\
+									\
+      __asm__ ("norm.f\t%0,%1\n\tmov.mi\t%0,-1" : "=r" (c_) : "r" (x) : "cc");\
+      (count) = c_ + 1;							\
+    }									\
+  while (0)
+#define COUNT_LEADING_ZEROS_0 32
+#endif
 #endif
 
 #if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \
@@ -285,12 +289,39 @@
 
 #endif /* defined (__AVR__) */
 
-#if defined (__CRIS__) && __CRIS_arch_version >= 3
+#if defined (__CRIS__)
+
+#if __CRIS_arch_version >= 3
 #define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif /* __CRIS_arch_version >= 3 */
+
 #if __CRIS_arch_version >= 8
 #define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
-#endif
-#endif /* __CRIS__ */
+#endif /* __CRIS_arch_version >= 8 */
+
+#if __CRIS_arch_version >= 10
+#define __umulsidi3(u,v) ((UDItype)(USItype) (u) * (UDItype)(USItype) (v))
+#else
+#define __umulsidi3 __umulsidi3
+extern UDItype __umulsidi3 (USItype, USItype);
+#endif /* __CRIS_arch_version >= 10 */
+
+#define umul_ppmm(w1, w0, u, v)		\
+  do {					\
+    UDItype __x = __umulsidi3 (u, v);	\
+    (w0) = (USItype) (__x);		\
+    (w1) = (USItype) (__x >> 32);	\
+  } while (0)
+
+/* FIXME: defining add_ssaaaa and sub_ddmmss should be advantageous for
+   DFmode ("double" intrinsics, avoiding two of the three insns handling
+   carry), but defining them as open-code C composing and doing the
+   operation in DImode (UDImode) shows that the DImode needs work:
+   register pressure from requiring neighboring registers and the
+   traffic to and from them come to dominate, in the 4.7 series.  */
+
+#endif /* defined (__CRIS__) */
 
 #if defined (__hppa) && W_TYPE_SIZE == 32
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \

Modified: fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/i386/fpu/libm-test-ulps Thu Dec  5 00:02:16 2013
@@ -7563,6 +7563,9 @@
 ifloat: 2
 
 # yn
+Test "yn (-10, 1.0)":
+float: 2
+ifloat: 2
 Test "yn (0, 0.125)":
 ildouble: 1
 ldouble: 1

Modified: fsf/trunk/libc/sysdeps/ieee754/k_standard.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/k_standard.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/k_standard.c Thu Dec  5 00:02:16 2013
@@ -248,7 +248,7 @@
 		else
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y0: DOMAIN error\n", 17);
@@ -265,7 +265,7 @@
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = -HUGE;
 		else
-		  exc.retval = -HUGE_VAL;
+		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
 		else if (!matherr(&exc)) {
@@ -286,7 +286,7 @@
 		else
 		  exc.retval = -HUGE_VAL;
 		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("y1: DOMAIN error\n", 17);
@@ -303,7 +303,7 @@
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = -HUGE;
 		else
-		  exc.retval = -HUGE_VAL;
+		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
 		else if (!matherr(&exc)) {
@@ -322,9 +322,11 @@
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = -HUGE;
 		else
-		  exc.retval = -HUGE_VAL;
-		if (_LIB_VERSION == _POSIX_)
-		  __set_errno (EDOM);
+		  exc.retval = ((x < 0 && ((int) x & 1) != 0)
+				? HUGE_VAL
+				: -HUGE_VAL);
+		if (_LIB_VERSION == _POSIX_)
+		  __set_errno (ERANGE);
 		else if (!matherr(&exc)) {
 		  if (_LIB_VERSION == _SVID_) {
 			(void) WRITE2("yn: DOMAIN error\n", 17);
@@ -341,7 +343,7 @@
 		if (_LIB_VERSION == _SVID_)
 		  exc.retval = -HUGE;
 		else
-		  exc.retval = -HUGE_VAL;
+		  exc.retval = NAN;
 		if (_LIB_VERSION == _POSIX_)
 		  __set_errno (EDOM);
 		else if (!matherr(&exc)) {

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_jnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_jnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128/e_jnl.c Thu Dec  5 00:02:16 2013
@@ -316,7 +316,7 @@
   if (x <= 0.0L)
     {
       if (x == 0.0L)
-	return -HUGE_VALL + x;
+	return ((n < 0 && (n & 1) != 0) ? 1.0L : -1.0L) / 0.0L;
       if (se & 0x80000000)
 	return zero / (zero * x);
     }

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/e_jnl.c Thu Dec  5 00:02:16 2013
@@ -316,7 +316,7 @@
   if (x <= 0.0L)
     {
       if (x == 0.0L)
-	return -HUGE_VALL + x;
+	return ((n < 0 && (n & 1) != 0) ? 1.0L : -1.0L) / 0.0L;
       if (se & 0x80000000)
 	return zero / (zero * x);
     }

Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_jnl.c
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_jnl.c (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-96/e_jnl.c Thu Dec  5 00:02:16 2013
@@ -302,7 +302,8 @@
   if (__builtin_expect ((ix == 0x7fff) && ((i0 & 0x7fffffff) != 0), 0))
     return x + x;
   if (__builtin_expect ((ix | i0 | i1) == 0, 0))
-    return -HUGE_VALL + x;  /* -inf and overflow exception.  */
+    /* -inf or inf and divide-by-zero exception.  */
+    return ((n < 0 && (n & 1) != 0) ? 1.0L : -1.0L) / 0.0L;
   if (__builtin_expect (se & 0x8000, 0))
     return zero / (zero * x);
   sign = 1;

Modified: fsf/trunk/libc/sysdeps/powerpc/bits/link.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/bits/link.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/bits/link.h Thu Dec  5 00:02:16 2013
@@ -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.  */
+typedef struct La_ppc64v2_regs
+{
+  uint64_t lr_reg[8];
+  double lr_fp[13];
+  uint32_t __padding;
+  uint32_t lr_vrsave;
+  uint32_t lr_vreg[12][4] __attribute__ ((aligned (16)));
+  uint64_t lr_r1;
+  uint64_t lr_lr;
+} La_ppc64v2_regs;
+
+/* Return values for calls from PLT on PPC64 in the ELFv2 ABI.  */
+typedef struct La_ppc64v2_retval
+{
+  uint64_t lrv_r3;
+  uint64_t lrv_r4;
+  double lrv_fp[10];
+  uint32_t lrv_vreg[8][4] __attribute__ ((aligned (16)));
+} La_ppc64v2_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_ppc64v2_gnu_pltenter (Elf64_Sym *__sym,
+					   unsigned int __ndx,
+					   uintptr_t *__refcook,
+					   uintptr_t *__defcook,
+					   La_ppc64v2_regs *__regs,
+					   unsigned int *__flags,
+					   const char *__symname,
+					   long int *__framesizep);
+extern unsigned int la_ppc64v2_gnu_pltexit (Elf64_Sym *__sym,
+					    unsigned int __ndx,
+					    uintptr_t *__refcook,
+					    uintptr_t *__defcook,
+					    const La_ppc64v2_regs *__inregs,
+					    La_ppc64v2_retval *__outregs,
+					    const char *__symname);
+
+__END_DECLS
+
 #endif

Modified: fsf/trunk/libc/sysdeps/powerpc/fpu/libm-test-ulps
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/fpu/libm-test-ulps (original)
+++ fsf/trunk/libc/sysdeps/powerpc/fpu/libm-test-ulps Thu Dec  5 00:02:16 2013
@@ -6785,11 +6785,17 @@
 ldouble: 5
 
 # erf
+Test "erf (0x1.4p+0)":
+double: 1
+idouble: 1
 Test "erf (1.25)":
 double: 1
 idouble: 1
 
 # erfc
+Test "erfc (-0x8p-4)":
+float: 1
+ifloat: 1
 Test "erfc (0.75)":
 float: 1
 ifloat: 1
@@ -6802,6 +6808,33 @@
 Test "erfc (0x1.ffff56789abcdef0123456789a8p+2)":
 ildouble: 1
 ldouble: 1
+Test "erfc (0x2p+0)":
+double: 1
+idouble: 1
+Test "erfc (0x3.ee6078p+0)":
+double: 1
+idouble: 1
+Test "erfc (0x4.2p+0)":
+double: 1
+idouble: 1
+Test "erfc (0x7.fe8008p+0)":
+float: 1
+ifloat: 1
+Test "erfc (0x7.fffd59e26af37bc048d159e26ap+0)":
+ildouble: 1
+ldouble: 1
+Test "erfc (0x7.fffd59e26af37bc8p+0)":
+ildouble: 2
+ldouble: 2
+Test "erfc (0x7.fffd59e26af37bcp+0)":
+ildouble: 2
+ldouble: 2
+Test "erfc (0x7.fffd6p+0)":
+float: 1
+ifloat: 1
+Test "erfc (0xcp-4)":
+float: 1
+ifloat: 1
 Test "erfc (2.0)":
 double: 1
 idouble: 1
@@ -6813,11 +6846,28 @@
 Test "exp (0.75)":
 ildouble: 1
 ldouble: 1
+Test "exp (0x3.2p+4)":
+ildouble: 1
+ldouble: 1
+Test "exp (0xcp-4)":
+ildouble: 1
+ldouble: 1
 Test "exp (50.0)":
 ildouble: 1
 ldouble: 1
 
 # exp10
+Test "exp10 (-0x1.31p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp10 (-0x1p+0)":
+double: 1
+idouble: 1
+Test "exp10 (-0x2.4p+4)":
+double: 1
+idouble: 1
 Test "exp10 (-1)":
 double: 2
 float: 1
@@ -6840,6 +6890,12 @@
 ifloat: 1
 ildouble: 1
 ldouble: 1
+Test "exp10 (0x2.4p+4)":
+double: 1
+idouble: 1
+Test "exp10 (0x3p+0)":
+double: 1
+idouble: 1
 Test "exp10 (3)":
 double: 1
 float: 1
@@ -6857,6 +6913,21 @@
 ldouble: 2
 
 # exp_downward
+Test "exp_downward (0x1p+0)":
+ildouble: 1
+ldouble: 1
+Test "exp_downward (0x2p+0)":
+double: 1
+idouble: 1
+Test "exp_downward (0x3p+0)":
+double: 1
+idouble: 1
+Test "exp_downward (0x5.8b9028p+4)":
+double: 1
+idouble: 1
+Test "exp_downward (0xcp-4)":
+double: 1
+idouble: 1
 Test "exp_downward (2)":
 float: 1
 ifloat: 1
@@ -6866,7 +6937,30 @@
 ildouble: 1
 ldouble: 1
 
+# exp_tonearest
+Test "exp_tonearest (0x3.2p+4)":
+ildouble: 1
+ldouble: 1
+Test "exp_tonearest (0xcp-4)":
+ildouble: 1
+ldouble: 1
+
 # exp_towardzero
+Test "exp_towardzero (0x1p+0)":
+ildouble: 1
+ldouble: 1
+Test "exp_towardzero (0x2p+0)":
+double: 1
+idouble: 1
+Test "exp_towardzero (0x3p+0)":
+double: 1
+idouble: 1
+Test "exp_towardzero (0x5.8b9028p+4)":
+double: 1
+idouble: 1
+Test "exp_towardzero (0xcp-4)":
+double: 1
+idouble: 1
 Test "exp_towardzero (2)":
 float: 1
 ifloat: 1
@@ -6877,6 +6971,65 @@
 ldouble: 1
 
 # exp_upward
+Test "exp_upward (-0x2.e870a4p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.e870a7e5e88c2p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.e870a7e5e88cp+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.e870a8p+8)":
+double: 1
+idouble: 1
+Test "exp_upward (-0x2.ebe224p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x2.ebe227861639p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x2.ebe228p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0x4.d2p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0xf.ffffffffffff8p+1020)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0xf.ffffffffffffbffffffffffffcp+1020)":
+ildouble: 1
+ldouble: 1
+Test "exp_upward (-0xf.fffffp+124)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (0x1p+0)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "exp_upward (0x2.c5cp+8)":
+double: 1
+idouble: 1
+Test "exp_upward (0x2p+0)":
+ildouble: 1
+ldouble: 1
+Test "exp_upward (0x3.2p+4)":
+double: 1
+idouble: 1
 Test "exp_upward (1)":
 float: 1
 ifloat: 1
@@ -6887,6 +7040,17 @@
 Test "expm1 (0.75)":
 double: 1
 idouble: 1
+Test "expm1 (0x1.f4p+8)":
+double: 1
+idouble: 1
+Test "expm1 (0x1p+0)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "expm1 (0xcp-4)":
+double: 1
+idouble: 1
 Test "expm1 (1)":
 double: 1
 float: 1
@@ -6984,6 +7148,19 @@
 Test "j0 (-0x1.001000001p+593)":
 ildouble: 2
 ldouble: 2
+Test "j0 (-0x2.002000002p+592)":
+ildouble: 2
+ldouble: 2
+Test "j0 (-0x4p+0)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (-0xf.fffffp+124)":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
 Test "j0 (-4.0)":
 double: 1
 float: 2
@@ -7001,6 +7178,32 @@
 Test "j0 (0x1p1023)":
 ildouble: 1
 ldouble: 1
+Test "j0 (0x4p+0)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "j0 (0x8p+0)":
+float: 1
+ifloat: 1
+Test "j0 (0x8p+1020)":
+ildouble: 1
+ldouble: 1
+Test "j0 (0xap+0)":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+Test "j0 (0xe.be71dp+104)":
+float: 2
+ifloat: 2
+ildouble: 1
+ldouble: 1
+Test "j0 (0xf.fffffp+124)":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
 Test "j0 (10.0)":
 double: 3
 float: 1
@@ -7038,6 +7241,38 @@
 ildouble: 1
 ldouble: 1
 Test "j1 (0x1p1023)":
+ildouble: 1
+ldouble: 1
+Test "j1 (0x2p+0)":
+double: 1
+idouble: 1
+Test "j1 (0x4.ffcp+72)":
+double: 1
+idouble: 1
+Test "j1 (0x8p+0)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (0x8p+1020)":
+ildouble: 1
+ldouble: 1
+Test "j1 (0xap+0)":
+float: 2
+ifloat: 2
+Test "j1 (0xf.ffffffffffff8p+1020)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "j1 (0xf.ffffffffffffbffffffffffffcp+1020)":
+ildouble: 1
+ldouble: 1
+Test "j1 (0xf.fffffp+124)":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
 ildouble: 1
 ldouble: 1
 Test "j1 (10.0)":
@@ -7289,6 +7524,17 @@
 ifloat: 1
 
 # pow10
+Test "pow10 (-0x1.31p+8)":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "pow10 (-0x1p+0)":
+double: 1
+idouble: 1
+Test "pow10 (-0x2.4p+4)":
+double: 1
+idouble: 1
 Test "pow10 (-1)":
 double: 1
 idouble: 1
@@ -7298,6 +7544,12 @@
 ildouble: 1
 ldouble: 1
 Test "pow10 (-36)":
+double: 1
+idouble: 1
+Test "pow10 (0x2.4p+4)":
+double: 1
+idouble: 1
+Test "pow10 (0x3p+0)":
 double: 1
 idouble: 1
 Test "pow10 (3)":
@@ -9088,8 +9340,8 @@
 float: 1
 idouble: 1
 ifloat: 1
-ildouble: 1
-ldouble: 1
+ildouble: 2
+ldouble: 2
 
 Function: "exp":
 ildouble: 1
@@ -9108,7 +9360,9 @@
 ldouble: 2
 
 Function: "exp_downward":
-float: 1
+double: 1
+float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
@@ -9118,13 +9372,17 @@
 ldouble: 1
 
 Function: "exp_towardzero":
-float: 1
+double: 1
+float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1
 
 Function: "exp_upward":
-float: 1
+double: 1
+float: 1
+idouble: 1
 ifloat: 1
 ildouble: 1
 ldouble: 1

Modified: fsf/trunk/libc/sysdeps/powerpc/ldsodefs.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/ldsodefs.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/ldsodefs.h Thu Dec  5 00:02:16 2013
@@ -25,6 +25,8 @@
 struct La_ppc32_retval;
 struct La_ppc64_regs;
 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,	\
-				      long int *framesizep)
+				      long int *framesizep);		\
+    Elf64_Addr (*ppc64v2_gnu_pltenter) (Elf64_Sym *, unsigned int,	\
+					uintptr_t *,  uintptr_t *,	\
+					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 *,	\
-				       struct La_ppc64_retval *, const char *)
+				       struct La_ppc64_retval *,	\
+				       const char *);			\
+    unsigned int (*ppc64v2_gnu_pltexit) (Elf64_Sym *, unsigned int,	\
+					 uintptr_t *,			\
+					 uintptr_t *,			\
+					 const struct La_ppc64v2_regs *,\
+					 struct La_ppc64v2_retval *,	\
+					 const char *)
 
 #include_next <ldsodefs.h>
 

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/__longjmp-common.S Thu Dec  5 00:02:16 2013
@@ -130,7 +130,7 @@
 	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)
@@ -148,7 +148,7 @@
 	PTR_DEMANGLE2 (r0, r25)
 #endif
 	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)

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/crti.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/crti.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/crti.S Thu Dec  5 00:02:16 2013
@@ -60,23 +60,14 @@
 .LC0:
 	.tc PREINIT_FUNCTION[TC], PREINIT_FUNCTION
 #endif
-	.type BODY_LABEL (_init), @function
-	.globl _init
-	.section ".opd", "aw"
-	.align 3
-_init:	OPD_ENT (_init)
-#ifdef HAVE_ASM_GLOBAL_DOT_NAME
-	.globl BODY_LABEL (_init)
-	.size _init, 24
-#else
-	.type _init, @function
-#endif
 	.section ".init", "ax", @progbits
+	ENTRY_2(_init)
 	.align ALIGNARG (2)
 BODY_LABEL (_init):
+	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)
@@ -87,20 +78,11 @@
 	nop
 1:
 
-	.type BODY_LABEL (_fini), @function
-	.globl _fini
-	.section ".opd", "aw"
-	.align 3
-_fini:	OPD_ENT (_fini)
-#ifdef HAVE_ASM_GLOBAL_DOT_NAME
-	.globl BODY_LABEL (_fini)
-	.size _fini, 24
-#else
-	.type _fini, @function
-#endif
 	.section ".fini", "ax", @progbits
+	ENTRY_2(_fini)
 	.align ALIGNARG (2)
 BODY_LABEL (_fini):
+	LOCALENTRY(_fini)
 	mflr 0
-	std 0, 16(r1)
-	stdu r1, -112(r1)
+	std 0, FRAME_LR_SAVE(r1)
+	stdu r1, -FRAME_MIN_SIZE_PARM(r1)

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/crtn.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/crtn.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/crtn.S Thu Dec  5 00:02:16 2013
@@ -39,13 +39,13 @@
 #include <sysdep.h>
 
 	.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
-	addi r1, r1, 112
-	ld r0, 16(r1)
+	addi r1, r1, FRAME_MIN_SIZE_PARM
+	ld r0, FRAME_LR_SAVE(r1)
 	mtlr r0
 	blr

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-irel.h Thu Dec  5 00:02:16 2013
@@ -50,7 +50,11 @@
     {
       Elf64_Addr *const reloc_addr = (void *) reloc->r_offset;
       Elf64_Addr value = elf_ifunc_invoke(reloc->r_addend);
+#if _CALL_ELF != 2
       *(Elf64_FuncDesc *) reloc_addr = *(Elf64_FuncDesc *) value;
+#else
+      *reloc_addr = value;
+#endif
     }
   else
     __libc_fatal ("unexpected reloc type in static binary");

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-machine.h Thu Dec  5 00:02:16 2013
@@ -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
    arrays of these.  */
@@ -40,6 +41,7 @@
   Elf64_Addr fd_toc;
   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)
 {
+  /* Verify that the binary matches our ABI version.  */
+  if ((ehdr->e_flags & EF_PPC64_ABI) != 0)
+    {
+#if _CALL_ELF != 2
+      if ((ehdr->e_flags & EF_PPC64_ABI) != 1)
+        return 0;
+#else
+      if ((ehdr->e_flags & EF_PPC64_ABI) != 2)
+        return 0;
+#endif
+    }
+
   return ehdr->e_machine == EM_PPC64;
 }
 
@@ -122,15 +136,9 @@
 #define RTLD_START \
   asm (".pushsection \".text\"\n"					\
 "	.align	2\n"							\
-"	.type	" BODY_PREFIX "_start,@function\n"			\
-"	.pushsection \".opd\",\"aw\"\n"					\
-"	.align	3\n"							\
-"	.globl	_start\n"						\
 "	" ENTRY_2(_start) "\n"						\
-"_start:\n"								\
-"	" OPD_ENT(_start) "\n"						\
-"	.popsection\n"							\
 BODY_PREFIX "_start:\n"							\
+"	" LOCALENTRY(_start) "\n"						\
 /* We start with the following on the stack, from top:			\
    argc (4 bytes);							\
    arguments for program (terminated by NULL);				\
@@ -154,11 +162,6 @@
 ".LT__start_name_end:\n"						\
 "	.align 2\n"							\
 "	" END_2(_start) "\n"						\
-"	.globl	_dl_start_user\n"					\
-"	.pushsection \".opd\",\"aw\"\n"					\
-"_dl_start_user:\n"							\
-"	" OPD_ENT(_dl_start_user) "\n"					\
-"	.popsection\n"							\
 "	.pushsection	\".toc\",\"aw\"\n"				\
 DL_STARTING_UP_DEF							\
 ".LC__rtld_local:\n"							\
@@ -170,7 +173,6 @@
 ".LC__dl_fini:\n"							\
 "	.tc _dl_fini[TC],_dl_fini\n"					\
 "	.popsection\n"							\
-"	.type	" BODY_PREFIX "_dl_start_user,@function\n"		\
 "	" ENTRY_2(_dl_start_user) "\n"					\
 /* Now, we do our main work of calling initialisation procedures.	\
    The ELF ABI doesn't say anything about parameters for these,		\
@@ -178,6 +180,7 @@
    Changing these is strongly discouraged (not least because argc is	\
    passed by value!).  */						\
 BODY_PREFIX "_dl_start_user:\n"						\
+"	" LOCALENTRY(_dl_start_user) "\n"				\
 /* the address of _start in r30.  */					\
 "	mr	30,3\n"							\
 /* &_dl_argc in 29, &_dl_argv in 27, and _dl_loaded in 28.  */		\
@@ -228,10 +231,7 @@
 /* Now, call the start function descriptor at r30...  */		\
 "	.globl	._dl_main_dispatch\n"					\
 "._dl_main_dispatch:\n"							\
-"	ld	0,0(30)\n"						\
-"	ld	2,8(30)\n"						\
-"	mtctr	0\n"							\
-"	ld	11,16(30)\n"						\
+"	" PPC64_LOAD_FUNCPTR(30) "\n"					\
 "	bctr\n"								\
 ".LT__dl_start_user:\n"							\
 "	.long 0\n"							\
@@ -272,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))
+#else
+/* And now that you have read that large comment, you can disregard it
+   all for ELFv2.  ELFv2 does need the special SHN_UNDEF treatment.  */
+#define IS_PPC64_TLS_RELOC(R)						\
+  (((R) >= R_PPC64_TLS && (R) <= R_PPC64_DTPREL16_HIGHESTA)		\
+   || ((R) >= R_PPC64_TPREL16_HIGH && (R) <= R_PPC64_DTPREL16_HIGHA))
+
+#define elf_machine_type_class(type) \
+  ((((type) == R_PPC64_JMP_SLOT					\
+     || (type) == R_PPC64_ADDR24				\
+     || 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
@@ -282,8 +296,19 @@
 #define ELF_MACHINE_NO_REL 1
 
 /* Stuff for the PLT.  */
+#if _CALL_ELF != 2
 #define PLT_INITIAL_ENTRY_WORDS 3
+#define PLT_ENTRY_WORDS 3
 #define GLINK_INITIAL_ENTRY_WORDS 8
+/* The first 32k entries of glink can set an index and branch using two
+   instructions; past that point, glink uses three instructions.  */
+#define GLINK_ENTRY_WORDS(I) (((I) < 0x8000)? 2 : 3)
+#else
+#define PLT_INITIAL_ENTRY_WORDS 2
+#define PLT_ENTRY_WORDS 1
+#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")
@@ -328,38 +353,45 @@
 
       if (lazy)
 	{
-	  /* The function descriptor of the appropriate trampoline
-	     routine is used to set the 1st and 2nd doubleword of the
-	     plt_reserve.  */
-	  Elf64_FuncDesc *resolve_fd;
 	  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;
-
-	  resolve_fd = (Elf64_FuncDesc *) (profile ? _dl_profile_resolve
-					   : _dl_runtime_resolve);
+	  Elf64_Addr dlrr;
+
+	  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
 	       want profiling and the timers are started.  */
 	    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.  */
-	  plt_reserve->fd_func = resolve_fd->fd_func;
-	  plt_reserve->fd_toc  = resolve_fd->fd_toc;
-	  plt_reserve->fd_aux  = (Elf64_Addr) map;
+	  {
+	    /* The plt_reserve area is the 1st 3 doublewords of the PLT.  */
+	    Elf64_FuncDesc *plt_reserve = (Elf64_FuncDesc *) plt;
+	    Elf64_FuncDesc *resolve_fd = (Elf64_FuncDesc *) dlrr;
+	    plt_reserve->fd_func = resolve_fd->fd_func;
+	    plt_reserve->fd_toc  = resolve_fd->fd_toc;
+	    plt_reserve->fd_aux  = (Elf64_Addr) map;
 #ifdef RTLD_BOOTSTRAP
-	  /* When we're bootstrapping, the opd entry will not have
-	     been relocated yet.  */
-	  plt_reserve->fd_func += l_addr;
-	  plt_reserve->fd_toc  += l_addr;
+	    /* When we're bootstrapping, the opd entry will not have
+	       been relocated yet.  */
+	    plt_reserve->fd_func += l_addr;
+	    plt_reserve->fd_toc  += l_addr;
+#endif
+	  }
+#else
+	  /* When we don't have function descriptors, the first doubleword
+	     of the PLT holds the address of _dl_runtime_resolve, and the
+	     second doubleword holds the map address.  */
+	  plt[0] = dlrr;
+	  plt[1] = (Elf64_Addr) map;
 #endif
 
 	  /* Set up the lazy PLT entries.  */
@@ -370,14 +402,8 @@
 	    {
 
 	      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,
-		 glink uses three instructions.  */
-	      if (i < 0x8000)
-		glink_offset += 2;
-	      else
-		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
@@ -398,6 +424,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
+   offset if usable.  */
+static inline Elf64_Addr __attribute__ ((always_inline))
+ppc64_local_entry_offset (struct link_map *map, lookup_t sym_map,
+			  const Elf64_Rela *reloc)
+{
+  const Elf64_Sym *symtab;
+  const Elf64_Sym *sym;
+
+  /* If the target function is in a different object, we cannot
+     use the local entry point.  */
+  if (sym_map != map)
+    return 0;
+
+  /* If the linker inserted multiple TOCs, we cannot use the
+     local entry point.  */
+  if (map->l_info[DT_PPC64(OPT)]
+      && (map->l_info[DT_PPC64(OPT)]->d_un.d_val & PPC64_OPT_MULTI_TOC))
+    return 0;
+
+  /* Otherwise, we can use the local entry point.  Retrieve its offset
+     from the symbol's ELF st_other field.  */
+  symtab = (const void *) D_PTR (map, l_info[DT_SYMTAB]);
+  sym = &symtab[ELFW(R_SYM) (reloc->r_info)];
+
+  /* If the target function is an ifunc then the local entry offset is
+     for the resolver, not the final destination.  */
+  if (__builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0))
+    return 0;
+
+  return PPC64_LOCAL_ENTRY_OFFSET (sym->st_other);
+}
+#endif
+
 /* Change the PLT entry whose reloc is 'reloc' to call the actual
    routine.  */
 static inline Elf64_Addr __attribute__ ((always_inline))
@@ -405,6 +467,7 @@
 		       const Elf64_Rela *reloc,
 		       Elf64_Addr *reloc_addr, Elf64_Addr finaladdr)
 {
+#if _CALL_ELF != 2
   Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr;
   Elf64_FuncDesc *rel = (Elf64_FuncDesc *) finaladdr;
   Elf64_Addr offset = 0;
@@ -442,13 +505,20 @@
   plt->fd_func = rel->fd_func + offset;
   PPC_DCBST (&plt->fd_func);
   PPC_ISYNC;
+#else
+  finaladdr += ppc64_local_entry_offset (map, sym_map, reloc);
+  *reloc_addr = finaladdr;
+#endif
 
   return finaladdr;
 }
 
 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,
+			  const Elf64_Rela *reloc,
+			  Elf64_Addr *reloc_addr, Elf64_Addr finaladdr)
+{
+#if _CALL_ELF != 2
   Elf64_FuncDesc *plt = (Elf64_FuncDesc *) reloc_addr;
   Elf64_FuncDesc *rel = (Elf64_FuncDesc *) finaladdr;
 
@@ -459,6 +529,10 @@
   PPC_DCBST (&plt->fd_aux);
   PPC_DCBST (&plt->fd_toc);
   PPC_SYNC;
+#else
+  finaladdr += ppc64_local_entry_offset (map, sym_map, reloc);
+  *reloc_addr = finaladdr;
+#endif
 }
 
 /* Return the final value of a plt relocation.  */
@@ -471,8 +545,13 @@
 
 
 /* Names of the architecture-specific auditing callback functions.  */
+#if _CALL_ELF != 2
 #define ARCH_LA_PLTENTER ppc64_gnu_pltenter
 #define ARCH_LA_PLTEXIT ppc64_gnu_pltexit
+#else
+#define ARCH_LA_PLTENTER ppc64v2_gnu_pltenter
+#define ARCH_LA_PLTEXIT ppc64v2_gnu_pltexit
+#endif
 
 #endif /* dl_machine_h */
 
@@ -528,6 +607,7 @@
 resolve_ifunc (Elf64_Addr value,
 	       const struct link_map *map, const struct link_map *sym_map)
 {
+#if _CALL_ELF != 2
 #ifndef RESOLVE_CONFLICT_FIND_MAP
   /* The function we are calling may not yet have its opd entry relocated.  */
   Elf64_FuncDesc opd;
@@ -545,6 +625,7 @@
       value = (Elf64_Addr) &opd;
     }
 #endif
+#endif
   return ((Elf64_Addr (*) (unsigned long int)) value) (GLRO(dl_hwcap));
 }
 
@@ -610,7 +691,7 @@
       /* Fall thru */
     case R_PPC64_JMP_SLOT:
 #ifdef RESOLVE_CONFLICT_FIND_MAP
-      elf_machine_plt_conflict (reloc_addr, value);
+      elf_machine_plt_conflict (map, sym_map, reloc, reloc_addr, value);
 #else
       elf_machine_fixup_plt (map, sym_map, reloc, reloc_addr, value);
 #endif
@@ -669,10 +750,24 @@
 
     case R_PPC64_TPREL16_HI:
       value = elf_machine_tprel (map, sym_map, sym, reloc);
+      if (dont_expect (value + 0x80000000 >= 0x100000000LL))
+	_dl_reloc_overflow (map, "R_PPC64_TPREL16_HI", reloc_addr, refsym);
       *(Elf64_Half *) reloc_addr = PPC_HI (value);
       break;
 
+    case R_PPC64_TPREL16_HIGH:
+      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))
+	_dl_reloc_overflow (map, "R_PPC64_TPREL16_HA", reloc_addr, refsym);
+      *(Elf64_Half *) reloc_addr = PPC_HA (value);
+      break;
+
+    case R_PPC64_TPREL16_HIGHA:
       value = elf_machine_tprel (map, sym_map, sym, reloc);
       *(Elf64_Half *) reloc_addr = PPC_HA (value);
       break;
@@ -709,17 +804,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;
-	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);
@@ -755,7 +856,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);
       *(Elf64_Word *) reloc_addr = value;
       return;

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-trampoline.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-trampoline.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/dl-trampoline.S Thu Dec  5 00:02:16 2013
@@ -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
    r10;  Use local var space rather than the parameter save area,
    because gcc as of 2010/05 doesn't allocate a proper stack frame for
    a function that makes no calls except for __tls_get_addr and we
    might be here resolving the __tls_get_addr call.  */
-#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)
@@ -48,36 +48,31 @@
 	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)
-	mfcr	r0
+	std	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
+	cfi_offset (lr, FRAME_LR_SAVE)
 	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)
 	bl	JUMPTARGET(_dl_fixup)
 #ifndef SHARED
 	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	r0,FRAME_SIZE+8(r1)
 	ld	r6,INT_PARMS+24(r1)
 	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)
-	ld	r2,8(r3)
-	mtctr	r0
-	ld	r11,16(r3)
+/* Prepare for calling the function returned by fixup.  */
+	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+FRAME_TOC_SAVE(r1)
+#endif
 /* Unwind the stack frame, and jump.  */
 	addi	r1,r1,FRAME_SIZE
 	bctr
@@ -85,17 +80,30 @@
 #undef FRAME_SIZE
 #undef INT_PARMS
 
-	/* Stack layout:
-	  +592   previous backchain
-	  +584   spill_r31
-	  +576   spill_r30
-	  +560   v1
-	  +552   fp4
-	  +544   fp3
-	  +536   fp2
-	  +528   fp1
-	  +520   r4
-	  +512   r3
+	/* Stack layout:		ELFv2 ABI.
+					+752   previous backchain
+					+744   spill_r31
+					+736   spill_r30
+					+720   v8
+					+704   v7
+					+688   v6
+					+672   v5
+					+656   v4
+					+640   v3
+					+624   v2
+					+608   v1
+					+600   fp10
+	  ELFv1 ABI			+592   fp9
+	  +592   previous backchain	+584   fp8
+	  +584   spill_r31		+576   fp7
+	  +576   spill_r30		+568   fp6
+	  +560   v1			+560   fp5
+	  +552   fp4			+552   fp4
+	  +544   fp3			+544   fp3
+	  +536   fp2			+536   fp2
+	  +528   fp1			+528   fp1
+	  +520   r4			+520   r4
+	  +512   r3			+512   r3
 	   return values
           +504   free
 	  +496   stackframe
@@ -147,18 +155,24 @@
 	  +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
-	  +24    Reserved for compiler
+	 * Parameter save area
+	 * (v1 ABI: Allocated by the call, at least 8 double words)
+	  +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
 	*/
-#define FRAME_SIZE 592
+#if _CALL_ELF == 2
+# define FRAME_SIZE 752
+# define VR_RTN 608
+#else
+# define FRAME_SIZE 592
+# define VR_RTN 560
+#endif
 #define INT_RTN 512
 #define FPR_RTN 528
-#define VR_RTN 560
 #define STACK_FRAME 496
 #define CALLING_LR 488
 #define CALLING_SP 480
@@ -203,18 +217,14 @@
 	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+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)
-/* I'm almost certain we don't have to save cr...  be safe.  */
-	std	r0,FRAME_SIZE+8(r1)
 	ld	r12,.LC__dl_hwcap@toc(r2)
 #ifdef SHARED
 	/* Load _rtld_local_ro._dl_hwcap.  */
@@ -311,24 +321,22 @@
 	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	r0,FRAME_SIZE+8(r1)
 	ld	r6,INT_PARMS+24(r1)
 	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)
-	ld	r2,8(r3)
-	ld	r11,16(r3)
+/* Prepare for calling the function returned by fixup.  */
+	PPC64_LOAD_FUNCPTR r3
 	ld	r3,INT_PARMS+0(r1)
-	mtctr	r0
+#if _CALL_ELF == 2
+/* Restore the caller's TOC in case we jump to a local entry point.  */
+	ld	r2,FRAME_SIZE+FRAME_TOC_SAVE(r1)
+#endif
 /* Load the floating point registers.  */
 	lfd	fp1,FPR_PARMS+0(r1)
 	lfd	fp2,FPR_PARMS+8(r1)
@@ -344,10 +352,11 @@
 	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
+
 L(do_pltexit):
 	la	r10,(VR_PARMS+0)(r1)
 	la	r9,(VR_PARMS+16)(r1)
@@ -375,25 +384,19 @@
 	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	r0,FRAME_SIZE+8(r1)
 	ld	r6,INT_PARMS+24(r1)
 	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)
-	std	r2,40(r1)
-	ld	r2,8(r3)
-	ld	r11,16(r3)
+/* Prepare for calling the function returned by fixup.  */
+	std	r2,FRAME_TOC_SAVE(r1)
+	PPC64_LOAD_FUNCPTR r3
 	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)
@@ -410,21 +413,42 @@
 	lfd	fp13,FPR_PARMS+96(r1)
 /* Call the target function.  */
 	bctrl
-	ld	r2,40(r1)
+	ld	r2,FRAME_TOC_SAVE(r1)
 	lwz	r12,VR_VRSAVE(r1)
 /* But return here and store the return values.  */
 	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)
-	stfd	fp3,FPR_PARMS+16(r1)
-	stfd	fp4,FPR_PARMS+24(r1)
+	stfd	fp3,FPR_RTN+16(r1)
+	stfd	fp4,FPR_RTN+24(r1)
+#if _CALL_ELF == 2
+	la	r12,VR_RTN+16(r1)
+	stfd	fp5,FPR_RTN+32(r1)
+	stfd	fp6,FPR_RTN+40(r1)
+	li	r5,32
+	li	r6,64
+	stfd	fp7,FPR_RTN+48(r1)
+	stfd	fp8,FPR_RTN+56(r1)
+	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
+#if _CALL_ELF == 2
+	stvx	v3,0,r12
+	stvx	v4,r5,r10
+	stvx	v5,r5,r12
+	addi	r5,r5,64
+	stvx	v6,r6,r10
+	stvx	v7,r6,r12
+	stvx	v8,r5,r10
+	stvx	v9,r5,r12
+#endif
 L(callpltexit):
 	addi	r5,r1,INT_PARMS
 	addi	r6,r1,INT_RTN
@@ -436,18 +460,39 @@
 	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
-	la	r10,VR_RTN(r1)
-	lfd	fp3,FPR_PARMS+16(r1)
-	lfd	fp4,FPR_PARMS+24(r1)
+	la	r11,VR_RTN(r1)
+	lfd	fp3,FPR_RTN+16(r1)
+	lfd	fp4,FPR_RTN+24(r1)
+#if _CALL_ELF == 2
+	la	r12,VR_RTN+16(r1)
+	lfd	fp5,FPR_RTN+32(r1)
+	lfd	fp6,FPR_RTN+40(r1)
+	li	r30,32
+	li	r31,64
+	lfd	fp7,FPR_RTN+48(r1)
+	lfd	fp8,FPR_RTN+56(r1)
+	lfd	fp9,FPR_RTN+64(r1)
+	lfd	fp10,FPR_RTN+72(r1)
+#endif
 	beq	L(pltexitreturn)
-	lvx	v2,0,r10
+	lvx	v2,0,r11
+#if _CALL_ELF == 2
+	lvx	v3,0,r12
+	lvx	v4,r30,r11
+	lvx	v5,r30,r12
+	addi	r30,r30,64
+	lvx	v6,r31,r11
+	lvx	v7,r31,r12
+	lvx	v8,r30,r11
+	lvx	v9,r30,r12
+#endif
 L(pltexitreturn):
-	ld	r0,FRAME_SIZE+16(r1)
-	ld	r31,584(r1)
-	ld	r30,576(r1)
+	ld	r0,FRAME_SIZE+FRAME_LR_SAVE(r1)
+	ld	r31,FRAME_SIZE-8(r1)
+	ld	r30,FRAME_SIZE-16(r1)
 	mtlr	r0
 	ld	r1,0(r1)
 	blr

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/ppc-mcount.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/ppc-mcount.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/ppc-mcount.S Thu Dec  5 00:02:16 2013
@@ -24,16 +24,16 @@
 ENTRY(_mcount)
 	mflr		 r4
 	ld		 r11, 0(r1)
-	stdu		 r1,-112(r1)
-	cfi_adjust_cfa_offset (112)
-	std		 r4, 128(r1)
-	cfi_offset (lr, 16)
-	ld		 r3, 16(r11)
+	stdu		 r1,-FRAME_MIN_SIZE(r1)
+	cfi_adjust_cfa_offset (FRAME_MIN_SIZE)
+	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
-	ld		 r0, 128(r1)
+	ld		 r0, FRAME_MIN_SIZE+FRAME_LR_SAVE(r1)
 	mtlr		 r0
-	addi		 r1,r1,112
+	addi		 r1,r1,FRAME_MIN_SIZE
 	blr
 END(_mcount)
 

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/setjmp-common.S
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/setjmp-common.S (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/setjmp-common.S Thu Dec  5 00:02:16 2013
@@ -54,10 +54,11 @@
    bugz #269.  __GI__setjmp is used in csu/libc-start.c when
    HAVE_CLEANUP_JMP_BUF is defined.  */
 ENTRY (__GI__setjmp)
-	std r2,40(r1)		/* Save the callers TOC in the save area.  */
-	cfi_endproc
-END_2 (__GI__setjmp)
-/* Fall thru. */
+	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))
+END (__GI__setjmp)
 #endif
 
 ENTRY (_setjmp)
@@ -79,7 +80,7 @@
 #endif
 	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)
 #else
 	std  r2,(JB_GPR2*8)(3)
@@ -215,14 +216,14 @@
 	b	JUMPTARGET (__sigjmp_save)
 #else
 	mflr	r0
-	std	r0,16(r1)
-	stdu	r1,-112(r1)
-	cfi_adjust_cfa_offset(112)
-	cfi_offset(lr,16)
+	std	r0,FRAME_LR_SAVE(r1)
+	stdu	r1,-FRAME_MIN_SIZE(r1)
+	cfi_adjust_cfa_offset(FRAME_MIN_SIZE)
+	cfi_offset(lr,FRAME_LR_SAVE)
 	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
 #endif

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/sysdep.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/sysdep.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/sysdep.h Thu Dec  5 00:02:16 2013
@@ -20,25 +20,67 @@
 
 #ifdef __ASSEMBLER__
 
+/* Stack frame offsets.  */
+#if _CALL_ELF != 2
+#define FRAME_MIN_SIZE		112
+#define FRAME_MIN_SIZE_PARM	112
+#define FRAME_BACKCHAIN		0
+#define FRAME_CR_SAVE		8
+#define FRAME_LR_SAVE		16
+#define FRAME_TOC_SAVE		40
+#define FRAME_PARM_SAVE		48
+#define FRAME_PARM1_SAVE	48
+#define FRAME_PARM2_SAVE	56
+#define FRAME_PARM3_SAVE	64
+#define FRAME_PARM4_SAVE	72
+#define FRAME_PARM5_SAVE	80
+#define FRAME_PARM6_SAVE	88
+#define FRAME_PARM7_SAVE	96
+#define FRAME_PARM8_SAVE	104
+#define FRAME_PARM9_SAVE	112
+#else
+#define FRAME_MIN_SIZE		32
+#define FRAME_MIN_SIZE_PARM	96
+#define FRAME_BACKCHAIN		0
+#define FRAME_CR_SAVE		8
+#define FRAME_LR_SAVE		16
+#define FRAME_TOC_SAVE		24
+#define FRAME_PARM_SAVE		32
+#define FRAME_PARM1_SAVE	32
+#define FRAME_PARM2_SAVE	40
+#define FRAME_PARM3_SAVE	48
+#define FRAME_PARM4_SAVE	56
+#define FRAME_PARM5_SAVE	64
+#define FRAME_PARM6_SAVE	72
+#define FRAME_PARM7_SAVE	80
+#define FRAME_PARM8_SAVE	88
+#define FRAME_PARM9_SAVE	96
+#endif
+
 /* Support macros for CALL_MCOUNT.  */
+#if _CALL_ELF == 2
+#define call_mcount_parm_offset (-64)
+#else
+#define call_mcount_parm_offset FRAME_PARM_SAVE
+#endif
 	.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
-	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
-	cfi_offset(2+\NARG,40+8*(\NARG))
+	cfi_offset(2+\NARG,call_mcount_parm_offset-8+8*(\NARG))
 	.endif
 	.endm
 
@@ -55,25 +97,35 @@
 #ifdef	PROF
 	mflr	r0
 	SAVE_ARG \NARG
-	std	r0,16(r1)
-	stdu	r1,-112(r1)
-	cfi_adjust_cfa_offset(112)
-	cfi_offset(lr,16)
+	std	r0,FRAME_LR_SAVE(r1)
+	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)
 #ifndef SHARED
 	nop
 #endif
-	ld	r0,128(r1)
+	ld	r0,FRAME_MIN_SIZE_PARM+FRAME_LR_SAVE(r1)
 	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
 #endif
 	.endm
 
+#if _CALL_ELF != 2
+
+/* Macro to prepare for calling via a function pointer.  */
+	.macro PPC64_LOAD_FUNCPTR PTR
+	ld      r12,0(\PTR)
+	ld      r2,8(\PTR)
+	mtctr   r12
+	ld      r11,16(\PTR)
+	.endm
+
 #ifdef USE_PPC64_OVERLAPPING_OPD
 # define OPD_ENT(name)	.quad BODY_LABEL (name), .TOC.@tocbase
 #else
@@ -81,7 +133,6 @@
 #endif
 
 #define ENTRY_1(name)	\
-	.section	".text";		\
 	.type BODY_LABEL(name),@function;	\
 	.globl name;				\
 	.section ".opd","aw";			\
@@ -108,12 +159,37 @@
 	.size name,.-BODY_LABEL(name);		\
 	.size BODY_LABEL(name),.-BODY_LABEL(name);
 #endif
+#define LOCALENTRY(name)
+
+#else /* _CALL_ELF */
+
+/* Macro to prepare for calling via a function pointer.  */
+	.macro PPC64_LOAD_FUNCPTR PTR
+	mr	r12,\PTR
+	mtctr   r12
+	.endm
+
+#define DOT_LABEL(X) X
+#define BODY_LABEL(X) X
+#define ENTRY_2(name)	\
+	.globl name;				\
+	.type name,@function;
+#define END_2(name)	\
+	.size name,.-name;
+#define LOCALENTRY(name)	\
+1:      addis	r2,r12,.TOC.-1b@ha; \
+        addi	r2,r2,.TOC.-1b@l; \
+	.localentry name,.-name;
+
+#endif /* _CALL_ELF */
 
 #define ENTRY(name)	\
+	.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
@@ -127,11 +203,13 @@
 /* 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;			\
 BODY_LABEL(name):				\
-	cfi_startproc;
+	cfi_startproc;				\
+	LOCALENTRY(name)
 
 /* Local labels stripped out by the linker.  */
 #undef L
@@ -231,15 +309,15 @@
     .else; \
 .Local_syscall_error: \
     mflr 0; \
-    std 0,16(1); \
-    stdu 1,-112(1); \
-    cfi_adjust_cfa_offset(112); \
-    cfi_offset(lr,16); \
+    std 0,FRAME_LR_SAVE(1); \
+    stdu 1,-FRAME_MIN_SIZE(1); \
+    cfi_adjust_cfa_offset(FRAME_MIN_SIZE); \
+    cfi_offset(lr,FRAME_LR_SAVE); \
     bl JUMPTARGET(__syscall_error); \
     nop; \
-    ld 0,112+16(1); \
-    addi 1,1,112; \
-    cfi_adjust_cfa_offset(-112); \
+    ld 0,FRAME_MIN_SIZE+FRAME_LR_SAVE(1); \
+    addi 1,1,FRAME_MIN_SIZE; \
+    cfi_adjust_cfa_offset(-FRAME_MIN_SIZE); \
     mtlr 0; \
     cfi_restore(lr); \
     blr; \
@@ -286,27 +364,68 @@
 
 #else /* !__ASSEMBLER__ */
 
+#if _CALL_ELF != 2
+
+#define PPC64_LOAD_FUNCPTR(ptr) \
+	"ld 	12,0(" #ptr ");\n"					\
+	"ld	2,8(" #ptr ");\n"					\
+	"mtctr	12;\n"							\
+	"ld	11,16(" #ptr ");"
+
 #ifdef USE_PPC64_OVERLAPPING_OPD
 # define OPD_ENT(name)	".quad " BODY_PREFIX #name ", .TOC.@tocbase;"
 #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"						\
+	".pushsection \".opd\",\"aw\";\n"				\
+	".align  3;\n"							\
+#name ":\n"								\
+	OPD_ENT (name) "\n"						\
+	".popsection;"
 
 #ifdef HAVE_ASM_GLOBAL_DOT_NAME
 # define DOT_PREFIX "."
 # define BODY_PREFIX "."
 # define ENTRY_2(name)	\
 	".globl " BODY_PREFIX #name ";\n"				\
+	ENTRY_1(name) "\n"						\
 	".size  " #name ", 24;"
 # define END_2(name)	\
 	".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
 #else
 # define DOT_PREFIX ""
 # define BODY_PREFIX ".LY"
-# define ENTRY_2(name) ".type " #name ",@function;"
+# define ENTRY_2(name)	\
+	".type " #name ",@function;\n"					\
+	ENTRY_1(name)
 # define END_2(name)	\
 	".size " #name ",.-" BODY_PREFIX #name ";\n"			\
 	".size " BODY_PREFIX #name ",.-" BODY_PREFIX #name ";"
 #endif
+#define LOCALENTRY(name)
+
+#else /* _CALL_ELF */
+
+#define PPC64_LOAD_FUNCPTR(ptr) \
+	"mr	12," #ptr ";\n"						\
+	"mtctr 	12;"
+
+#define DOT_PREFIX ""
+#define BODY_PREFIX ""
+#define ENTRY_2(name)	\
+	".type " #name ",@function;\n"					\
+	".globl " #name ";"
+#define END_2(name)	\
+	".size " #name ",.-" #name ";"
+#define LOCALENTRY(name)	\
+	"1: addis 2,12,.TOC.-1b@ha;\n"					\
+	"addi	2,2,.TOC.-1b@l;\n"					\
+	".localentry " #name ",.-" #name ";"
+
+#endif /* _CALL_ELF */
 
 #endif	/* __ASSEMBLER__ */

Modified: fsf/trunk/libc/sysdeps/powerpc/powerpc64/tst-audit.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/tst-audit.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/tst-audit.h Thu Dec  5 00:02:16 2013
@@ -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
 #define La_regs La_ppc64_regs
 #define La_retval La_ppc64_retval
 #define int_retval lrv_r3
+#else
+#define pltenter la_ppc64v2_gnu_pltenter
+#define pltexit la_ppc64v2_gnu_pltexit
+#define La_regs La_ppc64v2_regs
+#define La_retval La_ppc64v2_retval
+#define int_retval lrv_r3
+#endif

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Makefile (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Makefile Thu Dec  5 00:02:16 2013
@@ -1,9 +1,12 @@
-abi-variants := 32 64
+abi-variants := 32 64-v1 64-v2
 abi-32-options := -U__powerpc64__
 abi-32-condition := __WORDSIZE == 32
-abi-64-options := -D__powerpc64__
-abi-64-condition := __WORDSIZE == 64
-abi-64-ld-soname := ld64.so.1
+abi-64-v1-options := -D__powerpc64__ -U_CALL_ELF -D_CALL_ELF=1
+abi-64-v1-condition := __WORDSIZE == 64 && _CALL_ELF != 2
+abi-64-v1-ld-soname := ld64.so.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

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/bits/libc-vdso.h
==============================================================================

[... 629 lines stripped ...]
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits