diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-10-12 09:46:38 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-10-12 09:46:38 -0700 |
commit | 9cd320ea6572c577cdf17ce1f9ea5230b166af6d (patch) | |
tree | d1c8e7c2e09a91ed75f0e5476c648c2e745aa2de /libgcc | |
parent | 4854d721be78358e59367982bdd94461b4be3c5a (diff) | |
parent | 3175d40fc52fb8eb3c3b18cc343d773da24434fb (diff) | |
download | gcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.zip gcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.tar.gz gcc-9cd320ea6572c577cdf17ce1f9ea5230b166af6d.tar.bz2 |
Merge from trunk revision 3175d40fc52fb8eb3c3b18cc343d773da24434fb.
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 120 | ||||
-rw-r--r-- | libgcc/config.host | 2 | ||||
-rw-r--r-- | libgcc/config/aarch64/aarch64-unwind.h | 41 | ||||
-rw-r--r-- | libgcc/config/aarch64/libgcc-softfp.ver | 28 | ||||
-rw-r--r-- | libgcc/config/aarch64/lse.S | 19 | ||||
-rw-r--r-- | libgcc/config/aarch64/t-softfp | 1 | ||||
-rw-r--r-- | libgcc/config/arm/fp16.c | 10 | ||||
-rw-r--r-- | libgcc/config/i386/morestack.S | 2 | ||||
-rw-r--r-- | libgcc/config/i386/shadow-stack-unwind.h | 9 | ||||
-rw-r--r-- | libgcc/config/msp430/slli.S | 15 | ||||
-rw-r--r-- | libgcc/config/msp430/srai.S | 15 | ||||
-rw-r--r-- | libgcc/config/msp430/srli.S | 16 | ||||
-rw-r--r-- | libgcc/config/nvptx/atomic.c | 77 | ||||
-rw-r--r-- | libgcc/config/nvptx/t-nvptx | 3 | ||||
-rw-r--r-- | libgcc/config/riscv/save-restore.S | 13 | ||||
-rw-r--r-- | libgcc/config/riscv/t-elf | 2 | ||||
-rw-r--r-- | libgcc/config/rs6000/morestack.S | 30 | ||||
-rw-r--r-- | libgcc/config/rs6000/t-linux | 7 | ||||
-rw-r--r-- | libgcc/config/rs6000/t-slibgcc-aix | 23 | ||||
-rw-r--r-- | libgcc/config/rs6000/tramp.S | 6 | ||||
-rw-r--r-- | libgcc/libgcov-driver-system.c | 2 | ||||
-rw-r--r-- | libgcc/libgcov-driver.c | 8 | ||||
-rw-r--r-- | libgcc/libgcov.h | 49 | ||||
-rw-r--r-- | libgcc/unwind-dw2.c | 34 |
24 files changed, 428 insertions, 104 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 602c907..83332b7 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,123 @@ +2020-10-09 H.J. Lu <hjl.tools@gmail.com> + + PR target/97148 + * config/i386/shadow-stack-unwind.h: Include <x86gprintrin.h> + instead of <cetintrin.h>. + +2020-10-01 Alan Modra <amodra@gmail.com> + + * config/rs6000/morestack.S, + * config/rs6000/tramp.S: Support __PCREL__ code. + +2020-10-01 Alan Modra <amodra@gmail.com> + + * config/rs6000/t-linux: Document purpose of -mno-minimal-toc. + +2020-09-29 Maciej W. Rozycki <macro@wdc.com> + + * config/riscv/t-elf (LIB2_DIVMOD_EXCEPTION_FLAGS): New + variable. + +2020-09-28 Richard Sandiford <richard.sandiford@arm.com> + + * config/aarch64/libgcc-softfp.ver: New file. + * config/aarch64/t-softfp (SHLIB_MAPFILES): Add it. + +2020-09-27 Clement Chigot <clement.chigot@atos.net> + + * config/rs6000/t-slibgcc-aix: Use $(AR) without -X32_64. + +2020-09-22 Sergei Trofimovich <siarheit@google.com> + + PR gcov-profile/96913 + * libgcov-driver.c (write_one_data): Avoid function pointer + comparison in TOP streaming decision. + +2020-09-17 Torbjörn SVENSSON <torbjorn.svensson@st.com> + Christophe Lyon <christophe.lyon@linaro.org> + + * config/arm/fp16.c (__gnu_h2f_internal): Add 'static inline' + qualifier. + (__gnu_f2h_ieee, __gnu_h2f_ieee, __gnu_f2h_alternative) + (__gnu_h2f_alternative,__gnu_d2h_ieee, __gnu_d2h_alternative): Add + missing prototypes. + +2020-09-17 Wei Wentao <weiwt.fnst@cn.fujitsu.com> + + * config/aarch64/aarch64-unwind.h (aarch64_demangle_return_addr): Fix + unused variable warning. + +2020-09-16 Jojo R <jiejie_rong@c-sky.com> + + * config.host (C-SKY): Enable crtbegin/crtend.o of libgcc for elf target. + +2020-09-09 Tom de Vries <tdevries@suse.de> + + * config/nvptx/atomic.c (__SYNC_SUBWORD_COMPARE_AND_SWAP): Fix + Wbuiltin-declaration-mismatch. + +2020-08-26 Jozef Lawrynowicz <jozef.l@mittosystems.com> + + * config/msp430/slli.S (__gnu_mspabi_sllp): New. + * config/msp430/srai.S (__gnu_mspabi_srap): New. + * config/msp430/srli.S (__gnu_mspabi_srlp): New. + +2020-08-13 Kwok Cheung Yeung <kcy@codesourcery.com> + + * config/nvptx/atomic.c: New. + * config/nvptx/t-nvptx (LIB2ADD): Add atomic.c. + +2020-08-03 Ian Lance Taylor <iant@golang.org> + + * config/i386/morestack.S (BACKOFF) [x86_64]: Add 2048 bytes. + +2020-08-03 Jakub Jelinek <jakub@redhat.com> + + PR target/96402 + * config/aarch64/lse.S (__aarch64_cas16_acq_rel): Use x2, x3 instead + of x(tmp0), x(tmp1) in STXP arguments. + +2020-07-31 Maciej W. Rozycki <macro@wdc.com> + + * config/riscv/save-restore.S [__riscv_xlen == 64] + (__riscv_save_10, __riscv_save_8, __riscv_save_6, __riscv_save_4) + (__riscv_save_2): Replace negative immediates used for the final + stack pointer adjustment with positive ones, right-shifted by 4. + +2020-07-31 Martin Liska <mliska@suse.cz> + + * libgcov-driver.c: Add __gcov_kvp_pool + and __gcov_kvp_pool_index variables. + * libgcov.h (allocate_gcov_kvp): New. + (gcov_topn_add_value): Use it. + +2020-07-24 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * config/aarch64/lse.S: Add PAC property note. + +2020-07-23 Martin Liska <mliska@suse.cz> + + PR gcov-profile/96035 + * libgcov-driver-system.c: Create gcov folders with 0777 + so that it respects a system umask. + +2020-07-14 David Edelsohn <dje.gcc@gmail.com> + + * config/rs6000/t-slibgcc-aix: Set BITS from compiler cpp macro. + +2020-07-13 Szabolcs Nagy <szabolcs.nagy@arm.com> + + PR target/94891 + * config/aarch64/aarch64-unwind.h (MD_POST_EXTRACT_ROOT_ADDR): Remove. + (MD_POST_FROB_EH_HANDLER_ADDR): Remove. + (MD_POST_EXTRACT_FRAME_ADDR): Rename to ... + (MD_DEMANGLE_RETURN_ADDR): This. + (aarch64_post_extract_frame_addr): Rename to ... + (aarch64_demangle_return_addr): This. + (aarch64_post_frob_eh_handler_addr): Remove. + * unwind-dw2.c (uw_update_context): Demangle return address. + (uw_frob_return_addr): Remove. + 2020-07-09 Szabolcs Nagy <szabolcs.nagy@arm.com> PR target/96001 diff --git a/libgcc/config.host b/libgcc/config.host index 7a3e29d..dbb378f 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -579,7 +579,7 @@ cris-*-elf) ;; csky-*-elf*) tmake_file="csky/t-csky t-fdpbit" - extra_parts="$extra_parts crti.o crtn.o" + extra_parts="crtbegin.o crtend.o crti.o crtn.o" ;; csky-*-linux*) tmake_file="$tmake_file csky/t-csky t-slibgcc-libgcc t-fdpbit csky/t-linux-csky" diff --git a/libgcc/config/aarch64/aarch64-unwind.h b/libgcc/config/aarch64/aarch64-unwind.h index ed84a96..719b58c 100644 --- a/libgcc/config/aarch64/aarch64-unwind.h +++ b/libgcc/config/aarch64/aarch64-unwind.h @@ -27,11 +27,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define DWARF_REGNUM_AARCH64_RA_STATE 34 -#define MD_POST_EXTRACT_ROOT_ADDR(addr) __builtin_aarch64_xpaclri (addr) -#define MD_POST_EXTRACT_FRAME_ADDR(context, fs, addr) \ - aarch64_post_extract_frame_addr (context, fs, addr) -#define MD_POST_FROB_EH_HANDLER_ADDR(current, target, addr) \ - aarch64_post_frob_eh_handler_addr (current, target, addr) +#define MD_DEMANGLE_RETURN_ADDR(context, fs, addr) \ + aarch64_demangle_return_addr (context, fs, addr) #define MD_FROB_UPDATE_CONTEXT(context, fs) \ aarch64_frob_update_context (context, fs) @@ -52,14 +49,16 @@ aarch64_cie_signed_with_b_key (struct _Unwind_Context *context) return 0; } -/* Do AArch64 private extraction on ADDR based on context info CONTEXT and - unwind frame info FS. If ADDR is signed, we do address authentication on it - using CFA of current frame. */ +/* Do AArch64 private extraction on ADDR_WORD based on context info CONTEXT and + unwind frame info FS. If ADDR_WORD is signed, we do address authentication + on it using CFA of current frame. */ static inline void * -aarch64_post_extract_frame_addr (struct _Unwind_Context *context, - _Unwind_FrameState *fs, void *addr) +aarch64_demangle_return_addr (struct _Unwind_Context *context, + _Unwind_FrameState *fs ATTRIBUTE_UNUSED, + _Unwind_Word addr_word) { + void *addr = (void *)addr_word; if (context->flags & RA_SIGNED_BIT) { _Unwind_Word salt = (_Unwind_Word) context->cfa; @@ -71,28 +70,6 @@ aarch64_post_extract_frame_addr (struct _Unwind_Context *context, return addr; } -/* Do AArch64 private frob on exception handler's address HANDLER_ADDR before - installing it into current context CURRENT. TARGET is currently not used. - We need to sign exception handler's address if CURRENT itself is signed. */ - -static inline void * -aarch64_post_frob_eh_handler_addr (struct _Unwind_Context *current, - struct _Unwind_Context *target - ATTRIBUTE_UNUSED, - void *handler_addr) -{ - if (current->flags & RA_SIGNED_BIT) - { - if (aarch64_cie_signed_with_b_key (current)) - return __builtin_aarch64_pacib1716 (handler_addr, - (_Unwind_Word) current->cfa); - return __builtin_aarch64_pacia1716 (handler_addr, - (_Unwind_Word) current->cfa); - } - else - return handler_addr; -} - /* Do AArch64 private initialization on CONTEXT based on frame info FS. Mark CONTEXT as return address signed if bit 0 of DWARF_REGNUM_AARCH64_RA_STATE is set. */ diff --git a/libgcc/config/aarch64/libgcc-softfp.ver b/libgcc/config/aarch64/libgcc-softfp.ver new file mode 100644 index 0000000..b51a3de --- /dev/null +++ b/libgcc/config/aarch64/libgcc-softfp.ver @@ -0,0 +1,28 @@ +# Copyright (C) 2020 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/>. + +GCC_11.0 { + __divhc3 + __extendhftf2 + __fixhfti + __fixunshfti + __floattihf + __floatuntihf + __mulhc3 + __trunctfhf2 +} diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S index 64691c6..7496b8b 100644 --- a/libgcc/config/aarch64/lse.S +++ b/libgcc/config/aarch64/lse.S @@ -203,7 +203,7 @@ STARTFN NAME(cas) cmp x0, x(tmp0) ccmp x1, x(tmp1), #0, eq bne 1f - STXP w(tmp2), x(tmp0), x(tmp1), [x4] + STXP w(tmp2), x2, x3, [x4] cbnz w(tmp2), 0b 1: ret @@ -283,6 +283,19 @@ ENDFN NAME(LDNM) #define FEATURE_1_BTI 1 #define FEATURE_1_PAC 2 +/* Supported features based on the code generation options. */ +#if defined(__ARM_FEATURE_BTI_DEFAULT) +# define BTI_FLAG FEATURE_1_BTI +#else +# define BTI_FLAG 0 +#endif + +#if __ARM_FEATURE_PAC_DEFAULT & 3 +# define PAC_FLAG FEATURE_1_PAC +#else +# define PAC_FLAG 0 +#endif + /* Add a NT_GNU_PROPERTY_TYPE_0 note. */ #define GNU_PROPERTY(type, value) \ .section .note.gnu.property, "a"; \ @@ -300,7 +313,7 @@ ENDFN NAME(LDNM) .section .note.GNU-stack, "", %progbits /* Add GNU property note if built with branch protection. */ -# ifdef __ARM_FEATURE_BTI_DEFAULT -GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI) +# if (BTI_FLAG|PAC_FLAG) != 0 +GNU_PROPERTY (FEATURE_1_AND, BTI_FLAG|PAC_FLAG) # endif #endif diff --git a/libgcc/config/aarch64/t-softfp b/libgcc/config/aarch64/t-softfp index c4ce0dc..981ced7 100644 --- a/libgcc/config/aarch64/t-softfp +++ b/libgcc/config/aarch64/t-softfp @@ -8,3 +8,4 @@ softfp_extras := fixhfti fixunshfti floattihf floatuntihf TARGET_LIBGCC2_CFLAGS += -Wno-missing-prototypes LIB2ADD += $(srcdir)/config/aarch64/sfp-exceptions.c +SHLIB_MAPFILES += $(srcdir)/config/aarch64/libgcc-softfp.ver diff --git a/libgcc/config/arm/fp16.c b/libgcc/config/arm/fp16.c index e8f7afb..3664503 100644 --- a/libgcc/config/arm/fp16.c +++ b/libgcc/config/arm/fp16.c @@ -52,6 +52,14 @@ binary64 = 52 /* significand. */ }; +/* Function prototypes. */ +unsigned short __gnu_f2h_ieee (unsigned int a); +unsigned int __gnu_h2f_ieee (unsigned short a); +unsigned short __gnu_f2h_alternative (unsigned int x); +unsigned int __gnu_h2f_alternative (unsigned short a); +unsigned short __gnu_d2h_ieee (unsigned long long a); +unsigned short __gnu_d2h_alternative (unsigned long long x); + static inline unsigned short __gnu_float2h_internal (const struct format* fmt, unsigned long long a, int ieee) @@ -165,7 +173,7 @@ __gnu_d2h_internal (unsigned long long a, int ieee) return __gnu_float2h_internal (&binary64, a, ieee); } -unsigned int +static inline unsigned int __gnu_h2f_internal(unsigned short a, int ieee) { unsigned int sign = (unsigned int)(a & 0x8000) << 16; diff --git a/libgcc/config/i386/morestack.S b/libgcc/config/i386/morestack.S index 519bbbc..1c31783 100644 --- a/libgcc/config/i386/morestack.S +++ b/libgcc/config/i386/morestack.S @@ -79,7 +79,7 @@ #ifndef __x86_64__ #define BACKOFF (1024) #else -#define BACKOFF (1536) +#define BACKOFF (3584) #endif diff --git a/libgcc/config/i386/shadow-stack-unwind.h b/libgcc/config/i386/shadow-stack-unwind.h index 201b2153..ff979da 100644 --- a/libgcc/config/i386/shadow-stack-unwind.h +++ b/libgcc/config/i386/shadow-stack-unwind.h @@ -22,14 +22,7 @@ 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/>. */ -/* NB: We need _get_ssp and _inc_ssp from <cetintrin.h>. But we can't - include <x86intrin.h> which ends up including <mm_malloc.h>, which - includes <stdlib.h> and <errno.h> unconditionally. But we can't - include any libc system headers unconditionally from libgcc. Avoid - including <mm_malloc.h> here by defining _IMMINTRIN_H_INCLUDED. */ -#define _IMMINTRIN_H_INCLUDED -#include <cetintrin.h> -#undef _IMMINTRIN_H_INCLUDED +#include <x86gprintrin.h> /* Unwind the shadow stack for EH. */ #undef _Unwind_Frames_Extra diff --git a/libgcc/config/msp430/slli.S b/libgcc/config/msp430/slli.S index c31e2d5..b22622e 100644 --- a/libgcc/config/msp430/slli.S +++ b/libgcc/config/msp430/slli.S @@ -65,6 +65,21 @@ __mspabi_slli: RET #endif +#ifdef __MSP430X__ + .section .text.__gnu_mspabi_sllp +1: ADDA #-1,R13 + ADDA R12,R12 + .global __gnu_mspabi_sllp +__gnu_mspabi_sllp: + CMP #0,R13 + JNZ 1b +#ifdef __MSP430X_LARGE__ + RETA +#else + RET +#endif /* __MSP430X_LARGE__ */ +#endif /* __MSP430X__ */ + /* Logical Left Shift - R12:R13 -> R12:R13. */ .section .text.__mspabi_slll_n diff --git a/libgcc/config/msp430/srai.S b/libgcc/config/msp430/srai.S index d4a47fa..0100a36 100644 --- a/libgcc/config/msp430/srai.S +++ b/libgcc/config/msp430/srai.S @@ -64,6 +64,21 @@ __mspabi_srai: RET #endif +#ifdef __MSP430X__ + .section .text.__gnu_mspabi_srap +1: ADDA #-1,R13 + RRAX.A R12,R12 + .global __gnu_mspabi_srap +__gnu_mspabi_srap: + CMP #0,R13 + JNZ 1b +#ifdef __MSP430X_LARGE__ + RETA +#else + RET +#endif /* __MSP430X_LARGE__ */ +#endif /* __MSP430X__ */ + /* Arithmetic Right Shift - R12:R13 -> R12:R13. */ .section .text.__mspabi_sral_n diff --git a/libgcc/config/msp430/srli.S b/libgcc/config/msp430/srli.S index 838c4bc..50db47c 100644 --- a/libgcc/config/msp430/srli.S +++ b/libgcc/config/msp430/srli.S @@ -66,6 +66,22 @@ __mspabi_srli: RET #endif +#ifdef __MSP430X__ + .section .text.__gnu_mspabi_srlp +1: ADDA #-1,R13 + CLRC + RRCX.A R12,R12 + .global __gnu_mspabi_srlp +__gnu_mspabi_srlp: + CMP #0,R13 + JNZ 1b +#ifdef __MSP430X_LARGE__ + RETA +#else + RET +#endif /* __MSP430X_LARGE__ */ +#endif /* __MSP430X__ */ + /* Logical Right Shift - R12:R13 -> R12:R13. */ .section .text.__mspabi_srll_n diff --git a/libgcc/config/nvptx/atomic.c b/libgcc/config/nvptx/atomic.c new file mode 100644 index 0000000..60f21f3 --- /dev/null +++ b/libgcc/config/nvptx/atomic.c @@ -0,0 +1,77 @@ +/* NVPTX atomic operations + Copyright (C) 2020 Free Software Foundation, Inc. + Contributed by Mentor Graphics. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This file 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/>. */ + +#include <stdbool.h> + +/* Implement __sync_val_compare_and_swap and __sync_bool_compare_and_swap + for 1 and 2-byte values (which are not natively supported) in terms of + __sync_val_compare_and_swap for 4-byte values (which is supported). + This assumes that the contents of the word surrounding the subword + value that we are interested in are accessible as well (which should + normally be the case). Note that if the contents of the word surrounding + the subword changes between the __sync_val_compare_and_swap_4 and the + preceeding load of oldword, while the subword does not, the implementation + loops, which may manifest worst-case as a hang. */ + +#define __SYNC_SUBWORD_COMPARE_AND_SWAP(TYPE, SIZE) \ + \ +TYPE \ +__sync_val_compare_and_swap_##SIZE (volatile void *vptr, TYPE oldval, \ + TYPE newval) \ +{ \ + volatile TYPE *ptr = vptr; \ + volatile unsigned int *wordptr \ + = (volatile unsigned int *)((__UINTPTR_TYPE__) ptr & ~3UL); \ + int shift = ((__UINTPTR_TYPE__) ptr & 3UL) * 8; \ + unsigned int valmask = (1 << (SIZE * 8)) - 1; \ + unsigned int wordmask = ~(valmask << shift); \ + unsigned int oldword = *wordptr; \ + for (;;) \ + { \ + TYPE prevval = (oldword >> shift) & valmask; \ + /* Exit if the subword value previously read from memory is not */ \ + /* equal to the expected value OLDVAL. */ \ + if (__builtin_expect (prevval != oldval, 0)) \ + return prevval; \ + unsigned int newword = oldword & wordmask; \ + newword |= ((unsigned int) newval) << shift; \ + unsigned int prevword \ + = __sync_val_compare_and_swap_4 (wordptr, oldword, newword); \ + /* Exit only if the compare-and-swap succeeds on the whole word */ \ + /* (i.e. the contents of *WORDPTR have not changed since the last */ \ + /* memory read). */ \ + if (__builtin_expect (prevword == oldword, 1)) \ + return oldval; \ + oldword = prevword; \ + } \ +} \ + \ +bool \ +__sync_bool_compare_and_swap_##SIZE (volatile void *ptr, TYPE oldval, \ + TYPE newval) \ +{ \ + return __sync_val_compare_and_swap_##SIZE (ptr, oldval, newval) == oldval; \ +} + +__SYNC_SUBWORD_COMPARE_AND_SWAP (unsigned char, 1) +__SYNC_SUBWORD_COMPARE_AND_SWAP (unsigned short, 2) diff --git a/libgcc/config/nvptx/t-nvptx b/libgcc/config/nvptx/t-nvptx index c4d20c9..ede0bf0 100644 --- a/libgcc/config/nvptx/t-nvptx +++ b/libgcc/config/nvptx/t-nvptx @@ -1,5 +1,6 @@ LIB2ADD=$(srcdir)/config/nvptx/reduction.c \ - $(srcdir)/config/nvptx/mgomp.c + $(srcdir)/config/nvptx/mgomp.c \ + $(srcdir)/config/nvptx/atomic.c LIB2ADDEH= LIB2FUNCS_EXCLUDE=__main diff --git a/libgcc/config/riscv/save-restore.S b/libgcc/config/riscv/save-restore.S index 7212165..e510009 100644 --- a/libgcc/config/riscv/save-restore.S +++ b/libgcc/config/riscv/save-restore.S @@ -45,7 +45,7 @@ FUNC_BEGIN (__riscv_save_10) .cfi_restore 27 addi sp, sp, -112 .cfi_def_cfa_offset 112 - li t1, -16 + li t1, 1 .Ls10: sd s10, 16(sp) .cfi_offset 26, -96 @@ -60,7 +60,7 @@ FUNC_BEGIN (__riscv_save_8) .cfi_restore 27 addi sp, sp, -112 .cfi_def_cfa_offset 112 - li t1, -32 + li t1, 2 .Ls8: sd s8, 32(sp) .cfi_offset 24, -80 @@ -77,7 +77,7 @@ FUNC_BEGIN (__riscv_save_6) .cfi_restore 27 addi sp, sp, -112 .cfi_def_cfa_offset 112 - li t1, -48 + li t1, 3 .Ls6: sd s6, 48(sp) .cfi_offset 22, -64 @@ -99,7 +99,7 @@ FUNC_BEGIN (__riscv_save_4) .cfi_restore 27 addi sp, sp, -112 .cfi_def_cfa_offset 112 - li t1, -64 + li t1, 4 .Ls4: sd s4, 64(sp) .cfi_offset 20, -48 @@ -123,7 +123,7 @@ FUNC_BEGIN (__riscv_save_2) .cfi_restore 27 addi sp, sp, -112 .cfi_def_cfa_offset 112 - li t1, -80 + li t1, 5 .Ls2: sd s2, 80(sp) .cfi_offset 18, -32 @@ -133,9 +133,10 @@ FUNC_BEGIN (__riscv_save_2) .cfi_offset 8, -16 sd ra, 104(sp) .cfi_offset 1, -8 + slli t1, t1, 4 # CFA info is not correct in next 2 instruction since t1's # value is depend on how may register really save. - sub sp, sp, t1 + add sp, sp, t1 jr t0 .cfi_endproc FUNC_END (__riscv_save_12) diff --git a/libgcc/config/riscv/t-elf b/libgcc/config/riscv/t-elf index dbc8f85..415e1ff 100644 --- a/libgcc/config/riscv/t-elf +++ b/libgcc/config/riscv/t-elf @@ -4,3 +4,5 @@ LIB2ADD += $(srcdir)/config/riscv/save-restore.S \ $(srcdir)/config/riscv/div.S \ $(srcdir)/config/riscv/atomic.c \ +# Avoid the full unwinder being pulled along with the division libcalls. +LIB2_DIVMOD_EXCEPTION_FLAGS := -fasynchronous-unwind-tables diff --git a/libgcc/config/rs6000/morestack.S b/libgcc/config/rs6000/morestack.S index 1b8ebb5..ac33c88 100644 --- a/libgcc/config/rs6000/morestack.S +++ b/libgcc/config/rs6000/morestack.S @@ -55,11 +55,18 @@ .type name,@function; \ name##: +#ifdef __PCREL__ +#define ENTRY(name) \ + ENTRY0(name); \ + .localentry name, 1 +#define JUMP_TARGET(name) name##@notoc +#else #define ENTRY(name) \ ENTRY0(name); \ 0: addis %r2,%r12,.TOC.-0b@ha; \ addi %r2,%r2,.TOC.-0b@l; \ .localentry name, .-name +#endif #else @@ -81,6 +88,9 @@ BODY_LABEL(name)##: #define SIZE(name) .size name, .-BODY_LABEL(name) +#ifndef JUMP_TARGET +#define JUMP_TARGET(name) name +#endif .text # Just like __morestack, but with larger excess allocation @@ -156,7 +166,7 @@ ENTRY0(__morestack) stdu %r1,-MORESTACK_FRAMESIZE(%r1) # void __morestack_block_signals (void) - bl __morestack_block_signals + bl JUMP_TARGET(__morestack_block_signals) # void *__generic_morestack (size_t *pframe_size, # void *old_stack, @@ -164,7 +174,7 @@ ENTRY0(__morestack) addi %r3,%r29,NEWSTACKSIZE_SAVE mr %r4,%r29 li %r5,0 # no copying from old stack - bl __generic_morestack + bl JUMP_TARGET(__generic_morestack) # Start using new stack stdu %r29,-32(%r3) # back-chain @@ -183,7 +193,7 @@ ENTRY0(__morestack) std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss # void __morestack_unblock_signals (void) - bl __morestack_unblock_signals + bl JUMP_TARGET(__morestack_unblock_signals) # Set up for a call to the target function, located 3 # instructions after __morestack's return address. @@ -218,11 +228,11 @@ ENTRY0(__morestack) std %r10,PARAMREG_SAVE+56(%r29) #endif - bl __morestack_block_signals + bl JUMP_TARGET(__morestack_block_signals) # void *__generic_releasestack (size_t *pavailable) addi %r3,%r29,NEWSTACKSIZE_SAVE - bl __generic_releasestack + bl JUMP_TARGET(__generic_releasestack) # Reset __private_ss stack guard to value for old stack ld %r12,NEWSTACKSIZE_SAVE(%r29) @@ -231,7 +241,7 @@ ENTRY0(__morestack) .LEHE0: std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss - bl __morestack_unblock_signals + bl JUMP_TARGET(__morestack_unblock_signals) # Use old stack again. mr %r1,%r29 @@ -260,13 +270,15 @@ cleanup: std %r3,PARAMREG_SAVE(%r29) # Save exception header # size_t __generic_findstack (void *stack) mr %r3,%r29 - bl __generic_findstack + bl JUMP_TARGET(__generic_findstack) sub %r3,%r29,%r3 addi %r3,%r3,BACKOFF std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss ld %r3,PARAMREG_SAVE(%r29) - bl _Unwind_Resume + bl JUMP_TARGET(_Unwind_Resume) +#ifndef __PCREL__ nop +#endif .cfi_endproc SIZE (__morestack) @@ -310,7 +322,7 @@ ENTRY(__stack_split_initialize) # void __generic_morestack_set_initial_sp (void *sp, size_t len) mr %r3,%r1 li %r4, 0x4000 - b __generic_morestack_set_initial_sp + b JUMP_TARGET(__generic_morestack_set_initial_sp) # The lack of .cfi_endproc here is deliberate. This function and the # following ones can all use the default FDE. SIZE (__stack_split_initialize) diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux index 4f6d4c4..ed82194 100644 --- a/libgcc/config/rs6000/t-linux +++ b/libgcc/config/rs6000/t-linux @@ -1,3 +1,8 @@ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver -HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc +HOST_LIBGCC2_CFLAGS += -mlong-double-128 + +# This is a way of selecting -mcmodel=small for ppc64, which gives +# smaller and faster libgcc code. Directly specifying -mcmodel=small +# would need to take into account targets for which -mcmodel is invalid. +HOST_LIBGCC2_CFLAGS += -mno-minimal-toc diff --git a/libgcc/config/rs6000/t-slibgcc-aix b/libgcc/config/rs6000/t-slibgcc-aix index e5f8a02..a6c5cee 100644 --- a/libgcc/config/rs6000/t-slibgcc-aix +++ b/libgcc/config/rs6000/t-slibgcc-aix @@ -90,29 +90,30 @@ AR_FLAGS_FOR_TARGET = -X32_64 # Build and install AIX-style FAT libraries ifeq ($(MULTIBUILDTOP),) -BITS=$(shell if test -z "`ar -X64 t libgcc_s.a`" ; then \ +BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \ echo '64'; else echo '32'; fi) +ARX=$(shell echo $(AR) | sed -e 's/-X[^ ]*//g') all: all-multi ifeq ($(enable_shared),yes) - ar -X$(BITS) x ../ppc$(BITS)/libgcc/libgcc_s.a shr.o - ar -X$(BITS) rc ./libgcc_s.a shr.o + $(ARX) -X$(BITS) x ../ppc$(BITS)/libgcc/libgcc_s.a shr.o + $(ARX) -X$(BITS) rc ./libgcc_s.a shr.o rm -f shr.o - ar -X$(BITS) x ../pthread/ppc$(BITS)/libgcc/libgcc_s.a shr.o - ar -X$(BITS) rc ../pthread/libgcc/libgcc_s.a shr.o + $(ARX) -X$(BITS) x ../pthread/ppc$(BITS)/libgcc/libgcc_s.a shr.o + $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc_s.a shr.o rm -f shr.o endif - ar -X$(BITS) rc libgcc.a \ + $(ARX) -X$(BITS) rc libgcc.a \ $(addprefix ../ppc$(BITS)/libgcc/,$(libgcc-objects)) - ar -X$(BITS) rc libgcc_eh.a \ + $(ARX) -X$(BITS) rc libgcc_eh.a \ $(addprefix ../ppc$(BITS)/libgcc/,$(libgcc-eh-objects)) - ar -X$(BITS) rc ../pthread/libgcc/libgcc.a \ + $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc.a \ $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcc-objects)) - ar -X$(BITS) rc ../pthread/libgcc/libgcc_eh.a \ + $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcc_eh.a \ $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcc-eh-objects)) ifeq ($(enable_gcov),yes) - ar -X$(BITS) rc libgcov.a \ + $(ARX) -X$(BITS) rc libgcov.a \ $(addprefix ../ppc$(BITS)/libgcc/,$(libgcov-objects)) - ar -X$(BITS) rc ../pthread/libgcc/libgcov.a \ + $(ARX) -X$(BITS) rc ../pthread/libgcc/libgcov.a \ $(addprefix ../pthread/ppc$(BITS)/libgcc/,$(libgcov-objects)) endif $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \ diff --git a/libgcc/config/rs6000/tramp.S b/libgcc/config/rs6000/tramp.S index 9b8fcfe..b165faa 100644 --- a/libgcc/config/rs6000/tramp.S +++ b/libgcc/config/rs6000/tramp.S @@ -140,15 +140,21 @@ trampoline_size = .-trampoline_initial /* R5 = function address */ /* R6 = static chain */ +#ifndef __PCREL__ .pushsection ".toc","aw" .LC0: .quad trampoline_initial-8 .popsection +#endif FUNC_START(__trampoline_setup) .cfi_startproc +#ifdef __PCREL__ + pla 7,(trampoline_initial-8)@pcrel +#else addis 7,2,.LC0@toc@ha ld 7,.LC0@toc@l(7) /* trampoline address -8 */ +#endif li r8,trampoline_size /* verify that the trampoline is big enough */ cmpw cr1,r8,r4 diff --git a/libgcc/libgcov-driver-system.c b/libgcc/libgcov-driver-system.c index 031f057..216992a 100644 --- a/libgcc/libgcov-driver-system.c +++ b/libgcc/libgcov-driver-system.c @@ -115,7 +115,7 @@ create_file_directory (char *filename) /* Try to make directory if it doesn't already exist. */ if (access (filename, F_OK) == -1 #ifdef TARGET_POSIX_IO - && mkdir (filename, 0755) == -1 + && mkdir (filename, 0777) == -1 #else #ifdef mkdir #undef mkdir diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index 2590593..e53e4dc 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -424,7 +424,7 @@ write_one_data (const struct gcov_info *gi_ptr, n_counts = ci_ptr->num; - if (gi_ptr->merge[t_ix] == __gcov_merge_topn) + if (t_ix == GCOV_COUNTER_V_TOPN || t_ix == GCOV_COUNTER_V_INDIR) write_top_counters (ci_ptr, t_ix, n_counts); else { @@ -588,6 +588,12 @@ struct gcov_root __gcov_root; struct gcov_master __gcov_master = {GCOV_VERSION, 0}; +/* Pool of pre-allocated gcov_kvp strutures. */ +struct gcov_kvp __gcov_kvp_pool[GCOV_PREALLOCATED_KVP]; + +/* Index to first free gcov_kvp in the pool. */ +unsigned __gcov_kvp_pool_index; + void __gcov_exit (void) { diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index 81e1895..8be5beb 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -250,6 +250,8 @@ struct indirect_call_tuple /* Exactly one of these will be active in the process. */ extern struct gcov_master __gcov_master; +extern struct gcov_kvp __gcov_kvp_pool[GCOV_PREALLOCATED_KVP]; +extern unsigned __gcov_kvp_pool_index; /* Dump a set of gcov objects. */ extern void __gcov_dump_one (struct gcov_root *) ATTRIBUTE_HIDDEN; @@ -402,6 +404,47 @@ gcov_counter_add (gcov_type *counter, gcov_type value, *counter += value; } +/* Allocate gcov_kvp from heap. If we are recursively called, then allocate + it from a list of pre-allocated pool. */ + +static inline struct gcov_kvp * +allocate_gcov_kvp (void) +{ + struct gcov_kvp *new_node = NULL; + + static +#if defined(HAVE_CC_TLS) +__thread +#endif + volatile unsigned in_recursion ATTRIBUTE_UNUSED = 0; + +#if !defined(IN_GCOV_TOOL) && !defined(L_gcov_merge_topn) + if (__builtin_expect (in_recursion, 0)) + { + unsigned index; +#if GCOV_SUPPORTS_ATOMIC + index + = __atomic_fetch_add (&__gcov_kvp_pool_index, 1, __ATOMIC_RELAXED); +#else + index = __gcov_kvp_pool_index++; +#endif + if (index < GCOV_PREALLOCATED_KVP) + new_node = &__gcov_kvp_pool[index]; + else + /* Do not crash in the situation. */ + return NULL; + } + else +#endif + { + in_recursion = 1; + new_node = (struct gcov_kvp *)xcalloc (1, sizeof (struct gcov_kvp)); + in_recursion = 0; + } + + return new_node; +} + /* Add key value pair VALUE:COUNT to a top N COUNTERS. When INCREMENT_TOTAL is true, add COUNT to total of the TOP counter. If USE_ATOMIC is true, do it in atomic way. */ @@ -443,8 +486,10 @@ gcov_topn_add_value (gcov_type *counters, gcov_type value, gcov_type count, } else { - struct gcov_kvp *new_node - = (struct gcov_kvp *)xcalloc (1, sizeof (struct gcov_kvp)); + struct gcov_kvp *new_node = allocate_gcov_kvp (); + if (new_node == NULL) + return; + new_node->value = value; new_node->count = count; diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c index 62d4a3d..fe89656 100644 --- a/libgcc/unwind-dw2.c +++ b/libgcc/unwind-dw2.c @@ -1538,11 +1538,14 @@ uw_update_context (struct _Unwind_Context *context, _Unwind_FrameState *fs) { /* Compute the return address now, since the return address column can change from frame to frame. */ - context->ra = __builtin_extract_return_addr - (_Unwind_GetPtr (context, fs->retaddr_column)); -#ifdef MD_POST_EXTRACT_FRAME_ADDR - context->ra = MD_POST_EXTRACT_FRAME_ADDR (context, fs, context->ra); + void *ret_addr; +#ifdef MD_DEMANGLE_RETURN_ADDR + _Unwind_Word ra = _Unwind_GetGR (context, fs->retaddr_column); + ret_addr = MD_DEMANGLE_RETURN_ADDR (context, fs, ra); +#else + ret_addr = _Unwind_GetPtr (context, fs->retaddr_column); #endif + context->ra = __builtin_extract_return_addr (ret_addr); } } @@ -1577,9 +1580,6 @@ uw_init_context_1 (struct _Unwind_Context *context, void *outer_cfa, void *outer_ra) { void *ra = __builtin_extract_return_addr (__builtin_return_address (0)); -#ifdef MD_POST_EXTRACT_ROOT_ADDR - ra = MD_POST_EXTRACT_ROOT_ADDR (ra); -#endif _Unwind_FrameState fs; _Unwind_SpTmp sp_slot; _Unwind_Reason_Code code; @@ -1616,9 +1616,6 @@ uw_init_context_1 (struct _Unwind_Context *context, initialization context, then we can't see it in the given call frame data. So have the initialization context tell us. */ context->ra = __builtin_extract_return_addr (outer_ra); -#ifdef MD_POST_EXTRACT_ROOT_ADDR - context->ra = MD_POST_EXTRACT_ROOT_ADDR (context->ra); -#endif } static void _Unwind_DebugHook (void *, void *) @@ -1641,21 +1638,6 @@ _Unwind_DebugHook (void *cfa __attribute__ ((__unused__)), #endif } -/* Frob exception handler's address kept in TARGET before installing into - CURRENT context. */ - -static inline void * -uw_frob_return_addr (struct _Unwind_Context *current - __attribute__ ((__unused__)), - struct _Unwind_Context *target) -{ - void *ret_addr = __builtin_frob_return_addr (target->ra); -#ifdef MD_POST_FROB_EH_HANDLER_ADDR - ret_addr = MD_POST_FROB_EH_HANDLER_ADDR (current, target, ret_addr); -#endif - return ret_addr; -} - /* Install TARGET into CURRENT so that we can return to it. This is a macro because __builtin_eh_return must be invoked in the context of our caller. FRAMES is a number of frames to be unwind. @@ -1667,7 +1649,7 @@ uw_frob_return_addr (struct _Unwind_Context *current do \ { \ long offset = uw_install_context_1 ((CURRENT), (TARGET)); \ - void *handler = uw_frob_return_addr ((CURRENT), (TARGET)); \ + void *handler = __builtin_frob_return_addr ((TARGET)->ra); \ _Unwind_DebugHook ((TARGET)->cfa, handler); \ _Unwind_Frames_Extra (FRAMES); \ __builtin_eh_return (offset, handler); \ |