diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2022-06-03 23:30:54 +0100 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2022-11-01 20:24:06 +0000 |
commit | 96cabae5a4ce327d3cfbecac610a9e7b274cc3b9 (patch) | |
tree | ebcc5af1223dd254346ae03f9ee65e7c2d344bff | |
parent | f0a188b249f3a07ebc5d0dd7910f39b2752bfd5e (diff) | |
download | toolchains-96cabae5a4ce327d3cfbecac610a9e7b274cc3b9.tar.gz toolchains-96cabae5a4ce327d3cfbecac610a9e7b274cc3b9.tar.bz2 |
Use UnixLib's atomics implementation
Stop libgcc pulling in the atomics implementation for Linux. This
does not work on RISC OS and will result in unexpected aborts
deep in application code.
Additionally, enable the __sync_fetch_and_<op>_<size> atomics
when building UnixLib for EABI. It's not clear why these were
disabled, but things that need them will fail to link if they
are not present.
-rw-r--r-- | arm-riscos-gnueabihf/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p | 56 | ||||
-rw-r--r-- | arm-riscos-gnueabihf/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p | 22 |
2 files changed, 78 insertions, 0 deletions
diff --git a/arm-riscos-gnueabihf/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p b/arm-riscos-gnueabihf/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p new file mode 100644 index 0000000..12a88ac --- /dev/null +++ b/arm-riscos-gnueabihf/recipes/patches/gccsdk/gcc-libgcc-no-linux-atomics.p @@ -0,0 +1,56 @@ +Index: gcc/libgcc.config.arm.t-riscos-gnueabihf +=================================================================== +--- gcc/libgcc.config.arm.t-riscos-gnueabihf (revision 7698) ++++ gcc/libgcc.config.arm.t-riscos-gnueabihf (working copy) +@@ -1,36 +1,2 @@ +-# Copyright (C) 2011-2012 Free Software Foundation, Inc. +-# Contributed by John Tytgat (John.Tytgat@aaug.net). +-# +-# 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/>. +- +-# vvv Part of config/arm/t-bpabi +-LIB2ADD_ST += $(srcdir)/config/arm/fp16.c +- +-LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ +- $(srcdir)/config/arm/libunwind.S \ +- $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c +-# ^^^ +- +-ifeq (,$(findstring mlibscl,$(CFLAGS))$(findstring mmodule,$(CFLAGS))) +-# For shared libgcc building: +-EXTRA_PARTS += crtbeginS.o crtendS.o +-gcc_s_compile += -fPIC +-SHLIB_LDFLAGS=-fPIC +-include $(srcdir)/config/t-slibgcc +-include $(srcdir)/config/t-slibgcc-nolc-override +-endif +- ++# Use a version of div0 which raises SIGFPE, and a special __clear_cache. ++LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx _clear_cache +Index: gcc/libgcc.config.host.p +=================================================================== +--- gcc/libgcc.config.host.p (revision 7698) ++++ gcc/libgcc.config.host.p (working copy) +@@ -20,7 +20,7 @@ + ;; + +arm*-riscos-gnueabihf) + + tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix t-crtfm" +-+ tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc t-slibgcc-nolc-override" +++ tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-riscos-gnueabihf t-slibgcc-libgcc t-slibgcc-nolc-override" + + tm_file="$tm_file arm/bpabi-lib.h" + + unwind_header=config/arm/unwind-arm.h + + tmake_file="$tmake_file t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp" diff --git a/arm-riscos-gnueabihf/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p b/arm-riscos-gnueabihf/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p new file mode 100644 index 0000000..f9764ba --- /dev/null +++ b/arm-riscos-gnueabihf/recipes/patches/gccsdk/unixlib-sync-and-fetch-atomics.p @@ -0,0 +1,22 @@ +Index: libunixlib/gcccompat/atomics.c +=================================================================== +--- libunixlib/gcccompat/atomics.c (revision 7698) ++++ libunixlib/gcccompat/atomics.c (working copy) +@@ -146,8 +146,6 @@ + ATOMIC_COMPARE_AND_EXCHANGE(4,uint32_t) + ATOMIC_COMPARE_AND_EXCHANGE(8,uint64_t) + +-#ifndef __ARM_EABI__ +- + /* These built-in functions perform the operation suggested by the name, + * and return the value that had previously been in *ptr. That is, + * +@@ -200,8 +198,6 @@ + SYNC_FETCH_AND_OP(xor,^,8,long long) + SYNC_FETCH_AND_OP(and,&,8,long long) + +-#endif +- + /* These built-in functions perform the operation suggested by the name, + * and return the new value. That is, + * |