From e9ee848dcdc644aa9cd57371fab0a70dba443424 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 23 Jan 2020 14:34:59 +0100 Subject: Remove wrong bail out in prune_topn_counter. * libgcov-driver.c (prune_topn_counter): Remove check for -1 as we only prune run-time counters that do not generate an invalid state. --- libgcc/ChangeLog | 6 ++++++ libgcc/libgcov-driver.c | 15 +++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 76c9946..bd8cc38 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-23 Martin Liska + + * libgcov-driver.c (prune_topn_counter): Remove + check for -1 as we only prune run-time counters + that do not generate an invalid state. + 2020-01-22 Martin Liska PR tree-optimization/92924 diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c index cdb611d..fb32073 100644 --- a/libgcc/libgcov-driver.c +++ b/libgcc/libgcov-driver.c @@ -219,17 +219,12 @@ static struct gcov_fn_buffer *fn_buffer; static void prune_topn_counter (gcov_type *counters, gcov_type all) { - if (counters[1] == -1) - return; - for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++) - { - if (counters[2 * i + 1] < all) - { - counters[2 * i] = 0; - counters[2 * i + 1] = 0; - } - } + if (counters[2 * i + 1] < all) + { + counters[2 * i] = 0; + counters[2 * i + 1] = 0; + } } /* Prune counters so that they are ready to store or merge. */ -- cgit v1.1 From a3c1e1f2ff88628cb163abc5331af752221eddc0 Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Thu, 23 Jan 2020 16:38:14 +0100 Subject: Emit .note.GNU-stack for soft-float linux targets. gcc/ChangeLog: 2020-01-23 Dragan Mladjenovic * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to TARGET_SOFT_FLOAT. * config/mips/mips.c (TARGET_ASM_FILE_END): Define to ... (mips_asm_file_end): New function. Delegate to file_end_indicate_exec_stack if NEED_INDICATE_EXEC_STACK is true. * config/mips/mips.h (NEED_INDICATE_EXEC_STACK): Define to 0. libgcc/ChangeLog: 2020-01-23 Dragan Mladjenovic * config/mips/gnustack.h: New file. * config/mips/crti.S: Include gnustack.h. * config/mips/crtn.S: Likewise. * config/mips/mips16.S: Likewise. * config/mips/vr4120-div.S: Likewise. --- libgcc/ChangeLog | 8 ++++++++ libgcc/config/mips/crti.S | 3 +++ libgcc/config/mips/crtn.S | 3 +++ libgcc/config/mips/gnustack.h | 7 +++++++ libgcc/config/mips/mips16.S | 3 +++ libgcc/config/mips/vr4120-div.S | 3 +++ 6 files changed, 27 insertions(+) create mode 100644 libgcc/config/mips/gnustack.h (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index bd8cc38..eddcd9f 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2020-01-23 Dragan Mladjenovic + + * config/mips/gnustack.h: New file. + * config/mips/crti.S: Include gnustack.h. + * config/mips/crtn.S: Likewise. + * config/mips/mips16.S: Likewise. + * config/mips/vr4120-div.S: Likewise. + 2020-01-23 Martin Liska * libgcov-driver.c (prune_topn_counter): Remove diff --git a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S index 3347a78..6705642 100644 --- a/libgcc/config/mips/crti.S +++ b/libgcc/config/mips/crti.S @@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +/* An executable stack is *not* required for these functions. */ +#include "gnustack.h" + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ diff --git a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S index 7f46829..ceede64 100644 --- a/libgcc/config/mips/crtn.S +++ b/libgcc/config/mips/crtn.S @@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +/* An executable stack is *not* required for these functions. */ +#include "gnustack.h" + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ diff --git a/libgcc/config/mips/gnustack.h b/libgcc/config/mips/gnustack.h new file mode 100644 index 0000000..c7e9fe7 --- /dev/null +++ b/libgcc/config/mips/gnustack.h @@ -0,0 +1,7 @@ +#include "config.h" +#if defined(__ELF__) && defined(__linux__) +#if defined (__mips_soft_float) + .section .note.GNU-stack,"",%progbits + .previous +#endif +#endif diff --git a/libgcc/config/mips/mips16.S b/libgcc/config/mips/mips16.S index 396285e..5c3678b 100644 --- a/libgcc/config/mips/mips16.S +++ b/libgcc/config/mips/mips16.S @@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +/* An executable stack is *not* required for these functions. */ +#include "gnustack.h" + #include "auto-host.h" #if defined(__mips_micromips) || defined(__mips_soft_float) \ diff --git a/libgcc/config/mips/vr4120-div.S b/libgcc/config/mips/vr4120-div.S index 92226b5..2999c77 100644 --- a/libgcc/config/mips/vr4120-div.S +++ b/libgcc/config/mips/vr4120-div.S @@ -22,6 +22,9 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +/* An executable stack is *not* required for these functions. */ +#include "gnustack.h" + /* This file contains functions which implement divsi3 and modsi3 for -mfix-vr4120. div and ddiv do not give the correct result when one of the operands is negative. */ -- cgit v1.1 From 54b3d52c3cca836c7c4c08cc9c02eda6c096372a Mon Sep 17 00:00:00 2001 From: Dragan Mladjenovic Date: Thu, 23 Jan 2020 16:37:20 +0100 Subject: Emit .note.GNU-stack for hard-float linux targets. libgcc/ChangeLog: 2020-01-23 Dragan Mladjenovic * config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also. gcc/ChangeLog: 2020-01-23 Dragan Mladjenovic * config.in: Regenerated. * config/mips/linux.h (NEED_INDICATE_EXEC_STACK): Define to 1 for TARGET_LIBC_GNUSTACK. * configure: Regenerated. * configure.ac: Define TARGET_LIBC_GNUSTACK if glibc version is found to be 2.31 or greater. --- libgcc/ChangeLog | 4 ++++ libgcc/config/mips/gnustack.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index eddcd9f..bea77b2 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,5 +1,9 @@ 2020-01-23 Dragan Mladjenovic + * config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also. + +2020-01-23 Dragan Mladjenovic + * config/mips/gnustack.h: New file. * config/mips/crti.S: Include gnustack.h. * config/mips/crtn.S: Likewise. diff --git a/libgcc/config/mips/gnustack.h b/libgcc/config/mips/gnustack.h index c7e9fe7..561b348 100644 --- a/libgcc/config/mips/gnustack.h +++ b/libgcc/config/mips/gnustack.h @@ -1,6 +1,6 @@ #include "config.h" #if defined(__ELF__) && defined(__linux__) -#if defined (__mips_soft_float) +#if defined (TARGET_LIBC_GNUSTACK) || defined (__mips_soft_float) .section .note.GNU-stack,"",%progbits .previous #endif -- cgit v1.1 From e3fe0070c189e214d51cfc314591b6ffa526fb2f Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Fri, 24 Jan 2020 12:12:17 +0100 Subject: libgcov: Fix merging of topn [PR92924] PR tree-optimization/92924 * libgcov-merge.c (merge_topn_values_set): Fix merging. --- libgcc/libgcov-merge.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'libgcc') diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c index b658aec..19b8ee7 100644 --- a/libgcc/libgcov-merge.c +++ b/libgcc/libgcov-merge.c @@ -112,9 +112,11 @@ merge_topn_values_set (gcov_type *counters) for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++) { if (read_counters[2 * i + 1] == 0) - return; + continue; unsigned j; + int slot = -1; + for (j = 0; j < GCOV_TOPN_VALUES; j++) { if (counters[2 * j] == read_counters[2 * i]) @@ -123,18 +125,23 @@ merge_topn_values_set (gcov_type *counters) break; } else if (counters[2 * j + 1] == 0) - { - counters[2 * j] += read_counters[2 * i]; - counters[2 * j + 1] += read_counters[2 * i + 1]; - break; - } + slot = j; } - /* We haven't found a slot, bail out. */ if (j == GCOV_TOPN_VALUES) { - counters[1] = -1; - return; + if (slot > 0) + { + /* If we found empty slot, add the value. */ + counters[2 * slot] = read_counters[2 * i]; + counters[2 * slot + 1] = read_counters[2 * i + 1]; + } + else + { + /* We haven't found a slot, bail out. */ + counters[1] = -1; + return; + } } } } -- cgit v1.1 From e8e66971cdc6d1390d47a227899e2e340ff44d66 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Fri, 24 Jan 2020 11:24:25 +0000 Subject: Add `--with-toolexeclibdir=' configuration option Provide means, in the form of a `--with-toolexeclibdir=' configuration option, to override the default installation directory for target libraries, otherwise known as $toolexeclibdir. This is so that it is possible to get newly-built libraries, particularly the shared ones, installed in a common place, so that they can be readily used by the target system as their host libraries, possibly over NFS, without a need to manually copy them over from the currently hardcoded location they would otherwise be installed in. In the presence of the `--enable-version-specific-runtime-libs' option and for configurations building native GCC the option is ignored. config/ * toolexeclibdir.m4: New file. gcc/ * doc/install.texi (Cross-Compiler-Specific Options): Document `--with-toolexeclibdir' option. libada/ * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. libatomic/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libffi/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * include/Makefile.in: Regenerate. * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. libgcc/ * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. libgfortran/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libgomp/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libhsail-rt/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libitm/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libobjc/ * Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'. * aclocal.m4: Include `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. liboffloadmic/ * plugin/configure.ac: Handle `--with-toolexeclibdir='. * plugin/Makefile.in: Regenerate. * plugin/aclocal.m4: Regenerate. * plugin/configure: Regenerate. * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libphobos/ * m4/druntime.m4: Handle `--with-toolexeclibdir='. * m4/Makefile.in: Regenerate. * libdruntime/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libquadmath/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libsanitizer/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * asan/Makefile.in: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. libssp/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libstdc++-v3/ * acinclude.m4: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * doc/Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++17/Makefile.in: Regenerate. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. libvtv/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. zlib/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. --- libgcc/ChangeLog | 6 ++++++ libgcc/Makefile.in | 1 + libgcc/configure | 38 ++++++++++++++++++++++++++++++++++++-- libgcc/configure.ac | 25 +++++++++++++++++++++---- 4 files changed, 64 insertions(+), 6 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index bea77b2..0920265 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2020-01-24 Maciej W. Rozycki + + * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. + * configure.ac: Handle `--with-toolexeclibdir='. + * configure: Regenerate. + 2020-01-23 Dragan Mladjenovic * config/mips/gnustack.h: Check for TARGET_LIBC_GNUSTACK also. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 43bad01..851e765 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -165,6 +165,7 @@ AUTOCONF = autoconf configure_deps = \ $(srcdir)/../config/enable.m4 \ $(srcdir)/../config/tls.m4 \ + $(srcdir)/../config/toolexeclibdir.m4 \ $(srcdir)/../config/acx.m4 \ $(srcdir)/../config/no-executables.m4 \ $(srcdir)/../config/lib-ld.m4 \ diff --git a/libgcc/configure b/libgcc/configure index 97cbad3..ab8d471 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -705,6 +705,7 @@ enable_gcov enable_vtable_verify with_aix_soname enable_version_specific_runtime_libs +with_toolexeclibdir with_slibdir enable_maintainer_mode with_build_libsubdir @@ -1369,6 +1370,9 @@ Optional Packages: --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX + --with-toolexeclibdir=DIR + install libraries built with a cross compiler within + DIR --with-slibdir=DIR shared libraries in DIR LIBDIR --with-build-libsubdir=DIR Directory where to find libraries for build system --with-system-libunwind use installed libunwind @@ -2464,6 +2468,22 @@ fi $as_echo "$version_specific_libs" >&6; } +# Check whether --with-toolexeclibdir was given. +if test "${with_toolexeclibdir+set}" = set; then : + withval=$with_toolexeclibdir; case ${with_toolexeclibdir} in + /) + ;; + */) + with_toolexeclibdir=`echo $with_toolexeclibdir | sed 's,/$,,'` + ;; +esac +else + with_toolexeclibdir=no +fi + + + + # Check whether --with-slibdir was given. if test "${with_slibdir+set}" = set; then : withval=$with_slibdir; slibdir="$with_slibdir" @@ -2471,7 +2491,14 @@ else if test "${version_specific_libs}" = yes; then slibdir='$(libsubdir)' elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then - slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + case ${with_toolexeclibdir} in + no) + slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + ;; + *) + slibdir=${with_toolexeclibdir} + ;; + esac else slibdir='$(libdir)' fi @@ -2701,7 +2728,14 @@ case ${version_specific_libs} in test x"$with_cross_host" != x"no"; then # Install a library built with a cross compiler in tooldir, not libdir. toolexecdir='$(exec_prefix)/$(target_noncanonical)' - toolexeclibdir='$(toolexecdir)/lib' + case ${with_toolexeclibdir} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_toolexeclibdir} + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 2d22f05..85979da9 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script. sinclude(../config/enable.m4) sinclude(../config/tls.m4) +sinclude(../config/toolexeclibdir.m4) sinclude(../config/acx.m4) sinclude(../config/no-executables.m4) sinclude(../config/lib-ld.m4) @@ -113,16 +114,25 @@ AC_ARG_ENABLE(version-specific-runtime-libs, [version_specific_libs=no]) AC_MSG_RESULT($version_specific_libs) +GCC_WITH_TOOLEXECLIBDIR + AC_ARG_WITH(slibdir, [ --with-slibdir=DIR shared libraries in DIR [LIBDIR]], slibdir="$with_slibdir", -if test "${version_specific_libs}" = yes; then +[if test "${version_specific_libs}" = yes; then slibdir='$(libsubdir)' elif test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then - slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + case ${with_toolexeclibdir} in + no) + slibdir='$(exec_prefix)/$(host_noncanonical)/lib' + ;; + *) + slibdir=${with_toolexeclibdir} + ;; + esac else slibdir='$(libdir)' -fi) +fi]) AC_SUBST(slibdir) # Command-line options. @@ -168,7 +178,14 @@ case ${version_specific_libs} in test x"$with_cross_host" != x"no"; then # Install a library built with a cross compiler in tooldir, not libdir. toolexecdir='$(exec_prefix)/$(target_noncanonical)' - toolexeclibdir='$(toolexecdir)/lib' + case ${with_toolexeclibdir} in + no) + toolexeclibdir='$(toolexecdir)/lib' + ;; + *) + toolexeclibdir=${with_toolexeclibdir} + ;; + esac else toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)' toolexeclibdir='$(libdir)' -- cgit v1.1 From 2744b8b286cbdeecbb6ab03e015dc847a2fb42a2 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 27 Jan 2020 14:51:03 +0200 Subject: [ARC] Make libgcc compatible with ARC's reduced register set config. ARC processors can work with a reduced register set (i.e. registers r4-r9 and r16-r25 are not available). This option can be enabled passing -mrf16 option to the compiler, or by using -mcpu=em_mini CPU configuration. Using RF16 config requires all the hand-made assembly files used in libgcc to have the corresponding RF16 object attribute set. This patch qualifies the relevant hand-made assembly files to RF16 config, and also adds generic c-functions for the one which are not. libgcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/crti.S: Add RF16 object attribute. * config/arc/crtn.S: Likewise. * config/arc/crttls.S: Likewise. * config/arc/lib1funcs.S: Likewise. * config/arc/fp-hack.h (ARC_OPTFPE): Define. * config/arc/lib2funcs.c: New file. * config/arc/t-arc: Add lib2funcs to LIB2ADD. --- libgcc/ChangeLog | 10 +++++ libgcc/config/arc/crti.S | 5 +++ libgcc/config/arc/crtn.S | 5 +++ libgcc/config/arc/crttls.S | 6 +++ libgcc/config/arc/fp-hack.h | 5 ++- libgcc/config/arc/lib1funcs.S | 27 ++++++------- libgcc/config/arc/lib2funcs.c | 88 +++++++++++++++++++++++++++++++++++++++++++ libgcc/config/arc/t-arc | 1 + 8 files changed, 130 insertions(+), 17 deletions(-) create mode 100644 libgcc/config/arc/lib2funcs.c (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 0920265..22bef22 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,13 @@ +2020-01-27 Claudiu Zissulescu + + * config/arc/crti.S: Add RF16 object attribute. + * config/arc/crtn.S: Likewise. + * config/arc/crttls.S: Likewise. + * config/arc/lib1funcs.S: Likewise. + * config/arc/fp-hack.h (ARC_OPTFPE): Define. + * config/arc/lib2funcs.c: New file. + * config/arc/t-arc: Add lib2funcs to LIB2ADD. + 2020-01-24 Maciej W. Rozycki * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. diff --git a/libgcc/config/arc/crti.S b/libgcc/config/arc/crti.S index 297ddc7..e05a789 100644 --- a/libgcc/config/arc/crti.S +++ b/libgcc/config/arc/crti.S @@ -28,6 +28,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # This file contains the stack frame setup for contents of the .fini and # .init sections. +#ifdef __ARC_RF16__ + /* Use object attributes to inform other tools this file is + safe for RF16 configuration. */ + .arc_attribute Tag_ARC_ABI_rf16, 1 +#endif .section .init .global _init .word 0 diff --git a/libgcc/config/arc/crtn.S b/libgcc/config/arc/crtn.S index fc6197f..37eac5e 100644 --- a/libgcc/config/arc/crtn.S +++ b/libgcc/config/arc/crtn.S @@ -28,6 +28,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see # This file just makes sure that the .fini and .init sections do in # fact return. This file is the last thing linked into any executable. +#ifdef __ARC_RF16__ + /* Use object attributes to inform other tools this file is + safe for RF16 configuration. */ + .arc_attribute Tag_ARC_ABI_rf16, 1 +#endif .section .init pop_s blink j_s [blink] diff --git a/libgcc/config/arc/crttls.S b/libgcc/config/arc/crttls.S index 4c8faf9..b5aebf1 100644 --- a/libgcc/config/arc/crttls.S +++ b/libgcc/config/arc/crttls.S @@ -33,6 +33,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see the executable file might be covered by the GNU General Public License. */ +#ifdef __ARC_RF16__ + /* Use object attributes to inform other tools this file is + safe for RF16 configuration. */ + .arc_attribute Tag_ARC_ABI_rf16, 1 +#endif + #if (__ARC_TLS_REGNO__ != -1) /* ANSI concatenation macros. */ diff --git a/libgcc/config/arc/fp-hack.h b/libgcc/config/arc/fp-hack.h index 86b63d9..65cdcdd 100644 --- a/libgcc/config/arc/fp-hack.h +++ b/libgcc/config/arc/fp-hack.h @@ -30,7 +30,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define ARC_FP_DEBUG 1 #define FINE_GRAINED_LIBRARIES -#define ARC_OPTFPE (defined (__ARC700__) || defined (__ARC_FPX_QUARK__)) + +#if defined (__ARC700__) || defined (__ARC_FPX_QUARK__) +#define ARC_OPTFPE 1 +#endif #if !ARC_OPTFPE || ARC_FP_DEBUG #define L_pack_sf diff --git a/libgcc/config/arc/lib1funcs.S b/libgcc/config/arc/lib1funcs.S index 1ada0fe..cc54b40 100644 --- a/libgcc/config/arc/lib1funcs.S +++ b/libgcc/config/arc/lib1funcs.S @@ -53,7 +53,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X #define ENDFUNC(X) ENDFUNC0(X) - +#ifdef __ARC_RF16__ + /* Use object attributes to inform other tools this file is + safe for RF16 configuration. */ + .arc_attribute Tag_ARC_ABI_rf16, 1 +#endif #ifdef L_mulsi3 .section .text @@ -232,6 +236,7 @@ SYM(__umulsi3_highpart): #endif #endif /* L_umulsidi3 */ +#ifndef __ARC_RF16__ #ifdef L_muldi3 .section .text .align 4 @@ -285,6 +290,7 @@ SYM(__muldi3): #endif /* __LITTLE_ENDIAN__ */ ENDFUNC(__muldi3) #endif /* L_muldi3 */ +#endif /* !__ARC_RF16__ */ #ifdef L_umulsi3_highpart #include "ieee-754/arc-ieee-754.h" @@ -544,12 +550,6 @@ SYM(__udivmodsi4): SYM(__udivsi3): b @SYM(__udivmodsi4) ENDFUNC(__udivsi3) -#if 0 /* interferes with linux loader */ - .section .__arc_profile_forward, "a" - .long SYM(__udivsi3) - .long SYM(__udivmodsi4) - .long 65536 -#endif #endif /* L_udivsi3 */ @@ -948,12 +948,6 @@ SYM(__umodsi3): j.d [r7] mov r0,r1 ENDFUNC(__umodsi3) -#if 0 /* interferes with linux loader */ - .section .__arc_profile_forward, "a" - .long SYM(__umodsi3) - .long SYM(__udivmodsi4) - .long 65536 -#endif #endif /* L_umodsi3 */ @@ -1106,6 +1100,7 @@ SYM(__clzsi2): ;; ;#endif +#ifndef __ARC_RF16__ #ifdef L_millicodethunk_st .section .text .align 4 @@ -1315,9 +1310,7 @@ SYM(__ld_r13_to_r14_ret): #endif /* L_millicodethunk_ret */ -#define ARC_OPTFPE (defined (__ARC700__) || defined (__ARC_FPX_QUARK__)) - -#if ARC_OPTFPE +#if defined (__ARC700__) || defined (__ARC_FPX_QUARK__) #ifdef L_adddf3 #ifdef __ARC_NORM__ #include "ieee-754/adddf3.S" @@ -1482,3 +1475,5 @@ SYM(__ld_r13_to_r14_ret): #endif #endif #endif /* ARC_OPTFPE */ + +#endif /* !__ARC_RF16__ */ diff --git a/libgcc/config/arc/lib2funcs.c b/libgcc/config/arc/lib2funcs.c new file mode 100644 index 0000000..f9de7b2 --- /dev/null +++ b/libgcc/config/arc/lib2funcs.c @@ -0,0 +1,88 @@ +/* libgcc routines for ARC + Copyright (C) 2019 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 + . */ + + +typedef int sint64_t __attribute__ ((mode (DI))); +typedef unsigned int uint64_t __attribute__ ((mode (DI))); +typedef unsigned int nint32_t __attribute__ ((mode (SI))); +typedef int word_t __attribute__ ((mode (__word__))); + +sint64_t __muldi3 (sint64_t, sint64_t); +nint32_t __umodsi3 (nint32_t, nint32_t); + +#ifdef __ARC_RF16__ + +/* Generic multiplication procedure. No mpy operation involved. */ +sint64_t +__muldi3 (sint64_t a, sint64_t b) +{ + sint64_t res = 0; + uint64_t cnt = a; + + while (cnt) + { + if (cnt & 1) + res += b; + b <<= 1; + cnt >>= 1; + } + return res; +} + +/* Unsigned 32bit integer division/modulus. */ + +static inline __attribute__ ((__always_inline__)) +nint32_t +udivmodsi4 (nint32_t num, nint32_t den, word_t modwanted) +{ + nint32_t bit = 1; + nint32_t res = 0; + + while (den < num && bit && !(den & (1LL << 63))) + { + den <<= 1; + bit <<= 1; + } + while (bit) + { + if (num >= den) + { + num -= den; + res |= bit; + } + bit >>= 1; + den >>= 1; + } + if (modwanted) + return num; + return res; +} + +nint32_t +__umodsi3 (nint32_t a, nint32_t b) +{ + return udivmodsi4 (a, b, 1); +} + +#endif diff --git a/libgcc/config/arc/t-arc b/libgcc/config/arc/t-arc index 3844fef..34aa444 100644 --- a/libgcc/config/arc/t-arc +++ b/libgcc/config/arc/t-arc @@ -43,6 +43,7 @@ LIB1ASMFUNCS = _mulsi3 _umulsidi3 _umulsi3_highpart _muldi3 \ # used in an asm wrapper. LIB2ADD = fp-bit.c dp-bit.c +LIB2ADD += $(srcdir)/config/arc/lib2funcs.c dp-bit.c: $(srcdir)/fp-bit.c echo '#ifndef __big_endian__' > dp-bit.c -- cgit v1.1 From 3ae37f9297fc97aefc6c6968315bd1ac6a1bc7ef Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 27 Jan 2020 16:20:10 +0100 Subject: Add __gcov_indirect_call_profiler_v4_atomic. PR gcov-profile/93403 * tree-profile.c (gimple_init_gcov_profiler): Generate both __gcov_indirect_call_profiler_v4 and __gcov_indirect_call_profiler_v4_atomic. PR gcov-profile/93403 * libgcov-profiler.c (__gcov_indirect_call_profiler_v4): Call __gcov_indirect_call_profiler_body. (__gcov_indirect_call_profiler_body): New. (__gcov_indirect_call_profiler_v4_atomic): New. * libgcov.h (__gcov_indirect_call_profiler_v4_atomic): New declaration. --- libgcc/ChangeLog | 10 ++++++++++ libgcc/libgcov-profiler.c | 23 ++++++++++++++++++++--- libgcc/libgcov.h | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 22bef22..20cb222 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,13 @@ +2020-01-27 Martin Liska + + PR gcov-profile/93403 + * libgcov-profiler.c (__gcov_indirect_call_profiler_v4): + Call __gcov_indirect_call_profiler_body. + (__gcov_indirect_call_profiler_body): New. + (__gcov_indirect_call_profiler_v4_atomic): New. + * libgcov.h (__gcov_indirect_call_profiler_v4_atomic): + New declaration. + 2020-01-27 Claudiu Zissulescu * config/arc/crti.S: Add RF16 object attribute. diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c index 58784d1..6043ac4 100644 --- a/libgcc/libgcov-profiler.c +++ b/libgcc/libgcov-profiler.c @@ -199,8 +199,9 @@ struct indirect_call_tuple __gcov_indirect_call; as a pointer to a function. */ /* Tries to determine the most common value among its inputs. */ -void -__gcov_indirect_call_profiler_v4 (gcov_type value, void* cur_func) +static inline void +__gcov_indirect_call_profiler_body (gcov_type value, void *cur_func, + int use_atomic) { /* If the C++ virtual tables contain function descriptors then one function may have multiple descriptors and we need to dereference @@ -208,10 +209,26 @@ __gcov_indirect_call_profiler_v4 (gcov_type value, void* cur_func) if (cur_func == __gcov_indirect_call.callee || (__LIBGCC_VTABLE_USES_DESCRIPTORS__ && *(void **) cur_func == *(void **) __gcov_indirect_call.callee)) - __gcov_topn_values_profiler_body (__gcov_indirect_call.counters, value, 0); + __gcov_topn_values_profiler_body (__gcov_indirect_call.counters, value, + use_atomic); __gcov_indirect_call.callee = NULL; } + +void +__gcov_indirect_call_profiler_v4 (gcov_type value, void *cur_func) +{ + __gcov_indirect_call_profiler_body (value, cur_func, 0); +} + +#if GCOV_SUPPORTS_ATOMIC +void +__gcov_indirect_call_profiler_v4_atomic (gcov_type value, void *cur_func) +{ + __gcov_indirect_call_profiler_body (value, cur_func, 1); +} +#endif + #endif #ifdef L_gcov_time_profiler diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index bc7e308..023293e 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -274,6 +274,7 @@ extern void __gcov_pow2_profiler_atomic (gcov_type *, gcov_type); extern void __gcov_topn_values_profiler (gcov_type *, gcov_type); extern void __gcov_topn_values_profiler_atomic (gcov_type *, gcov_type); extern void __gcov_indirect_call_profiler_v4 (gcov_type, void *); +extern void __gcov_indirect_call_profiler_v4_atomic (gcov_type, void *); extern void __gcov_time_profiler (gcov_type *); extern void __gcov_time_profiler_atomic (gcov_type *); extern void __gcov_average_profiler (gcov_type *, gcov_type); -- cgit v1.1 From 2d33dcfe9f0494c9b56a8d704c3d27c5a4329ebc Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Fri, 31 Jan 2020 16:46:50 -0800 Subject: nios2: Support for GOT-relative DW_EH_PE_datarel encoding. On nios2-linux-gnu, there has been a long-standing bug in C++ exception handling that sometimes resulted in link errors like ../nios2-linux-gnu/bin/ld: FDE encoding in /tmp/cccfpQ2l.o(.eh_frame) prevents .eh_frame_hdr table being created when building some shared libraries or PIE executables. The root of the problem is that GCC was incorrectly emitting an absolute encoding in EH tables for PIC. This patch changes it to use either DW_EH_PE_indirect (for global) or DW_EH_PE_datarel (for local), and fixes libgcc so it can find the address of the GOT as the base address for DW_EH_PE_datarel. Complicating matters somewhat, GAS was missing support for %gotoff(symbol) relocation syntax. I have just pushed a fix for that, but I've added a configure check to test for presence of the binutils support and fall back to the current absolute encoding (which works most of the time) if it is not available. Once the fix makes it into an official binutils release it might be appropriate to make this error out instead. Since this is a wrong-code bug and affects only nios2 target, I think this is appropriate for Stage 4. I regression-tested on both nios2-linux-gnu and nios2-elf, with and without the binutils support present, before committing this. 2020-01-31 Sandra Loosemore gcc/ * configure.ac [nios2-*-*]: Check HAVE_AS_NIOS2_GOTOFF_RELOCATION. * config.in: Regenerated. * configure: Regenerated. * config/nios2/nios2.h (ASM_PREFERRED_EH_DATA_FORMAT): Fix handling for PIC when HAVE_AS_NIOS2_GOTOFF_RELOCATION. (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX): New. gcc/testsuite/ * g++.target/nios2/hello-pie.C: New. * g++.target/nios2/nios2.exp: New. libgcc/ * config.host [nios2-*-linux*] (tmake_file, tm_file): Adjust. * config/nios2-elf-lib.h: New. * unwind-dw2-fde-dip.c (_Unwind_IteratePhdrCallback): Use existing code for finding GOT base for nios2. --- libgcc/ChangeLog | 9 +++++++++ libgcc/config.host | 3 ++- libgcc/config/nios2/elf-lib.h | 24 ++++++++++++++++++++++++ libgcc/unwind-dw2-fde-dip.c | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 libgcc/config/nios2/elf-lib.h (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 20cb222..9ec9edf 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,12 @@ +2020-01-31 Sandra Loosemore + + nios2: Support for GOT-relative DW_EH_PE_datarel encoding. + + * config.host [nios2-*-linux*] (tmake_file, tm_file): Adjust. + * config/nios2-elf-lib.h: New. + * unwind-dw2-fde-dip.c (_Unwind_IteratePhdrCallback): Use existing + code for finding GOT base for nios2. + 2020-01-27 Martin Liska PR gcov-profile/93403 diff --git a/libgcc/config.host b/libgcc/config.host index 8f0ea90..4198dc8 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1112,7 +1112,8 @@ nds32*-elf*) esac ;; nios2-*-linux*) - tmake_file="$tmake_file nios2/t-nios2 nios2/t-linux t-libgcc-pic t-slibgcc-libgcc" + tmake_file="$tmake_file nios2/t-nios2 nios2/t-linux t-libgcc-pic t-eh-dw2-dip t-slibgcc-libgcc" + tm_file="$tm_file nios2/elf-lib.h" md_unwind_header=nios2/linux-unwind.h ;; nios2-*-*) diff --git a/libgcc/config/nios2/elf-lib.h b/libgcc/config/nios2/elf-lib.h new file mode 100644 index 0000000..4d718d9 --- /dev/null +++ b/libgcc/config/nios2/elf-lib.h @@ -0,0 +1,24 @@ +/* Target macros for the Nios II port of GCC. + Copyright (C) 2015-2020 Free Software Foundation, Inc. + +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 +. */ + +#define CRT_GET_RFIB_DATA(dbase) \ + ({ extern void *_gp_got; (dbase) = &_gp_got; }) diff --git a/libgcc/unwind-dw2-fde-dip.c b/libgcc/unwind-dw2-fde-dip.c index d3a09ce..6e50405 100644 --- a/libgcc/unwind-dw2-fde-dip.c +++ b/libgcc/unwind-dw2-fde-dip.c @@ -329,7 +329,7 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr) return 1; #ifdef CRT_GET_RFIB_DATA -# ifdef __i386__ +# if defined __i386__ || defined __nios2__ data->dbase = NULL; if (p_dynamic) { -- cgit v1.1 From 811a475ea3fcc55ee4aea7c81171891ef19dfc25 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 7 Feb 2020 11:01:14 +0100 Subject: arm: Fix up arm installed unwind.h for use in pedantic modes [PR93615] As the following testcase shows, unwind.h on ARM can't be (starting with GCC 10) compiled with -std=c* modes, only -std=gnu* modes. The problem is it uses asm keyword, which isn't a keyword in those modes (system headers vs. non-system ones don't make a difference here). glibc and other installed headers use __asm or __asm__ keywords instead that work fine in both standard and gnu modes. While there, as it is an installed header, I think it is also wrong to completely ignore any identifier namespace rules. The generic unwind.h defines just _Unwind* namespace identifiers plus _sleb128_t/_uleb128_t (but e.g. unlike libstdc++/glibc headers doesn't uglify operand names), the ARM unwind.h is much worse here. I've just changed the gnu_Unwind_Find_got function at least not be in user identifier namespace, but perhaps it would be good to go further and rename e.g. or e.g. typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State, _Unwind_Control_Block *, _Unwind_Context *); in unwind-arm-common.h. 2020-02-07 Jakub Jelinek PR target/93615 * config/arm/unwind-arm.h (gnu_Unwind_Find_got): Rename to ... (_Unwind_gnu_Find_got): ... this. Use __asm instead of asm. Remove trailing :s in asm. Formatting fixes. (_Unwind_decode_typeinfo_ptr): Adjust caller. * gcc.dg/pr93615.c: New test. --- libgcc/ChangeLog | 8 ++++++++ libgcc/config/arm/unwind-arm.h | 14 +++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 9ec9edf..b6e5ffc 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2020-02-07 Jakub Jelinek + + PR target/93615 + * config/arm/unwind-arm.h (gnu_Unwind_Find_got): Rename to ... + (_Unwind_gnu_Find_got): ... this. Use __asm instead of asm. Remove + trailing :s in asm. Formatting fixes. + (_Unwind_decode_typeinfo_ptr): Adjust caller. + 2020-01-31 Sandra Loosemore nios2: Support for GOT-relative DW_EH_PE_datarel encoding. diff --git a/libgcc/config/arm/unwind-arm.h b/libgcc/config/arm/unwind-arm.h index 1c82855..e77b769 100644 --- a/libgcc/config/arm/unwind-arm.h +++ b/libgcc/config/arm/unwind-arm.h @@ -43,19 +43,15 @@ extern "C" { #endif _Unwind_Ptr __attribute__((weak)) __gnu_Unwind_Find_got (_Unwind_Ptr); -static inline _Unwind_Ptr gnu_Unwind_Find_got (_Unwind_Ptr ptr) +static inline _Unwind_Ptr _Unwind_gnu_Find_got (_Unwind_Ptr ptr) { _Unwind_Ptr res; if (__gnu_Unwind_Find_got) - res = __gnu_Unwind_Find_got (ptr); + res = __gnu_Unwind_Find_got (ptr); else - { - asm volatile ("mov %[result], r" XSTR(FDPIC_REGNUM) - : [result]"=r" (res) - : - :); - } + __asm volatile ("mov %[result], r" XSTR(FDPIC_REGNUM) + : [result] "=r" (res)); return res; } @@ -75,7 +71,7 @@ static inline _Unwind_Ptr gnu_Unwind_Find_got (_Unwind_Ptr ptr) #if __FDPIC__ /* For FDPIC, we store the offset of the GOT entry. */ /* So, first get GOT from dynamic linker and then use indirect access. */ - tmp += gnu_Unwind_Find_got (ptr); + tmp += _Unwind_gnu_Find_got (ptr); tmp = *(_Unwind_Word *) tmp; #elif (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \ || defined(__FreeBSD__) || defined(__fuchsia__) -- cgit v1.1 From 5602b48b2ed84feb1a5792e3d73b00b42138ca6e Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Mon, 10 Feb 2020 12:54:39 +0000 Subject: arm: Fix up arm installed unwind.h for use in pedantic modes [PR93615] Commit r10-6500-g811a475ea3fcc55ee4aea7c81171891ef19dfc25 broke the GCC build for arm-none-uclinuxfdpiceabi, as it forgot to update some uses of gnu_Unwind_Find_got. 2020-02-10 Christophe Lyon libgcc/ PR target/93615 * unwind-arm-common.inc: Replace uses of gnu_Unwind_Find_got with _Unwind_gnu_Find_got. * unwind-pe.h: Likewise. --- libgcc/ChangeLog | 7 +++++++ libgcc/unwind-arm-common.inc | 8 ++++---- libgcc/unwind-pe.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index b6e5ffc..4fd1297 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2020-02-10 Christophe Lyon + + PR target/93615 + * unwind-arm-common.inc: Replace uses of gnu_Unwind_Find_got with + _Unwind_gnu_Find_got. + * unwind-pe.h: Likewise. + 2020-02-07 Jakub Jelinek PR target/93615 diff --git a/libgcc/unwind-arm-common.inc b/libgcc/unwind-arm-common.inc index 3c774b8..31a072b 100644 --- a/libgcc/unwind-arm-common.inc +++ b/libgcc/unwind-arm-common.inc @@ -419,7 +419,7 @@ get_eit_entry (_Unwind_Control_Block *ucbp, _uw return_address) UCB_PR_ADDR (ucbp) = selfrel_offset31 (ucbp->pr_cache.ehtp); #if __FDPIC__ UCB_PR_GOT (ucbp) - = (unsigned int) gnu_Unwind_Find_got ((_Unwind_Ptr) UCB_PR_ADDR (ucbp)); + = (unsigned int) _Unwind_gnu_Find_got ((_Unwind_Ptr) UCB_PR_ADDR (ucbp)); #endif } return _URC_OK; @@ -462,7 +462,7 @@ unwind_phase2 (_Unwind_Control_Block * ucbp, phase2_vrs * vrs) #if __FDPIC__ /* r9 could have been lost due to PLT jump. Restore correct value. */ - vrs->core.r[FDPIC_REGNUM] = gnu_Unwind_Find_got (VRS_PC (vrs)); + vrs->core.r[FDPIC_REGNUM] = _Unwind_gnu_Find_got (VRS_PC (vrs)); #endif uw_restore_core_regs (vrs, &vrs->core); @@ -562,7 +562,7 @@ unwind_phase2_forced (_Unwind_Control_Block *ucbp, phase2_vrs *entry_vrs, #if __FDPIC__ /* r9 could have been lost due to PLT jump. Restore correct value. */ - saved_vrs.core.r[FDPIC_REGNUM] = gnu_Unwind_Find_got (VRS_PC (&saved_vrs)); + saved_vrs.core.r[FDPIC_REGNUM] = _Unwind_gnu_Find_got (VRS_PC (&saved_vrs)); #endif uw_restore_core_regs (&saved_vrs, &saved_vrs.core); @@ -698,7 +698,7 @@ __gnu_Unwind_Resume (_Unwind_Control_Block * ucbp, phase2_vrs * entry_vrs) /* Upload the registers to enter the landing pad. */ #if __FDPIC__ /* r9 could have been lost due to PLT jump. Restore correct value. */ - entry_vrs->core.r[FDPIC_REGNUM] = gnu_Unwind_Find_got (VRS_PC (entry_vrs)); + entry_vrs->core.r[FDPIC_REGNUM] = _Unwind_gnu_Find_got (VRS_PC (entry_vrs)); #endif uw_restore_core_regs (entry_vrs, &entry_vrs->core); diff --git a/libgcc/unwind-pe.h b/libgcc/unwind-pe.h index a336127..a6b4bff 100644 --- a/libgcc/unwind-pe.h +++ b/libgcc/unwind-pe.h @@ -267,7 +267,7 @@ read_encoded_value_with_base (unsigned char encoding, _Unwind_Ptr base, into account. */ if ((encoding & DW_EH_PE_pcrel) && (encoding & DW_EH_PE_indirect)) { - result += gnu_Unwind_Find_got ((_Unwind_Ptr) u); + result += _Unwind_gnu_Find_got ((_Unwind_Ptr) u); result = *(_Unwind_Internal_Ptr *) result; } else -- cgit v1.1 From bf6465d0461234ccd45ae34d5e2375a0bee0081d Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 10 Feb 2020 07:58:45 -0800 Subject: i386: Properly pop restore token in signal frame Linux CET kernel places a restore token on shadow stack for signal handler to enhance security. The restore token is 8 byte and aligned to 8 bytes. It is usually transparent to user programs since kernel will pop the restore token when signal handler returns. But when an exception is thrown from a signal handler, now we need to pop the restore token from shadow stack. For x86-64, we just need to treat the signal frame as normal frame. For i386, we need to search for the restore token to check if the original shadow stack is 8 byte aligned. If the original shadow stack is 8 byte aligned, we just need to pop 2 slots, one restore token, from shadow stack. Otherwise, we need to pop 3 slots, one restore token + 4 byte padding, from shadow stack. This patch also includes 2 tests, one has a restore token with 4 byte padding and one without. Tested on Linux/x86-64 CET machine with and without -m32. libgcc/ PR libgcc/85334 * config/i386/shadow-stack-unwind.h (_Unwind_Frames_Increment): New. gcc/testsuite/ PR libgcc/85334 * g++.target/i386/pr85334-1.C: New test. * g++.target/i386/pr85334-2.C: Likewise. --- libgcc/config/i386/shadow-stack-unwind.h | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'libgcc') diff --git a/libgcc/config/i386/shadow-stack-unwind.h b/libgcc/config/i386/shadow-stack-unwind.h index a0244d2e..201b2153 100644 --- a/libgcc/config/i386/shadow-stack-unwind.h +++ b/libgcc/config/i386/shadow-stack-unwind.h @@ -49,3 +49,46 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see } \ } \ while (0) + +/* Linux CET kernel places a restore token on shadow stack for signal + handler to enhance security. The restore token is 8 byte and aligned + to 8 bytes. It is usually transparent to user programs since kernel + will pop the restore token when signal handler returns. But when an + exception is thrown from a signal handler, now we need to pop the + restore token from shadow stack. For x86-64, we just need to treat + the signal frame as normal frame. For i386, we need to search for + the restore token to check if the original shadow stack is 8 byte + aligned. If the original shadow stack is 8 byte aligned, we just + need to pop 2 slots, one restore token, from shadow stack. Otherwise, + we need to pop 3 slots, one restore token + 4 byte padding, from + shadow stack. */ +#ifndef __x86_64__ +#undef _Unwind_Frames_Increment +#define _Unwind_Frames_Increment(context, frames) \ + if (_Unwind_IsSignalFrame (context)) \ + do \ + { \ + _Unwind_Word ssp, prev_ssp, token; \ + ssp = _get_ssp (); \ + if (ssp != 0) \ + { \ + /* Align shadow stack pointer to the next \ + 8 byte aligned boundary. */ \ + ssp = (ssp + 4) & ~7; \ + do \ + { \ + /* Look for a restore token. */ \ + token = (*(_Unwind_Word *) (ssp - 8)); \ + prev_ssp = token & ~7; \ + if (prev_ssp == ssp) \ + break; \ + ssp += 8; \ + } \ + while (1); \ + frames += (token & 0x4) ? 3 : 2; \ + } \ + } \ + while (0); \ + else \ + frames++; +#endif -- cgit v1.1 From cf0f07ef0efc27f7e23b97b719e515d478a6b524 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 10 Feb 2020 08:06:53 -0800 Subject: Move ChangeLog entry of commit bf6465d046 from gcc to libgcc --- libgcc/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 4fd1297..4c7443a 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2020-02-10 H.J. Lu + + PR libgcc/85334 + * config/i386/shadow-stack-unwind.h (_Unwind_Frames_Increment): + New. + 2020-02-10 Christophe Lyon PR target/93615 -- cgit v1.1 From 7214fce3024d726ad548d7003fa162eb5021c491 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 10 Feb 2020 14:12:32 -0700 Subject: Fix libgcc build failure for FRV with recent versions of gas. * config/frv/frvbegin.c: Use right flags for .ctors and .dtors sections. * config/frv/frvend.c: Similarly. --- libgcc/ChangeLog | 6 ++++++ libgcc/config/frv/frvbegin.c | 4 ++-- libgcc/config/frv/frvend.c | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 4c7443a..917d0e7 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,9 @@ +2020-02-10 Jeff Law + + * config/frv/frvbegin.c: Use right flags for .ctors and .dtors + sections. + * config/frv/frvend.c: Similarly. + 2020-02-10 H.J. Lu PR libgcc/85334 diff --git a/libgcc/config/frv/frvbegin.c b/libgcc/config/frv/frvbegin.c index 8ab1a1b..0f54bf1 100644 --- a/libgcc/config/frv/frvbegin.c +++ b/libgcc/config/frv/frvbegin.c @@ -59,8 +59,8 @@ __asm__ (".section " SECTION "," FLAGS "\n\t" \ /* Beginning of .ctor/.dtor sections that provides a list of constructors and destructors to run. */ -INIT_SECTION_NEG_ONE (".ctors", "\"aw\"", "__CTOR_LIST__"); -INIT_SECTION_NEG_ONE (".dtors", "\"aw\"", "__DTOR_LIST__"); +INIT_SECTION_NEG_ONE (".ctors", "\"a\"", "__CTOR_LIST__"); +INIT_SECTION_NEG_ONE (".dtors", "\"a\"", "__DTOR_LIST__"); /* Beginning of .eh_frame section that provides all of the exception handling tables. */ diff --git a/libgcc/config/frv/frvend.c b/libgcc/config/frv/frvend.c index eb3494c..d2b83b2 100644 --- a/libgcc/config/frv/frvend.c +++ b/libgcc/config/frv/frvend.c @@ -52,8 +52,8 @@ __asm__ (".section " SECTION "," FLAGS "\n\t" \ /* End of .ctor/.dtor sections that provides a list of constructors and destructors to run. */ -FINI_SECTION_ZERO (".ctors", "\"aw\"", "__CTOR_END__"); -FINI_SECTION_ZERO (".dtors", "\"aw\"", "__DTOR_END__"); +FINI_SECTION_ZERO (".ctors", "\"a\"", "__CTOR_END__"); +FINI_SECTION_ZERO (".dtors", "\"a\"", "__DTOR_END__"); /* End of .eh_frame section that provides all of the exception handling tables. */ -- cgit v1.1 From 02ce382cd323097f9d02fbf91e0a3f59ebcd3d30 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Wed, 12 Feb 2020 12:20:15 -0800 Subject: Use a non-empty test program to test ability to link. On bare-metal targets, I/O support is typically provided by a BSP and requires a linker script and/or hosting library to be specified on the linker command line. Linking an empty program with the default linker script may succeed, however, which confuses libstdc++ configuration when programs that probe for the presence of various I/O features fail with link errors. 2020-02-12 Sandra Loosemore PR libstdc++/79193 PR libstdc++/88999 config/ * no-executables.m4: Use a non-empty program to test for linker support. libgcc/ * configure: Regenerated. libgfortran/ * configure: Regenerated. libiberty/ * configure: Regenerated. libitm/ * configure: Regenerated. libobjc/ * configure: Regenerated. libquadmath/ * configure: Regenerated. libssp/ * configure: Regenerated. libstdc++v-3/ * configure: Regenerated. --- libgcc/ChangeLog | 7 +++++++ libgcc/configure | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 917d0e7..7b46ccb 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2020-02-12 Sandra Loosemore + + PR libstdc++/79193 + PR libstdc++/88999 + + * configure: Regenerated. + 2020-02-10 Jeff Law * config/frv/frvbegin.c: Use right flags for .ctors and .dtors diff --git a/libgcc/configure b/libgcc/configure index ab8d471..093036a 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -3553,11 +3553,11 @@ done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main () { - +printf ("hello world\n"); ; return 0; } -- cgit v1.1 From ea0b12523d0d9a9059b5173ce9653b92ddfb284f Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 18 Feb 2020 14:28:22 +0100 Subject: Introduce -fprofile-reproducibility and support it with TOP N. PR ipa/92924 * common.opt: Add -fprofile-reproducibility. * doc/invoke.texi: Document it. * value-prof.c (dump_histogram_value): Document and support behavior for counters[0] being a negative value. (get_nth_most_common_value): Handle negative counters[0] in respect to flag_profile_reproducible. PR ipa/92924 * libgcov-merge.c (merge_topn_values_set): Record when a TOP N counter becomes invalid. When merging remove a smallest value if the space is needed. --- libgcc/ChangeLog | 7 +++++++ libgcc/libgcov-merge.c | 50 +++++++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 15 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 7b46ccb..dedc308 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,10 @@ +2020-02-18 Martin Liska + + PR ipa/92924 + * libgcov-merge.c (merge_topn_values_set): Record + when a TOP N counter becomes invalid. When merging + remove a smallest value if the space is needed. + 2020-02-12 Sandra Loosemore PR libstdc++/79193 diff --git a/libgcc/libgcov-merge.c b/libgcc/libgcov-merge.c index 19b8ee7..c0785b0 100644 --- a/libgcc/libgcov-merge.c +++ b/libgcc/libgcov-merge.c @@ -86,36 +86,47 @@ __gcov_merge_time_profile (gcov_type *counters, unsigned n_counters) #ifdef L_gcov_merge_topn +/* To merging of TOPN profiles. + counters[0] is the number of executions + for i in 0 ... TOPN-1 + counters[2 * i + 1] is target + counters[2 * i + 2] is corresponding hitrate counter. + + Because we prune counters only those with probability >= 1/TOPN are + present now. + + We use sign of counters[0] to track whether the number of different + targets exceeds TOPN. */ + static void merge_topn_values_set (gcov_type *counters) { /* First value is number of total executions of the profiler. */ - gcov_type all = gcov_get_counter_ignore_scaling (-1); - counters[0] += all; + gcov_type all = gcov_get_counter (); + gcov_type *total = &counters[0]; ++counters; + /* Negative value means that counter is missing some of values. */ + if (all < 0) + *total = -(*total); + + *total += all; + /* Read all part values. */ gcov_type read_counters[2 * GCOV_TOPN_VALUES]; - for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++) { read_counters[2 * i] = gcov_get_counter_target (); read_counters[2 * i + 1] = gcov_get_counter_ignore_scaling (-1); } - if (read_counters[1] == -1) - { - counters[1] = -1; - return; - } - for (unsigned i = 0; i < GCOV_TOPN_VALUES; i++) { if (read_counters[2 * i + 1] == 0) continue; unsigned j; - int slot = -1; + int slot = 0; for (j = 0; j < GCOV_TOPN_VALUES; j++) { @@ -124,13 +135,15 @@ merge_topn_values_set (gcov_type *counters) counters[2 * j + 1] += read_counters[2 * i + 1]; break; } - else if (counters[2 * j + 1] == 0) + else if (counters[2 * j + 1] < counters[2 * slot + 1]) slot = j; } if (j == GCOV_TOPN_VALUES) { - if (slot > 0) + gcov_type slot_count = counters[2 * slot + 1]; + /* We found an empty slot. */ + if (slot_count == 0) { /* If we found empty slot, add the value. */ counters[2 * slot] = read_counters[2 * i]; @@ -138,9 +151,16 @@ merge_topn_values_set (gcov_type *counters) } else { - /* We haven't found a slot, bail out. */ - counters[1] = -1; - return; + /* Here we are loosing some values. */ + if (*total >= 0) + *total = -(*total); + if (read_counters[2 * i + 1] > slot_count) + { + counters[2 * slot] = read_counters[2 * i]; + counters[2 * slot + 1] = read_counters[2 * i + 1]; + } + else + counters[2 * slot + 1] -= read_counters[2 * i + 1]; } } } -- cgit v1.1 From 8dd5d8f31a4f42cdb56341185596783e7b995bb6 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 2 Mar 2020 13:08:49 +0100 Subject: Remove duplicate declaration. * libgcov-interface.c: Remove duplicate declaration of __gcov_flush_mx. --- libgcc/ChangeLog | 5 +++++ libgcc/libgcov-interface.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index dedc308..99e999b 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,8 @@ +2020-03-02 Martin Liska + + * libgcov-interface.c: Remove duplicate + declaration of __gcov_flush_mx. + 2020-02-18 Martin Liska PR ipa/92924 diff --git a/libgcc/libgcov-interface.c b/libgcc/libgcov-interface.c index 49b44d5..048b902 100644 --- a/libgcc/libgcov-interface.c +++ b/libgcc/libgcov-interface.c @@ -52,7 +52,6 @@ void __gcov_dump (void) {} { src (); } extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN; -extern __gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN; #ifdef L_gcov_flush #ifdef __GTHREAD_MUTEX_INIT -- cgit v1.1 From 6b9ce2b4eb49e3c930730c3721323349e2136b1a Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Tue, 3 Mar 2020 16:02:24 +0000 Subject: libgcc: arm: convert thumb1 code to unified syntax Unified syntax has been the official syntax for thumb1 assembly for over 10 years now. It's time we made preparations for that becoming the default in the assembler. But before we can start doing that we really need to clean up some laggards from the olden days. Libgcc support for thumb1 is one such example. This patch converts all of the legacy (disjoint) syntax that I could find over to unified code. The identification was done by using a trick version of gas that defaulted to unified mode which then faults if legacy syntax is encountered. The code produced was then compared against the old code to check for differences. One such difference does exist, but that is because in unified syntax 'movs rd, rn' is encoded as 'lsls rd, rn, #0', rather than 'adds rd, rn, #0'; but that is a deliberate change that was introduced because the lsls encoding more closely reflects the behaviour of 'movs' in arm state (where only some of the condition flags are modified). * config/arm/bpabi-v6m.S (aeabi_lcmp): Convert thumb1 code to unified syntax. (aeabi_ulcmp, aeabi_ldivmod, aeabi_uldivmod): Likewise. (aeabi_frsub, aeabi_cfcmpeq, aeabi_fcmpeq): Likewise. (aeabi_fcmp, aeabi_drsub, aeabi_cdrcmple): Likewise. (aeabi_cdcmpeq, aeabi_dcmpeq, aeabi_dcmp): Likewise. * config/arm/lib1funcs.S (Lend_fde): Convert thumb1 code to unified syntax. (divsi3, modsi3): Likewise. (clzdi2, ctzsi2): Likewise. * config/arm/libunwind.S (restore_core_regs): Convert thumb1 code to unified syntax. (UNWIND_WRAPPER): Likewise. --- libgcc/ChangeLog | 16 ++ libgcc/config/arm/bpabi-v6m.S | 120 +++++++------- libgcc/config/arm/lib1funcs.S | 365 ++++++++++++++++++++++-------------------- libgcc/config/arm/libunwind.S | 88 +++++----- 4 files changed, 312 insertions(+), 277 deletions(-) (limited to 'libgcc') diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 99e999b..c113897 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,19 @@ +2020-03-03 Richard Earnshaw + + * config/arm/bpabi-v6m.S (aeabi_lcmp): Convert thumb1 code to unified + syntax. + (aeabi_ulcmp, aeabi_ldivmod, aeabi_uldivmod): Likewise. + (aeabi_frsub, aeabi_cfcmpeq, aeabi_fcmpeq): Likewise. + (aeabi_fcmp, aeabi_drsub, aeabi_cdrcmple): Likewise. + (aeabi_cdcmpeq, aeabi_dcmpeq, aeabi_dcmp): Likewise. + * config/arm/lib1funcs.S (Lend_fde): Convert thumb1 code to unified + syntax. + (divsi3, modsi3): Likewise. + (clzdi2, ctzsi2): Likewise. + * config/arm/libunwind.S (restore_core_regs): Convert thumb1 code to + unified syntax. + (UNWIND_WRAPPER): Likewise. + 2020-03-02 Martin Liska * libgcov-interface.c: Remove duplicate diff --git a/libgcc/config/arm/bpabi-v6m.S b/libgcc/config/arm/bpabi-v6m.S index 29fe8fa..1a403ef 100644 --- a/libgcc/config/arm/bpabi-v6m.S +++ b/libgcc/config/arm/bpabi-v6m.S @@ -39,21 +39,21 @@ FUNC_START aeabi_lcmp cmp xxh, yyh beq 1f bgt 2f - mov r0, #1 - neg r0, r0 + movs r0, #1 + negs r0, r0 RET 2: - mov r0, #1 + movs r0, #1 RET 1: - sub r0, xxl, yyl + subs r0, xxl, yyl beq 1f bhi 2f - mov r0, #1 - neg r0, r0 + movs r0, #1 + negs r0, r0 RET 2: - mov r0, #1 + movs r0, #1 1: RET FUNC_END aeabi_lcmp @@ -65,15 +65,15 @@ FUNC_START aeabi_lcmp FUNC_START aeabi_ulcmp cmp xxh, yyh bne 1f - sub r0, xxl, yyl + subs r0, xxl, yyl beq 2f 1: bcs 1f - mov r0, #1 - neg r0, r0 + movs r0, #1 + negs r0, r0 RET 1: - mov r0, #1 + movs r0, #1 2: RET FUNC_END aeabi_ulcmp @@ -91,29 +91,29 @@ FUNC_START aeabi_ulcmp cmp xxl, #0 2: beq 3f - mov xxh, #0 - mvn xxh, xxh @ 0xffffffff - mov xxl, xxh + movs xxh, #0 + mvns xxh, xxh @ 0xffffffff + movs xxl, xxh 3: .else blt 6f bgt 4f cmp xxl, #0 beq 5f -4: mov xxl, #0 - mvn xxl, xxl @ 0xffffffff - lsr xxh, xxl, #1 @ 0x7fffffff +4: movs xxl, #0 + mvns xxl, xxl @ 0xffffffff + lsrs xxh, xxl, #1 @ 0x7fffffff b 5f -6: mov xxh, #0x80 - lsl xxh, xxh, #24 @ 0x80000000 - mov xxl, #0 +6: movs xxh, #0x80 + lsls xxh, xxh, #24 @ 0x80000000 + movs xxl, #0 5: .endif @ tailcalls are tricky on v6-m. push {r0, r1, r2} ldr r0, 1f adr r1, 1f - add r0, r1 + adds r0, r1 str r0, [sp, #8] @ We know we are not on armv4t, so pop pc is safe. pop {r0, r1, pc} @@ -128,15 +128,15 @@ FUNC_START aeabi_ulcmp FUNC_START aeabi_ldivmod test_div_by_zero signed - push {r0, r1} - mov r0, sp - push {r0, lr} - ldr r0, [sp, #8] - bl SYM(__gnu_ldivmod_helper) - ldr r3, [sp, #4] - mov lr, r3 - add sp, sp, #8 - pop {r2, r3} + push {r0, r1} + mov r0, sp + push {r0, lr} + ldr r0, [sp, #8] + bl SYM(__gnu_ldivmod_helper) + ldr r3, [sp, #4] + mov lr, r3 + add sp, sp, #8 + pop {r2, r3} RET FUNC_END aeabi_ldivmod @@ -147,15 +147,15 @@ FUNC_START aeabi_ldivmod FUNC_START aeabi_uldivmod test_div_by_zero unsigned - push {r0, r1} - mov r0, sp - push {r0, lr} - ldr r0, [sp, #8] - bl SYM(__udivmoddi4) - ldr r3, [sp, #4] - mov lr, r3 - add sp, sp, #8 - pop {r2, r3} + push {r0, r1} + mov r0, sp + push {r0, lr} + ldr r0, [sp, #8] + bl SYM(__udivmoddi4) + ldr r3, [sp, #4] + mov lr, r3 + add sp, sp, #8 + pop {r2, r3} RET FUNC_END aeabi_uldivmod @@ -166,9 +166,9 @@ FUNC_START aeabi_uldivmod FUNC_START aeabi_frsub push {r4, lr} - mov r4, #1 - lsl r4, #31 - eor r0, r0, r4 + movs r4, #1 + lsls r4, #31 + eors r0, r0, r4 bl __aeabi_fadd pop {r4, pc} @@ -181,7 +181,7 @@ FUNC_START aeabi_frsub FUNC_START aeabi_cfrcmple mov ip, r0 - mov r0, r1 + movs r0, r1 mov r1, ip b 6f @@ -196,8 +196,8 @@ FUNC_ALIAS aeabi_cfcmple aeabi_cfcmpeq cmp r0, #0 @ Clear the C flag if the return value was -1, indicating @ that the first operand was smaller than the second. - bmi 1f - mov r1, #0 + bmi 1f + movs r1, #0 cmn r0, r1 1: pop {r0, r1, r2, r3, r4, pc} @@ -210,8 +210,8 @@ FUNC_START aeabi_fcmpeq push {r4, lr} bl __eqsf2 - neg r0, r0 - add r0, r0, #1 + negs r0, r0 + adds r0, r0, #1 pop {r4, pc} FUNC_END aeabi_fcmpeq @@ -223,10 +223,10 @@ FUNC_START aeabi_fcmp\cond bl __\helper\mode cmp r0, #0 b\cond 1f - mov r0, #0 + movs r0, #0 pop {r4, pc} 1: - mov r0, #1 + movs r0, #1 pop {r4, pc} FUNC_END aeabi_fcmp\cond @@ -244,9 +244,9 @@ COMPARISON ge, ge FUNC_START aeabi_drsub push {r4, lr} - mov r4, #1 - lsl r4, #31 - eor xxh, xxh, r4 + movs r4, #1 + lsls r4, #31 + eors xxh, xxh, r4 bl __aeabi_dadd pop {r4, pc} @@ -259,10 +259,10 @@ FUNC_START aeabi_drsub FUNC_START aeabi_cdrcmple mov ip, r0 - mov r0, r2 + movs r0, r2 mov r2, ip mov ip, r1 - mov r1, r3 + movs r1, r3 mov r3, ip b 6f @@ -277,8 +277,8 @@ FUNC_ALIAS aeabi_cdcmple aeabi_cdcmpeq cmp r0, #0 @ Clear the C flag if the return value was -1, indicating @ that the first operand was smaller than the second. - bmi 1f - mov r1, #0 + bmi 1f + movs r1, #0 cmn r0, r1 1: pop {r0, r1, r2, r3, r4, pc} @@ -291,8 +291,8 @@ FUNC_START aeabi_dcmpeq push {r4, lr} bl __eqdf2 - neg r0, r0 - add r0, r0, #1 + negs r0, r0 + adds r0, r0, #1 pop {r4, pc} FUNC_END aeabi_dcmpeq @@ -304,10 +304,10 @@ FUNC_START aeabi_dcmp\cond bl __\helper\mode cmp r0, #0 b\cond 1f - mov r0, #0 + movs r0, #0 pop {r4, pc} 1: - mov r0, #1 + movs r0, #1 pop {r4, pc} FUNC_END aeabi_dcmp\cond diff --git a/libgcc/config/arm/lib1funcs.S b/libgcc/config/arm/lib1funcs.S index e4b73ca..e8d2158 100644 --- a/libgcc/config/arm/lib1funcs.S +++ b/libgcc/config/arm/lib1funcs.S @@ -22,6 +22,10 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ +/* Everything in this file should now use unified syntax. */ + + .syntax unified + /* An executable stack is *not* required for these functions. */ #if defined(__ELF__) && defined(__linux__) .section .note.GNU-stack,"",%progbits @@ -270,7 +274,7 @@ LSYM(Lend_fde): #ifdef NOT_ISA_TARGET_32BIT push {r0, lr} - mov r0, #0 + movs r0, #0 bl SYM(__aeabi_idiv0) @ We know we are not on armv4t, so pop pc is safe. pop {r1, pc} @@ -310,7 +314,7 @@ LSYM(Lend_fde): push { r1, lr } 98: cfi_push 98b - __\name, 0xe, -0x4, 0x8 bl SYM (__div0) - mov r0, #0 @ About as wrong as it could be. + movs r0, #0 @ About as wrong as it could be. #if defined (__INTERWORKING__) pop { r1, r2 } bx r2 @@ -349,7 +353,7 @@ SYM (\name): #define THUMB_FUNC .thumb_func #define THUMB_CODE .force_thumb # if defined(__thumb2__) -#define THUMB_SYNTAX .syntax divided +#define THUMB_SYNTAX # else #define THUMB_SYNTAX # endif @@ -725,8 +729,8 @@ pc .req r15 /* ------------------------------------------------------------------------ */ .macro THUMB_DIV_MOD_BODY modulo @ Load the constant 0x10000000 into our work register. - mov work, #1 - lsl work, #28 + movs work, #1 + lsls work, #28 LSYM(Loop1): @ Unless the divisor is very big, shift it up in multiples of @ four bits, since this is the amount of unwinding in the main @@ -736,12 +740,12 @@ LSYM(Loop1): bhs LSYM(Lbignum) cmp divisor, dividend bhs LSYM(Lbignum) - lsl divisor, #4 - lsl curbit, #4 + lsls divisor, #4 + lsls curbit, #4 b LSYM(Loop1) LSYM(Lbignum): @ Set work to 0x80000000 - lsl work, #3 + lsls work, #3 LSYM(Loop2): @ For very big divisors, we must shift it a bit at a time, or @ we will be in danger of overflowing. @@ -749,8 +753,8 @@ LSYM(Loop2): bhs LSYM(Loop3) cmp divisor, dividend bhs LSYM(Loop3) - lsl divisor, #1 - lsl curbit, #1 + lsls divisor, #1 + lsls curbit, #1 b LSYM(Loop2) LSYM(Loop3): @ Test for possible subtractions ... @@ -758,39 +762,39 @@ LSYM(Loop3): @ ... On the final pass, this may subtract too much from the dividend, @ so keep track of which subtractions are done, we can fix them up @ afterwards. - mov overdone, #0 + movs overdone, #0 cmp dividend, divisor blo LSYM(Lover1) - sub dividend, dividend, divisor + subs dividend, dividend, divisor LSYM(Lover1): - lsr work, divisor, #1 + lsrs work, divisor, #1 cmp dividend, work blo LSYM(Lover2) - sub dividend, dividend, work + subs dividend, dividend, work mov ip, curbit - mov work, #1 - ror curbit, work - orr overdone, curbit + movs work, #1 + rors curbit, work + orrs overdone, curbit mov curbit, ip LSYM(Lover2): - lsr work, divisor, #2 + lsrs work, divisor, #2 cmp dividend, work blo LSYM(Lover3) - sub dividend, dividend, work + subs dividend, dividend, work mov ip, curbit - mov work, #2 - ror curbit, work - orr overdone, curbit + movs work, #2 + rors curbit, work + orrs overdone, curbit mov curbit, ip LSYM(Lover3): - lsr work, divisor, #3 + lsrs work, divisor, #3 cmp dividend, work blo LSYM(Lover4) - sub dividend, dividend, work + subs dividend, dividend, work mov ip, curbit - mov work, #3 - ror curbit, work - orr overdone, curbit + movs work, #3 + rors curbit, work + orrs overdone, curbit mov curbit, ip LSYM(Lover4): mov ip, curbit @@ -800,46 +804,46 @@ LSYM(Lover4): @ since the "bit" will have been shifted out at the bottom. cmp dividend, divisor blo LSYM(Lover1) - sub dividend, dividend, divisor - orr result, result, curbit + subs dividend, dividend, divisor + orrs result, result, curbit LSYM(Lover1): - lsr work, divisor, #1 + lsrs work, divisor, #1 cmp dividend, work blo LSYM(Lover2) - sub dividend, dividend, work - lsr work, curbit, #1 - orr result, work + subs dividend, dividend, work + lsrs work, curbit, #1 + orrs result, work LSYM(Lover2): - lsr work, divisor, #2 + lsrs work, divisor, #2 cmp dividend, work blo LSYM(Lover3) - sub dividend, dividend, work - lsr work, curbit, #2 - orr result, work + subs dividend, dividend, work + lsrs work, curbit, #2 + orrs result, work LSYM(Lover3): - lsr work, divisor, #3 + lsrs work, divisor, #3 cmp dividend, work blo LSYM(Lover4) - sub dividend, dividend, work - lsr work, curbit, #3 - orr result, work + subs dividend, dividend, work + lsrs work, curbit, #3 + orrs result, work LSYM(Lover4): .endif cmp dividend, #0 @ Early termination? beq LSYM(Lover5) - lsr curbit, #4 @ No, any more bits to do? + lsrs curbit, #4 @ No, any more bits to do? beq LSYM(Lover5) - lsr divisor, #4 + lsrs divisor, #4 b LSYM(Loop3) LSYM(Lover5): .if \modulo @ Any subtractions that we should not have done will be recorded in @ the top three bits of "overdone". Exactly which were not needed @ are governed by the position of the bit, stored in ip. - mov work, #0xe - lsl work, #28 - and overdone, work + movs work, #0xe + lsls work, #28 + ands overdone, work beq LSYM(Lgot_result) @ If we terminated early, because dividend became zero, then the @@ -849,33 +853,33 @@ LSYM(Lover5): @ the bit in ip could be in the top two bits which might then match @ with one of the smaller RORs. mov curbit, ip - mov work, #0x7 + movs work, #0x7 tst curbit, work beq LSYM(Lgot_result) mov curbit, ip - mov work, #3 - ror curbit, work + movs work, #3 + rors curbit, work tst overdone, curbit beq LSYM(Lover6) - lsr work, divisor, #3 - add dividend, work + lsrs work, divisor, #3 + adds dividend, work LSYM(Lover6): mov curbit, ip - mov work, #2 - ror curbit, work + movs work, #2 + rors curbit, work tst overdone, curbit beq LSYM(Lover7) - lsr work, divisor, #2 - add dividend, work + lsrs work, divisor, #2 + adds dividend, work LSYM(Lover7): mov curbit, ip - mov work, #1 - ror curbit, work + movs work, #1 + rors curbit, work tst overdone, curbit beq LSYM(Lgot_result) - lsr work, divisor, #1 - add dividend, work + lsrs work, divisor, #1 + adds dividend, work .endif LSYM(Lgot_result): .endm @@ -885,7 +889,7 @@ LSYM(Lgot_result): /* Branch to div(n), and jump to label if curbit is lo than divisior. */ .macro BranchToDiv n, label - lsr curbit, dividend, \n + lsrs curbit, dividend, \n cmp curbit, divisor blo \label .endm @@ -893,13 +897,13 @@ LSYM(Lgot_result): /* Body of div(n). Shift the divisor in n bits and compare the divisor and dividend. Update the dividend as the substruction result. */ .macro DoDiv n - lsr curbit, dividend, \n + lsrs curbit, dividend, \n cmp curbit, divisor bcc 1f - lsl curbit, divisor, \n - sub dividend, dividend, curbit + lsls curbit, divisor, \n + subs dividend, dividend, curbit -1: adc result, result +1: adcs result, result .endm /* The body of division with positive divisor. Unless the divisor is very @@ -907,29 +911,29 @@ LSYM(Lgot_result): unwinding in the main division loop. Continue shifting until the divisor is larger than the dividend. */ .macro THUMB1_Div_Positive - mov result, #0 + movs result, #0 BranchToDiv #1, LSYM(Lthumb1_div1) BranchToDiv #4, LSYM(Lthumb1_div4) BranchToDiv #8, LSYM(Lthumb1_div8) BranchToDiv #12, LSYM(Lthumb1_div12) BranchToDiv #16, LSYM(Lthumb1_div16) LSYM(Lthumb1_div_large_positive): - mov result, #0xff - lsl divisor, divisor, #8 + movs result, #0xff + lsls divisor, divisor, #8 rev result, result - lsr curbit, dividend, #16 + lsrs curbit, dividend, #16 cmp curbit, divisor blo 1f - asr result, #8 - lsl divisor, divisor, #8 + asrs result, #8 + lsls divisor, divisor, #8 beq LSYM(Ldivbyzero_waypoint) -1: lsr curbit, dividend, #12 +1: lsrs curbit, dividend, #12 cmp curbit, divisor blo LSYM(Lthumb1_div12) b LSYM(Lthumb1_div16) LSYM(Lthumb1_div_loop): - lsr divisor, divisor, #8 + lsrs divisor, divisor, #8 LSYM(Lthumb1_div16): Dodiv #15 Dodiv #14 @@ -954,11 +958,11 @@ LSYM(Lthumb1_div3): LSYM(Lthumb1_div2): Dodiv #1 LSYM(Lthumb1_div1): - sub divisor, dividend, divisor + subs divisor, dividend, divisor bcs 1f cpy divisor, dividend -1: adc result, result +1: adcs result, result cpy dividend, result RET @@ -970,43 +974,43 @@ LSYM(Ldivbyzero_waypoint): THUMB1_Div_Positive except that the shift steps are in multiples of six bits. */ .macro THUMB1_Div_Negative - lsr result, divisor, #31 + lsrs result, divisor, #31 beq 1f - neg divisor, divisor + negs divisor, divisor -1: asr curbit, dividend, #32 +1: asrs curbit, dividend, #32 bcc 2f - neg dividend, dividend + negs dividend, dividend -2: eor curbit, result - mov result, #0 +2: eors curbit, result + movs result, #0 cpy ip, curbit BranchToDiv #4, LSYM(Lthumb1_div_negative4) BranchToDiv #8, LSYM(Lthumb1_div_negative8) LSYM(Lthumb1_div_large): - mov result, #0xfc - lsl divisor, divisor, #6 + movs result, #0xfc + lsls divisor, divisor, #6 rev result, result - lsr curbit, dividend, #8 + lsrs curbit, dividend, #8 cmp curbit, divisor blo LSYM(Lthumb1_div_negative8) - lsl divisor, divisor, #6 - asr result, result, #6 + lsls divisor, divisor, #6 + asrs result, result, #6 cmp curbit, divisor blo LSYM(Lthumb1_div_negative8) - lsl divisor, divisor, #6 - asr result, result, #6 + lsls divisor, divisor, #6 + asrs result, result, #6 cmp curbit, divisor blo LSYM(Lthumb1_div_negative8) - lsl divisor, divisor, #6 + lsls divisor, divisor, #6 beq LSYM(Ldivbyzero_negative) - asr result, result, #6 + asrs result, result, #6 b LSYM(Lthumb1_div_negative8) LSYM(Lthumb1_div_negative_loop): - lsr divisor, divisor, #6 + lsrs divisor, divisor, #6 LSYM(Lthumb1_div_negative8): DoDiv #7 DoDiv #6 @@ -1017,28 +1021,28 @@ LSYM(Lthumb1_div_negative4): DoDiv #2 bcs LSYM(Lthumb1_div_negative_loop) DoDiv #1 - sub divisor, dividend, divisor + subs divisor, dividend, divisor bcs 1f cpy divisor, dividend 1: cpy curbit, ip - adc result, result - asr curbit, curbit, #1 + adcs result, result + asrs curbit, curbit, #1 cpy dividend, result bcc 2f - neg dividend, dividend + negs dividend, dividend cmp curbit, #0 2: bpl 3f - neg divisor, divisor + negs divisor, divisor 3: RET LSYM(Ldivbyzero_negative): cpy curbit, ip - asr curbit, curbit, #1 + asrs curbit, curbit, #1 bcc LSYM(Ldiv0) - neg dividend, dividend + negs dividend, dividend .endm #endif /* ARM Thumb version. */ @@ -1056,8 +1060,8 @@ LSYM(Ldivbyzero_negative): cmp divisor, #0 beq LSYM(Ldiv0) LSYM(udivsi3_skip_div0_test): - mov curbit, #1 - mov result, #0 + movs curbit, #1 + movs result, #0 push { work } cmp dividend, divisor @@ -1065,7 +1069,7 @@ LSYM(udivsi3_skip_div0_test): THUMB_DIV_MOD_BODY 0 - mov r0, result + movs r0, result pop { work } RET @@ -1184,7 +1188,7 @@ ARM_FUNC_START aeabi_uidivmod cmp divisor, #0 beq LSYM(Ldiv0) - mov curbit, #1 + movs curbit, #1 cmp dividend, divisor bhs LSYM(Lover10) RET @@ -1263,7 +1267,7 @@ LSYM(Lover12): #else LSYM(divsi3_skip_div0_test): cpy curbit, dividend - orr curbit, divisor + orrs curbit, divisor bmi LSYM(Lthumb1_div_negative) LSYM(Lthumb1_div_positive): @@ -1395,11 +1399,11 @@ ARM_FUNC_START aeabi_idivmod FUNC_START modsi3 - mov curbit, #1 + movs curbit, #1 cmp divisor, #0 beq LSYM(Ldiv0) bpl LSYM(Lover10) - neg divisor, divisor @ Loops below use unsigned. + negs divisor, divisor @ Loops below use unsigned. LSYM(Lover10): push { work } @ Need to save the sign of the dividend, unfortunately, we need @@ -1408,7 +1412,7 @@ LSYM(Lover10): push { dividend } cmp dividend, #0 bpl LSYM(Lover11) - neg dividend, dividend + negs dividend, dividend LSYM(Lover11): cmp dividend, divisor blo LSYM(Lgot_result) @@ -1418,7 +1422,7 @@ LSYM(Lover11): pop { work } cmp work, #0 bpl LSYM(Lover12) - neg dividend, dividend + negs dividend, dividend LSYM(Lover12): pop { work } RET @@ -1540,12 +1544,12 @@ LSYM(Lover12): address, so just clear pc..pc+1. */ #if defined __thumb__ && !defined __thumb2__ push {r7} - mov r7, #0xf - lsl r7, #16 - add r7, #2 + movs r7, #0xf + lsls r7, #16 + adds r7, #2 adr r0, . + 4 - add r1, r0, #1 - mov r2, #0 + adds r1, r0, #1 + movs r2, #0 svc 0 pop {r7} #else @@ -1595,17 +1599,17 @@ LSYM(Lover12): FUNC_ALIAS aeabi_llsr lshrdi3 #ifdef __thumb__ - lsr al, r2 - mov r3, ah - lsr ah, r2 + lsrs al, r2 + movs r3, ah + lsrs ah, r2 mov ip, r3 - sub r2, #32 - lsr r3, r2 - orr al, r3 - neg r2, r2 + subs r2, #32 + lsrs r3, r2 + orrs al, r3 + negs r2, r2 mov r3, ip - lsl r3, r2 - orr al, r3 + lsls r3, r2 + orrs al, r3 RET #else subs r3, r2, #32 @@ -1627,21 +1631,21 @@ LSYM(Lover12): FUNC_ALIAS aeabi_lasr ashrdi3 #ifdef __thumb__ - lsr al, r2 - mov r3, ah - asr ah, r2 - sub r2, #32 + lsrs al, r2 + movs r3, ah + asrs ah, r2 + subs r2, #32 @ If r2 is negative at this point the following step would OR @ the sign bit into all of AL. That's not what we want... bmi 1f mov ip, r3 - asr r3, r2 - orr al, r3 + asrs r3, r2 + orrs al, r3 mov r3, ip 1: - neg r2, r2 - lsl r3, r2 - orr al, r3 + negs r2, r2 + lsls r3, r2 + orrs al, r3 RET #else subs r3, r2, #32 @@ -1664,17 +1668,17 @@ LSYM(Lover12): FUNC_ALIAS aeabi_llsl ashldi3 #ifdef __thumb__ - lsl ah, r2 - mov r3, al - lsl al, r2 + lsls ah, r2 + movs r3, al + lsls al, r2 mov ip, r3 - sub r2, #32 - lsl r3, r2 - orr ah, r3 - neg r2, r2 + subs r2, #32 + lsls r3, r2 + orrs ah, r3 + negs r2, r2 mov r3, ip - lsr r3, r2 - orr ah, r3 + lsrs r3, r2 + orrs ah, r3 RET #else subs r3, r2, #32 @@ -1695,26 +1699,26 @@ LSYM(Lover12): #ifdef L_clzsi2 #ifdef NOT_ISA_TARGET_32BIT FUNC_START clzsi2 - mov r1, #28 - mov r3, #1 - lsl r3, r3, #16 + movs r1, #28 + movs r3, #1 + lsls r3, r3, #16 cmp r0, r3 /* 0x10000 */ bcc 2f - lsr r0, r0, #16 - sub r1, r1, #16 -2: lsr r3, r3, #8 + lsrs r0, r0, #16 + subs r1, r1, #16 +2: lsrs r3, r3, #8 cmp r0, r3 /* #0x100 */ bcc 2f - lsr r0, r0, #8 - sub r1, r1, #8 -2: lsr r3, r3, #4 + lsrs r0, r0, #8 + subs r1, r1, #8 +2: lsrs r3, r3, #4 cmp r0, r3 /* #0x10 */ bcc 2f - lsr r0, r0, #4 - sub r1, r1, #4 + lsrs r0, r0, #4 + subs r1, r1, #4 2: adr r2, 1f ldrb r0, [r2, r0] - add r0, r0, r1 + adds r0, r0, r1 bx lr .align 2 1: @@ -1757,34 +1761,49 @@ ARM_FUNC_START clzsi2 # ifdef NOT_ISA_TARGET_32BIT FUNC_START clzdi2 push {r4, lr} -# else + cmp xxh, #0 + bne 1f +# ifdef __ARMEB__ + movs r0, xxl + bl __clzsi2 + adds r0, r0, #32 + b 2f +1: + bl __clzsi2 +# else + bl __clzsi2 + adds r0, r0, #32 + b 2f +1: + movs r0, xxh + bl __clzsi2 +# endif +2: + pop {r4, pc} +# else /* NOT_ISA_TARGET_32BIT */ ARM_FUNC_START clzdi2 do_push {r4, lr} -# endif cmp xxh, #0 bne 1f -# ifdef __ARMEB__ +# ifdef __ARMEB__ mov r0, xxl bl __clzsi2 add r0, r0, #32 b 2f 1: bl __clzsi2 -# else +# else bl __clzsi2 add r0, r0, #32 b 2f 1: mov r0, xxh bl __clzsi2 -# endif +# endif 2: -# ifdef NOT_ISA_TARGET_32BIT - pop {r4, pc} -# else RETLDM r4 -# endif FUNC_END clzdi2 +# endif /* NOT_ISA_TARGET_32BIT */ #else /* defined (__ARM_FEATURE_CLZ) */ @@ -1803,28 +1822,28 @@ ARM_FUNC_START clzdi2 #ifdef L_ctzsi2 #ifdef NOT_ISA_TARGET_32BIT FUNC_START ctzsi2 - neg r1, r0 - and r0, r0, r1 - mov r1, #28 - mov r3, #1 - lsl r3, r3, #16 + negs r1, r0 + ands r0, r0, r1 + movs r1, #28 + movs r3, #1 + lsls r3, r3, #16 cmp r0, r3 /* 0x10000 */ bcc 2f - lsr r0, r0, #16 - sub r1, r1, #16 -2: lsr r3, r3, #8 + lsrs r0, r0, #16 + subs r1, r1, #16 +2: lsrs r3, r3, #8 cmp r0, r3 /* #0x100 */ bcc 2f - lsr r0, r0, #8 - sub r1, r1, #8 -2: lsr r3, r3, #4 + lsrs r0, r0, #8 + subs r1, r1, #8 +2: lsrs r3, r3, #4 cmp r0, r3 /* #0x10 */ bcc 2f - lsr r0, r0, #4 - sub r1, r1, #4 + lsrs r0, r0, #4 + subs r1, r1, #4 2: adr r2, 1f ldrb r0, [r2, r0] - sub r0, r0, r1 + subs r0, r0, r1 bx lr .align 2 1: diff --git a/libgcc/config/arm/libunwind.S b/libgcc/config/arm/libunwind.S index 176ba5e..08e0fcc 100644 --- a/libgcc/config/arm/libunwind.S +++ b/libgcc/config/arm/libunwind.S @@ -63,28 +63,28 @@ /* r0 points to a 16-word block. Upload these values to the actual core state. */ FUNC_START restore_core_regs - mov r1, r0 - add r1, r1, #52 - ldmia r1!, {r3, r4, r5} - sub r3, r3, #4 - mov ip, r3 - str r5, [r3] - mov lr, r4 + movs r1, r0 + adds r1, r1, #52 + ldmia r1!, {r3, r4, r5} + subs r3, r3, #4 + mov ip, r3 + str r5, [r3] + mov lr, r4 /* Restore r8-r11. */ - mov r1, r0 - add r1, r1, #32 - ldmia r1!, {r2, r3, r4, r5} - mov r8, r2 - mov r9, r3 - mov sl, r4 - mov fp, r5 - mov r1, r0 - add r1, r1, #8 - ldmia r1!, {r2, r3, r4, r5, r6, r7} - ldr r1, [r0, #4] - ldr r0, [r0] - mov sp, ip - pop {pc} + movs r1, r0 + adds r1, r1, #32 + ldmia r1!, {r2, r3, r4, r5} + mov r8, r2 + mov r9, r3 + mov sl, r4 + mov fp, r5 + movs r1, r0 + adds r1, r1, #8 + ldmia r1!, {r2, r3, r4, r5, r6, r7} + ldr r1, [r0, #4] + ldr r0, [r0] + mov sp, ip + pop {pc} FUNC_END restore_core_regs UNPREFIX restore_core_regs @@ -132,38 +132,38 @@ FUNC_START gnu_Unwind_Save_WMMXC FUNC_START \name /* Create a phase2_vrs structure. */ /* Save r0 in the PC slot so we can use it as a scratch register. */ - push {r0} - add r0, sp, #4 - push {r0, lr} /* Push original SP and LR. */ + push {r0} + add r0, sp, #4 + push {r0, lr} /* Push original SP and LR. */ /* Make space for r8-r12. */ - sub sp, sp, #20 + sub sp, sp, #20 /* Save low registers. */ - push {r0, r1, r2, r3, r4, r5, r6, r7} + push {r0, r1, r2, r3, r4, r5, r6, r7} /* Save high registers. */ - add r0, sp, #32 - mov r1, r8 - mov r2, r9 - mov r3, sl - mov r4, fp - mov r5, ip - stmia r0!, {r1, r2, r3, r4, r5} + add r0, sp, #32 + mov r1, r8 + mov r2, r9 + mov r3, sl + mov r4, fp + mov r5, ip + stmia r0!, {r1, r2, r3, r4, r5} /* Restore original low register values. */ - add r0, sp, #4 - ldmia r0!, {r1, r2, r3, r4, r5} + add r0, sp, #4 + ldmia r0!, {r1, r2, r3, r4, r5} /* Restore orginial r0. */ - ldr r0, [sp, #60] - str r0, [sp] + ldr r0, [sp, #60] + str r0, [sp] /* Demand-save flags, plus an extra word for alignment. */ - mov r3, #0 - push {r2, r3} + movs r3, #0 + push {r2, r3} /* Point r1 at the block. Pass r[0..nargs) unchanged. */ - add r\nargs, sp, #4 + add r\nargs, sp, #4 - bl SYM (__gnu\name) + bl SYM (__gnu\name) - ldr r3, [sp, #64] - add sp, sp, #72 - bx r3 + ldr r3, [sp, #64] + add sp, sp, #72 + bx r3 FUNC_END \name UNPREFIX \name -- cgit v1.1 From 0993851dc131608a49da294a9ca7dd102df349ab Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Wed, 4 Mar 2020 13:29:38 +0100 Subject: IBM Z: zTPF: Build libgcc with -mtpf-trace-skip libgcc is supposed to be built with the trace skip flags and branch targets. Add a zTPF header file fragment and add the -mtpf-trace-skip option. libgcc/ChangeLog: 2020-03-04 Andreas Krebbel * config.host: Include the new makefile fragment. * config/s390/t-tpf: New file. --- libgcc/config.host | 2 +- libgcc/config/s390/t-tpf | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 libgcc/config/s390/t-tpf (limited to 'libgcc') diff --git a/libgcc/config.host b/libgcc/config.host index 4198dc8..1ff4159 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1301,7 +1301,7 @@ s390x-*-linux*) md_unwind_header=s390/linux-unwind.h ;; s390x-ibm-tpf*) - tmake_file="${tmake_file} s390/t-crtstuff t-libgcc-pic t-eh-dw2-dip" + tmake_file="${tmake_file} s390/t-crtstuff t-libgcc-pic t-eh-dw2-dip s390/t-tpf" extra_parts="crtbeginS.o crtendS.o" md_unwind_header=s390/tpf-unwind.h ;; diff --git a/libgcc/config/s390/t-tpf b/libgcc/config/s390/t-tpf new file mode 100644 index 0000000..50da223 --- /dev/null +++ b/libgcc/config/s390/t-tpf @@ -0,0 +1,7 @@ +DFP_ENABLE = true + +# Override t-slibgcc-elf-ver to export some libgcc symbols with +# the symbol versions that glibc used. +SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/s390/libgcc-glibc.ver + +HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mtpf-trace-skip -- cgit v1.1