diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-12 13:52:43 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-12 13:52:43 +0000 |
commit | 875d2ea2b87818e1e88b0135796f788e492969d2 (patch) | |
tree | dc7310f1fd349ec96cdf3943f0bc22bc458ba345 /libgcc | |
parent | 8f2883a19640f425e3ad8fe2ffe9b4ceb1c5bc7e (diff) | |
parent | d1609a232616d0a85f2f7bd9ebf4dae4b11fd481 (diff) | |
download | gcc-875d2ea2b87818e1e88b0135796f788e492969d2.zip gcc-875d2ea2b87818e1e88b0135796f788e492969d2.tar.gz gcc-875d2ea2b87818e1e88b0135796f788e492969d2.tar.bz2 |
Merge from trunk revision 249111.
From-SVN: r249126
Diffstat (limited to 'libgcc')
35 files changed, 908 insertions, 53 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 906cbd5..9a97dba 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,140 @@ +2017-06-09 Martin Liska <mliska@suse.cz> + + * libgcov-profiler.c (__gcov_indirect_call_profiler_v2): + Reset __gcov_indirect_call_callee to NULL. + +2017-06-08 Olivier Hainque <hainque@adacore.com> + + * config/t-vxworks (LIBGCC2_INCLUDES): Add path to wrn/coreip to + the set of -I options, support for direct inclusions of net/uio.h + by VxWorks header files via ioLib.h. + +2017-06-07 Tony Reix <tony.reix@atos.net> + Matthieu Sarter <matthieu.sarter.external@atos.net> + David Edelsohn <dje.gcc@gmail.com> + + * config/rs6000/aix-unwind.h (MD_FALLBACK_FRAME_STATE_FOR): Define + unconditionally. + (ucontext_for): Add 64-bit AIX 6.1, 7.1, 7.2 support. Add 32-bit + AIX 7.2 support. + +2017-06-02 Olivier Hainque <hainque@adacore.com> + + * config/vxlib.c (__gthread_once): Add missing value to + return statement. + +2017-05-30 Olivier Hainque <hainque@adacore.com> + + * config/t-vxworks (LIBGCC2_INCLUDES): Remove extraneous + dollar sign before $(MULTIDIR). + +2017-05-26 Richard Henderson <rth@redhat.com> + + PR libgcc/80037 + * config/alpha/t-alpha (CRTSTUFF_T_CFLAGS): New. + +2017-05-17 Andreas Tobler <andreast@gcc.gnu.org> + + * config/arm/unwind-arm.h: Make _Unwind_GetIP, _Unwind_GetIPInfo and + _Unwind_SetIP available as functions for arm*-*-freebsd*. + * config/arm/unwind-arm.c: Implement the above. + +2017-05-15 Adhemerval Zanella <adhemerval.zanella@linaro.org> + + * config/sparc/lb1spc.S [__ELF__ && __linux__]: Emit .note.GNU-stack + section for a non-executable stack. + +2017-05-14 Krister Walfridsson <krister.walfridsson@gmail.com> + + PR target/80600 + * config.host (*-*-netbsd*): Add t-slibgcc-libgcc to tmake_file. + +2017-05-14 Daniel Santos <daniel.santos@pobox.com> + + * config.host: Add i386/t-msabi to i386/t-linux file list. + * config/i386/i386-asm.h: New file. + * config/i386/resms64.S: New file. + * config/i386/resms64f.S: New file. + * config/i386/resms64fx.S: New file. + * config/i386/resms64x.S: New file. + * config/i386/savms64.S: New file. + * config/i386/savms64f.S: New file. + * config/i386/t-msabi: New file. + +2017-05-09 Andreas Tobler <andreast@gcc.gnu.org> + + * config.host: Use the generic FreeBSD t-slibgcc-elf-ver for + arm*-*-freebsd* instead of the t-slibgcc-libgcc. + +2017-05-05 Joshua Conner <joshconner@google.com> + + * config/arm/unwind-arm.h (_Unwind_decode_typeinfo_ptr): Use + pc-relative indirect handling for fuchsia. + * config/t-slibgcc-fuchsia: New file. + * config.host (*-*-fuchsia*, aarch64*-*-fuchsia*, arm*-*-fuchsia*, + x86_64-*-fuchsia*): Add definitions. + +2017-04-19 Martin Liska <mliska@suse.cz> + + PR gcov-profile/80435 + * Makefile.in: Install gcov.h. + * gcov.h: New file. + * libgcov.h: Use the header and make __gcov_flush publicly + visible. + +2017-04-18 Martin Liska <mliska@suse.cz> + + PR gcov-profile/78783 + * libgcov-driver.c (gcov_get_filename): New function. + +2017-04-07 Jeff Law <law@redhat.com> + + * Makefile.in: Swap definition of LIBGCC_LINKS and inclusion of + target makefile fragment. + * config/sh/t-sh (unwind-dw2-Os-4-200.o): Depend on LIBGCC_LINKS. + +2017-04-07 Alan Modra <amodra@gmail.com> + + PR target/45053 + * config/rs6000/t-crtstuff (CRTSTUFF_T_CFLAGS): Add -O2. + +2017-04-03 Jonathan Wakely <jwakely@redhat.com> + + * config/c6x/pr-support.c (__gnu_unwind_execute): Fix typo in comment. + +2017-03-27 Claudiu Zissulescu <claziss@synopsys.com> + + * config/arc/ieee-754/divdf3.S (__divdf3): Use __ARCEM__. + +2017-03-10 John Marino <gnugcc@marino.st> + + * config/aarch64/freebsd-unwind.h: New file. + * config.host: Add aarch64-*-freebsd unwinder. + +2017-03-10 Segher Boessenkool <segher@kernel.crashing.org> + + * config/rs6000/crtrestvr.s: Use .machine altivec. + * config/rs6000/crtsavevr.s: Ditto. + +2017-03-10 Segher Boessenkool <segher@kernel.crashing.org> + + * configure.ac (test for libgcc_cv_powerpc_float128): Temporarily + modify CFLAGS. Add -mabi=altivec -mvsx -mfloat128. + (test for libgcc_cv_powerpc_float128_hw): Add -mpower9-vector and + -mfloat128-hardware to the CFLAGS. Fix syntax error in the C snippet. + * configure: Regenerate. + * config.in: Regenerate. + +2017-03-02 Jonathan Yong <10walls@gmail.com> + + * config/i386/gthr-win32.h: Define NOGDI before + windows.h include to prevent w32api CC_NONE macro + clash with libgfortran. + +2017-03-02 Jonathan Yong <10walls@gmail.com> + + * unwind-seh.c: Suppress warnings for RtlUnwindEx calls. + 2017-02-16 Andrew Pinski <apinski@cavium.com> * config/aarch64/value-unwind.h: New file. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index f71d320..a1a392d 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -348,8 +348,6 @@ LIBUNWIND = SHLIBUNWIND_LINK = SHLIBUNWIND_INSTALL = -tmake_file = @tmake_file@ -include $(srcdir)/empty.mk $(tmake_file) # Create links to files specified in config.host. LIBGCC_LINKS = enable-execute-stack.c unwind.h md-unwind-support.h \ @@ -366,6 +364,9 @@ sfp-machine.h: $(srcdir)/config/$(sfp_machine_header) gthr-default.h: $(srcdir)/$(thread_header) -$(LN_S) $< $@ +tmake_file = @tmake_file@ +include $(srcdir)/empty.mk $(tmake_file) + # Collect target defines and headers from config.host. libgcc_tm_defines = @tm_defines@ libgcc_tm_file = @tm_file@ @@ -906,14 +907,14 @@ libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER)) libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \ $(libgcov-interface-objects) $(libgcov-driver-objects) -$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h +$(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c -$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h +$(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c -$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h +$(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \ - $(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h + $(srcdir)/libgcov-driver-system.c $(srcdir)/gcov.h $(srcdir)/libgcov.h $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c @@ -1113,6 +1114,10 @@ install-unwind_h: all: install-unwind_h-forbuild +install-gcov_h: + $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include + $(INSTALL_DATA) $(srcdir)/gcov.h $(DESTDIR)$(libsubdir)/include + # Documentation targets (empty). .PHONY: info html dvi pdf install-info install-html install-pdf @@ -1170,13 +1175,14 @@ install-leaf: $(install-shared) $(install-libunwind) esac; \ done -install: install-leaf install-unwind_h +install: install-leaf install-unwind_h install-gcov_h @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install install-strip: install .PHONY: install install-shared install-libunwind install-strip .PHONY: install-unwind_h install-unwind_h-forbuild +.PHONY: install-gcov_h # Don't export variables to the environment, in order to not confuse # configure. diff --git a/libgcc/config.host b/libgcc/config.host index 8bab369..7711abf 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -231,6 +231,10 @@ case ${host} in ;; esac ;; +*-*-fuchsia*) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-fuchsia" + extra_parts="crtbegin.o crtend.o" + ;; *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver t-linux" extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" @@ -245,6 +249,7 @@ case ${host} in *-*-netbsd*) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" tmake_file="$tmake_file t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver" + tmake_file="$tmake_file t-slibgcc-libgcc" # NetBSD 1.7 and later are set up to use GCC's crtstuff for # ELF configurations. We will clear extra_parts in the # a.out configurations. @@ -340,7 +345,11 @@ aarch64*-*-freebsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm" - md_unwind_header=aarch64/aarch64-unwind.h + md_unwind_header=aarch64/freebsd-unwind.h + ;; +aarch64*-*-fuchsia*) + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" + tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" ;; aarch64*-*-linux*) extra_parts="$extra_parts crtfastmath.o" @@ -389,11 +398,17 @@ arm-wrs-vxworks) ;; arm*-*-freebsd*) # ARM FreeBSD EABI tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix arm/t-elf" - tmake_file="${tmake_file} arm/t-bpabi arm/t-freebsd t-slibgcc-libgcc" + tmake_file="${tmake_file} arm/t-bpabi arm/t-freebsd" tm_file="${tm_file} arm/bpabi-lib.h" unwind_header=config/arm/unwind-arm.h tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" ;; +arm*-*-fuchsia*) + tmake_file="${tmake_file} arm/t-arm arm/t-elf arm/t-bpabi" + tmake_file="${tmake_file} arm/tsoftfp t-softfp" + tm_file="${tm_file} arm/bpabi-lib.h" + unwind_header=config/arm/unwind-arm.h + ;; arm*-*-netbsdelf*) tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover" ;; @@ -588,6 +603,9 @@ i[34567]86-*-elf*) x86_64-*-elf* | x86_64-*-rtems*) tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" ;; +x86_64-*-fuchsia*) + tmake_file="$tmake_file t-libgcc-pic" + ;; i[34567]86-*-dragonfly*) tmake_file="${tmake_file} i386/t-dragonfly i386/t-crtstuff" md_unwind_header=i386/dragonfly-unwind.h @@ -1351,7 +1369,7 @@ case ${host} in i[34567]86-*-linux* | x86_64-*-linux* | \ i[34567]86-*-kfreebsd*-gnu | x86_64-*-kfreebsd*-gnu | \ i[34567]86-*-gnu*) - tmake_file="${tmake_file} t-tls i386/t-linux t-slibgcc-libgcc" + tmake_file="${tmake_file} t-tls i386/t-linux i386/t-msabi t-slibgcc-libgcc" if test "$libgcc_cv_cfi" = "yes"; then tmake_file="${tmake_file} t-stack i386/t-stack-i386" fi diff --git a/libgcc/config.in b/libgcc/config.in index 4d33411..25aa0d9 100644 --- a/libgcc/config.in +++ b/libgcc/config.in @@ -21,9 +21,6 @@ /* Define if the system-provided CRTs are present on Solaris. */ #undef HAVE_SOLARIS_CRTS -/* Define if the system-provided CRTs are present on Solaris. */ -#undef HAVE_SOLARIS_CRTS - /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff --git a/libgcc/config/aarch64/freebsd-unwind.h b/libgcc/config/aarch64/freebsd-unwind.h new file mode 100644 index 0000000..b822a72 --- /dev/null +++ b/libgcc/config/aarch64/freebsd-unwind.h @@ -0,0 +1,108 @@ +/* DWARF2 EH unwinding support for FreeBSD/ARM64 (aarch64). + Copyright (C) 2017 Free Software Foundation, Inc. + Contributed by John Marino <gnugcc@marino.st> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +/* Identify a signal frame, and set the frame state data appropriately. + See unwind-dw2.c for the structs. */ + +/* Always include AArch64 unwinder header file. */ +#include "config/aarch64/aarch64-unwind.h" + +#include <sys/types.h> +#include <signal.h> +#include <unistd.h> +#include <sys/ucontext.h> +#include <machine/frame.h> +#include <sys/user.h> +#include <sys/sysctl.h> + +#define REG_NAME(reg) mc_gpregs.gp_## reg +#define XREG(num) mc_gpregs.gp_x[num] +#define DARC __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__ + +#define MD_FALLBACK_FRAME_STATE_FOR aarch64_freebsd_fallback_frame_state + +static int +aarch64_outside_sigtramp_range (unsigned char *pc) +{ + static int sigtramp_range_determined = 0; + static unsigned char *sigtramp_start, *sigtramp_end; + + if (sigtramp_range_determined == 0) + { + struct kinfo_sigtramp kst = {0}; + size_t len = sizeof (kst); + int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_SIGTRAMP, getpid() }; + + sigtramp_range_determined = 1; + if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0) + { + sigtramp_range_determined = 2; + sigtramp_start = kst.ksigtramp_start; + sigtramp_end = kst.ksigtramp_end; + } + } + if (sigtramp_range_determined < 2) /* sysctl failed if < 2 */ + return 1; + + return (pc < sigtramp_start || pc >= sigtramp_end); +} + +static _Unwind_Reason_Code +aarch64_freebsd_fallback_frame_state +(struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + int n; + struct sigframe *sf; + mcontext_t *sc; + _Unwind_Ptr new_cfa; + + if (aarch64_outside_sigtramp_range(context->ra)) + return _URC_END_OF_STACK; + + sf = (struct sigframe *) context->cfa; + sc = &sf->sf_uc.uc_mcontext; + + new_cfa = (_Unwind_Ptr) sc; + fs->regs.cfa_how = CFA_REG_OFFSET; + fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__; + fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa; + + for (n = 0; n < 32; n++) + fs->regs.reg[n].how = REG_SAVED_OFFSET; + + for (n = 0; n < 30; n++) + fs->regs.reg[n].loc.offset = (_Unwind_Ptr) &(sc->XREG(n)) - new_cfa; + + fs->regs.reg[30].loc.offset = (_Unwind_Ptr) &(sc->REG_NAME(lr)) - new_cfa; + fs->regs.reg[31].loc.offset = (_Unwind_Ptr) &(sc->REG_NAME(sp)) - new_cfa; + + fs->regs.reg[DARC].how = REG_SAVED_OFFSET; + fs->regs.reg[DARC].loc.offset = (_Unwind_Ptr) &(sc->REG_NAME(elr)) - new_cfa; + + fs->retaddr_column = DARC; + fs->signal_frame = 1; + + return _URC_NO_REASON; +} diff --git a/libgcc/config/alpha/t-alpha b/libgcc/config/alpha/t-alpha index 0b6ffb1..0c2f840 100644 --- a/libgcc/config/alpha/t-alpha +++ b/libgcc/config/alpha/t-alpha @@ -1,2 +1,6 @@ # This is a support routine for longlong.h, used by libgcc2.c. LIB2ADD += $(srcdir)/config/alpha/qrnnd.S + +# When GAS-generated unwind tables are created, they get created +# after the __FRAME_END__ terminator, which causes an ld error. +CRTSTUFF_T_CFLAGS = -fno-unwind-tables diff --git a/libgcc/config/arc/ieee-754/divdf3.S b/libgcc/config/arc/ieee-754/divdf3.S index 4d6aae2..b8085a6 100644 --- a/libgcc/config/arc/ieee-754/divdf3.S +++ b/libgcc/config/arc/ieee-754/divdf3.S @@ -189,13 +189,13 @@ __divdf3: asl r8,DBL1H,12 lsr r12,DBL1L,20 lsr r4,r8,26 -#ifdef __HS__ +#if defined (__ARCHS__) || defined (__ARCEM__) add3 r10,pcl,60 ; (.Ldivtab-.) >> 3 #else add3 r10,pcl,59 ; (.Ldivtab-.) >> 3 #endif ld.as r4,[r10,r4] -#ifdef __HS__ +#if defined (__ARCHS__) || defined (__ARCEM__) ld.as r9,[pcl,182]; [pcl,(-((.-.L7ff00000) >> 2))] ; 0x7ff00000 #else ld.as r9,[pcl,180]; [pcl,(-((.-.L7ff00000) >> 2))] ; 0x7ff00000 @@ -299,14 +299,14 @@ __divdf3: rsub r7,r6,5 asr r10,r12,28 bmsk r4,r12,27 -#ifdef __HS__ +#if defined (__ARCHS__) || defined (__ARCEM__) min r7, r7, 31 asr DBL0L, r4, r7 #else asrs DBL0L,r4,r7 #endif add DBL1H,r11,r10 -#ifdef __HS__ +#if defined (__ARCHS__) || defined (__ARCEM__) abs.f r10, r4 sub.mi r10, r10, 1 #endif diff --git a/libgcc/config/arm/unwind-arm.c b/libgcc/config/arm/unwind-arm.c index a3d7391..c6bfe13 100644 --- a/libgcc/config/arm/unwind-arm.c +++ b/libgcc/config/arm/unwind-arm.c @@ -509,3 +509,25 @@ __aeabi_unwind_cpp_pr2 (_Unwind_State state, { return __gnu_unwind_pr_common (state, ucbp, context, 2); } + +#ifdef __FreeBSD__ +/* FreeBSD expects these to be functions */ +inline _Unwind_Ptr +_Unwind_GetIP (struct _Unwind_Context *context) +{ + return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1; +} + +inline _Unwind_Ptr +_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn) +{ + *ip_before_insn = 0; + return _Unwind_GetIP (context); +} + +inline void +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) +{ + _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)); +} +#endif diff --git a/libgcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h index 9fb854f..037be34 100644 --- a/libgcc/config/arm/unwind-arm.h +++ b/libgcc/config/arm/unwind-arm.h @@ -49,7 +49,7 @@ extern "C" { return 0; #if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \ - || defined(__FreeBSD__) + || defined(__FreeBSD__) || defined(__fuchsia__) /* Pc-relative indirect. */ #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect) tmp += ptr; @@ -72,12 +72,19 @@ extern "C" { { return _URC_FAILURE; } +#ifndef __FreeBSD__ /* Return the address of the instruction, not the actual IP value. */ #define _Unwind_GetIP(context) \ (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) #define _Unwind_SetIP(context, val) \ _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)) +#else + #undef _Unwind_GetIPInfo + _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); + _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *); + void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); +#endif #ifdef __cplusplus } /* extern "C" */ diff --git a/libgcc/config/c6x/pr-support.c b/libgcc/config/c6x/pr-support.c index 6731850..f1ab7ad 100644 --- a/libgcc/config/c6x/pr-support.c +++ b/libgcc/config/c6x/pr-support.c @@ -449,7 +449,7 @@ __gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws) if ((op & 0xf0) == 0xe0) { - /* B3 = reg. RETURN case alreadh handled above. */ + /* B3 = reg. RETURN case already handled above. */ int regno = unwind_frame_regs[op & 0xf]; _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, ®); diff --git a/libgcc/config/i386/gthr-win32.h b/libgcc/config/i386/gthr-win32.h index 74a524b..246fa5f 100644 --- a/libgcc/config/i386/gthr-win32.h +++ b/libgcc/config/i386/gthr-win32.h @@ -545,6 +545,7 @@ __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) #else /* ! __GTHREAD_HIDE_WIN32API */ +#define NOGDI #include <windows.h> #include <errno.h> diff --git a/libgcc/config/i386/i386-asm.h b/libgcc/config/i386/i386-asm.h new file mode 100644 index 0000000..c613e9f --- /dev/null +++ b/libgcc/config/i386/i386-asm.h @@ -0,0 +1,82 @@ +/* Defines common perprocessor and assembly macros for use by various stubs. + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifndef I386_ASM_H +#define I386_ASM_H + +#ifdef __ELF__ +# define ELFFN(fn) .type fn,@function +#else +# define ELFFN(fn) +#endif + +#define FUNC_START(fn) \ + .global fn; \ + ELFFN (fn); \ +fn: + +#define HIDDEN_FUNC(fn)\ + FUNC_START (fn) \ + .hidden fn; \ + +#define FUNC_END(fn) .size fn,.-fn + +#ifdef __SSE2__ +# ifdef __AVX__ +# define MOVAPS vmovaps +# else +# define MOVAPS movaps +# endif + +/* Save SSE registers 6-15. off is the offset of rax to get to xmm6. */ +.macro SSE_SAVE off=0 + MOVAPS %xmm15,(\off - 0x90)(%rax) + MOVAPS %xmm14,(\off - 0x80)(%rax) + MOVAPS %xmm13,(\off - 0x70)(%rax) + MOVAPS %xmm12,(\off - 0x60)(%rax) + MOVAPS %xmm11,(\off - 0x50)(%rax) + MOVAPS %xmm10,(\off - 0x40)(%rax) + MOVAPS %xmm9, (\off - 0x30)(%rax) + MOVAPS %xmm8, (\off - 0x20)(%rax) + MOVAPS %xmm7, (\off - 0x10)(%rax) + MOVAPS %xmm6, \off(%rax) +.endm + +/* Restore SSE registers 6-15. off is the offset of rsi to get to xmm6. */ +.macro SSE_RESTORE off=0 + MOVAPS (\off - 0x90)(%rsi), %xmm15 + MOVAPS (\off - 0x80)(%rsi), %xmm14 + MOVAPS (\off - 0x70)(%rsi), %xmm13 + MOVAPS (\off - 0x60)(%rsi), %xmm12 + MOVAPS (\off - 0x50)(%rsi), %xmm11 + MOVAPS (\off - 0x40)(%rsi), %xmm10 + MOVAPS (\off - 0x30)(%rsi), %xmm9 + MOVAPS (\off - 0x20)(%rsi), %xmm8 + MOVAPS (\off - 0x10)(%rsi), %xmm7 + MOVAPS \off(%rsi), %xmm6 +.endm + +#endif /* __SSE2__ */ +#endif /* I386_ASM_H */ diff --git a/libgcc/config/i386/resms64.S b/libgcc/config/i386/resms64.S new file mode 100644 index 0000000..f47e2f0 --- /dev/null +++ b/libgcc/config/i386/resms64.S @@ -0,0 +1,57 @@ +/* Epilogue stub for 64-bit ms/sysv clobbers: restore + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Epilogue routine for restoring 64-bit ms/sysv registers. */ + + .text +HIDDEN_FUNC(__resms64_18) + mov -0x70(%rsi),%r15 +HIDDEN_FUNC(__resms64_17) + mov -0x68(%rsi),%r14 +HIDDEN_FUNC(__resms64_16) + mov -0x60(%rsi),%r13 +HIDDEN_FUNC(__resms64_15) + mov -0x58(%rsi),%r12 +HIDDEN_FUNC(__resms64_14) + mov -0x50(%rsi),%rbp +HIDDEN_FUNC(__resms64_13) + mov -0x48(%rsi),%rbx +HIDDEN_FUNC(__resms64_12) + mov -0x40(%rsi),%rdi + SSE_RESTORE off=0x60 + mov -0x38(%rsi),%rsi + ret +FUNC_END(__resms64_12) +FUNC_END(__resms64_13) +FUNC_END(__resms64_14) +FUNC_END(__resms64_15) +FUNC_END(__resms64_16) +FUNC_END(__resms64_17) +FUNC_END(__resms64_18) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/resms64f.S b/libgcc/config/i386/resms64f.S new file mode 100644 index 0000000..817da60 --- /dev/null +++ b/libgcc/config/i386/resms64f.S @@ -0,0 +1,55 @@ +/* Epilogue stub for 64-bit ms/sysv clobbers: restore (with hard frame pointer) + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Epilogue routine for restoring 64-bit ms/sysv registers when hard frame + pointer is used. */ + + .text +HIDDEN_FUNC(__resms64f_17) + mov -0x68(%rsi),%r15 +HIDDEN_FUNC(__resms64f_16) + mov -0x60(%rsi),%r14 +HIDDEN_FUNC(__resms64f_15) + mov -0x58(%rsi),%r13 +HIDDEN_FUNC(__resms64f_14) + mov -0x50(%rsi),%r12 +HIDDEN_FUNC(__resms64f_13) + mov -0x48(%rsi),%rbx +HIDDEN_FUNC(__resms64f_12) + mov -0x40(%rsi),%rdi + SSE_RESTORE off=0x60 + mov -0x38(%rsi),%rsi + ret +FUNC_END(__resms64f_12) +FUNC_END(__resms64f_13) +FUNC_END(__resms64f_14) +FUNC_END(__resms64f_15) +FUNC_END(__resms64f_16) +FUNC_END(__resms64f_17) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/resms64fx.S b/libgcc/config/i386/resms64fx.S new file mode 100644 index 0000000..5dba584 --- /dev/null +++ b/libgcc/config/i386/resms64fx.S @@ -0,0 +1,57 @@ +/* Epilogue stub for 64-bit ms/sysv clobbers: restore, leave and return + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Epilogue routine for 64-bit ms/sysv registers when hard frame pointer + * used -- restores registers, restores frame pointer and then returns + * from the function. */ + + .text +HIDDEN_FUNC(__resms64fx_17) + mov -0x68(%rsi),%r15 +HIDDEN_FUNC(__resms64fx_16) + mov -0x60(%rsi),%r14 +HIDDEN_FUNC(__resms64fx_15) + mov -0x58(%rsi),%r13 +HIDDEN_FUNC(__resms64fx_14) + mov -0x50(%rsi),%r12 +HIDDEN_FUNC(__resms64fx_13) + mov -0x48(%rsi),%rbx +HIDDEN_FUNC(__resms64fx_12) + mov -0x40(%rsi),%rdi + SSE_RESTORE off=0x60 + mov -0x38(%rsi),%rsi + leaveq + ret +FUNC_END(__resms64fx_12) +FUNC_END(__resms64fx_13) +FUNC_END(__resms64fx_14) +FUNC_END(__resms64fx_15) +FUNC_END(__resms64fx_16) +FUNC_END(__resms64fx_17) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/resms64x.S b/libgcc/config/i386/resms64x.S new file mode 100644 index 0000000..7770447 --- /dev/null +++ b/libgcc/config/i386/resms64x.S @@ -0,0 +1,59 @@ +/* Epilogue stub for 64-bit ms/sysv clobbers: restore and return + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Epilogue routine for restoring 64-bit ms/sysv registers and returning from + * function. */ + + .text +HIDDEN_FUNC(__resms64x_18) + mov -0x70(%rsi),%r15 +HIDDEN_FUNC(__resms64x_17) + mov -0x68(%rsi),%r14 +HIDDEN_FUNC(__resms64x_16) + mov -0x60(%rsi),%r13 +HIDDEN_FUNC(__resms64x_15) + mov -0x58(%rsi),%r12 +HIDDEN_FUNC(__resms64x_14) + mov -0x50(%rsi),%rbp +HIDDEN_FUNC(__resms64x_13) + mov -0x48(%rsi),%rbx +HIDDEN_FUNC(__resms64x_12) + mov -0x40(%rsi),%rdi + SSE_RESTORE off=0x60 + mov -0x38(%rsi),%rsi + mov %r10,%rsp + ret +FUNC_END(__resms64x_12) +FUNC_END(__resms64x_13) +FUNC_END(__resms64x_14) +FUNC_END(__resms64x_15) +FUNC_END(__resms64x_16) +FUNC_END(__resms64x_17) +FUNC_END(__resms64x_18) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/savms64.S b/libgcc/config/i386/savms64.S new file mode 100644 index 0000000..2067dd8 --- /dev/null +++ b/libgcc/config/i386/savms64.S @@ -0,0 +1,57 @@ +/* Prologue stub for 64-bit ms/sysv clobbers: save + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Prologue routine for saving 64-bit ms/sysv registers. */ + + .text +HIDDEN_FUNC(__savms64_18) + mov %r15,-0x70(%rax) +HIDDEN_FUNC(__savms64_17) + mov %r14,-0x68(%rax) +HIDDEN_FUNC(__savms64_16) + mov %r13,-0x60(%rax) +HIDDEN_FUNC(__savms64_15) + mov %r12,-0x58(%rax) +HIDDEN_FUNC(__savms64_14) + mov %rbp,-0x50(%rax) +HIDDEN_FUNC(__savms64_13) + mov %rbx,-0x48(%rax) +HIDDEN_FUNC(__savms64_12) + mov %rdi,-0x40(%rax) + mov %rsi,-0x38(%rax) + SSE_SAVE off=0x60 + ret +FUNC_END(__savms64_12) +FUNC_END(__savms64_13) +FUNC_END(__savms64_14) +FUNC_END(__savms64_15) +FUNC_END(__savms64_16) +FUNC_END(__savms64_17) +FUNC_END(__savms64_18) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/savms64f.S b/libgcc/config/i386/savms64f.S new file mode 100644 index 0000000..81583b6 --- /dev/null +++ b/libgcc/config/i386/savms64f.S @@ -0,0 +1,55 @@ +/* Prologue stub for 64-bit ms/sysv clobbers: save (with hard frame pointer) + Copyright (C) 2016-2017 Free Software Foundation, Inc. + Contributed by Daniel Santos <daniel.santos@pobox.com> + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#ifdef __x86_64__ +#include "i386-asm.h" + +/* Prologue routine for saving 64-bit ms/sysv registers when realignment is + * needed or hard frame pointer used. */ + + .text +HIDDEN_FUNC(__savms64f_17) + mov %r15,-0x68(%rax) +HIDDEN_FUNC(__savms64f_16) + mov %r14,-0x60(%rax) +HIDDEN_FUNC(__savms64f_15) + mov %r13,-0x58(%rax) +HIDDEN_FUNC(__savms64f_14) + mov %r12,-0x50(%rax) +HIDDEN_FUNC(__savms64f_13) + mov %rbx,-0x48(%rax) +HIDDEN_FUNC(__savms64f_12) + mov %rdi,-0x40(%rax) + mov %rsi,-0x38(%rax) + SSE_SAVE off=0x60 + ret +FUNC_END(__savms64f_12) +FUNC_END(__savms64f_13) +FUNC_END(__savms64f_14) +FUNC_END(__savms64f_15) +FUNC_END(__savms64f_16) +FUNC_END(__savms64f_17) + +#endif /* __x86_64__ */ diff --git a/libgcc/config/i386/t-msabi b/libgcc/config/i386/t-msabi new file mode 100644 index 0000000..f9806a6 --- /dev/null +++ b/libgcc/config/i386/t-msabi @@ -0,0 +1,7 @@ +# Makefile fragment to support -mcall-ms2sysv-xlogues +LIB2ADD_ST += $(srcdir)/config/i386/savms64.S \ + $(srcdir)/config/i386/resms64.S \ + $(srcdir)/config/i386/resms64x.S \ + $(srcdir)/config/i386/savms64f.S \ + $(srcdir)/config/i386/resms64f.S \ + $(srcdir)/config/i386/resms64fx.S diff --git a/libgcc/config/rs6000/aix-unwind.h b/libgcc/config/rs6000/aix-unwind.h index c513a12..1561658 100644 --- a/libgcc/config/rs6000/aix-unwind.h +++ b/libgcc/config/rs6000/aix-unwind.h @@ -64,7 +64,8 @@ #endif /* Now on to MD_FALLBACK_FRAME_STATE_FOR. - 32bit AIX 5.2, 5.3 and 7.1 only at this stage. */ + 32bit AIX 5.2, 5.3, 6.1, 7.X and + 64bit AIX 6.1, 7.X only at this stage. */ #include <stdlib.h> #include <stddef.h> @@ -73,18 +74,16 @@ #ifdef __64BIT__ -/* 64bit fallback not implemented yet, so MD_FALLBACK_FRAME_STATE_FOR not - defined. Arrange just for the code below to compile. */ typedef struct __context64 mstate_t; #else typedef struct mstsave mstate_t; -#define MD_FALLBACK_FRAME_STATE_FOR ppc_aix_fallback_frame_state - #endif +#define MD_FALLBACK_FRAME_STATE_FOR ppc_aix_fallback_frame_state + /* If we are compiling on AIX < 5.3, the VMX related datastructs are not defined and we take measures to obtain proper runtime behavior if the compiled code happens to run on a later version with VMX enabled. */ @@ -128,10 +127,26 @@ ucontext_for (struct _Unwind_Context *context) { const unsigned int * ra = context->ra; - /* AIX 5.2, 5.3 and 7.1, threaded or not, share common patterns + /* AIX 5.2, 5.3, 6.1 and 7.X, threaded or not, share common patterns and feature variants depending on the configured kernel (unix_mp or unix_64). */ +#ifdef __64BIT__ + if (*(ra - 5) == 0x4c00012c /* isync */ + && *(ra - 4) == 0xe8ec0000 /* ld r7,0(r12) */ + && *(ra - 3) == 0xe84c0008 /* ld r2,8(r12) */ + && *(ra - 2) == 0x7ce903a6 /* mtctr r7 */ + && *(ra - 1) == 0x4e800421 /* bctrl */ + && *(ra - 0) == 0x7de27b78) /* mr r2,r15 <-- context->ra */ + { + /* unix_64 */ + if (*(ra - 6) == 0x7d000164) /* mtmsrd r8 */ + { + /* AIX 6.1, 7.1 and 7.2 */ + return (ucontext_t *)(context->cfa + 0x70); + } + } +#else if (*(ra - 5) == 0x4c00012c /* isync */ && *(ra - 4) == 0x80ec0000 /* lwz r7,0(r12) */ && *(ra - 3) == 0x804c0004 /* lwz r2,4(r12) */ @@ -152,10 +167,14 @@ ucontext_for (struct _Unwind_Context *context) case 0x835a0570: /* lwz r26,1392(r26) */ return (ucontext_t *)(context->cfa + 0x40); - /* AIX 7.1 */ + /* AIX 6.1 and 7.1 */ case 0x2c1a0000: /* cmpwi r26,0 */ return (ucontext_t *)(context->cfa + 0x40); - + + /* AIX 7.2 */ + case 0x3800000a: /* li r0,A */ + return (ucontext_t *)(context->cfa + 0x40); + default: return 0; } @@ -174,7 +193,7 @@ ucontext_for (struct _Unwind_Context *context) return &frame->ucontext; } } - +#endif return 0; } diff --git a/libgcc/config/rs6000/crtrestvr.S b/libgcc/config/rs6000/crtrestvr.S index 592a2b4..a44ab89 100644 --- a/libgcc/config/rs6000/crtrestvr.S +++ b/libgcc/config/rs6000/crtrestvr.S @@ -31,6 +31,7 @@ /* Called with r0 pointing just beyond the end of the vector save area. */ + .machine altivec .section ".text" CFI_STARTPROC HIDDEN_FUNC(_restvr_20) diff --git a/libgcc/config/rs6000/crtsavevr.S b/libgcc/config/rs6000/crtsavevr.S index 2fd54c4..bc02019 100644 --- a/libgcc/config/rs6000/crtsavevr.S +++ b/libgcc/config/rs6000/crtsavevr.S @@ -31,6 +31,7 @@ /* Called with r0 pointing just beyond the end of the vector save area. */ + .machine altivec .section ".text" CFI_STARTPROC HIDDEN_FUNC(_savevr_20) diff --git a/libgcc/config/rs6000/t-crtstuff b/libgcc/config/rs6000/t-crtstuff index 7422d383..0b2601b 100644 --- a/libgcc/config/rs6000/t-crtstuff +++ b/libgcc/config/rs6000/t-crtstuff @@ -1,3 +1,6 @@ # If .sdata is enabled __CTOR_{LIST,END}__ go into .sdata instead of # .ctors. -CRTSTUFF_T_CFLAGS = -msdata=none +# Do not build crtend.o with -Os as that can result in references to +# out-of-line register save/restore functions, which may be unresolved +# as crtend.o is linked after libgcc.a. See PR45053. +CRTSTUFF_T_CFLAGS = -msdata=none -O2 diff --git a/libgcc/config/sh/t-sh b/libgcc/config/sh/t-sh index 46d01a6..10869c4 100644 --- a/libgcc/config/sh/t-sh +++ b/libgcc/config/sh/t-sh @@ -45,7 +45,7 @@ sdivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.S $(gcc_compile) -c -DL_sdivsi3_i4i $< udivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.S $(gcc_compile) -c -DL_udivsi3_i4i $< -unwind-dw2-Os-4-200.o: $(srcdir)/unwind-dw2.c +unwind-dw2-Os-4-200.o: $(srcdir)/unwind-dw2.c $(LIBGCC_LINKS) $(gcc_compile) $(LIBGCC2_CFLAGS) $(vis_hide) -fexceptions -Os -c $< OBJS_Os_4_200=sdivsi3_i4i-Os-4-200.o udivsi3_i4i-Os-4-200.o unwind-dw2-Os-4-200.o diff --git a/libgcc/config/sparc/lb1spc.S b/libgcc/config/sparc/lb1spc.S index b60bd57..e693864 100644 --- a/libgcc/config/sparc/lb1spc.S +++ b/libgcc/config/sparc/lb1spc.S @@ -5,6 +5,12 @@ slightly edited to match the desired calling convention, and also to optimize them for our purposes. */ +/* An executable stack is *not* required for these functions. */ +#if defined(__ELF__) && defined(__linux__) +.section .note.GNU-stack,"",%progbits +.previous +#endif + #ifdef L_mulsi3 .text .align 4 diff --git a/libgcc/config/t-slibgcc-fuchsia b/libgcc/config/t-slibgcc-fuchsia new file mode 100644 index 0000000..a171283 --- /dev/null +++ b/libgcc/config/t-slibgcc-fuchsia @@ -0,0 +1,44 @@ +# Copyright (C) 2017 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Fuchsia-specific shared library overrides. + +SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \ + $(LDFLAGS) +# Copyright (C) 2017 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Fuchsia-specific shared library overrides. + +SHLIB_LDFLAGS = -Wl,--soname=$(SHLIB_SONAME) \ + $(LDFLAGS) diff --git a/libgcc/config/t-vxworks b/libgcc/config/t-vxworks index 3647f75..d67e446 100644 --- a/libgcc/config/t-vxworks +++ b/libgcc/config/t-vxworks @@ -7,8 +7,8 @@ LIB2ADD = $(srcdir)/config/vxlib.c $(srcdir)/config/vxlib-tls.c # This ensures that the correct target headers are used; some # VxWorks system headers have names that collide with GCC's # internal (host) headers, e.g. regs.h. -LIBGCC2_INCLUDES = -nostdinc -I \ - `case "/$$(MULTIDIR)" in \ - */mrtp*) echo $(WIND_USR)/h ;; \ - *) echo $(WIND_BASE)/target/h ;; \ +LIBGCC2_INCLUDES = -nostdinc \ + `case "/$(MULTIDIR)" in \ + */mrtp*) echo -I$(WIND_USR)/h -I$(WIND_USR)/h/wrn/coreip ;; \ + *) echo -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip ;; \ esac` diff --git a/libgcc/config/vxlib.c b/libgcc/config/vxlib.c index 3cb8690..3df5d1f 100644 --- a/libgcc/config/vxlib.c +++ b/libgcc/config/vxlib.c @@ -70,7 +70,7 @@ __gthread_once (__gthread_once_t *guard, void (*func)(void)) /* This can happen on powerpc, which is using all 32 bits of the gthread_once_t structure. */ if (guard->done) - return; + return 0; #endif taskDelay (1); } diff --git a/libgcc/configure b/libgcc/configure index 5c900cc..45c4597 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -4779,6 +4779,8 @@ case ${host} in # software libraries, and whether the assembler can handle xsaddqp # for hardware support. powerpc*-*-linux*) + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; } if test "${libgcc_cv_powerpc_float128+set}" = set; then : @@ -4786,8 +4788,7 @@ if test "${libgcc_cv_powerpc_float128+set}" = set; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#pragma GCC target ("vsx") - vector double dadd (vector double a, vector double b) { return a + b; } +vector double dadd (vector double a, vector double b) { return a + b; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : libgcc_cv_powerpc_float128=yes @@ -4799,6 +4800,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128" >&5 $as_echo "$libgcc_cv_powerpc_float128" >&6; } + CFLAGS="$CFLAGS -mpower9-vector -mfloat128-hardware" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 3.0 to build hardware __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 3.0 to build hardware __float128 libraries... " >&6; } if test "${libgcc_cv_powerpc_float128_hw+set}" = set; then : @@ -4806,12 +4808,11 @@ if test "${libgcc_cv_powerpc_float128_hw+set}" = set; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#pragma GCC target ("vsx,power9-vector") - #include <sys/auxv.h> +#include <sys/auxv.h> #ifndef AT_PLATFORM #error "AT_PLATFORM is not defined" #endif - vector unsigned char (vector unsigned char a, vector unsigned char b) + vector unsigned char add (vector unsigned char a, vector unsigned char b) { vector unsigned char ret; __asm__ ("xsaddqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b)); @@ -4830,6 +4831,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128_hw" >&5 $as_echo "$libgcc_cv_powerpc_float128_hw" >&6; } + CFLAGS="$saved_CFLAGS" esac # Collect host-machine-specific information. diff --git a/libgcc/configure.ac b/libgcc/configure.ac index ea2030f..af15147 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -379,23 +379,24 @@ case ${host} in # software libraries, and whether the assembler can handle xsaddqp # for hardware support. powerpc*-*-linux*) + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries], [libgcc_cv_powerpc_float128], [AC_COMPILE_IFELSE( - [#pragma GCC target ("vsx") - vector double dadd (vector double a, vector double b) { return a + b; }], + [vector double dadd (vector double a, vector double b) { return a + b; }], [libgcc_cv_powerpc_float128=yes], [libgcc_cv_powerpc_float128=no])]) + CFLAGS="$CFLAGS -mpower9-vector -mfloat128-hardware" AC_CACHE_CHECK([for PowerPC ISA 3.0 to build hardware __float128 libraries], [libgcc_cv_powerpc_float128_hw], [AC_COMPILE_IFELSE( - [#pragma GCC target ("vsx,power9-vector") - #include <sys/auxv.h> + [#include <sys/auxv.h> #ifndef AT_PLATFORM #error "AT_PLATFORM is not defined" #endif - vector unsigned char (vector unsigned char a, vector unsigned char b) + vector unsigned char add (vector unsigned char a, vector unsigned char b) { vector unsigned char ret; __asm__ ("xsaddqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b)); @@ -406,6 +407,7 @@ powerpc*-*-linux*) __attribute__ ((__ifunc__ ("add_resolver")));], [libgcc_cv_powerpc_float128_hw=yes], [libgcc_cv_powerpc_float128_hw=no])]) + CFLAGS="$saved_CFLAGS" esac # Collect host-machine-specific information. diff --git a/libgcc/gcov.h b/libgcc/gcov.h new file mode 100644 index 0000000..0333ecc --- /dev/null +++ b/libgcc/gcov.h @@ -0,0 +1,41 @@ +/* GCOV interface routines. + Copyright (C) 2017 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC 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 General Public License + for more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef GCC_GCOV_H +#define GCC_GCOV_H + +/* Set all counters to zero. */ + +extern void __gcov_reset (void); + +/* Write profile information to a file. */ + +extern void __gcov_dump (void); + +/* Write profile information to a file and reset counters to zero. + The function does operations under a mutex. */ + +extern void __gcov_flush (void); + +#endif /* GCC_GCOV_H */ diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index 70fe69f..c3b2fd4 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -852,6 +852,15 @@ gcov_do_dump (struct gcov_info *list, int run_counted) free (gf.filename); } +#if IN_GCOV_TOOL +const char * +__attribute__ ((unused)) +gcov_get_filename (struct gcov_info *list) +{ + return list->filename; +} +#endif + #if !IN_GCOV_TOOL void __gcov_dump_one (struct gcov_root *root) diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c index 067d762..e4570a0 100644 --- a/libgcc/libgcov-profiler.c +++ b/libgcc/libgcov-profiler.c @@ -336,6 +336,8 @@ __gcov_indirect_call_profiler_v2 (gcov_type value, void* cur_func) || (__LIBGCC_VTABLE_USES_DESCRIPTORS__ && __gcov_indirect_call_callee && *(void **) cur_func == *(void **) __gcov_indirect_call_callee)) __gcov_one_value_profiler_body (__gcov_indirect_call_counters, value, 0); + + __gcov_indirect_call_callee = NULL; } #endif diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index 6118fe9..4c1204c 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -42,6 +42,7 @@ #include "coretypes.h" #include "tm.h" #include "libgcc_tm.h" +#include "gcov.h" #if __CHAR_BIT__ == 8 typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI))); @@ -237,16 +238,11 @@ extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN; /* GCOV exit function registered via a static destructor. */ extern void __gcov_exit (void) ATTRIBUTE_HIDDEN; -/* Called before fork, to avoid double counting. */ -extern void __gcov_flush (void) ATTRIBUTE_HIDDEN; - /* Function to reset all counters to 0. Both externally visible (and overridable) and internal version. */ -extern void __gcov_reset (void); extern void __gcov_reset_int (void) ATTRIBUTE_HIDDEN; /* User function to enable early write of profile information so far. */ -extern void __gcov_dump (void); extern void __gcov_dump_int (void) ATTRIBUTE_HIDDEN; /* The merge function that just sums the counters. */ diff --git a/libgcc/unwind-seh.c b/libgcc/unwind-seh.c index 37326c5..91edc1a 100644 --- a/libgcc/unwind-seh.c +++ b/libgcc/unwind-seh.c @@ -221,7 +221,7 @@ _GCC_specific_handler (PEXCEPTION_RECORD ms_exc, void *this_frame, test is that we're the target frame. */ if (ms_exc->ExceptionInformation[1] == (_Unwind_Ptr) this_frame) { - RtlUnwindEx (this_frame, ms_exc->ExceptionInformation[2], + RtlUnwindEx (this_frame, (PVOID) ms_exc->ExceptionInformation[2], ms_exc, gcc_exc, ms_orig_context, ms_disp->HistoryTable); abort (); @@ -313,7 +313,7 @@ _GCC_specific_handler (PEXCEPTION_RECORD ms_exc, void *this_frame, ms_exc->ExceptionInformation[3] = gcc_context.reg[1]; /* Begin phase 2. Perform the unwinding. */ - RtlUnwindEx (this_frame, gcc_context.ra, ms_exc, + RtlUnwindEx (this_frame, (PVOID)gcc_context.ra, ms_exc, (PVOID)gcc_context.reg[0], ms_orig_context, ms_disp->HistoryTable); } @@ -365,7 +365,7 @@ _Unwind_Resume (struct _Unwind_Exception *gcc_exc) ms_context.ContextFlags = CONTEXT_ALL; RtlCaptureContext (&ms_context); - RtlUnwindEx ((void *) gcc_exc->private_[1], gcc_exc->private_[2], + RtlUnwindEx ((void *) gcc_exc->private_[1], (PVOID)gcc_exc->private_[2], &ms_exc, gcc_exc, &ms_context, &ms_history); /* Is RtlUnwindEx declared noreturn? */ |