toolchain: add support for gcc 8.3.0

This commit is contained in:
Maxim Anisimov
2019-03-09 13:31:21 +00:00
parent 3d1d43b8ab
commit e0f5474c56
47 changed files with 623 additions and 753 deletions

View File

@ -1,146 +0,0 @@
commit 99368862e44740ff4fd33760893f04e14f9dbdf1
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Jul 31 00:52:27 2007 +0000
Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
SVN-Revision: 8256
This patch brings over a feature from MirBSD:
* -fhonour-copts
If this option is not given, it's warned (depending
on environment variables). This is to catch errors
of misbuilt packages which override CFLAGS themselves.
This patch was authored by Thorsten Glaser <tg at mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -107,6 +107,9 @@ static dump_flags_t original_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
+/* Check if a port honours COPTS. */
+static int honour_copts = 0;
+
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -461,6 +464,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
+ case OPT_fhonour_copts:
+ if (c_language == clk_c) {
+ honour_copts++;
+ }
+ break;
+
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1110,6 +1119,47 @@ c_common_init (void)
return false;
}
+ if (c_language == clk_c) {
+ char *ev = getenv ("GCC_HONOUR_COPTS");
+ int evv;
+ if (ev == NULL)
+ evv = -1;
+ else if ((*ev == '0') || (*ev == '\0'))
+ evv = 0;
+ else if (*ev == '1')
+ evv = 1;
+ else if (*ev == '2')
+ evv = 2;
+ else if (*ev == 's')
+ evv = -1;
+ else {
+ warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
+ evv = 1; /* maybe depend this on something like MIRBSD_NATIVE? */
+ }
+ if (evv == 1) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in lenient mode");
+ return false;
+ } else if (honour_copts != 1) {
+ warning (0, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ } else if (evv == 2) {
+ if (honour_copts == 0) {
+ error ("someone does not honour COPTS at all in strict mode");
+ return false;
+ } else if (honour_copts != 1) {
+ error ("someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ return false;
+ }
+ } else if (evv == 0) {
+ if (honour_copts != 1)
+ inform (UNKNOWN_LOCATION, "someone does not honour COPTS correctly, passed %d times",
+ honour_copts);
+ }
+ }
+
return true;
}
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1469,6 +1469,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
+fhonour-copts
+C ObjC C++ ObjC++ RejectNegative
+
fhosted
C ObjC
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1547,6 +1547,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities.
+fhonour-copts
+Common RejectNegative
+
; Nonzero means ignore `#ident' directives. 0 means handle them.
; Generate position-independent code for executables if possible
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -2056,6 +2056,9 @@ common_handle_option (struct gcc_options
opts, opts_set, loc, dc);
break;
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Wlarger_than_:
opts->x_larger_than_size = value;
opts->x_warn_larger_than = value != -1;
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7005,6 +7005,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
+@item -fhonour-copts
+@opindex fhonour-copts
+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+given at least once, and warn if it is given more than once.
+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
+given exactly once.
+If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
+is not given exactly once.
+The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
+This flag and environment variable only affect the C language.
+
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector

View File

@ -1,13 +0,0 @@
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index dd8cee9..f156398 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -41,7 +41,7 @@ long_double_type_size = @long_double_type_size@
decimal_float = @decimal_float@
enable_vtable_verify = @enable_vtable_verify@
enable_decimal_float = @enable_decimal_float@
-fixed_point = @fixed_point@
+#fixed_point = @fixed_point@
with_aix_soname = @with_aix_soname@
enable_execute_stack = @enable_execute_stack@
unwind_header = @unwind_header@

View File

@ -1,373 +0,0 @@
diff --git a/libbacktrace/getpagesize.h b/libbacktrace/getpagesize.h
new file mode 100644
index 0000000..2a713e2
--- /dev/null
+++ b/libbacktrace/getpagesize.h
@@ -0,0 +1,42 @@
+/* getpagesize.h -- Public header file for stack backtrace library.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ (1) Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ (2) Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ (3) The name of the author may not be used to
+ endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. */
+
+#ifndef GETPAGESIZE_H
+#define GETPAGESIZE_H
+
+#if defined(__linux__)
+#include <features.h>
+#if defined(__UCLIBC__)
+#undef getpagesize
+#define getpagesize() 4096
+#endif
+#endif
+
+#endif
diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c
index 32fcba6..8cc9ffe 100644
--- a/libbacktrace/mmap.c
+++ b/libbacktrace/mmap.c
@@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.h"
#include "internal.h"
+#include "getpagesize.h"
/* Memory allocation on systems that provide anonymous mmap. This
permits the backtrace functions to be invoked from a signal
diff --git a/libbacktrace/mmapio.c b/libbacktrace/mmapio.c
index 94e8c93..72ba5c7 100644
--- a/libbacktrace/mmapio.c
+++ b/libbacktrace/mmapio.c
@@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.h"
#include "internal.h"
+#include "getpagesize.h"
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
index a43243e..17eeb4a 100644
--- a/libsanitizer/asan/asan_linux.cc
+++ b/libsanitizer/asan/asan_linux.cc
@@ -21,6 +21,7 @@
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"
+#include <features.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/mman.h>
@@ -88,7 +89,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) {
UNIMPLEMENTED();
}
-#if SANITIZER_ANDROID
+#if SANITIZER_ANDROID || defined(__UCLIBC__)
// FIXME: should we do anything for Android?
void AsanCheckDynamicRTPrereqs() {}
void AsanCheckIncompatibleRT() {}
diff --git a/libsanitizer/interception/interception_linux.cc b/libsanitizer/interception/interception_linux.cc
index 888b2ce..8eb4602 100644
--- a/libsanitizer/interception/interception_linux.cc
+++ b/libsanitizer/interception/interception_linux.cc
@@ -30,11 +30,11 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
return real == wrapper;
}
-#if !defined(__ANDROID__) // android does not have dlvsym
+#if !defined(__ANDROID__) && !defined(__UCLIBC__) // android and uClibc do not have dlvsym
void *GetFuncAddrVer(const char *func_name, const char *ver) {
return dlvsym(RTLD_NEXT, func_name, ver);
}
-#endif // !defined(__ANDROID__)
+#endif // !defined(__ANDROID__) && !defined(__UCLIBC__)
} // namespace __interception
diff --git a/libsanitizer/interception/interception_linux.h b/libsanitizer/interception/interception_linux.h
index f596518..e00f1e3 100644
--- a/libsanitizer/interception/interception_linux.h
+++ b/libsanitizer/interception/interception_linux.h
@@ -19,6 +19,10 @@
#ifndef INTERCEPTION_LINUX_H
#define INTERCEPTION_LINUX_H
+#if defined(__linux__)
+#include <features.h>
+#endif
+
namespace __interception {
// returns true if a function with the given name was found.
bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
@@ -32,7 +36,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
(::__interception::uptr) & (func), \
(::__interception::uptr) & WRAP(func))
-#if !defined(__ANDROID__) // android does not have dlvsym
+#if !defined(__ANDROID__) && !defined(__UCLIBC__) // android and uClibc do not have dlvsym
#define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
(::__interception::real_##func = (func##_f)( \
unsigned long)::__interception::GetFuncAddrVer(#func, symver))
diff --git a/libsanitizer/sanitizer_common/sanitizer_common_syscalls.inc b/libsanitizer/sanitizer_common/sanitizer_common_syscalls.inc
index 6fd5ef7..7fb17a6 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_syscalls.inc
@@ -921,7 +921,7 @@ POST_SYSCALL(newfstat)(long res, long fd, void *statbuf) {
}
}
-#if !SANITIZER_ANDROID
+#if !SANITIZER_ANDROID && !defined(__UCLIBC__)
PRE_SYSCALL(ustat)(long dev, void *ubuf) {}
POST_SYSCALL(ustat)(long res, long dev, void *ubuf) {
@@ -929,7 +929,7 @@ POST_SYSCALL(ustat)(long res, long dev, void *ubuf) {
if (ubuf) POST_WRITE(ubuf, struct_ustat_sz);
}
}
-#endif // !SANITIZER_ANDROID
+#endif // !SANITIZER_ANDROID && !__UCLIBC__
PRE_SYSCALL(stat64)(const void *filename, void *statbuf) {
if (filename)
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 2826cc8..9c1d2e0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -50,6 +50,7 @@
#include <fcntl.h>
#include <link.h>
#include <pthread.h>
+#include <features.h>
#include <sched.h>
#include <sys/mman.h>
#include <sys/ptrace.h>
@@ -1000,7 +1001,7 @@ uptr GetMaxVirtualAddress() {
uptr GetPageSize() {
// Android post-M sysconf(_SC_PAGESIZE) crashes if called from .preinit_array.
-#if SANITIZER_ANDROID
+#if SANITIZER_ANDROID || defined(__UCLIBC__)
return 4096;
#elif SANITIZER_LINUX && (defined(__x86_64__) || defined(__i386__))
return EXEC_PAGESIZE;
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index a915d37..a6ad8db 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -12,6 +12,10 @@
#include "sanitizer_platform.h"
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
#if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
// Tests in this file assume that off_t-dependent data structures match the
// libc ABI. For example, struct dirent here is what readdir() function (as
@@ -141,7 +145,9 @@ typedef struct user_fpregs elf_fpregset_t;
#include <net/if_ppp.h>
#include <netax25/ax25.h>
#include <netipx/ipx.h>
+#if !defined(__UCLIBC__)
#include <netrom/netrom.h>
+#endif
#if HAVE_RPC_XDR_H
# include <rpc/xdr.h>
#elif HAVE_TIRPC_RPC_XDR_H
@@ -157,6 +163,9 @@ typedef struct user_fpregs elf_fpregset_t;
# include <sys/procfs.h>
#endif
#include <sys/user.h>
+#if defined(__GLIBC__) && !__GLIBC_PREREQ(2, 28)
+ #include <sys/ustat.h>
+#endif
#include <linux/cyclades.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
@@ -476,7 +485,9 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned struct_kbkeycode_sz = sizeof(struct kbkeycode);
unsigned struct_kbsentry_sz = sizeof(struct kbsentry);
unsigned struct_mtconfiginfo_sz = sizeof(struct mtconfiginfo);
+#if !defined(__UCLIBC__)
unsigned struct_nr_parms_struct_sz = sizeof(struct nr_parms_struct);
+#endif
unsigned struct_scc_modem_sz = sizeof(struct scc_modem);
unsigned struct_scc_stat_sz = sizeof(struct scc_stat);
unsigned struct_serial_multiport_struct_sz
@@ -911,10 +922,12 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
unsigned IOCTL_SIOCAX25SETPARMS = SIOCAX25SETPARMS;
unsigned IOCTL_SIOCDEVPLIP = SIOCDEVPLIP;
unsigned IOCTL_SIOCIPXCFGDATA = SIOCIPXCFGDATA;
+#if !defined(__UCLIBC__)
unsigned IOCTL_SIOCNRDECOBS = SIOCNRDECOBS;
unsigned IOCTL_SIOCNRGETPARMS = SIOCNRGETPARMS;
unsigned IOCTL_SIOCNRRTCTL = SIOCNRRTCTL;
unsigned IOCTL_SIOCNRSETPARMS = SIOCNRSETPARMS;
+#endif
unsigned IOCTL_TIOCGSERIAL = TIOCGSERIAL;
unsigned IOCTL_TIOCSERGETMULTI = TIOCSERGETMULTI;
unsigned IOCTL_TIOCSERSETMULTI = TIOCSERSETMULTI;
@@ -1068,9 +1081,6 @@ COMPILER_CHECK(sizeof(__sanitizer_sigaction) == sizeof(struct sigaction));
// Can't write checks for sa_handler and sa_sigaction due to them being
// preprocessor macros.
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
-#endif
#if !defined(__s390x__) || __GLIBC_PREREQ (2, 20)
// On s390x glibc 2.19 and earlier sa_flags was unsigned long, and sa_resv
// didn't exist.
@@ -1245,7 +1255,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
#endif
-#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !defined(__UCLIBC__)
COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
CHECK_SIZE_AND_OFFSET(FILE, _flags);
CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 4d11d07..5b7a304 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -18,6 +18,10 @@
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform.h"
+#ifdef __linux__
+#include <features.h>
+#endif
+
#if SANITIZER_FREEBSD
// FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that
// incorporates the map structure.
@@ -84,9 +88,17 @@ namespace __sanitizer {
const unsigned struct_kernel_stat_sz = 144;
const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__mips__)
+#if defined(__UCLIBC__)
+#if defined(__USE_FILE_OFFSET64)
+ const unsigned struct_kernel_stat_sz = 160;
+#else
+ const unsigned struct_kernel_stat_sz = 152;
+#endif
+#else
const unsigned struct_kernel_stat_sz =
SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) :
FIRST_32_SECOND_64(160, 216);
+#endif
const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390__) && !defined(__s390x__)
const unsigned struct_kernel_stat_sz = 64;
@@ -194,7 +206,9 @@ namespace __sanitizer {
int v[10];
};
+#if !defined(__UCLIBC__)
extern unsigned struct_ustat_sz;
+#endif
extern unsigned struct_rlimit64_sz;
extern unsigned struct_statvfs64_sz;
@@ -581,10 +595,23 @@ namespace __sanitizer {
#elif SANITIZER_MAC
typedef unsigned __sanitizer_sigset_t;
#elif SANITIZER_LINUX
+
+#if defined(__UCLIBC__)
+#if defined(__mips__)
+#define _SIGSET_NWORDS (128/(8*sizeof(unsigned long)))
+#else
+#define _SIGSET_NWORDS (64/(8*sizeof(unsigned long)))
+#endif
+ struct __sanitizer_sigset_t {
+ unsigned long __val[_SIGSET_NWORDS];
+ };
+#else
struct __sanitizer_sigset_t {
// The size is determined by looking at sizeof of real sigset_t on linux.
uptr val[128 / sizeof(uptr)];
};
+#endif
+
#elif SANITIZER_FREEBSD
struct __sanitizer_sigset_t {
// uint32_t * 4
@@ -622,7 +649,17 @@ namespace __sanitizer {
uptr sa_flags;
void (*sa_restorer)();
};
-#else // !SANITIZER_ANDROID
+#elif defined(__mips__) && defined(__UCLIBC__)
+ struct __sanitizer_sigaction {
+ unsigned sa_flags;
+ union {
+ void (*handler)(int sig);
+ void (*sigaction)(int sig, void *siginfo, void *uctx);
+ };
+ __sanitizer_sigset_t sa_mask;
+ void (*sa_restorer)();
+ };
+#else // !SANITIZER_ANDROID && !(__mips__ && __UCLIBC__)
struct __sanitizer_sigaction {
#if defined(__mips__) && !SANITIZER_FREEBSD
unsigned int sa_flags;
@@ -813,7 +850,7 @@ namespace __sanitizer {
#endif
};
-#if SANITIZER_LINUX && !SANITIZER_ANDROID
+#if SANITIZER_LINUX && !SANITIZER_ANDROID && !defined(__UCLIBC__)
struct __sanitizer_FILE {
int _flags;
char *_IO_read_ptr;
@@ -1025,7 +1062,9 @@ struct __sanitizer_cookie_io_functions_t {
extern unsigned struct_kbkeycode_sz;
extern unsigned struct_kbsentry_sz;
extern unsigned struct_mtconfiginfo_sz;
+#if !defined(__UCLIBC__)
extern unsigned struct_nr_parms_struct_sz;
+#endif
extern unsigned struct_scc_modem_sz;
extern unsigned struct_scc_stat_sz;
extern unsigned struct_serial_multiport_struct_sz;
@@ -1436,10 +1475,12 @@ struct __sanitizer_cookie_io_functions_t {
extern unsigned IOCTL_SIOCAX25SETPARMS;
extern unsigned IOCTL_SIOCDEVPLIP;
extern unsigned IOCTL_SIOCIPXCFGDATA;
+#if !defined(__UCLIBC__)
extern unsigned IOCTL_SIOCNRDECOBS;
extern unsigned IOCTL_SIOCNRGETPARMS;
extern unsigned IOCTL_SIOCNRRTCTL;
extern unsigned IOCTL_SIOCNRSETPARMS;
+#endif
extern unsigned IOCTL_SNDCTL_DSP_GETISPACE;
extern unsigned IOCTL_SNDCTL_DSP_GETOSPACE;
extern unsigned IOCTL_TIOCGSERIAL;

View File

@ -1,88 +0,0 @@
diff --git a/gcc/config/mips/linux-common.h b/gcc/config/mips/linux-common.h
index c2f7630a8..432be8074 100644
--- a/gcc/config/mips/linux-common.h
+++ b/gcc/config/mips/linux-common.h
@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3. If not see
ANDROID_TARGET_OS_CPP_BUILTINS(); \
} while (0)
+#undef ASAN_CC1_SPEC
+#define ASAN_CC1_SPEC "%{fsanitize=*:-funwind-tables}"
+
#undef LINK_SPEC
#define LINK_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_LINK_SPEC, \
@@ -34,12 +37,12 @@ along with GCC; see the file COPYING3. If not see
#undef SUBTARGET_CC1_SPEC
#define SUBTARGET_CC1_SPEC \
- LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
- GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC("-fpic"))
+ LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \
+ GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " ANDROID_CC1_SPEC("-fpic"))
#undef CC1PLUS_SPEC
#define CC1PLUS_SPEC \
- LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC)
+ LINUX_OR_ANDROID_CC (ASAN_CC1_SPEC "", ASAN_CC1_SPEC " " ANDROID_CC1PLUS_SPEC)
#undef LIB_SPEC
#define LIB_SPEC \
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 2dfd0c18b..a0fd5fedf 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -50,3 +50,10 @@ along with GCC; see the file COPYING3. If not see
#define GNU_USER_DYNAMIC_LINKERN32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+
+#undef ASAN_CC1_SPEC
+#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
+
+#undef CC1_SPEC
+#define CC1_SPEC GNU_USER_TARGET_CC1_SPEC ASAN_CC1_SPEC
+
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index aabd4b158..ed820d04e 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -494,6 +494,7 @@ static int mips_base_move_loop_invariants; /* flag_move_loop_invariants */
static int mips_base_align_loops; /* align_loops */
static int mips_base_align_jumps; /* align_jumps */
static int mips_base_align_functions; /* align_functions */
+static unsigned HOST_WIDE_INT mips_asan_shadow_offset (void);
/* Index [M][R] is true if register R is allowed to hold a value of mode M. */
static bool mips_hard_regno_mode_ok_p[MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
@@ -22621,6 +22622,17 @@ mips_starting_frame_offset (void)
#undef TARGET_STARTING_FRAME_OFFSET
#define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET mips_asan_shadow_offset
+
struct gcc_target targetm = TARGET_INITIALIZER;
+/* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */
+
+static unsigned HOST_WIDE_INT
+mips_asan_shadow_offset (void)
+{
+ return 0x0aaa0000L;
+}
+
#include "gt-mips.h"
diff --git a/libsanitizer/configure.tgt b/libsanitizer/configure.tgt
index 573e3b482..dd8fd9848 100644
--- a/libsanitizer/configure.tgt
+++ b/libsanitizer/configure.tgt
@@ -43,6 +43,8 @@ case "${target}" in
;;
s390*-*-linux*)
;;
+ mips*-*-linux*)
+ ;;
arm*-*-linux*)
;;
aarch64*-*-linux*)

View File

@ -1,15 +0,0 @@
diff --git a/libsanitizer/asan/asan_rtl.cc b/libsanitizer/asan/asan_rtl.cc
index 3905658a4..cc2a88fa3 100644
--- a/libsanitizer/asan/asan_rtl.cc
+++ b/libsanitizer/asan/asan_rtl.cc
@@ -69,8 +69,8 @@ static void AsanCheckFailed(const char *file, int line, const char *cond,
}
// -------------------------- Globals --------------------- {{{1
-int asan_inited;
-bool asan_init_is_running;
+int asan_inited = 0;
+bool asan_init_is_running = 0;
#if !ASAN_FIXED_MAPPING
uptr kHighMemEnd, kMidMemBeg, kMidMemEnd;

View File

@ -1,14 +0,0 @@
diff --git a/libgcc/unwind-dw2-fde.h b/libgcc/unwind-dw2-fde.h
index 88e802811..558315ed1 100644
--- a/libgcc/unwind-dw2-fde.h
+++ b/libgcc/unwind-dw2-fde.h
@@ -168,6 +168,9 @@ extern const fde * _Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
static inline int
last_fde (struct object *obj __attribute__ ((__unused__)), const fde *f)
{
+ if (f->length >= 0xfffffff0) /* special DWARF extension */
+ return 1;
+
#ifdef DWARF2_OBJECT_END_PTR_EXTENSION
return f == (const fde *) obj->fde_end || f->length == 0;
#else

View File

@ -1,27 +0,0 @@
commit 254e8a1efb2826ddcd18528dc01a76cf61b05ace
Author: hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu Apr 26 01:09:27 2018 +0000
This appears to be present in compiler-rt upstream, but as part
of more intrusive changes. For gcc, the lack of this results in
a fatal warning (-Werror) at build-time.
* sanitizer_common/sanitizer_atomic_clang_other.h [_MIPS_SIM
&& _MIPS_SIM == _ABIO32] (lock): Add initializer for .pad member.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259663 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
index a0605bbbd82..59e9f645f68 100644
--- a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
+++ b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h
@@ -35,7 +35,7 @@ static void __spin_unlock(volatile int *lock) { __sync_lock_release(lock); }
static struct {
int lock;
char pad[32 - sizeof(int)];
-} __attribute__((aligned(32))) lock = {0};
+} __attribute__((aligned(32))) lock = {0, {0}};
template <class T>
T __mips_sync_fetch_and_add(volatile T *ptr, T val) {

View File

@ -1,33 +0,0 @@
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform.h b/libsanitizer/sanitizer_common/sanitizer_platform.h
index 1eb4d0c61..82875872c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform.h
@@ -112,6 +112,15 @@
#if defined(__mips__)
# define SANITIZER_MIPS 1
+# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
+# define ONE_OF_MIPS_32_N32_64(a, b, c) (a)
+# elif defined(_MIPS_SIM) && _MIPS_SIM == _ABIN32
+# define ONE_OF_MIPS_32_N32_64(a, b, c) (b)
+# elif defined(_MIPS_SIM) && _MIPS_SIM == _ABI64
+# define ONE_OF_MIPS_32_N32_64(a, b, c) (c)
+# else
+# define ONE_OF_MIPS_32_N32_64(a, b, c) sanitizer_platform_unknown_sim
+# endif
# if defined(__mips64)
# define SANITIZER_MIPS32 0
# define SANITIZER_MIPS64 1
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 5b7a304e9..152f5a4cd 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -97,7 +97,7 @@ namespace __sanitizer {
#else
const unsigned struct_kernel_stat_sz =
SANITIZER_ANDROID ? FIRST_32_SECOND_64(104, 128) :
- FIRST_32_SECOND_64(160, 216);
+ ONE_OF_MIPS_32_N32_64(144, 160, 216);
#endif
const unsigned struct_kernel_stat64_sz = 104;
#elif defined(__s390__) && !defined(__s390x__)

View File

@ -1,8 +0,0 @@
md5 gcc-8.2.0.tar.xz 4ab282f414676496483b3e1793d07862
sha1 gcc-8.2.0.tar.xz 19926bdb6c4b58891015929853d41aeff019d400
sha256 gcc-8.2.0.tar.xz 196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080
sha512 gcc-8.2.0.tar.xz 64898a165f67e136d802a92e7633bf1b06c85266027e52127ea025bf5fc2291b5e858288aac0bdba246e6cdf7c6ec88bc8e0e7f3f6f1985f4297710cafde56ed
md5 gcc-8.2.0.tar.gz ee04f0c22a941f5f17d93809387f2729
sha1 gcc-8.2.0.tar.gz 3895bb765c2ceecccd6dee86467f6d1bb1994cbd
sha256 gcc-8.2.0.tar.gz 1b0f36be1045ff58cbb9c83743835367b860810f17f0195a4e093458b372020f
sha512 gcc-8.2.0.tar.gz 3182cd248a37ce4c36ad2a43f1910da13325452472ea80855afc21f134c4e4792c29887f5e070fe21c3ff8e5953e59f69343e1d3b968ee1eb2d8b5c8ae9f48fa

View File

@ -4,10 +4,10 @@
--- a/libgfortran/io/close.c
+++ b/libgfortran/io/close.c
@@ -25,6 +25,7 @@
#include "io.h"
#include "unix.h"
#include <limits.h>
@@ -28,6 +28,7 @@
#if !HAVE_UNLINK_OPEN_FILE
#include <string.h>
#endif
+#include <stdlib.h>
typedef enum

View File

@ -30,6 +30,10 @@ Date: Wed Jul 29 11:28:29 2015 +0300
libstdc++-v3/include/bits/locale_facets.h | 18 +++++++-
libstdc++-v3/libsupc++/guard.cc | 5 ++
21 files changed, 235 insertions(+), 20 deletions(-)
create mode 100644 gcc/config/aarch64/aarch64-linux-android.h
create mode 100644 gcc/config/mips/android.h
create mode 100644 gcc/config/mips/t-linux-android
create mode 100644 gcc/config/mips/t-linux-android64
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@ -53,7 +57,7 @@ Date: Wed Jul 29 11:28:29 2015 +0300
esac
aarch64_multilibs="${with_multilib_list}"
if test "$aarch64_multilibs" = "default"; then
@@ -2130,6 +2134,17 @@
@@ -2133,6 +2137,17 @@
tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h ${tm_file} mips/gnu-user.h mips/linux.h mips/linux-common.h"
extra_options="${extra_options} linux-android.opt"
case ${target} in
@ -254,8 +258,8 @@ Date: Wed Jul 29 11:28:29 2015 +0300
+
#undef ASM_SPEC
#define ASM_SPEC \
- "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}"
+ "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}} " \
- "--32 %{msse2avx:%{!mavx:-msse2avx}}"
+ "--32 %{msse2avx:%{!mavx:-msse2avx}} " \
+ LINUX_OR_ANDROID_CC ("", ANDROID_ASM_SPEC)
#undef SUBTARGET_EXTRA_SPECS
@ -488,16 +492,16 @@ Date: Wed Jul 29 11:28:29 2015 +0300
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1102,7 +1116,7 @@
@@ -1104,7 +1118,7 @@
* @return @a __hi.
*/
virtual const char*
- do_widen(const char* __lo, const char* __hi, char_type* __to) const
+ do_widen(const char* __lo, const char* __hi, char_type* __to) const __CRYSTAX_X86_DONT_OPTIMIZE
{
__builtin_memcpy(__to, __lo, __hi - __lo);
return __hi;
@@ -1163,7 +1177,7 @@
if (__builtin_expect(__hi != __lo, true))
__builtin_memcpy(__to, __lo, __hi - __lo);
@@ -1167,7 +1181,7 @@
private:
void _M_narrow_init() const;

View File

@ -12,7 +12,7 @@ Date: Thu Aug 20 19:11:07 2015 +0300
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -15916,6 +15916,7 @@
@@ -15971,6 +15971,7 @@
else if (!SYMBOL_REF_FAR_ADDR_P (op0)
&& (SYMBOL_REF_LOCAL_P (op0)
|| (HAVE_LD_PIE_COPYRELOC

View File

@ -15,7 +15,7 @@ Date: Mon Apr 14 21:05:51 2014 -0700
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -22608,9 +22608,13 @@
@@ -22619,9 +22619,13 @@
memsize = MEM_SIZE (x);
/* Only certain alignment specifiers are supported by the hardware. */

View File

@ -0,0 +1,24 @@
commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Oct 19 21:45:51 2014 +0000
gcc: do not assume that the Mac OS X filesystem is case insensitive
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42973
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -43,11 +43,6 @@ extern "C" {
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
-# if defined(__APPLE__)
-# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
-# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
-# endif
-# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)

View File

@ -13,15 +13,13 @@ Subject: [PATCH] 2018-05-17 Jerome Lambourg <lambourg@adacore.com>
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@260330 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/config/arm/arm_cmse.h | 5 ++---
libgcc/config/arm/cmse.c | 5 +++--
4 files changed, 15 insertions(+), 5 deletions(-)
gcc/config/arm/arm_cmse.h | 5 ++---
libgcc/config/arm/cmse.c | 5 +++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/config/arm/arm_cmse.h b/gcc/config/arm/arm_cmse.h
index 367e212dc9c..f972e23659d 100644
--- a/gcc/config/arm/arm_cmse.h
+++ b/gcc/config/arm/arm_cmse.h
@@ -35,7 +35,6 @@ extern "C" {
@@ -35,7 +35,6 @@
#if __ARM_FEATURE_CMSE & 1
#include <stddef.h>
@ -29,7 +27,7 @@ index 367e212dc9c..f972e23659d 100644
#ifdef __ARM_BIG_ENDIAN
@@ -174,9 +173,9 @@ cmse_nonsecure_caller (void)
@@ -174,9 +173,9 @@
#define CMSE_MPU_NONSECURE 16
#define CMSE_NONSECURE 18
@ -41,11 +39,9 @@ index 367e212dc9c..f972e23659d 100644
#endif /* __ARM_FEATURE_CMSE & 2 */
diff --git a/libgcc/config/arm/cmse.c b/libgcc/config/arm/cmse.c
index 3ded385693a..2ad0af2ecd8 100644
--- a/libgcc/config/arm/cmse.c
+++ b/libgcc/config/arm/cmse.c
@@ -36,7 +36,7 @@ cmse_check_address_range (void *p, size_t size, int flags)
@@ -36,7 +36,7 @@
char *pb = (char *) p, *pe;
/* Check if the range wraps around. */
@ -54,7 +50,7 @@ index 3ded385693a..2ad0af2ecd8 100644
return NULL;
/* Check if an unknown flag is present. */
@@ -51,7 +51,8 @@ cmse_check_address_range (void *p, size_t size, int flags)
@@ -51,7 +51,8 @@
/* Execute the right variant of the TT instructions. */
pe = pb + size - 1;
@ -64,6 +60,3 @@ index 3ded385693a..2ad0af2ecd8 100644
switch (flags & known_secure_level)
{
case 0:
--
2.14.4

View File

@ -12,15 +12,13 @@ gcc/ChangeLog
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261204 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/config/arm/arm_cmse.h | 4 ++--
4 files changed, 16 insertions(+), 2 deletions(-)
gcc/config/arm/arm_cmse.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/cmse-1c99.c
diff --git a/gcc/config/arm/arm_cmse.h b/gcc/config/arm/arm_cmse.h
index f972e23659d..9b35537cd33 100644
--- a/gcc/config/arm/arm_cmse.h
+++ b/gcc/config/arm/arm_cmse.h
@@ -173,7 +173,7 @@ cmse_nonsecure_caller (void)
@@ -173,7 +173,7 @@
#define CMSE_MPU_NONSECURE 16
#define CMSE_NONSECURE 18
@ -29,7 +27,7 @@ index f972e23659d..9b35537cd33 100644
#define cmse_is_nsfptr(p) (!((__INTPTR_TYPE__) (p) & 1))
@@ -187,7 +187,7 @@ __extension__ void *
@@ -187,7 +187,7 @@
cmse_check_address_range (void *, size_t, int);
#define cmse_check_pointed_object(p, f) \

View File

@ -0,0 +1,35 @@
commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
Author: Luka Perkov <luka@openwrt.org>
Date: Tue Feb 26 16:16:33 2013 +0000
gcc: don't build documentation
This closes #13039.
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 35807
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3203,18 +3203,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)
-doc/%.info: %.texi
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/%.info:
# Duplicate entry to handle renaming of gccinstall.info
-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
- if [ x$(BUILD_INFO) = xinfo ]; then \
- $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
- -I $(gcc_docdir)/include -o $@ $<; \
- fi
+doc/gccinstall.info:
doc/cpp.dvi: $(TEXI_CPP_FILES)
doc/gcc.dvi: $(TEXI_GCC_FILES)

View File

@ -0,0 +1,20 @@
Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
MIPS16 functions have a static assembler prologue which clobbers
registers v0 and v1. Add these register clobbers to function call
instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3102,6 +3102,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}
+ if (TARGET_MIPS16 && TARGET_USE_GOT)
+ {
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+ }
+
if (TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
&& TARGET_CALL_CLOBBERED_GP)

View File

@ -0,0 +1,13 @@
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -868,7 +868,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC
-#ifdef TARGET_LIBC_PROVIDES_SSP
+#if DEFAULT_LIBC == LIBC_MUSL
+#define LINK_SSP_SPEC "-lssp_nonshared"
+#elif defined(TARGET_LIBC_PROVIDES_SSP)
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit:}"
#else

View File

@ -0,0 +1,21 @@
commit ecf7671b769fe96f7b5134be442089f8bdba55d2
Author: Felix Fietkau <nbd@nbd.name>
Date: Thu Aug 4 20:29:45 2016 +0200
gcc: add a patch to generate better code with Os on mips
Also happens to reduce compressed code size a bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -19834,7 +19834,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */
- if (optimize_size)
+ if (0 && optimize_size)
mips_cost = &mips_rtx_cost_optimize_size;
else
mips_cost = &mips_rtx_cost_data[mips_tune];

View File

@ -1,6 +1,13 @@
diff -ruNp gcc-8.2.0.orig/libgcc/Makefile.in gcc-8.2.0/libgcc/Makefile.in
--- gcc-8.2.0.orig/libgcc/Makefile.in 2018-09-19 22:39:53.258167718 +0300
+++ gcc-8.2.0/libgcc/Makefile.in 2018-09-21 13:00:03.220460630 +0300
commit c96312958c0621e72c9b32da5bc224ffe2161384
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Oct 19 23:26:09 2009 +0000
gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
SVN-Revision: 18086
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -923,11 +923,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.

View File

@ -0,0 +1,54 @@
commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Feb 12 20:25:47 2012 +0000
gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -126,10 +126,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.S, so ensure an error if this definition
is used. */
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -53,6 +53,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_assert ("system=posix"); \
} while (0)
+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic or musl is the default C library and whether
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -136,5 +136,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -60,6 +60,9 @@
#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux)"
+#undef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef LINK_SHLIB_SPEC
#define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
%{static-pie:-static -pie --no-dynamic-linker -z text}"

View File

@ -0,0 +1,22 @@
commit 64661de100da1ec1061ef3e5e400285dce115e6b
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun May 10 13:16:35 2015 +0000
gcc: add some size optimization patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45664
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@
HOST_LIBGCC2_CFLAGS += -DUSE_GAS_SYMVER
-LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c \
- $(srcdir)/unwind-compat.c $(srcdir)/unwind-dw2-fde-compat.c
+LIB2ADDEH = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
LIB2ADDEHSTATIC = $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
# Override the default value from t-slibgcc-elf-ver and mention -lunwind

View File

@ -0,0 +1,11 @@
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#endif
/* We do not want to add the weak attribute to the declarations of these

View File

@ -0,0 +1,9 @@
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
# Version these symbols if building libgcc.so.
SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
+
+CRTSTUFF_T_CFLAGS += -mno-mips16
+CRTSTUFF_T_CFLAGS_S += -mno-mips16

View File

@ -0,0 +1,22 @@
Author: Jo-Philipp Wich <jow@openwrt.org>
Date: Sat Apr 21 03:02:39 2012 +0000
gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
SVN-Revision: 31390
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -9347,8 +9347,10 @@ getenv_spec_function (int argc, const ch
value = varname;
if (!value)
- fatal_error (input_location,
- "environment variable %qs not defined", varname);
+ {
+ warning (input_location, "environment variable %qs not defined", varname);
+ value = "";
+ }
/* We have to escape every character of the environment variable so
they are not interpreted as active spec characters. A

View File

@ -0,0 +1,111 @@
From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001
From: Andrew McDonnell <bugs@andrewmcdonnell.net>
Date: Fri, 3 Oct 2014 19:09:00 +0930
Subject: Add .note.GNU-stack section
See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html
Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html
Re: [Patch, MIPS] Add .note.GNU-stack section
From: Steve Ellcey <sellcey at mips dot com>
On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote:
>
>
> On Wed, Sep 10, 2014 at 9:27 AM, <pinskia@gmail.com> wrote:
> This works except you did not update the assembly files in
> libgcc or glibc. We (Cavium) have the same patch in our tree
> for a few released versions.
> Mind just checking yours in then Andrew?
> Thanks!
> -eric
I talked to Andrew about what files he changed in GCC and created and
tested this new patch. Andrew also mentioned changing some assembly
files in glibc but I don't see any use of '.section .note.GNU-stack' in
any assembly files in glibc (for any platform) so I wasn't planning on
creating a glibc to add them to mips glibc assembly language files.
OK to check in this patch?
Steve Ellcey
sellcey@mips.com
2014-09-26 Steve Ellcey <sellcey@mips.com>
---
gcc/config/mips/mips.c | 3 +++
libgcc/config/mips/crti.S | 4 ++++
libgcc/config/mips/crtn.S | 3 +++
libgcc/config/mips/mips16.S | 4 ++++
libgcc/config/mips/vr4120-div.S | 4 ++++
5 files changed, 18 insertions(+)
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -22627,6 +22627,9 @@ mips_starting_frame_offset (void)
#undef TARGET_STARTING_FRAME_OFFSET
#define TARGET_STARTING_FRAME_OFFSET mips_starting_frame_offset
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-mips.h"
--- a/libgcc/config/mips/crti.S
+++ b/libgcc/config/mips/crti.S
@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Except
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 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. */
--- a/libgcc/config/mips/crtn.S
+++ b/libgcc/config/mips/crtn.S
@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Except
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+
/* 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. */
--- a/libgcc/config/mips/mips16.S
+++ b/libgcc/config/mips/mips16.S
@@ -48,6 +48,10 @@ see the files COPYING3 and COPYING.RUNTI
values using the soft-float calling convention, but do the actual
operation using the hard floating point instructions. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
#if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64)
/* This file contains 32-bit assembly code. */
--- a/libgcc/config/mips/vr4120-div.S
+++ b/libgcc/config/mips/vr4120-div.S
@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
-mfix-vr4120. div and ddiv do not give the correct result when one
of the operands is negative. */
+/* An executable stack is *not* required for these functions. */
+ .section .note.GNU-stack,"",%progbits
+ .previous
+
.set nomips16
#define DIV \

View File

@ -0,0 +1,168 @@
From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
From: BangLang Huang <banglang.huang@foxmail.com>
Date: Wed, 9 Nov 2016 10:36:49 +0800
Subject: [PATCH] libffi: fix MIPS softfloat build issue
Backported from github.com/libffi/libffi#272
Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
libffi/src/mips/n32.S | 17 +++++++++++++++++
libffi/src/mips/o32.S | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)

View File

@ -0,0 +1,67 @@
From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 4 May 2018 18:20:53 +0800
Subject: [PATCH] gotools: fix compilation when making cross compiler
libgo is "the runtime support library for the Go programming language.
This library is intended for use with the Go frontend."
gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
the linker will complain that it cannot find it. That's because shared libgcc
is not present in the install directory yet. libgo.so was made without problem
because gcc will emit -lgcc_s when compiled with -shared option. When gotools
were being made, it was supplied with -static-libgcc thus no link option was
provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
for linking with libgo.so
- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
available after gcc pass2 completed and will meet the gotools link requirement
at gcc pass3
---
gotools/Makefile.am | 4 +++-
gotools/Makefile.in | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@@ -41,7 +42,8 @@ GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -263,6 +263,7 @@ mkinstalldirs = $(SHELL) $(toplevel_srcd
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_FALSE@GOCOMPILER = $(GOC)
@@ -271,7 +272,8 @@ LIBGOTOOL = $(libgodir)/libgotool.a
@NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
AM_GOCFLAGS = -I $(libgodir)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
libgosrcdir = $(srcdir)/../libgo/go
cmdsrcdir = $(libgosrcdir)/cmd

8
toolchain/packages/gcc/8.3.0/chksum vendored Normal file
View File

@ -0,0 +1,8 @@
md5 gcc-8.3.0.tar.xz 65b210b4bfe7e060051f799e0f994896
sha1 gcc-8.3.0.tar.xz c27f4499dd263fe4fb01bcc5565917f3698583b2
sha256 gcc-8.3.0.tar.xz 64baadfe6cc0f4947a84cb12d7f0dfaf45bb58b7e92461639596c21e02d97d2c
sha512 gcc-8.3.0.tar.xz 1811337ae3add9680cec64968a2509d085b6dc5b6783fc1e8c295e3e47416196fd1a3ad8dfe7e10be2276b4f62c357659ce2902f239f60a8648548231b4b5802
md5 gcc-8.3.0.tar.gz 9972f8c24c02ebcb5a342c1b30de69ff
sha1 gcc-8.3.0.tar.gz f9e58b8aedd77eacc39d45a97ef7692cd59372bf
sha256 gcc-8.3.0.tar.gz ea71adc1c3d86330874b8df19611424b143308f0d6612d542472600532c96d2d
sha512 gcc-8.3.0.tar.gz c0e6c3b6de8e40f1f078583bec0d9c0237fbcfd5c73cebe3c188aee1fd702cabc5f2bd2a3b05b4dfd8336cc214d6158c8ad885fe412fc193a7cca4e519ba7ab3