diff options
Diffstat (limited to 'pkgs/development/compilers/gcc/patches/7')
5 files changed, 539 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc/patches/7/0001-Fix-build-for-glibc-2.31.patch b/pkgs/development/compilers/gcc/patches/7/0001-Fix-build-for-glibc-2.31.patch new file mode 100644 index 00000000000..d8aad14942b --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/7/0001-Fix-build-for-glibc-2.31.patch @@ -0,0 +1,62 @@ +From 2d03b6eaf823fc2db6a32b4a95e18f8a7474b47f Mon Sep 17 00:00:00 2001 +From: Maximilian Bosch <maximilian@mbosch.me> +Date: Thu, 20 Feb 2020 01:56:42 +0100 +Subject: [PATCH] Fix build for glibc 2.31 + +--- + .../sanitizer_platform_limits_posix.cc | 5 +++-- + .../sanitizer_platform_limits_posix.h | 15 +-------------- + 2 files changed, 4 insertions(+), 16 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +index 97eae3fc7..4089d4695 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +@@ -1145,8 +1145,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid); + CHECK_SIZE_AND_OFFSET(ipc_perm, gid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); + CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); +-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) +-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ ++#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31) ++/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit ++ on many architectures. */ + CHECK_SIZE_AND_OFFSET(ipc_perm, mode); + #endif + +diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +index c13932283..3456fb2db 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h ++++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +@@ -204,27 +204,14 @@ namespace __sanitizer { + unsigned __seq; + u64 __unused1; + u64 __unused2; +-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__) +- unsigned int mode; +- unsigned short __seq; +- unsigned short __pad1; +- unsigned long __unused1; +- unsigned long __unused2; + #elif defined(__sparc__) +-# if defined(__arch64__) + unsigned mode; +- unsigned short __pad1; +-# else +- unsigned short __pad1; +- unsigned short mode; + unsigned short __pad2; +-# endif + unsigned short __seq; + unsigned long long __unused1; + unsigned long long __unused2; + #else +- unsigned short mode; +- unsigned short __pad1; ++ unsigned int mode; + unsigned short __seq; + unsigned short __pad2; + #if defined(__x86_64__) && !defined(_LP64) +-- +2.25.0 + diff --git a/pkgs/development/compilers/gcc/patches/7/Added-mcf-thread-model-support-from-mcfgthread.patch b/pkgs/development/compilers/gcc/patches/7/Added-mcf-thread-model-support-from-mcfgthread.patch new file mode 100644 index 00000000000..0c5d0ee9e46 --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/7/Added-mcf-thread-model-support-from-mcfgthread.patch @@ -0,0 +1,285 @@ +From d3cb66e4751fcbd581b81a14a973de2d78fc02ad Mon Sep 17 00:00:00 2001 +From: Liu Hao <lh_mouse@126.com> +Date: Mon, 18 Apr 2016 11:50:55 +0800 +Subject: [PATCH] Added 'mcf' thread model support from mcfgthread. + +Signed-off-by: Liu Hao <lh_mouse@126.com> +--- + config/gthr.m4 | 1 + + gcc/config.gcc | 3 +++ + gcc/config/i386/mingw-mcfgthread.h | 1 + + gcc/config/i386/mingw-w64.h | 2 +- + gcc/config/i386/mingw32.h | 11 ++++++++++- + gcc/configure | 2 +- + gcc/configure.ac | 2 +- + libatomic/configure.tgt | 2 +- + libgcc/config.host | 6 ++++++ + libgcc/config/i386/gthr-mcf.h | 1 + + libgcc/config/i386/t-mingw-mcfgthread | 2 ++ + libgcc/configure | 1 + + libstdc++-v3/configure | 1 + + libstdc++-v3/libsupc++/atexit_thread.cc | 18 ++++++++++++++++++ + libstdc++-v3/libsupc++/guard.cc | 23 +++++++++++++++++++++++ + 15 files changed, 71 insertions(+), 5 deletions(-) + create mode 100644 gcc/config/i386/mingw-mcfgthread.h + create mode 100644 libgcc/config/i386/gthr-mcf.h + create mode 100644 libgcc/config/i386/t-mingw-mcfgthread + +diff --git a/config/gthr.m4 b/config/gthr.m4 +index 7b29f1f3327..82e21fe1709 100644 +--- a/config/gthr.m4 ++++ b/config/gthr.m4 +@@ -21,6 +21,7 @@ case $1 in + tpf) thread_header=config/s390/gthr-tpf.h ;; + vxworks) thread_header=config/gthr-vxworks.h ;; + win32) thread_header=config/i386/gthr-win32.h ;; ++ mcf) thread_header=config/i386/gthr-mcf.h ;; + esac + AC_SUBST(thread_header) + ]) +diff --git a/gcc/config.gcc b/gcc/config.gcc +index 8f91197f34e..59db37cac04 100644 +--- a/gcc/config.gcc ++++ b/gcc/config.gcc +@@ -1719,6 +1719,9 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) + if test x$enable_threads = xposix ; then + tm_file="${tm_file} i386/mingw-pthread.h" + fi ++ if test x$enable_threads = xmcf ; then ++ tm_file="${tm_file} i386/mingw-mcfgthread.h" ++ fi + tm_file="${tm_file} i386/mingw32.h" + # This makes the logic if mingw's or the w64 feature set has to be used + case ${target} in +diff --git a/gcc/config/i386/mingw-mcfgthread.h b/gcc/config/i386/mingw-mcfgthread.h +new file mode 100644 +index 00000000000..ec381a7798f +--- /dev/null ++++ b/gcc/config/i386/mingw-mcfgthread.h +@@ -0,0 +1 @@ ++#define TARGET_USE_MCFGTHREAD 1 +diff --git a/gcc/config/i386/mingw-w64.h b/gcc/config/i386/mingw-w64.h +index 270ec0dd037..88966f79695 100644 +--- a/gcc/config/i386/mingw-w64.h ++++ b/gcc/config/i386/mingw-w64.h +@@ -48,7 +48,7 @@ along with GCC; see the file COPYING3. If not see + "%{mwindows:-lgdi32 -lcomdlg32} " \ + "%{fvtable-verify=preinit:-lvtv -lpsapi; \ + fvtable-verify=std:-lvtv -lpsapi} " \ +- "-ladvapi32 -lshell32 -luser32 -lkernel32" ++ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32" + + #undef SPEC_32 + #undef SPEC_64 +diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h +index e5f014cb473..989cfbe894e 100644 +--- a/gcc/config/i386/mingw32.h ++++ b/gcc/config/i386/mingw32.h +@@ -32,6 +32,14 @@ along with GCC; see the file COPYING3. If not see + | MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \ + | MASK_MS_BITFIELD_LAYOUT) + ++#ifndef TARGET_USE_MCFGTHREAD ++#define CPP_MCFGTHREAD() ((void)0) ++#define LIB_MCFGTHREAD "" ++#else ++#define CPP_MCFGTHREAD() (builtin_define("__USING_MCFGTHREAD__")) ++#define LIB_MCFGTHREAD " -lmcfgthread " ++#endif ++ + /* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS + is for compatibility with native compiler. */ + #define EXTRA_OS_CPP_BUILTINS() \ +@@ -50,6 +58,7 @@ along with GCC; see the file COPYING3. If not see + builtin_define_std ("WIN64"); \ + builtin_define ("_WIN64"); \ + } \ ++ CPP_MCFGTHREAD(); \ + } \ + while (0) + +@@ -93,7 +102,7 @@ along with GCC; see the file COPYING3. If not see + "%{mwindows:-lgdi32 -lcomdlg32} " \ + "%{fvtable-verify=preinit:-lvtv -lpsapi; \ + fvtable-verify=std:-lvtv -lpsapi} " \ +- "-ladvapi32 -lshell32 -luser32 -lkernel32" ++ LIB_MCFGTHREAD "-ladvapi32 -lshell32 -luser32 -lkernel32" + + /* Weak symbols do not get resolved if using a Windows dll import lib. + Make the unwind registration references strong undefs. */ +diff --git a/gcc/configure b/gcc/configure +index ea73b151a4e..317200e5620 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -11681,7 +11681,7 @@ case ${enable_threads} in + target_thread_file='single' + ;; + aix | dce | lynx | mipssde | posix | rtems | \ +- single | tpf | vxworks | win32) ++ single | tpf | vxworks | win32 | mcf) + target_thread_file=${enable_threads} + ;; + *) +diff --git a/gcc/configure.ac b/gcc/configure.ac +index 9d4c792a33f..d51899a5676 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -1612,7 +1612,7 @@ case ${enable_threads} in + target_thread_file='single' + ;; + aix | dce | lynx | mipssde | posix | rtems | \ +- single | tpf | vxworks | win32) ++ single | tpf | vxworks | win32 | mcf) + target_thread_file=${enable_threads} + ;; + *) +diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt +index b8af3ab2546..73248438a8c 100644 +--- a/libatomic/configure.tgt ++++ b/libatomic/configure.tgt +@@ -125,7 +125,7 @@ case "${target}" in + *-*-mingw*) + # OS support for atomic primitives. + case ${target_thread_file} in +- win32) ++ win32 | mcf) + config_path="${config_path} mingw" + ;; + posix) +diff --git a/libgcc/config.host b/libgcc/config.host +index b279a6458f9..20d22f585da 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -710,6 +710,9 @@ i[34567]86-*-mingw*) + posix) + tmake_file="i386/t-mingw-pthread $tmake_file" + ;; ++ mcf) ++ tmake_file="i386/t-mingw-mcfgthread $tmake_file" ++ ;; + esac + # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h + if test x$ac_cv_sjlj_exceptions = xyes; then +@@ -734,6 +737,9 @@ x86_64-*-mingw*) + posix) + tmake_file="i386/t-mingw-pthread $tmake_file" + ;; ++ mcf) ++ tmake_file="i386/t-mingw-mcfgthread $tmake_file" ++ ;; + esac + # This has to match the logic for DWARF2_UNWIND_INFO in gcc/config/i386/cygming.h + if test x$ac_cv_sjlj_exceptions = xyes; then +diff --git a/libgcc/config/i386/gthr-mcf.h b/libgcc/config/i386/gthr-mcf.h +new file mode 100644 +index 00000000000..5ea2908361f +--- /dev/null ++++ b/libgcc/config/i386/gthr-mcf.h +@@ -0,0 +1 @@ ++#include <mcfgthread/gthread.h> +diff --git a/libgcc/config/i386/t-mingw-mcfgthread b/libgcc/config/i386/t-mingw-mcfgthread +new file mode 100644 +index 00000000000..4b9b10e32d6 +--- /dev/null ++++ b/libgcc/config/i386/t-mingw-mcfgthread +@@ -0,0 +1,2 @@ ++SHLIB_PTHREAD_CFLAG = ++SHLIB_PTHREAD_LDFLAG = -lmcfgthread +diff --git a/libgcc/configure b/libgcc/configure +index 45c459788c3..8fc569ef16e 100644 +--- a/libgcc/configure ++++ b/libgcc/configure +@@ -5086,6 +5086,7 @@ case $target_thread_file in + tpf) thread_header=config/s390/gthr-tpf.h ;; + vxworks) thread_header=config/gthr-vxworks.h ;; + win32) thread_header=config/i386/gthr-win32.h ;; ++ mcf) thread_header=config/i386/gthr-mcf.h ;; + esac + + +diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure +index 2406cb9d946..50e7e4ced89 100755 +--- a/libstdc++-v3/configure ++++ b/libstdc++-v3/configure +@@ -15182,6 +15182,7 @@ case $target_thread_file in + tpf) thread_header=config/s390/gthr-tpf.h ;; + vxworks) thread_header=config/gthr-vxworks.h ;; + win32) thread_header=config/i386/gthr-win32.h ;; ++ mcf) thread_header=config/i386/gthr-mcf.h ;; + esac + + +diff --git a/libstdc++-v3/libsupc++/atexit_thread.cc b/libstdc++-v3/libsupc++/atexit_thread.cc +index 923a0707556..a55d85aad2d 100644 +--- a/libstdc++-v3/libsupc++/atexit_thread.cc ++++ b/libstdc++-v3/libsupc++/atexit_thread.cc +@@ -25,6 +25,22 @@ + #include <cstdlib> + #include <new> + #include "bits/gthr.h" ++ ++#ifdef __USING_MCFGTHREAD__ ++ ++#include <mcfgthread/gthread.h> ++ ++extern "C" int ++__cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), ++ void *obj, void *dso_handle) ++ _GLIBCXX_NOTHROW ++{ ++ return ::_MCFCRT_AtThreadExit((void (*)(_MCFCRT_STD intptr_t))dtor, (_MCFCRT_STD intptr_t)obj) ? 0 : -1; ++ (void)dso_handle; ++} ++ ++#else // __USING_MCFGTHREAD__ ++ + #ifdef _GLIBCXX_THREAD_ATEXIT_WIN32 + #define WIN32_LEAN_AND_MEAN + #include <windows.h> +@@ -167,3 +183,5 @@ __cxxabiv1::__cxa_thread_atexit (void (*dtor)(void *), void *obj, void */*dso_ha + } + + #endif /* _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL */ ++ ++#endif // __USING_MCFGTHREAD__ +diff --git a/libstdc++-v3/libsupc++/guard.cc b/libstdc++-v3/libsupc++/guard.cc +index 19953bc52f0..72fd5f26d5b 100644 +--- a/libstdc++-v3/libsupc++/guard.cc ++++ b/libstdc++-v3/libsupc++/guard.cc +@@ -28,6 +28,27 @@ + #include <cxxabi.h> + #include <exception> + #include <new> ++ ++#ifdef __USING_MCFGTHREAD__ ++ ++#include <mcfgthread/gthread.h> ++ ++namespace __cxxabiv1 { ++ ++extern "C" int __cxa_guard_acquire(__guard *g){ ++ return ::_MCFCRT_WaitForOnceFlagForever((::_MCFCRT_OnceFlag *)g) == ::_MCFCRT_kOnceResultInitial; ++} ++extern "C" void __cxa_guard_abort(__guard *g) throw() { ++ ::_MCFCRT_SignalOnceFlagAsAborted((::_MCFCRT_OnceFlag *)g); ++} ++extern "C" void __cxa_guard_release(__guard *g) throw() { ++ ::_MCFCRT_SignalOnceFlagAsFinished((::_MCFCRT_OnceFlag *)g); ++} ++ ++} ++ ++#else // __USING_MCFGTHREAD__ ++ + #include <ext/atomicity.h> + #include <ext/concurrence.h> + #include <bits/atomic_lockfree_defines.h> +@@ -425,3 +446,5 @@ namespace __cxxabiv1 + #endif + } + } ++ ++#endif +-- +2.12.1 + diff --git a/pkgs/development/compilers/gcc/patches/7/gcc8-asan-glibc-2.34.patch b/pkgs/development/compilers/gcc/patches/7/gcc8-asan-glibc-2.34.patch new file mode 100644 index 00000000000..5645b97c1d8 --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/7/gcc8-asan-glibc-2.34.patch @@ -0,0 +1,70 @@ +From ef195a39d0d3b929cc676302d074b42c25460601 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek <jakub@redhat.com> +Date: Sat, 17 Apr 2021 11:27:14 +0200 +Subject: [PATCH] sanitizer: Fix asan against glibc 2.34 [PR100114] + +As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in +glibc 2.34 and later, so +static const uptr kAltStackSize = SIGSTKSZ * 4; +needs dynamic initialization, but is used by a function called indirectly +from .preinit_array and therefore before the variable is constructed. +This results in using 0 size instead and all asan instrumented programs +die with: +==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22) + +Here is a cherry-pick from upstream to fix this. + +2021-04-17 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/100114 + * sanitizer_common/sanitizer_posix_libcdep.cc: Cherry-pick + llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe + and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023. + +(cherry picked from commit 950bac27d63c1c2ac3a6ed867692d6a13f21feb3) +--- + .../sanitizer_common/sanitizer_posix_libcdep.cc | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc +index 1a37118c299..066079b3954 100644 +--- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc ++++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cc +@@ -159,7 +159,11 @@ bool SupportsColoredOutput(fd_t fd) { + + #if !SANITIZER_GO + // TODO(glider): different tools may require different altstack size. +-static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. ++static uptr GetAltStackSize() { ++ // SIGSTKSZ is not enough. ++ static const uptr kAltStackSize = SIGSTKSZ * 4; ++ return kAltStackSize; ++} + + void SetAlternateSignalStack() { + stack_t altstack, oldstack; +@@ -170,10 +174,9 @@ void SetAlternateSignalStack() { + // TODO(glider): the mapped stack should have the MAP_STACK flag in the + // future. It is not required by man 2 sigaltstack now (they're using + // malloc()). +- void* base = MmapOrDie(kAltStackSize, __func__); +- altstack.ss_sp = (char*) base; ++ altstack.ss_size = GetAltStackSize(); ++ altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__); + altstack.ss_flags = 0; +- altstack.ss_size = kAltStackSize; + CHECK_EQ(0, sigaltstack(&altstack, nullptr)); + } + +@@ -181,7 +184,7 @@ void UnsetAlternateSignalStack() { + stack_t altstack, oldstack; + altstack.ss_sp = nullptr; + altstack.ss_flags = SS_DISABLE; +- altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. ++ altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. + CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); + UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); + } +-- +2.27.0 + diff --git a/pkgs/development/compilers/gcc/patches/7/riscv-no-relax.patch b/pkgs/development/compilers/gcc/patches/7/riscv-no-relax.patch new file mode 100644 index 00000000000..93d9cd1d60f --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/7/riscv-no-relax.patch @@ -0,0 +1,109 @@ +commit e7c570f37384d824cb9725f237920e9691e57269 +gpg: Signature made Tue 06 Mar 2018 04:52:46 PM PST +gpg: using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41 +gpg: issuer "palmer@dabbelt.com" +gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [ultimate] +gpg: aka "Palmer Dabbelt <palmer@sifive.com>" [ultimate] +Author: Palmer Dabbelt <palmer@sifive.com> +Date: Thu Mar 1 12:01:06 2018 -0800 + + RISC-V: Add and document the "-mno-relax" option + + RISC-V relies on aggressive linker relaxation to get good code size. As + a result no text symbol addresses can be known until link time, which + means that alignment must be handled during the link. This alignment + pass is essentially just another linker relaxation, so this has the + unfortunate side effect that linker relaxation is required for + correctness on many RISC-V targets. + + The RISC-V assembler has supported an ".option norelax" for a long time + because there are situations in which linker relaxation is a bad idea -- + the canonical example is when trying to materialize the initial value of + the global pointer into a register, which would otherwise be relaxed to + a NOP. We've been relying on users who want to disable relaxation for + an entire link to pass "-Wl,--no-relax", but that still relies on the + linker relaxing R_RISCV_ALIGN to handle alignment despite it not being + strictly necessary. + + This patch adds a GCC option, "-mno-relax", that disable linker + relaxation by adding ".option norelax" to the top of every generated + assembly file. The assembler is smart enough to handle alignment at + assemble time for files that have never emitted a relaxable relocation, + so this is sufficient to really disable all relaxations in the linker, + which results in significantly faster link times for large objects. + + This also has the side effect of allowing toolchains that don't support + linker relaxation (LLVM and the Linux module loader) to function + correctly. Toolchains that don't support linker relaxation should + default to "-mno-relax" and error when presented with any R_RISCV_ALIGN + relocation as those need to be handled for correctness. + + gcc/ChangeLog + + 2018-03-01 Palmer Dabbelt <palmer@sifive.com> + + * config/riscv/riscv.opt (mrelax): New option. + * config/riscv/riscv.c (riscv_file_start): Emit ".option + "norelax" when riscv_mrelax is disabled. + * doc/invoke.texi (RISC-V): Document "-mrelax" and "-mno-relax". + +diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c +index c38f6c394d54..3e81874de232 100644 +--- a/gcc/config/riscv/riscv.c ++++ b/gcc/config/riscv/riscv.c +@@ -3979,6 +3979,11 @@ riscv_file_start (void) + + /* Instruct GAS to generate position-[in]dependent code. */ + fprintf (asm_out_file, "\t.option %spic\n", (flag_pic ? "" : "no")); ++ ++ /* If the user specifies "-mno-relax" on the command line then disable linker ++ relaxation in the assembler. */ ++ if (! riscv_mrelax) ++ fprintf (asm_out_file, "\t.option norelax\n"); + } + + /* Implement TARGET_ASM_OUTPUT_MI_THUNK. Generate rtl rather than asm text +diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt +index 581a26bb5c1e..b37ac75d9bb4 100644 +--- a/gcc/config/riscv/riscv.opt ++++ b/gcc/config/riscv/riscv.opt +@@ -106,6 +106,11 @@ mexplicit-relocs + Target Report Mask(EXPLICIT_RELOCS) + Use %reloc() operators, rather than assembly macros, to load addresses. + ++mrelax ++Target Bool Var(riscv_mrelax) Init(1) ++Take advantage of linker relaxations to reduce the number of instructions ++required to materialize symbol addresses. ++ + Mask(64BIT) + + Mask(MUL) +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 8d366c626bae..deb48af2ecad 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -1042,7 +1042,8 @@ See RS/6000 and PowerPC Options. + -msave-restore -mno-save-restore @gol + -mstrict-align -mno-strict-align @gol + -mcmodel=medlow -mcmodel=medany @gol +--mexplicit-relocs -mno-explicit-relocs @gol} ++-mexplicit-relocs -mno-explicit-relocs @gol ++-mrelax -mno-relax @gol} + + @emph{RL78 Options} + @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol +@@ -23102,6 +23103,12 @@ Use or do not use assembler relocation operators when dealing with symbolic + addresses. The alternative is to use assembler macros instead, which may + limit optimization. + ++@item -mrelax ++@itemx -mno-relax ++Take advantage of linker relaxations to reduce the number of instructions ++required to materialize symbol addresses. The default is to take advantage of ++linker relaxations. ++ + @end table + + @node RL78 Options + diff --git a/pkgs/development/compilers/gcc/patches/7/riscv-pthread-reentrant.patch b/pkgs/development/compilers/gcc/patches/7/riscv-pthread-reentrant.patch new file mode 100644 index 00000000000..c7527ffb2b1 --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/7/riscv-pthread-reentrant.patch @@ -0,0 +1,13 @@ +Index: gcc/config/riscv/linux.h +=================================================================== +--- a/gcc/config/riscv/linux.h (revision 257620) ++++ b/gcc/config/riscv/linux.h (revision 257621) +@@ -47,6 +47,8 @@ + + #define ICACHE_FLUSH_FUNC "__riscv_flush_icache" + ++#define CPP_SPEC "%{pthread:-D_REENTRANT}" ++ + #define LINK_SPEC "\ + -melf" XLEN_SPEC "lriscv \ + %{shared} \ |