gcc-for-nvcc: update to gcc 10.3.0

imported from OE-Core hardknott, and rename the
recipes to be 'gcc-for-nvcc' instead of including
a repeat of the major version number.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2023-07-22 06:35:45 -07:00
parent 512eab93cf
commit 56e0e9ba94
92 changed files with 9890 additions and 2636 deletions

View File

@@ -1,8 +1,8 @@
# CUDA requires gcc/g++ 8, so add that compiler and its runtime as # CUDA requires gcc/g++ 10, so add that compiler and its runtime as
# dependencies, and set CC_FOR_CUDA and CXX_FOR_CUDA to point to that compiler. # dependencies, and set CC_FOR_CUDA and CXX_FOR_CUDA to point to that compiler.
DEPENDS:append:cuda = " virtual/${TARGET_PREFIX}cuda-gcc gcc-8-runtime" DEPENDS:append:cuda = " virtual/${TARGET_PREFIX}cuda-gcc gcc-for-nvcc-runtime"
CUDA_HOST_TOOLCHAIN_SUFFIX ??= "" CUDA_HOST_TOOLCHAIN_SUFFIX ??= ""
CUDA_HOST_TOOLCHAIN_SUFFIX:cuda = "-8.5.0" CUDA_HOST_TOOLCHAIN_SUFFIX:cuda = "-10.3.0"
CC_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}gcc${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" CC_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}gcc${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
CXX_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}g++${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" CXX_FOR_CUDA ?= "${CCACHE}${HOST_PREFIX}g++${CUDA_HOST_TOOLCHAIN_SUFFIX} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
PACKAGE_ARCH:cuda = "${TEGRA_PKGARCH}" PACKAGE_ARCH:cuda = "${TEGRA_PKGARCH}"

View File

@@ -52,7 +52,7 @@ SIGGEN_EXCLUDE_SAFE_RECIPE_DEPS += "\
libdrm->libdrm-nvdc \ libdrm->libdrm-nvdc \
libdrm-nvdc->tegra-libraries \ libdrm-nvdc->tegra-libraries \
tegra-nvs-service->tegra-nvs-base \ tegra-nvs-service->tegra-nvs-base \
gcc-8-cross-${TARGET_ARCH}->linux-libc-headers \ gcc-for-nvcc-cross-${TARGET_ARCH}->linux-libc-headers \
" "
addpylib ${LAYERDIR}/lib oe4t addpylib ${LAYERDIR}/lib oe4t

View File

@@ -1,2 +1,2 @@
RDEPENDS:${PN}:append:tegra = " libgcc-8-dev gcc-8-runtime-dev" RDEPENDS:${PN}:append:tegra = " libgcc-for-nvcc-dev gcc-for-nvcc-runtime-dev"
PACKAGE_ARCH:tegra = "${TEGRA_PKGARCH}" PACKAGE_ARCH:tegra = "${TEGRA_PKGARCH}"

View File

@@ -1 +1 @@
RDEPENDS:${PN}:append:tegra = " gcc-8-cross-canadian-${TRANSLATED_TARGET_ARCH}" RDEPENDS:${PN}:append:tegra = " gcc-for-nvcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"

View File

@@ -42,8 +42,8 @@ S = "${WORKDIR}/${BP}"
B = "${S}" B = "${S}"
CUDA_PATH = "/usr/local/cuda-${CUDA_VERSION}" CUDA_PATH = "/usr/local/cuda-${CUDA_VERSION}"
CC_FIRST = "${@cuda_extract_compiler('CC_FOR_CUDA', d)[0]}" CC_FIRST = "${@cuda_extract_compiler('CXX_FOR_CUDA', d)[0]}"
CC_REST = "${@cuda_extract_compiler('CC_FOR_CUDA', d, prefix='')[1]}" CC_REST = "${@cuda_extract_compiler('CXX_FOR_CUDA', d, prefix='')[1]}"
CFLAGS += "-I=${CUDA_PATH}/include" CFLAGS += "-I=${CUDA_PATH}/include"
EXTRA_NVCCFLAGS = "-I${STAGING_DIR_HOST}${CUDA_PATH}/include" EXTRA_NVCCFLAGS = "-I${STAGING_DIR_HOST}${CUDA_PATH}/include"

View File

@@ -1,5 +0,0 @@
require gcc-${PV}.inc
require gcc-8-cross-canadian.inc

View File

@@ -1,3 +0,0 @@
require gcc-${PV}.inc
require gcc-8-cross.inc

View File

@@ -1,2 +0,0 @@
require gcc-8-cross_${PV}.bb
require gcc-8-crosssdk.inc

View File

@@ -1,8 +0,0 @@
require gcc-${PV}.inc
require gcc-8-runtime.inc
# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
# Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm"

View File

@@ -1,11 +0,0 @@
do_fetch() {
:
}
do_fetch[noexec] = "1"
deltask do_unpack
deltask do_patch
SRC_URI = ""
do_configure[depends] += "gcc-source-${PV}:do_preconfigure"
do_populate_lic[depends] += "gcc-source-${PV}:do_unpack"

View File

@@ -1,116 +0,0 @@
require gcc-8-common.inc
# Third digit in PV should be incremented after a minor release
PV = "8.5.0"
# BINV should be incremented to a revision after a minor gcc release
BINV = "8.5.0"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-8.5:"
DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native"
LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
"
BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
#SRCREV = "f7cf798b73fd1a07098f9a490deec1e2a36e0bed"
#BASEURI ?= "git://github.com/gcc-mirror/gcc;branch=gcc-6-branch;protocol=git"
#BASEURI ?= "http://mirrors.concertpass.com/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
SRC_URI = "\
${BASEURI} \
file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
file://0002-gcc-poison-system-directories.patch \
file://0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
file://0004-64-bit-multilib-hack.patch \
file://0005-optional-libstdc.patch \
file://0006-gcc-disable-MASK_RELAX_PIC_CALLS-bit.patch \
file://0007-COLLECT_GCC_OPTIONS.patch \
file://0008-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0009-fortran-cross-compile-hack.patch \
file://0010-cpp-honor-sysroot.patch \
file://0011-MIPS64-Default-to-N64-ABI.patch \
file://0012-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
file://0013-gcc-Fix-argument-list-too-long-error.patch \
file://0014-Disable-sdt.patch \
file://0015-libtool.patch \
file://0016-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0017-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0018-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
file://0019-export-CPP.patch \
file://0020-Disable-the-MULTILIB_OSDIRNAMES-and-other-multilib-o.patch \
file://0021-Ensure-target-gcc-headers-can-be-included.patch \
file://0022-gcc-4.8-won-t-build-with-disable-dependency-tracking.patch \
file://0023-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
file://0024-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
file://0025-aarch64-Add-support-for-musl-ldso.patch \
file://0026-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0027-handle-sysroot-support-for-nativesdk-gcc.patch \
file://0028-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
file://0029-Fix-various-_FOR_BUILD-and-related-variables.patch \
file://0030-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
file://0031-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
file://0032-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
file://0033-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
file://0035-sync-gcc-stddef.h-with-musl.patch \
file://0036-fix-segmentation-fault-in-precompiled-header-generat.patch \
file://0037-Fix-for-testsuite-failure.patch \
file://0038-Re-introduce-spe-commandline-options.patch \
file://0039-riscv-Disable-multilib-for-OE.patch \
file://0040-powerpc-powerpc64-Add-support-for-musl-ldso.patch \
file://0041-Add-a-recursion-limit-to-libiberty-s-demangling-code.patch \
file://0042-PR-debug-86964.patch \
file://0043-PR85434-Prevent-spilling-of-stack-protector-guard-s-.patch \
file://0044-libsanitizer-remove-cyclades.patch \
"
SRC_URI[sha256sum] = "d308841a511bb830a6100397b0042db24ce11f642dab6ea6ee44842e5325ed50"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
# Language Overrides
FORTRAN = ""
JAVA = ""
LTO = "--enable-lto"
SSP ?= "--disable-libssp"
SSP:mingw32 = "--enable-libssp"
EXTRA_OECONF_BASE = "\
${LTO} \
${SSP} \
--enable-libitm \
--disable-bootstrap \
--disable-libmudflap \
--with-system-zlib \
${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
--enable-linker-build-id \
--with-ppl=no \
--with-cloog=no \
--enable-checking=release \
--enable-cheaders=c_global \
--without-isl \
"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
# Is a binutils 2.26 issue, not gcc
CVE_CHECK_IGNORE += "CVE-2021-37322"

View File

@@ -1,56 +0,0 @@
From 1dba090a11c40b0926f9707a543d658c95e1f156 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:14:20 +0400
Subject: [PATCH 06/40] gcc: disable MASK_RELAX_PIC_CALLS bit
The new feature added after 4.3.3
"http://www.pubbs.net/200909/gcc/94048-patch-add-support-for-rmipsjalr.html"
will cause cc1plus eat up all the system memory when build webkit-gtk.
The function mips_get_pic_call_symbol keeps on recursively calling itself.
Disable this feature to walk aside the bug.
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [configuration]
---
gcc/configure | 7 -------
gcc/configure.ac | 7 -------
2 files changed, 14 deletions(-)
Index: gcc-8.5.0/gcc/configure
===================================================================
--- gcc-8.5.0.orig/gcc/configure
+++ gcc-8.5.0/gcc/configure
@@ -27550,13 +27550,6 @@ $as_echo_n "checking assembler and linke
rm -f conftest.*
fi
fi
- if test $gcc_cv_as_ld_jalr_reloc = yes; then
- if test x$target_cpu_default = x; then
- target_cpu_default=MASK_RELAX_PIC_CALLS
- else
- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
- fi
- fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ld_jalr_reloc" >&5
$as_echo "$gcc_cv_as_ld_jalr_reloc" >&6; }
Index: gcc-8.5.0/gcc/configure.ac
===================================================================
--- gcc-8.5.0.orig/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac
@@ -4794,13 +4794,6 @@ x:
rm -f conftest.*
fi
fi
- if test $gcc_cv_as_ld_jalr_reloc = yes; then
- if test x$target_cpu_default = x; then
- target_cpu_default=MASK_RELAX_PIC_CALLS
- else
- target_cpu_default="($target_cpu_default)|MASK_RELAX_PIC_CALLS"
- fi
- fi
AC_MSG_RESULT($gcc_cv_as_ld_jalr_reloc)
AC_CACHE_CHECK([linker for .eh_frame personality relaxation],

View File

@@ -1,39 +0,0 @@
From d4326ab74a362b0fc83ed866f82c359389a36adc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:21:55 +0000
Subject: [PATCH 20/40] Disable the MULTILIB_OSDIRNAMES and other multilib
options.
Hard coding the MULTILIB_OSDIRNAMES with ../lib64 is causing problems on
systems where the libdir is NOT set to /lib64. This is allowed by the
ABI, as
long as the dynamic loader is present in /lib.
We simply want to use the default rules in gcc to find and configure the
normal libdir.
Upstream-Status: Inappropriate[OE-Specific]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/aarch64/t-aarch64-linux | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: gcc-8.5.0/gcc/config/aarch64/t-aarch64-linux
===================================================================
--- gcc-8.5.0.orig/gcc/config/aarch64/t-aarch64-linux
+++ gcc-8.5.0/gcc/config/aarch64/t-aarch64-linux
@@ -21,8 +21,8 @@
LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)

View File

@@ -1,95 +0,0 @@
From 476eda9054df443d094273c8b61fce63d940adfc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:25:11 +0000
Subject: [PATCH 21/40] Ensure target gcc headers can be included
There are a few headers installed as part of the OpenEmbedded
gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
built for the target architecture, these are within the target
sysroot and not cross/nativesdk; thus they weren't able to be
found by gcc with the existing search paths. Add support for
picking up these headers under the sysroot supplied on the gcc
command line in order to resolve this.
Upstream-Status: Pending
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/Makefile.in | 2 ++
gcc/cppdefault.c | 4 ++++
gcc/defaults.h | 9 +++++++++
gcc/gcc.c | 7 -------
4 files changed, 15 insertions(+), 7 deletions(-)
Index: gcc-8.5.0/gcc/Makefile.in
===================================================================
--- gcc-8.5.0.orig/gcc/Makefile.in
+++ gcc-8.5.0/gcc/Makefile.in
@@ -614,6 +614,7 @@ libexecdir = @libexecdir@
# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+libsubdir_target = $(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
@@ -2871,6 +2872,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localed
PREPROCESSOR_DEFINES = \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
Index: gcc-8.5.0/gcc/cppdefault.c
===================================================================
--- gcc-8.5.0.orig/gcc/cppdefault.c
+++ gcc-8.5.0/gcc/cppdefault.c
@@ -59,6 +59,10 @@ const struct default_include cpp_include
/* This is the dir for gcc's private headers. */
{ GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+ /* This is the dir for gcc's private headers under the specified sysroot. */
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
{ LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
Index: gcc-8.5.0/gcc/defaults.h
===================================================================
--- gcc-8.5.0.orig/gcc/defaults.h
+++ gcc-8.5.0/gcc/defaults.h
@@ -1455,4 +1455,13 @@ see the files COPYING3 and COPYING.RUNTI
#define DWARF_GNAT_ENCODINGS_DEFAULT DWARF_GNAT_ENCODINGS_GDB
#endif
+/* Default prefixes to attach to command names. */
+
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#endif
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+#endif
+
#endif /* ! GCC_DEFAULTS_H */
Index: gcc-8.5.0/gcc/gcc.c
===================================================================
--- gcc-8.5.0.orig/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c
@@ -1464,13 +1464,6 @@ static const char *gcc_libexec_prefix;
/* Default prefixes to attach to command names. */
-#ifndef STANDARD_STARTFILE_PREFIX_1
-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
-#endif
-#ifndef STANDARD_STARTFILE_PREFIX_2
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
-#endif
-
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
#undef MD_EXEC_PREFIX
#undef MD_STARTFILE_PREFIX

View File

@@ -1,51 +0,0 @@
From bc192f0a07ad819dee93446c5ef6895d9550d92d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 11:17:19 +0000
Subject: [PATCH 22/40] gcc 4.8+ won't build with --disable-dependency-tracking
since the *.Ppo files don't get created unless --enable-dependency-tracking is true.
This patch ensures we only use those compiler options when its enabled.
Upstream-Status: Submitted
(Problem was already reported upstream, attached this patch there
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55930)
RP
2012/09/22
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libatomic/Makefile.am | 3 ++-
libatomic/Makefile.in | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/libatomic/Makefile.am
===================================================================
--- gcc-8.5.0.orig/libatomic/Makefile.am
+++ gcc-8.5.0/libatomic/Makefile.am
@@ -101,7 +101,8 @@ PAT_S = $(word 3,$(PAT_SPLIT))
IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_FALSE@M_DEPS =
M_SIZE = -DN=$(PAT_N)
M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
M_FILE = $(PAT_BASE)_n.c
Index: gcc-8.5.0/libatomic/Makefile.in
===================================================================
--- gcc-8.5.0.orig/libatomic/Makefile.in
+++ gcc-8.5.0/libatomic/Makefile.in
@@ -335,7 +335,8 @@ PAT_N = $(word 2,$(PAT_SPLIT))
PAT_S = $(word 3,$(PAT_SPLIT))
IFUNC_DEF = -DIFUNC_ALT=$(PAT_S)
IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS))
-M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo
+@AMDEP_FALSE@M_DEPS =
M_SIZE = -DN=$(PAT_N)
M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT))
M_FILE = $(PAT_BASE)_n.c

View File

@@ -1,120 +0,0 @@
From 6dfbca78b8d253aecf9cbb5e68e04b8dd3d6a543 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Apr 2016 20:03:28 +0000
Subject: [PATCH 32/40] libgcc: Add knob to use ldbl-128 on ppc
musl does not support ldbl 128 so we can not assume
that linux as a whole supports ldbl-128 bits, instead
act upon configure option passed to gcc and assume no
on musl and yes otherwise if no option is passed since
default behaviour is to assume ldbl128 it does not
change the defaults
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libgcc/Makefile.in | 1 +
libgcc/config/rs6000/t-linux | 5 ++++-
libgcc/configure | 18 ++++++++++++++++++
libgcc/configure.ac | 12 ++++++++++++
4 files changed, 35 insertions(+), 1 deletion(-)
mode change 100644 => 100755 libgcc/configure
Index: gcc-8.5.0/libgcc/Makefile.in
===================================================================
--- gcc-8.5.0.orig/libgcc/Makefile.in
+++ gcc-8.5.0/libgcc/Makefile.in
@@ -48,6 +48,7 @@ unwind_header = @unwind_header@
md_unwind_header = @md_unwind_header@
sfp_machine_header = @sfp_machine_header@
thread_header = @thread_header@
+with_ldbl128 = @with_ldbl128@
host_noncanonical = @host_noncanonical@
real_host_noncanonical = @real_host_noncanonical@
Index: gcc-8.5.0/libgcc/config/rs6000/t-linux
===================================================================
--- gcc-8.5.0.orig/libgcc/config/rs6000/t-linux
+++ gcc-8.5.0/libgcc/config/rs6000/t-linux
@@ -1,3 +1,6 @@
SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-minimal-toc
+ifeq ($(with_ldbl128),yes)
+HOST_LIBGCC2_CFLAGS += -mlong-double-128
+endif
+HOST_LIBGCC2_CFLAGS += -mno-minimal-toc
Index: gcc-8.5.0/libgcc/configure
===================================================================
--- gcc-8.5.0.orig/libgcc/configure
+++ gcc-8.5.0/libgcc/configure
@@ -619,6 +619,7 @@ build_vendor
build_cpu
build
with_aix_soname
+with_ldbl128
enable_vtable_verify
enable_shared
libgcc_topdir
@@ -669,6 +670,7 @@ with_cross_host
with_ld
enable_shared
enable_vtable_verify
+with_long_double_128
with_aix_soname
enable_version_specific_runtime_libs
with_slibdir
@@ -1341,6 +1343,7 @@ Optional Packages:
--with-target-subdir=SUBDIR Configuring in a subdirectory for target
--with-cross-host=HOST Configuring with a cross compiler
--with-ld arrange to use the specified ld (full pathname)
+ --with-long-double-128 use 128-bit long double by default
--with-aix-soname=aix|svr4|both
shared library versioning (aka "SONAME") variant to
provide on AIX
@@ -2223,6 +2226,21 @@ else
fi
+
+
+# Check whether --with-long-double-128 was given.
+if test "${with_long_double_128+set}" = set; then :
+ withval=$with_long_double_128; with_ldbl128="$with_long_double_128"
+else
+ case "${host}" in
+ power*-*-musl*)
+ with_ldbl128="no";;
+ *) with_ldbl128="yes";;
+ esac
+
+fi
+
+
# Check whether --with-aix-soname was given.
Index: gcc-8.5.0/libgcc/configure.ac
===================================================================
--- gcc-8.5.0.orig/libgcc/configure.ac
+++ gcc-8.5.0/libgcc/configure.ac
@@ -78,6 +78,18 @@ AC_ARG_ENABLE(vtable-verify,
[enable_vtable_verify=no])
AC_SUBST(enable_vtable_verify)
+AC_ARG_WITH(long-double-128,
+[AS_HELP_STRING([--with-long-double-128],
+ [use 128-bit long double by default])],
+ with_ldbl128="$with_long_double_128",
+[case "${host}" in
+ power*-*-musl*)
+ with_ldbl128="no";;
+ *) with_ldbl128="yes";;
+ esac
+])
+AC_SUBST(with_ldbl128)
+
AC_ARG_WITH(aix-soname,
[AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
[shared library versioning (aka "SONAME") variant to provide on AIX])],

View File

@@ -1,24 +0,0 @@
From 24f74444c00c6c9bf076fb002614ebf6dec31f1a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 28 Dec 2018 09:59:53 -0800
Subject: [PATCH 39/40] riscv: Disable multilib for OE
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/riscv/t-linux | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/gcc/config/riscv/t-linux
===================================================================
--- gcc-8.5.0.orig/gcc/config/riscv/t-linux
+++ gcc-8.5.0/gcc/config/riscv/t-linux
@@ -1,3 +1,5 @@
# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
+MULTILIB_DIRNAMES := . .
+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))

View File

@@ -1,28 +0,0 @@
From 4bd0a3866f302725cb4eddcaddaeece64900c42f Mon Sep 17 00:00:00 2001
From: Serhey Popovych <serhe.popovych@gmail.com>
Date: Tue, 11 Dec 2018 02:30:50 -0500
Subject: [PATCH 40/40] powerpc/powerpc64: Add support for musl ldso
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
---
gcc/config/rs6000/linux64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/gcc/config/rs6000/linux64.h
===================================================================
--- gcc-8.5.0.orig/gcc/config/rs6000/linux64.h
+++ gcc-8.5.0/gcc/config/rs6000/linux64.h
@@ -421,9 +421,9 @@ extern int dot_symbols;
#endif
#define MUSL_DYNAMIC_LINKER32 \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#define MUSL_DYNAMIC_LINKER64 \
- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"

View File

@@ -1,322 +0,0 @@
From e1744e11b1c2b36f91a8847b61bafb8c5e7407ae Mon Sep 17 00:00:00 2001
From: nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 7 Dec 2018 10:33:30 +0000
Subject: [PATCH] Add a recursion limit to libiberty's demangling code. The
limit is enabled by default, but can be disabled via a new demangling option.
include * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
(DEMANGLE_RECURSION_LIMIT): Define
PR 87681
PR 87675
PR 87636
PR 87350
PR 87335
libiberty * cp-demangle.h (struct d_info): Add recursion_level field.
* cp-demangle.c (d_function_type): Add recursion counter.
If the recursion limit is reached and the check is not disabled,
then return with a failure result.
(cplus_demangle_init_info): Initialise the recursion_level field.
(d_demangle_callback): If the recursion limit is enabled, check
for a mangled string that is so long that there is not enough
stack space for the local arrays.
* cplus-dem.c (struct work): Add recursion_level field.
(squangle_mop_up): Set the numb and numk fields to zero.
(work_stuff_copy_to_from): Handle the case where a btypevec or
ktypevec field is NULL.
(demangle_nested_args): Add recursion counter. If
the recursion limit is not disabled and reached, return with a
failure result.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266886 138bc75d-0d04-0410-961f-82ee72b054a4
CVE: CVE-2018-18484
Upstream-Status: Backport [https://github.com/gcc-mirror/gcc/commit/03e51746ed98d9106803f6009ebd71ea670ad3b9]
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
include/ChangeLog | 5 +++++
include/demangle.h | 11 +++++++++++
libiberty/ChangeLog | 23 ++++++++++++++++++++++
libiberty/cp-demangle.c | 51 ++++++++++++++++++++++++++++++++++++++-----------
libiberty/cp-demangle.h | 3 +++
libiberty/cplus-dem.c | 37 +++++++++++++++++++++++++++++++++--
6 files changed, 117 insertions(+), 13 deletions(-)
Index: gcc-8.5.0/include/ChangeLog
===================================================================
--- gcc-8.5.0.orig/include/ChangeLog
+++ gcc-8.5.0/include/ChangeLog
@@ -18,6 +18,11 @@
* GCC 8.3.0 released.
+2018-12-07 Nick Clifton <nickc@redhat.com>
+
+ * demangle.h (DMGL_NO_RECURSE_LIMIT): Define.
+ (DEMANGLE_RECURSION_LIMIT): Define
+
2018-07-26 Release Manager
* GCC 8.2.0 released.
Index: gcc-8.5.0/include/demangle.h
===================================================================
--- gcc-8.5.0.orig/include/demangle.h
+++ gcc-8.5.0/include/demangle.h
@@ -68,6 +68,17 @@ extern "C" {
/* If none of these are set, use 'current_demangling_style' as the default. */
#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST)
+/* Disable a limit on the depth of recursion in mangled strings.
+ Note if this limit is disabled then stack exhaustion is possible when
+ demangling pathologically complicated strings. Bug reports about stack
+ exhaustion when the option is enabled will be rejected. */
+#define DMGL_NO_RECURSE_LIMIT (1 << 18)
+
+/* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as
+ the maximum depth of recursion allowed. It should be enough for any
+ real-world mangled name. */
+#define DEMANGLE_RECURSION_LIMIT 1024
+
/* Enumeration of possible demangling styles.
Lucid and ARM styles are still kept logically distinct, even though
Index: gcc-8.5.0/libiberty/ChangeLog
===================================================================
--- gcc-8.5.0.orig/libiberty/ChangeLog
+++ gcc-8.5.0/libiberty/ChangeLog
@@ -45,6 +45,29 @@
(simple_object_copy_lto_debug_sections): Create file in binary
mode.
+2018-12-07 Nick Clifton <nickc@redhat.com>
+
+ PR 87681
+ PR 87675
+ PR 87636
+ PR 87350
+ PR 87335
+ * cp-demangle.h (struct d_info): Add recursion_level field.
+ * cp-demangle.c (d_function_type): Add recursion counter.
+ If the recursion limit is reached and the check is not disabled,
+ then return with a failure result.
+ (cplus_demangle_init_info): Initialise the recursion_level field.
+ (d_demangle_callback): If the recursion limit is enabled, check
+ for a mangled string that is so long that there is not enough
+ stack space for the local arrays.
+ * cplus-dem.c (struct work): Add recursion_level field.
+ (squangle_mop_up): Set the numb and numk fields to zero.
+ (work_stuff_copy_to_from): Handle the case where a btypevec or
+ ktypevec field is NULL.
+ (demangle_nested_args): Add recursion counter. If
+ the recursion limit is not disabled and reached, return with a
+ failure result.
+
2018-07-26 Release Manager
* GCC 8.2.0 released.
Index: gcc-8.5.0/libiberty/cp-demangle.c
===================================================================
--- gcc-8.5.0.orig/libiberty/cp-demangle.c
+++ gcc-8.5.0/libiberty/cp-demangle.c
@@ -2843,21 +2843,35 @@ d_ref_qualifier (struct d_info *di, stru
static struct demangle_component *
d_function_type (struct d_info *di)
{
- struct demangle_component *ret;
+ struct demangle_component *ret = NULL;
- if (! d_check_char (di, 'F'))
- return NULL;
- if (d_peek_char (di) == 'Y')
+ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
{
- /* Function has C linkage. We don't print this information.
- FIXME: We should print it in verbose mode. */
- d_advance (di, 1);
+ if (di->recursion_level > DEMANGLE_RECURSION_LIMIT)
+ /* FIXME: There ought to be a way to report
+ that the recursion limit has been reached. */
+ return NULL;
+
+ di->recursion_level ++;
}
- ret = d_bare_function_type (di, 1);
- ret = d_ref_qualifier (di, ret);
- if (! d_check_char (di, 'E'))
- return NULL;
+ if (d_check_char (di, 'F'))
+ {
+ if (d_peek_char (di) == 'Y')
+ {
+ /* Function has C linkage. We don't print this information.
+ FIXME: We should print it in verbose mode. */
+ d_advance (di, 1);
+ }
+ ret = d_bare_function_type (di, 1);
+ ret = d_ref_qualifier (di, ret);
+
+ if (! d_check_char (di, 'E'))
+ ret = NULL;
+ }
+
+ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
+ di->recursion_level --;
return ret;
}
@@ -6188,6 +6202,7 @@ cplus_demangle_init_info (const char *ma
di->expansion = 0;
di->is_expression = 0;
di->is_conversion = 0;
+ di->recursion_level = 0;
}
/* Internal implementation for the demangler. If MANGLED is a g++ v3 ABI
@@ -6227,6 +6242,20 @@ d_demangle_callback (const char *mangled
cplus_demangle_init_info (mangled, options, strlen (mangled), &di);
+ /* PR 87675 - Check for a mangled string that is so long
+ that we do not have enough stack space to demangle it. */
+ if (((options & DMGL_NO_RECURSE_LIMIT) == 0)
+ /* This check is a bit arbitrary, since what we really want to do is to
+ compare the sizes of the di.comps and di.subs arrays against the
+ amount of stack space remaining. But there is no portable way to do
+ this, so instead we use the recursion limit as a guide to the maximum
+ size of the arrays. */
+ && (unsigned long) di.num_comps > DEMANGLE_RECURSION_LIMIT)
+ {
+ /* FIXME: We need a way to indicate that a stack limit has been reached. */
+ return 0;
+ }
+
{
#ifdef CP_DYNAMIC_ARRAYS
__extension__ struct demangle_component comps[di.num_comps];
Index: gcc-8.5.0/libiberty/cp-demangle.h
===================================================================
--- gcc-8.5.0.orig/libiberty/cp-demangle.h
+++ gcc-8.5.0/libiberty/cp-demangle.h
@@ -122,6 +122,9 @@ struct d_info
/* Non-zero if we are parsing the type operand of a conversion
operator, but not when in an expression. */
int is_conversion;
+ /* If DMGL_NO_RECURSE_LIMIT is not active then this is set to
+ the current recursion level. */
+ unsigned int recursion_level;
};
/* To avoid running past the ending '\0', don't:
Index: gcc-8.5.0/libiberty/cplus-dem.c
===================================================================
--- gcc-8.5.0.orig/libiberty/cplus-dem.c
+++ gcc-8.5.0/libiberty/cplus-dem.c
@@ -146,6 +146,7 @@ struct work_stuff
int *proctypevec; /* Indices of currently processed remembered typevecs. */
int proctypevec_size;
int nproctypes;
+ unsigned int recursion_level;
};
#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
@@ -1292,12 +1293,14 @@ squangle_mop_up (struct work_stuff *work
free ((char *) work -> btypevec);
work->btypevec = NULL;
work->bsize = 0;
+ work->numb = 0;
}
if (work -> ktypevec != NULL)
{
free ((char *) work -> ktypevec);
work->ktypevec = NULL;
work->ksize = 0;
+ work->numk = 0;
}
}
@@ -1331,8 +1334,15 @@ work_stuff_copy_to_from (struct work_stu
for (i = 0; i < from->numk; i++)
{
- int len = strlen (from->ktypevec[i]) + 1;
+ int len;
+
+ if (from->ktypevec[i] == NULL)
+ {
+ to->ktypevec[i] = NULL;
+ continue;
+ }
+ len = strlen (from->ktypevec[i]) + 1;
to->ktypevec[i] = XNEWVEC (char, len);
memcpy (to->ktypevec[i], from->ktypevec[i], len);
}
@@ -1342,8 +1352,15 @@ work_stuff_copy_to_from (struct work_stu
for (i = 0; i < from->numb; i++)
{
- int len = strlen (from->btypevec[i]) + 1;
+ int len;
+
+ if (from->btypevec[i] == NULL)
+ {
+ to->btypevec[i] = NULL;
+ continue;
+ }
+ len = strlen (from->btypevec[i]) + 1;
to->btypevec[i] = XNEWVEC (char , len);
memcpy (to->btypevec[i], from->btypevec[i], len);
}
@@ -1401,6 +1418,7 @@ delete_non_B_K_work_stuff (struct work_s
free ((char*) work->tmpl_argvec);
work->tmpl_argvec = NULL;
+ work->ntmpl_args = 0;
}
if (work->previous_argument)
{
@@ -4477,6 +4495,7 @@ remember_Btype (struct work_stuff *work,
}
/* Lose all the info related to B and K type codes. */
+
static void
forget_B_and_K_types (struct work_stuff *work)
{
@@ -4502,6 +4521,7 @@ forget_B_and_K_types (struct work_stuff
}
}
}
+
/* Forget the remembered types, but not the type vector itself. */
static void
@@ -4696,6 +4716,16 @@ demangle_nested_args (struct work_stuff
int result;
int saved_nrepeats;
+ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0)
+ {
+ if (work->recursion_level > DEMANGLE_RECURSION_LIMIT)
+ /* FIXME: There ought to be a way to report
+ that the recursion limit has been reached. */
+ return 0;
+
+ work->recursion_level ++;
+ }
+
/* The G++ name-mangling algorithm does not remember types on nested
argument lists, unless -fsquangling is used, and in that case the
type vector updated by remember_type is not used. So, we turn
@@ -4722,6 +4752,9 @@ demangle_nested_args (struct work_stuff
--work->forgetting_types;
work->nrepeats = saved_nrepeats;
+ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0)
+ --work->recursion_level;
+
return result;
}

View File

@@ -1,92 +0,0 @@
From beb921e1106b5bcbb0c6e2be84b241327e2ffc51 Mon Sep 17 00:00:00 2001
From: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 25 Mar 2019 21:19:09 +0000
Subject: [PATCH] PR debug/86964 * dwarf2out.c
(premark_used_variables): New function. (prune_unused_types_walk): Do
not mark not premarked external variables. (prune_unused_types):
Call premark_used_variables.
* gcc.dg/debug/dwarf2/pr86964.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269925 138bc75d-0d04-0410-961f-82ee72b054a4
Upstream-Status: Backport
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
---
gcc/ChangeLog | 8 ++++++
gcc/dwarf2out.c | 32 +++++++++++++++++++++
2 files changed, 40 insertions(+)
Index: gcc-8.5.0/gcc/ChangeLog
===================================================================
--- gcc-8.5.0.orig/gcc/ChangeLog
+++ gcc-8.5.0/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2019-03-25 Johan Karlsson <johan.karlsson@enea.com>
+
+ PR debug/86964
+ * dwarf2out.c (premark_used_variables): New function.
+ (prune_unused_types_walk): Do not mark not premarked external
+ variables.
+ (prune_unused_types): Call premark_used_variables.
+
2021-05-14 Release Manager
* GCC 8.5.0 released.
Index: gcc-8.5.0/gcc/dwarf2out.c
===================================================================
--- gcc-8.5.0.orig/gcc/dwarf2out.c
+++ gcc-8.5.0/gcc/dwarf2out.c
@@ -22697,6 +22697,21 @@ premark_types_used_by_global_vars (void)
->traverse<void *, premark_types_used_by_global_vars_helper> (NULL);
}
+/* Mark all variables used by the symtab as perennial. */
+
+static void
+premark_used_variables (void)
+{
+ /* Mark DIEs in the symtab as used. */
+ varpool_node *var;
+ FOR_EACH_VARIABLE (var)
+ {
+ dw_die_ref die = lookup_decl_die (var->decl);
+ if (die)
+ die->die_perennial_p = 1;
+ }
+}
+
/* Generate a DW_TAG_call_site DIE in function DECL under SUBR_DIE
for CA_LOC call arg loc node. */
@@ -29323,6 +29338,19 @@ prune_unused_types_walk (dw_die_ref die)
return;
+ case DW_TAG_variable:
+ if (flag_debug_only_used_symbols)
+ {
+ if (die->die_perennial_p)
+ break;
+
+ /* premark_used_variables marks external variables --- don't mark
+ them here. */
+ if (get_AT (die, DW_AT_external))
+ return;
+ }
+ /* FALLTHROUGH */
+
default:
/* Mark everything else. */
break;
@@ -29449,6 +29477,10 @@ prune_unused_types (void)
/* Mark types that are used in global variables. */
premark_types_used_by_global_vars ();
+ /* Mark variables used in the symtab. */
+ if (flag_debug_only_used_symbols)
+ premark_used_variables ();
+
/* Set the mark on nodes that are actually used. */
prune_unused_types_walk (comp_unit_die ());
for (node = limbo_die_list; node; node = node->next)

View File

@@ -1,810 +0,0 @@
From f98495d90ba66f67fe922a4b9229ea787041c418 Mon Sep 17 00:00:00 2001
From: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 22 Nov 2018 14:46:17 +0000
Subject: [PATCH] PR85434: Prevent spilling of stack protector guard's address
on ARM
In case of high register pressure in PIC mode, address of the stack
protector's guard can be spilled on ARM targets as shown in PR85434,
thus allowing an attacker to control what the canary would be compared
against. ARM does lack stack_protect_set and stack_protect_test insn
patterns, defining them does not help as the address is expanded
regularly and the patterns only deal with the copy and test of the
guard with the canary.
This problem does not occur for x86 targets because the PIC access and
the test can be done in the same instruction. Aarch64 is exempt too
because PIC access insn pattern are mov of UNSPEC which prevents it from
the second access in the epilogue being CSEd in cse_local pass with the
first access in the prologue.
The approach followed here is to create new "combined" set and test
standard pattern names that take the unexpanded guard and do the set or
test. This allows the target to use an opaque pattern (eg. using UNSPEC)
to hide the individual instructions being generated to the compiler and
split the pattern into generic load, compare and branch instruction
after register allocator, therefore avoiding any spilling. This is here
implemented for the ARM targets. For targets not implementing these new
standard pattern names, the existing stack_protect_set and
stack_protect_test pattern names are used.
To be able to split PIC access after register allocation, the functions
had to be augmented to force a new PIC register load and to control
which register it loads into. This is because sharing the PIC register
between prologue and epilogue could lead to spilling due to CSE again
which an attacker could use to control what the canary gets compared
against.
2018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
gcc/
PR target/85434
* target-insns.def (stack_protect_combined_set): Define new standard
pattern name.
(stack_protect_combined_test): Likewise.
* cfgexpand.c (stack_protect_prologue): Try new
stack_protect_combined_set pattern first.
* function.c (stack_protect_epilogue): Try new
stack_protect_combined_test pattern first.
* config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
parameters to control which register to use as PIC register and force
reloading PIC register respectively. Insert in the stream of insns if
possible.
(legitimize_pic_address): Expose above new parameters in prototype and
adapt recursive calls accordingly. Use pic_reg if non null instead of
cached one.
(arm_load_pic_register): Add pic_reg parameter and use it if non null.
(arm_legitimize_address): Adapt to new legitimize_pic_address
prototype.
(thumb_legitimize_address): Likewise.
(arm_emit_call_insn): Adapt to require_pic_register prototype change.
(arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
(thumb1_expand_prologue): Likewise.
* config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
change.
(arm_load_pic_register): Likewise.
* config/arm/predicated.md (guard_addr_operand): New predicate.
(guard_operand): New predicate.
* config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
prototype change.
(builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
prototype change.
(stack_protect_combined_set): New expander..
(stack_protect_combined_set_insn): New insn_and_split pattern.
(stack_protect_set_insn): New insn pattern.
(stack_protect_combined_test): New expander.
(stack_protect_combined_test_insn): New insn_and_split pattern.
(arm_stack_protect_test_insn): New insn pattern.
* config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
* config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
(UNSPEC_SP_TEST): Likewise.
* doc/md.texi (stack_protect_combined_set): Document new standard
pattern name.
(stack_protect_set): Clarify that the operand for guard's address is
legal.
(stack_protect_combined_test): Document new standard pattern name.
(stack_protect_test): Clarify that the operand for guard's address is
legal.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266379 138bc75d-0d04-0410-961f-82ee72b054a4
Upstream-Status: Backport
CVE: CVE-2018-12886
Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
---
gcc/ChangeLog | 49 ++++++
gcc/cfgexpand.c | 17 +++
gcc/config/arm/arm-protos.h | 4 +-
gcc/config/arm/arm.c | 87 ++++++++---
gcc/config/arm/arm.md | 163 +++++++++++++++++++-
gcc/config/arm/predicates.md | 17 +++
gcc/config/arm/thumb1.md | 13 ++
gcc/config/arm/unspecs.md | 3 +
gcc/doc/md.texi | 55 ++++++-
gcc/function.c | 32 +++-
gcc/target-insns.def | 2 +
11 files changed, 399 insertions(+), 43 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/arm/pr85434.c
Index: gcc-8.5.0/gcc/ChangeLog
===================================================================
--- gcc-8.5.0.orig/gcc/ChangeLog
+++ gcc-8.5.0/gcc/ChangeLog
@@ -7479,6 +7479,55 @@
* config/arm/neon.md (movv4hf, movv8hf): Refactored to..
(mov<mov>): ..this and enable unconditionally.
+2018-11-22 Thomas Preud'homme <thomas.preudhomme@linaro.org>
+
+ * target-insns.def (stack_protect_combined_set): Define new standard
+ pattern name.
+ (stack_protect_combined_test): Likewise.
+ * cfgexpand.c (stack_protect_prologue): Try new
+ stack_protect_combined_set pattern first.
+ * function.c (stack_protect_epilogue): Try new
+ stack_protect_combined_test pattern first.
+ * config/arm/arm.c (require_pic_register): Add pic_reg and compute_now
+ parameters to control which register to use as PIC register and force
+ reloading PIC register respectively. Insert in the stream of insns if
+ possible.
+ (legitimize_pic_address): Expose above new parameters in prototype and
+ adapt recursive calls accordingly. Use pic_reg if non null instead of
+ cached one.
+ (arm_load_pic_register): Add pic_reg parameter and use it if non null.
+ (arm_legitimize_address): Adapt to new legitimize_pic_address
+ prototype.
+ (thumb_legitimize_address): Likewise.
+ (arm_emit_call_insn): Adapt to require_pic_register prototype change.
+ (arm_expand_prologue): Adapt to arm_load_pic_register prototype change.
+ (thumb1_expand_prologue): Likewise.
+ * config/arm/arm-protos.h (legitimize_pic_address): Adapt to prototype
+ change.
+ (arm_load_pic_register): Likewise.
+ * config/arm/predicated.md (guard_addr_operand): New predicate.
+ (guard_operand): New predicate.
+ * config/arm/arm.md (movsi expander): Adapt to legitimize_pic_address
+ prototype change.
+ (builtin_setjmp_receiver expander): Adapt to thumb1_expand_prologue
+ prototype change.
+ (stack_protect_combined_set): New expander..
+ (stack_protect_combined_set_insn): New insn_and_split pattern.
+ (stack_protect_set_insn): New insn pattern.
+ (stack_protect_combined_test): New expander.
+ (stack_protect_combined_test_insn): New insn_and_split pattern.
+ (arm_stack_protect_test_insn): New insn pattern.
+ * config/arm/thumb1.md (thumb1_stack_protect_test_insn): New insn pattern.
+ * config/arm/unspecs.md (UNSPEC_SP_SET): New unspec.
+ (UNSPEC_SP_TEST): Likewise.
+ * doc/md.texi (stack_protect_combined_set): Document new standard
+ pattern name.
+ (stack_protect_set): Clarify that the operand for guard's address is
+ legal.
+ (stack_protect_combined_test): Document new standard pattern name.
+ (stack_protect_test): Clarify that the operand for guard's address is
+ legal.
+
2018-11-22 Uros Bizjak <ubizjak@gmail.com>
Backport from mainline
Index: gcc-8.5.0/gcc/cfgexpand.c
===================================================================
--- gcc-8.5.0.orig/gcc/cfgexpand.c
+++ gcc-8.5.0/gcc/cfgexpand.c
@@ -6181,6 +6181,23 @@ stack_protect_prologue (void)
rtx x, y;
x = expand_normal (crtl->stack_protect_guard);
+
+ if (targetm.have_stack_protect_combined_set () && guard_decl)
+ {
+ gcc_assert (DECL_P (guard_decl));
+ y = DECL_RTL (guard_decl);
+
+ /* Allow the target to compute address of Y and copy it to X without
+ leaking Y into a register. This combined address + copy pattern
+ allows the target to prevent spilling of any intermediate results by
+ splitting it after register allocator. */
+ if (rtx_insn *insn = targetm.gen_stack_protect_combined_set (x, y))
+ {
+ emit_insn (insn);
+ return;
+ }
+ }
+
if (guard_decl)
y = expand_normal (guard_decl);
else
Index: gcc-8.5.0/gcc/config/arm/arm-protos.h
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/arm-protos.h
+++ gcc-8.5.0/gcc/config/arm/arm-protos.h
@@ -28,7 +28,7 @@ extern enum unwind_info_type arm_except_
extern int use_return_insn (int, rtx);
extern bool use_simple_return_p (void);
extern enum reg_class arm_regno_class (int);
-extern void arm_load_pic_register (unsigned long);
+extern void arm_load_pic_register (unsigned long, rtx);
extern int arm_volatile_func (void);
extern void arm_expand_prologue (void);
extern void arm_expand_epilogue (bool);
@@ -67,7 +67,7 @@ extern int const_ok_for_dimode_op (HOST_
extern int arm_split_constant (RTX_CODE, machine_mode, rtx,
HOST_WIDE_INT, rtx, rtx, int);
extern int legitimate_pic_operand_p (rtx);
-extern rtx legitimize_pic_address (rtx, machine_mode, rtx);
+extern rtx legitimize_pic_address (rtx, machine_mode, rtx, rtx, bool);
extern rtx legitimize_tls_address (rtx, rtx);
extern bool arm_legitimate_address_p (machine_mode, rtx, bool);
extern int arm_legitimate_address_outer_p (machine_mode, rtx, RTX_CODE, int);
Index: gcc-8.5.0/gcc/config/arm/arm.c
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/arm.c
+++ gcc-8.5.0/gcc/config/arm/arm.c
@@ -7386,21 +7386,34 @@ legitimate_pic_operand_p (rtx x)
return 1;
}
-/* Record that the current function needs a PIC register. Initialize
- cfun->machine->pic_reg if we have not already done so. */
+/* Record that the current function needs a PIC register. If PIC_REG is null,
+ a new pseudo is allocated as PIC register, otherwise PIC_REG is used. In
+ both case cfun->machine->pic_reg is initialized if we have not already done
+ so. COMPUTE_NOW decide whether and where to set the PIC register. If true,
+ PIC register is reloaded in the current position of the instruction stream
+ irregardless of whether it was loaded before. Otherwise, it is only loaded
+ if not already done so (crtl->uses_pic_offset_table is null). Note that
+ nonnull PIC_REG is only supported iff COMPUTE_NOW is true and null PIC_REG
+ is only supported iff COMPUTE_NOW is false. */
static void
-require_pic_register (void)
+require_pic_register (rtx pic_reg, bool compute_now)
{
+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
+
/* A lot of the logic here is made obscure by the fact that this
routine gets called as part of the rtx cost estimation process.
We don't want those calls to affect any assumptions about the real
function; and further, we can't call entry_of_function() until we
start the real expansion process. */
- if (!crtl->uses_pic_offset_table)
+ if (!crtl->uses_pic_offset_table || compute_now)
{
- gcc_assert (can_create_pseudo_p ());
+ gcc_assert (can_create_pseudo_p ()
+ || (pic_reg != NULL_RTX
+ && REG_P (pic_reg)
+ && GET_MODE (pic_reg) == Pmode));
if (arm_pic_register != INVALID_REGNUM
+ && !compute_now
&& !(TARGET_THUMB1 && arm_pic_register > LAST_LO_REGNUM))
{
if (!cfun->machine->pic_reg)
@@ -7416,8 +7429,10 @@ require_pic_register (void)
{
rtx_insn *seq, *insn;
+ if (pic_reg == NULL_RTX)
+ pic_reg = gen_reg_rtx (Pmode);
if (!cfun->machine->pic_reg)
- cfun->machine->pic_reg = gen_reg_rtx (Pmode);
+ cfun->machine->pic_reg = pic_reg;
/* Play games to avoid marking the function as needing pic
if we are being called as part of the cost-estimation
@@ -7428,11 +7443,12 @@ require_pic_register (void)
start_sequence ();
if (TARGET_THUMB1 && arm_pic_register != INVALID_REGNUM
- && arm_pic_register > LAST_LO_REGNUM)
+ && arm_pic_register > LAST_LO_REGNUM
+ && !compute_now)
emit_move_insn (cfun->machine->pic_reg,
gen_rtx_REG (Pmode, arm_pic_register));
else
- arm_load_pic_register (0UL);
+ arm_load_pic_register (0UL, pic_reg);
seq = get_insns ();
end_sequence ();
@@ -7445,16 +7461,33 @@ require_pic_register (void)
we can't yet emit instructions directly in the final
insn stream. Queue the insns on the entry edge, they will
be committed after everything else is expanded. */
- insert_insn_on_edge (seq,
- single_succ_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+ if (currently_expanding_to_rtl)
+ insert_insn_on_edge (seq,
+ single_succ_edge
+ (ENTRY_BLOCK_PTR_FOR_FN (cfun)));
+ else
+ emit_insn (seq);
}
}
}
}
+/* Legitimize PIC load to ORIG into REG. If REG is NULL, a new pseudo is
+ created to hold the result of the load. If not NULL, PIC_REG indicates
+ which register to use as PIC register, otherwise it is decided by register
+ allocator. COMPUTE_NOW forces the PIC register to be loaded at the current
+ location in the instruction stream, irregardless of whether it was loaded
+ previously. Note that nonnull PIC_REG is only supported iff COMPUTE_NOW is
+ true and null PIC_REG is only supported iff COMPUTE_NOW is false.
+
+ Returns the register REG into which the PIC load is performed. */
+
rtx
-legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
+legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg,
+ bool compute_now)
{
+ gcc_assert (compute_now == (pic_reg != NULL_RTX));
+
if (GET_CODE (orig) == SYMBOL_REF
|| GET_CODE (orig) == LABEL_REF)
{
@@ -7487,9 +7520,12 @@ legitimize_pic_address (rtx orig, machin
rtx mem;
/* If this function doesn't have a pic register, create one now. */
- require_pic_register ();
+ require_pic_register (pic_reg, compute_now);
+
+ if (pic_reg == NULL_RTX)
+ pic_reg = cfun->machine->pic_reg;
- pat = gen_calculate_pic_address (reg, cfun->machine->pic_reg, orig);
+ pat = gen_calculate_pic_address (reg, pic_reg, orig);
/* Make the MEM as close to a constant as possible. */
mem = SET_SRC (pat);
@@ -7538,9 +7574,11 @@ legitimize_pic_address (rtx orig, machin
gcc_assert (GET_CODE (XEXP (orig, 0)) == PLUS);
- base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg);
+ base = legitimize_pic_address (XEXP (XEXP (orig, 0), 0), Pmode, reg,
+ pic_reg, compute_now);
offset = legitimize_pic_address (XEXP (XEXP (orig, 0), 1), Pmode,
- base == reg ? 0 : reg);
+ base == reg ? 0 : reg, pic_reg,
+ compute_now);
if (CONST_INT_P (offset))
{
@@ -7640,16 +7678,17 @@ static GTY(()) int pic_labelno;
low register. */
void
-arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED)
+arm_load_pic_register (unsigned long saved_regs ATTRIBUTE_UNUSED, rtx pic_reg)
{
- rtx l1, labelno, pic_tmp, pic_rtx, pic_reg;
+ rtx l1, labelno, pic_tmp, pic_rtx;
if (crtl->uses_pic_offset_table == 0 || TARGET_SINGLE_PIC_BASE)
return;
gcc_assert (flag_pic);
- pic_reg = cfun->machine->pic_reg;
+ if (pic_reg == NULL_RTX)
+ pic_reg = cfun->machine->pic_reg;
if (TARGET_VXWORKS_RTP)
{
pic_rtx = gen_rtx_SYMBOL_REF (Pmode, VXWORKS_GOTT_BASE);
@@ -8725,7 +8764,8 @@ arm_legitimize_address (rtx x, rtx orig_
{
/* We need to find and carefully transform any SYMBOL and LABEL
references; so go back to the original address expression. */
- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
+ false /*compute_now*/);
if (new_x != orig_x)
x = new_x;
@@ -8793,7 +8833,8 @@ thumb_legitimize_address (rtx x, rtx ori
{
/* We need to find and carefully transform any SYMBOL and LABEL
references; so go back to the original address expression. */
- rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX);
+ rtx new_x = legitimize_pic_address (orig_x, mode, NULL_RTX, NULL_RTX,
+ false /*compute_now*/);
if (new_x != orig_x)
x = new_x;
@@ -18093,7 +18134,7 @@ arm_emit_call_insn (rtx pat, rtx addr, b
? !targetm.binds_local_p (SYMBOL_REF_DECL (addr))
: !SYMBOL_REF_LOCAL_P (addr)))
{
- require_pic_register ();
+ require_pic_register (NULL_RTX, false /*compute_now*/);
use_reg (&CALL_INSN_FUNCTION_USAGE (insn), cfun->machine->pic_reg);
}
@@ -22067,7 +22108,7 @@ arm_expand_prologue (void)
mask &= THUMB2_WORK_REGS;
if (!IS_NESTED (func_type))
mask |= (1 << IP_REGNUM);
- arm_load_pic_register (mask);
+ arm_load_pic_register (mask, NULL_RTX);
}
/* If we are profiling, make sure no instructions are scheduled before
@@ -25310,7 +25351,7 @@ thumb1_expand_prologue (void)
/* Load the pic register before setting the frame pointer,
so we can use r7 as a temporary work register. */
if (flag_pic && arm_pic_register != INVALID_REGNUM)
- arm_load_pic_register (live_regs_mask);
+ arm_load_pic_register (live_regs_mask, NULL_RTX);
if (!frame_pointer_needed && CALLER_INTERWORKING_SLOT_SIZE > 0)
emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
Index: gcc-8.5.0/gcc/config/arm/arm.md
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/arm.md
+++ gcc-8.5.0/gcc/config/arm/arm.md
@@ -6014,7 +6014,7 @@
|| symbol_mentioned_p (operands[1])
|| label_mentioned_p (operands[1])))
operands[1] =
- legitimize_pic_address (operands[1], SImode, tmp);
+ legitimize_pic_address (operands[1], SImode, tmp, NULL_RTX, false);
}
"
)
@@ -6302,7 +6302,7 @@
/* r3 is clobbered by set/longjmp, so we can use it as a scratch
register. */
if (arm_pic_register != INVALID_REGNUM)
- arm_load_pic_register (1UL << 3);
+ arm_load_pic_register (1UL << 3, NULL_RTX);
DONE;
}")
@@ -8692,6 +8692,164 @@
(set_attr "conds" "clob")]
)
+;; Named patterns for stack smashing protection.
+(define_expand "stack_protect_combined_set"
+ [(parallel
+ [(set (match_operand:SI 0 "memory_operand" "")
+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
+ UNSPEC_SP_SET))
+ (clobber (match_scratch:SI 2 ""))
+ (clobber (match_scratch:SI 3 ""))])]
+ ""
+ ""
+)
+
+;; Use a separate insn from the above expand to be able to have the mem outside
+;; the operand #1 when register allocation comes. This is needed to avoid LRA
+;; try to reload the guard since we need to control how PIC access is done in
+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
+;; legitimize_pic_address ()).
+(define_insn_and_split "*stack_protect_combined_set_insn"
+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
+ UNSPEC_SP_SET))
+ (clobber (match_scratch:SI 2 "=&l,&r"))
+ (clobber (match_scratch:SI 3 "=&l,&r"))]
+ ""
+ "#"
+ "reload_completed"
+ [(parallel [(set (match_dup 0) (unspec:SI [(mem:SI (match_dup 2))]
+ UNSPEC_SP_SET))
+ (clobber (match_dup 2))])]
+ "
+{
+ if (flag_pic)
+ {
+ /* Forces recomputing of GOT base now. */
+ legitimize_pic_address (operands[1], SImode, operands[2], operands[3],
+ true /*compute_now*/);
+ }
+ else
+ {
+ if (address_operand (operands[1], SImode))
+ operands[2] = operands[1];
+ else
+ {
+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
+ emit_move_insn (operands[2], mem);
+ }
+ }
+}"
+ [(set_attr "arch" "t1,32")]
+)
+
+(define_insn "*stack_protect_set_insn"
+ [(set (match_operand:SI 0 "memory_operand" "=m,m")
+ (unspec:SI [(mem:SI (match_operand:SI 1 "register_operand" "+&l,&r"))]
+ UNSPEC_SP_SET))
+ (clobber (match_dup 1))]
+ ""
+ "@
+ ldr\\t%1, [%1]\;str\\t%1, %0\;movs\t%1,#0
+ ldr\\t%1, [%1]\;str\\t%1, %0\;mov\t%1,#0"
+ [(set_attr "length" "8,12")
+ (set_attr "conds" "clob,nocond")
+ (set_attr "type" "multiple")
+ (set_attr "arch" "t1,32")]
+)
+
+(define_expand "stack_protect_combined_test"
+ [(parallel
+ [(set (pc)
+ (if_then_else
+ (eq (match_operand:SI 0 "memory_operand" "")
+ (unspec:SI [(match_operand:SI 1 "guard_operand" "")]
+ UNSPEC_SP_TEST))
+ (label_ref (match_operand 2))
+ (pc)))
+ (clobber (match_scratch:SI 3 ""))
+ (clobber (match_scratch:SI 4 ""))
+ (clobber (reg:CC CC_REGNUM))])]
+ ""
+ ""
+)
+
+;; Use a separate insn from the above expand to be able to have the mem outside
+;; the operand #1 when register allocation comes. This is needed to avoid LRA
+;; try to reload the guard since we need to control how PIC access is done in
+;; the -fpic/-fPIC case (see COMPUTE_NOW parameter when calling
+;; legitimize_pic_address ()).
+(define_insn_and_split "*stack_protect_combined_test_insn"
+ [(set (pc)
+ (if_then_else
+ (eq (match_operand:SI 0 "memory_operand" "m,m")
+ (unspec:SI [(mem:SI (match_operand:SI 1 "guard_addr_operand" "X,X"))]
+ UNSPEC_SP_TEST))
+ (label_ref (match_operand 2))
+ (pc)))
+ (clobber (match_scratch:SI 3 "=&l,&r"))
+ (clobber (match_scratch:SI 4 "=&l,&r"))
+ (clobber (reg:CC CC_REGNUM))]
+ ""
+ "#"
+ "reload_completed"
+ [(const_int 0)]
+{
+ rtx eq;
+
+ if (flag_pic)
+ {
+ /* Forces recomputing of GOT base now. */
+ legitimize_pic_address (operands[1], SImode, operands[3], operands[4],
+ true /*compute_now*/);
+ }
+ else
+ {
+ if (address_operand (operands[1], SImode))
+ operands[3] = operands[1];
+ else
+ {
+ rtx mem = XEXP (force_const_mem (SImode, operands[1]), 0);
+ emit_move_insn (operands[3], mem);
+ }
+ }
+ if (TARGET_32BIT)
+ {
+ emit_insn (gen_arm_stack_protect_test_insn (operands[4], operands[0],
+ operands[3]));
+ rtx cc_reg = gen_rtx_REG (CC_Zmode, CC_REGNUM);
+ eq = gen_rtx_EQ (CC_Zmode, cc_reg, const0_rtx);
+ emit_jump_insn (gen_arm_cond_branch (operands[2], eq, cc_reg));
+ }
+ else
+ {
+ emit_insn (gen_thumb1_stack_protect_test_insn (operands[4], operands[0],
+ operands[3]));
+ eq = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
+ emit_jump_insn (gen_cbranchsi4 (eq, operands[4], const0_rtx,
+ operands[2]));
+ }
+ DONE;
+}
+ [(set_attr "arch" "t1,32")]
+)
+
+(define_insn "arm_stack_protect_test_insn"
+ [(set (reg:CC_Z CC_REGNUM)
+ (compare:CC_Z (unspec:SI [(match_operand:SI 1 "memory_operand" "m,m")
+ (mem:SI (match_operand:SI 2 "register_operand" "+l,r"))]
+ UNSPEC_SP_TEST)
+ (const_int 0)))
+ (clobber (match_operand:SI 0 "register_operand" "=&l,&r"))
+ (clobber (match_dup 2))]
+ "TARGET_32BIT"
+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
+ [(set_attr "length" "8,12")
+ (set_attr "conds" "set")
+ (set_attr "type" "multiple")
+ (set_attr "arch" "t,32")]
+)
+
(define_expand "casesi"
[(match_operand:SI 0 "s_register_operand" "") ; index to jump on
(match_operand:SI 1 "const_int_operand" "") ; lower bound
Index: gcc-8.5.0/gcc/config/arm/predicates.md
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/predicates.md
+++ gcc-8.5.0/gcc/config/arm/predicates.md
@@ -31,6 +31,23 @@
|| REGNO_REG_CLASS (REGNO (op)) != NO_REGS));
})
+; Predicate for stack protector guard's address in
+; stack_protect_combined_set_insn and stack_protect_combined_test_insn patterns
+(define_predicate "guard_addr_operand"
+ (match_test "true")
+{
+ return (CONSTANT_ADDRESS_P (op)
+ || !targetm.cannot_force_const_mem (mode, op));
+})
+
+; Predicate for stack protector guard in stack_protect_combined_set and
+; stack_protect_combined_test patterns
+(define_predicate "guard_operand"
+ (match_code "mem")
+{
+ return guard_addr_operand (XEXP (op, 0), mode);
+})
+
(define_predicate "imm_for_neon_inv_logic_operand"
(match_code "const_vector")
{
Index: gcc-8.5.0/gcc/config/arm/thumb1.md
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/thumb1.md
+++ gcc-8.5.0/gcc/config/arm/thumb1.md
@@ -1962,4 +1962,17 @@
}"
[(set_attr "type" "mov_reg")]
)
+
+(define_insn "thumb1_stack_protect_test_insn"
+ [(set (match_operand:SI 0 "register_operand" "=&l")
+ (unspec:SI [(match_operand:SI 1 "memory_operand" "m")
+ (mem:SI (match_operand:SI 2 "register_operand" "+l"))]
+ UNSPEC_SP_TEST))
+ (clobber (match_dup 2))]
+ "TARGET_THUMB1"
+ "ldr\t%0, [%2]\;ldr\t%2, %1\;eors\t%0, %2, %0"
+ [(set_attr "length" "8")
+ (set_attr "conds" "set")
+ (set_attr "type" "multiple")]
+)
Index: gcc-8.5.0/gcc/config/arm/unspecs.md
===================================================================
--- gcc-8.5.0.orig/gcc/config/arm/unspecs.md
+++ gcc-8.5.0/gcc/config/arm/unspecs.md
@@ -86,6 +86,9 @@
UNSPEC_PROBE_STACK ; Probe stack memory reference
UNSPEC_NONSECURE_MEM ; Represent non-secure memory in ARMv8-M with
; security extension
+ UNSPEC_SP_SET ; Represent the setting of stack protector's canary
+ UNSPEC_SP_TEST ; Represent the testing of stack protector's canary
+ ; against the guard.
])
(define_c_enum "unspec" [
Index: gcc-8.5.0/gcc/doc/md.texi
===================================================================
--- gcc-8.5.0.orig/gcc/doc/md.texi
+++ gcc-8.5.0/gcc/doc/md.texi
@@ -7285,22 +7285,61 @@ builtins.
The get/set patterns have a single output/input operand respectively,
with @var{mode} intended to be @code{Pmode}.
+@cindex @code{stack_protect_combined_set} instruction pattern
+@item @samp{stack_protect_combined_set}
+This pattern, if defined, moves a @code{ptr_mode} value from an address
+whose declaration RTX is given in operand 1 to the memory in operand 0
+without leaving the value in a register afterward. If several
+instructions are needed by the target to perform the operation (eg. to
+load the address from a GOT entry then load the @code{ptr_mode} value
+and finally store it), it is the backend's responsibility to ensure no
+intermediate result gets spilled. This is to avoid leaking the value
+some place that an attacker might use to rewrite the stack guard slot
+after having clobbered it.
+
+If this pattern is not defined, then the address declaration is
+expanded first in the standard way and a @code{stack_protect_set}
+pattern is then generated to move the value from that address to the
+address in operand 0.
+
@cindex @code{stack_protect_set} instruction pattern
@item @samp{stack_protect_set}
-This pattern, if defined, moves a @code{ptr_mode} value from the memory
-in operand 1 to the memory in operand 0 without leaving the value in
-a register afterward. This is to avoid leaking the value some place
-that an attacker might use to rewrite the stack guard slot after
-having clobbered it.
+This pattern, if defined, moves a @code{ptr_mode} value from the valid
+memory location in operand 1 to the memory in operand 0 without leaving
+the value in a register afterward. This is to avoid leaking the value
+some place that an attacker might use to rewrite the stack guard slot
+after having clobbered it.
+
+Note: on targets where the addressing modes do not allow to load
+directly from stack guard address, the address is expanded in a standard
+way first which could cause some spills.
If this pattern is not defined, then a plain move pattern is generated.
+@cindex @code{stack_protect_combined_test} instruction pattern
+@item @samp{stack_protect_combined_test}
+This pattern, if defined, compares a @code{ptr_mode} value from an
+address whose declaration RTX is given in operand 1 with the memory in
+operand 0 without leaving the value in a register afterward and
+branches to operand 2 if the values were equal. If several
+instructions are needed by the target to perform the operation (eg. to
+load the address from a GOT entry then load the @code{ptr_mode} value
+and finally store it), it is the backend's responsibility to ensure no
+intermediate result gets spilled. This is to avoid leaking the value
+some place that an attacker might use to rewrite the stack guard slot
+after having clobbered it.
+
+If this pattern is not defined, then the address declaration is
+expanded first in the standard way and a @code{stack_protect_test}
+pattern is then generated to compare the value from that address to the
+value at the memory in operand 0.
+
@cindex @code{stack_protect_test} instruction pattern
@item @samp{stack_protect_test}
This pattern, if defined, compares a @code{ptr_mode} value from the
-memory in operand 1 with the memory in operand 0 without leaving the
-value in a register afterward and branches to operand 2 if the values
-were equal.
+valid memory location in operand 1 with the memory in operand 0 without
+leaving the value in a register afterward and branches to operand 2 if
+the values were equal.
If this pattern is not defined, then a plain compare pattern and
conditional branch pattern is used.
Index: gcc-8.5.0/gcc/function.c
===================================================================
--- gcc-8.5.0.orig/gcc/function.c
+++ gcc-8.5.0/gcc/function.c
@@ -5107,18 +5107,34 @@ stack_protect_epilogue (void)
tree guard_decl = targetm.stack_protect_guard ();
rtx_code_label *label = gen_label_rtx ();
rtx x, y;
- rtx_insn *seq;
+ rtx_insn *seq = NULL;
x = expand_normal (crtl->stack_protect_guard);
- if (guard_decl)
- y = expand_normal (guard_decl);
+
+ if (targetm.have_stack_protect_combined_test () && guard_decl)
+ {
+ gcc_assert (DECL_P (guard_decl));
+ y = DECL_RTL (guard_decl);
+ /* Allow the target to compute address of Y and compare it with X without
+ leaking Y into a register. This combined address + compare pattern
+ allows the target to prevent spilling of any intermediate results by
+ splitting it after register allocator. */
+ seq = targetm.gen_stack_protect_combined_test (x, y, label);
+ }
else
- y = const0_rtx;
+ {
+ if (guard_decl)
+ y = expand_normal (guard_decl);
+ else
+ y = const0_rtx;
+
+ /* Allow the target to compare Y with X without leaking either into
+ a register. */
+ if (targetm.have_stack_protect_test ())
+ seq = targetm.gen_stack_protect_test (x, y, label);
+ }
- /* Allow the target to compare Y with X without leaking either into
- a register. */
- if (targetm.have_stack_protect_test ()
- && ((seq = targetm.gen_stack_protect_test (x, y, label)) != NULL_RTX))
+ if (seq)
emit_insn (seq);
else
emit_cmp_and_jump_insns (x, y, EQ, NULL_RTX, ptr_mode, 1, label);
Index: gcc-8.5.0/gcc/target-insns.def
===================================================================
--- gcc-8.5.0.orig/gcc/target-insns.def
+++ gcc-8.5.0/gcc/target-insns.def
@@ -96,7 +96,9 @@ DEF_TARGET_INSN (sibcall_value, (rtx x0,
DEF_TARGET_INSN (simple_return, (void))
DEF_TARGET_INSN (split_stack_prologue, (void))
DEF_TARGET_INSN (split_stack_space_check, (rtx x0, rtx x1))
+DEF_TARGET_INSN (stack_protect_combined_set, (rtx x0, rtx x1))
DEF_TARGET_INSN (stack_protect_set, (rtx x0, rtx x1))
+DEF_TARGET_INSN (stack_protect_combined_test, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (stack_protect_test, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (store_multiple, (rtx x0, rtx x1, rtx x2))
DEF_TARGET_INSN (tablejump, (rtx x0, rtx x1))

View File

@@ -1,118 +0,0 @@
From 2b40941d23b1570cdd90083b58fa0f66aa58c86e Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 21 May 2021 12:16:56 +0100
Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer
The Linux kernel has removed the interface to cyclades from
the latest kernel headers[1] due to them being orphaned for the
past 13 years.
libsanitizer uses this header when compiling against glibc, but
glibcs itself doesn't seem to have any references to cyclades.
Further more it seems that the driver is broken in the kernel and
the firmware doesn't seem to be available anymore.
As such since this is breaking the build of libsanitizer (and so the
GCC bootstrap[2]) I propose to remove this.
[1] https://lkml.org/lkml/2021/3/2/153
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379
libsanitizer/ChangeLog:
PR sanitizer/100379
* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
---
.../sanitizer_common_interceptors_ioctl.inc | 9 ---------
.../sanitizer_platform_limits_posix.cc | 11 -----------
.../sanitizer_platform_limits_posix.h | 10 ----------
3 files changed, 30 deletions(-)
Index: gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
===================================================================
--- gcc-8.5.0.orig/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -361,15 +361,6 @@ static void ioctl_table_fill() {
#if SANITIZER_LINUX && !SANITIZER_ANDROID
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
- _(CYGETDEFTHRESH, WRITE, sizeof(int));
- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
- _(CYGETTHRESH, WRITE, sizeof(int));
- _(CYGETTIMEOUT, WRITE, sizeof(int));
- _(CYSETDEFTHRESH, NONE, 0);
- _(CYSETDEFTIMEOUT, NONE, 0);
- _(CYSETTHRESH, NONE, 0);
- _(CYSETTIMEOUT, NONE, 0);
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
Index: gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
===================================================================
--- gcc-8.5.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_
# include <sys/procfs.h>
#endif
#include <sys/user.h>
-#include <linux/cyclades.h>
#include <linux/if_eql.h>
#include <linux/if_plip.h>
#include <linux/lp.h>
@@ -464,7 +463,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
#if SANITIZER_LINUX && !SANITIZER_ANDROID
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
#if EV_VERSION > (0x010000)
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
#else
@@ -831,15 +829,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
- unsigned IOCTL_CYGETMON = CYGETMON;
- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
Index: gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- gcc-8.5.0.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ gcc-8.5.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -1004,7 +1004,6 @@ struct __sanitizer_cookie_io_functions_t
#if SANITIZER_LINUX && !SANITIZER_ANDROID
extern unsigned struct_ax25_parms_struct_sz;
- extern unsigned struct_cyclades_monitor_sz;
extern unsigned struct_input_keymap_entry_sz;
extern unsigned struct_ipx_config_data_sz;
extern unsigned struct_kbdiacrs_sz;
@@ -1349,15 +1348,6 @@ struct __sanitizer_cookie_io_functions_t
#endif // SANITIZER_LINUX || SANITIZER_FREEBSD
#if SANITIZER_LINUX && !SANITIZER_ANDROID
- extern unsigned IOCTL_CYGETDEFTHRESH;
- extern unsigned IOCTL_CYGETDEFTIMEOUT;
- extern unsigned IOCTL_CYGETMON;
- extern unsigned IOCTL_CYGETTHRESH;
- extern unsigned IOCTL_CYGETTIMEOUT;
- extern unsigned IOCTL_CYSETDEFTHRESH;
- extern unsigned IOCTL_CYSETDEFTIMEOUT;
- extern unsigned IOCTL_CYSETTHRESH;
- extern unsigned IOCTL_CYSETTIMEOUT;
extern unsigned IOCTL_EQL_EMANCIPATE;
extern unsigned IOCTL_EQL_ENSLAVE;
extern unsigned IOCTL_EQL_GETMASTRCFG;

View File

@@ -0,0 +1,129 @@
require gcc-for-nvcc-common.inc
# Third digit in PV should be incremented after a minor release
PV = "10.3.0"
# BINV should be incremented to a revision after a minor gcc release
BINV = "10.3.0"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc-for-nvcc:${FILE_DIRNAME}/gcc-for-nvcc/backport:"
DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
"
BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
SRC_URI = "\
${BASEURI} \
file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
file://0002-gcc-poison-system-directories.patch \
file://0003-gcc-4.3.3-SYSROOT_CFLAGS_FOR_TARGET.patch \
file://0004-64-bit-multilib-hack.patch \
file://0005-optional-libstdc.patch \
file://0006-COLLECT_GCC_OPTIONS.patch \
file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0008-fortran-cross-compile-hack.patch \
file://0009-cpp-honor-sysroot.patch \
file://0010-MIPS64-Default-to-N64-ABI.patch \
file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
file://0012-gcc-Fix-argument-list-too-long-error.patch \
file://0013-Disable-sdt.patch \
file://0014-libtool.patch \
file://0015-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0017-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
file://0018-export-CPP.patch \
file://0019-Ensure-target-gcc-headers-can-be-included.patch \
file://0020-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
file://0021-Use-SYSTEMLIBS_DIR-replacement-instead-of-hardcoding.patch \
file://0022-aarch64-Add-support-for-musl-ldso.patch \
file://0023-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0024-handle-sysroot-support-for-nativesdk-gcc.patch \
file://0025-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
file://0026-Fix-various-_FOR_BUILD-and-related-variables.patch \
file://0027-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
file://0028-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
file://0029-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
file://0030-sync-gcc-stddef.h-with-musl.patch \
file://0031-fix-segmentation-fault-in-precompiled-header-generat.patch \
file://0032-Fix-for-testsuite-failure.patch \
file://0033-Re-introduce-spe-commandline-options.patch \
file://0034-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
file://0035-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
file://0036-mingw32-Enable-operation_not_supported.patch \
file://0037-libatomic-Do-not-enforce-march-on-aarch64.patch \
file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \
file://0001-CVE-2021-35465.patch \
file://0002-CVE-2021-35465.patch \
file://0003-CVE-2021-35465.patch \
file://0004-CVE-2021-35465.patch \
file://0001-CVE-2021-42574.patch \
file://0002-CVE-2021-42574.patch \
file://0003-CVE-2021-42574.patch \
file://0004-CVE-2021-42574.patch \
file://0005-CVE-2021-42574.patch \
"
SRC_URI[sha256sum] = "64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
# For dev release snapshotting
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${RELEASE}"
#B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
# Language Overrides
FORTRAN = ""
JAVA = ""
SSP ?= "--disable-libssp"
SSP:mingw32 = "--enable-libssp"
EXTRA_OECONF_BASE = "\
${SSP} \
--enable-libitm \
--enable-lto \
--disable-bootstrap \
--with-system-zlib \
${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
--enable-linker-build-id \
--with-ppl=no \
--with-cloog=no \
--enable-checking=release \
--enable-cheaders=c_global \
--without-isl \
"
EXTRA_OECONF_INITIAL = "\
--disable-libgomp \
--disable-libitm \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--enable-linker-build-id \
--enable-decimal-float=no \
--without-isl \
--disable-libssp \
"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
# Is a binutils 2.26 issue, not gcc
CVE_CHECK_IGNORE += "CVE-2021-37322"

View File

@@ -14,7 +14,7 @@ BPN = "gcc"
COMPILERDEP = "virtual/${TARGET_PREFIX}cuda-gcc:do_gcc_stash_builddir" COMPILERDEP = "virtual/${TARGET_PREFIX}cuda-gcc:do_gcc_stash_builddir"
python extract_stashed_builddir () { python extract_stashed_builddir () {
src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-8-stashed-builddir-${TARGET_SYS}") src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-for-nvcc-stashed-builddir-${TARGET_SYS}")
dest = d.getVar("B") dest = d.getVar("B")
oe.path.copyhardlinktree(src, dest) oe.path.copyhardlinktree(src, dest)
staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d) staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
@@ -41,19 +41,13 @@ def get_gcc_ppc_plt_settings(bb, d):
return "--enable-secureplt" return "--enable-secureplt"
return "" return ""
def get_long_double_setting(bb, d):
if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and d.getVar('TCLIBC') in [ 'glibc' ]:
return "--with-long-double-128"
else:
return "--without-long-double-128 libgcc_cv_powerpc_float128=no"
return ""
def get_gcc_multiarch_setting(bb, d): def get_gcc_multiarch_setting(bb, d):
target_arch = d.getVar('TRANSLATED_TARGET_ARCH') target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
multiarch_options = { multiarch_options = {
"i586": "--enable-targets=all", "i586": "--enable-targets=all",
"i686": "--enable-targets=all", "i686": "--enable-targets=all",
"powerpc": "--enable-targets=powerpc64", "powerpc": "--enable-targets=powerpc64",
"powerpc64le": "--enable-targets=powerpcle",
"mips": "--enable-targets=all", "mips": "--enable-targets=all",
"sparc": "--enable-targets=all", "sparc": "--enable-targets=all",
} }
@@ -91,11 +85,7 @@ get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEA
DEBIANNAME:${MLPREFIX}libgcc = "libgcc1" DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
MIRRORS =+ "\ MIRRORS =+ "\
${GNU_MIRROR}/gcc ftp://gcc.gnu.org/pub/gcc/releases/ \n \ ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
${GNU_MIRROR}/gcc ftp://gd.tuwien.ac.at/gnu/gcc/ \n \
${GNU_MIRROR}/gcc http://mirrors.rcn.net/pub/sourceware/gcc/releases/ \n \
${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
${GNU_MIRROR}/gcc http://gcc.get-software.com/releases/ \n \
" "
# #
# Set some default values # Set some default values
@@ -105,7 +95,7 @@ BINV = "${PV}"
#S = "${WORKDIR}/gcc-${PV}" #S = "${WORKDIR}/gcc-${PV}"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}" B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
target_includedir ?= "${includedir}" target_includedir ?= "${includedir}"
target_libdir ?= "${libdir}" target_libdir ?= "${libdir}"

View File

@@ -1,10 +1,12 @@
require gcc-8-multilib-config.inc require gcc-for-nvcc-multilib-config.inc
require gcc-8-shared-source.inc require gcc-for-nvcc-shared-source.inc
# #
# Build the list of lanaguages to build. # Build the list of lanaguages to build.
# #
# These can be overridden by the version specific .inc file. # These can be overridden by the version specific .inc file.
# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
FORTRAN ?= ",f77"
LANGUAGES ?= "c,c++" LANGUAGES ?= "c,c++"
EXTRA_OECONF_BASE ?= "" EXTRA_OECONF_BASE ?= ""
@@ -15,9 +17,9 @@ GCCTHREADS ?= "posix"
GCCPIE ??= "" GCCPIE ??= ""
SYMVERS_CONF ?= "--enable-symvers=gnu"
EXTRA_OECONF = "\ EXTRA_OECONF = "\
--enable-version-specific-runtime-libs \
--with-gxx-include-dir=${includedir}/c++/${BINV} \
${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \ ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
--with-gnu-ld \ --with-gnu-ld \
--enable-shared \ --enable-shared \
@@ -27,19 +29,20 @@ EXTRA_OECONF = "\
${GCCPIE} \ ${GCCPIE} \
--enable-c99 \ --enable-c99 \
--enable-long-long \ --enable-long-long \
--enable-symvers=gnu \ ${SYMVERS_CONF} \
--disable-install-libiberty \
--enable-libstdcxx-pch \ --enable-libstdcxx-pch \
--program-prefix=${TARGET_PREFIX} \ --program-prefix=${TARGET_PREFIX} \
--program-suffix=-${BINV} \
--without-local-prefix \ --without-local-prefix \
--disable-install-libiberty \
${EXTRA_OECONF_BASE} \ ${EXTRA_OECONF_BASE} \
${EXTRA_OECONF_GCC_FLOAT} \ ${EXTRA_OECONF_GCC_FLOAT} \
${EXTRA_OECONF_PATHS} \ ${EXTRA_OECONF_PATHS} \
${@get_gcc_mips_plt_setting(bb, d)} \ ${@get_gcc_mips_plt_setting(bb, d)} \
${@get_gcc_ppc_plt_settings(bb, d)} \ ${@get_gcc_ppc_plt_settings(bb, d)} \
${@get_long_double_setting(bb, d)} \
${@get_gcc_multiarch_setting(bb, d)} \ ${@get_gcc_multiarch_setting(bb, d)} \
--enable-standard-branch-protection \
--enable-version-specific-runtime-libs \
--program-suffix=-${BINV} \
" "
# glibc version is a minimum controlling whether features are enabled. # glibc version is a minimum controlling whether features are enabled.
@@ -102,6 +105,7 @@ do_configure () {
export LD_FOR_TARGET="${HOST_PREFIX}ld" export LD_FOR_TARGET="${HOST_PREFIX}ld"
export NM_FOR_TARGET="${HOST_PREFIX}nm" export NM_FOR_TARGET="${HOST_PREFIX}nm"
export AR_FOR_TARGET="${HOST_PREFIX}ar" export AR_FOR_TARGET="${HOST_PREFIX}ar"
export GFORTRAN_FOR_TARGET="gfortran"
export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib" export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
fi fi
export CC_FOR_BUILD="${BUILD_CC}" export CC_FOR_BUILD="${BUILD_CC}"

View File

@@ -1,13 +1,13 @@
inherit cross-canadian inherit cross-canadian
SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)" SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
PN = "gcc-8-cross-canadian-${TRANSLATED_TARGET_ARCH}" PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc" DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
GCCMULTILIB = "--enable-multilib" GCCMULTILIB = "--enable-multilib"
require gcc-8-configure-common.inc require gcc-for-nvcc-configure-common.inc
EXTRA_OECONF_PATHS = "\ EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \ --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
@@ -45,6 +45,9 @@ export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}" export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
do_configure () { do_configure () {
if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
fi
export CC_FOR_BUILD="${BUILD_CC}" export CC_FOR_BUILD="${BUILD_CC}"
export CXX_FOR_BUILD="${BUILD_CXX}" export CXX_FOR_BUILD="${BUILD_CXX}"
export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}" export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
@@ -121,11 +124,15 @@ do_install () {
dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/ dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
install -d $dest install -d $dest
suffix=${EXEEXT} suffix=${EXEEXT}
for t in ar as ld nm objcopy objdump ranlib strip; do for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do
if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
continue
fi
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
done done
for t in gcc cpp; do for t in gcc cpp; do
ln -sf ${BINRELPATH}/${TARGET_PREFIX}${t}${BINV}$suffix $dest${t}${BINV}$suffix ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t-${BINV}$suffix $dest$t-${BINV}$suffix
done done
t=real-ld t=real-ld
ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld$suffix $dest$t$suffix ln -sf ${BINRELPATH}/${TARGET_PREFIX}ld$suffix $dest$t$suffix
@@ -136,7 +143,7 @@ do_install () {
cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
chown -R root:root ${D} chown -R root:root ${D}
cross_canadian_bindirlinks cross_canadian_bindirlinks
for i in linux ${CANADIANEXTRAOS} for i in linux ${CANADIANEXTRAOS}
@@ -145,7 +152,7 @@ do_install () {
do do
d=${D}${bindir}/../${TARGET_ARCH}$v-$i d=${D}${bindir}/../${TARGET_ARCH}$v-$i
install -d $d install -d $d
for j in ${TARGET_PREFIX}gcc-${BINV}${EXEEXT} ${TARGET_PREFIX}g++-${BINV}${EXEEXT} for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT}
do do
p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,` p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
case $i in case $i in
@@ -164,7 +171,7 @@ do_install () {
} }
ELFUTILS = "nativesdk-elfutils" ELFUTILS = "nativesdk-elfutils"
DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib" DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib nativesdk-zstd"
RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}" RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
SYSTEMHEADERS = "${target_includedir}/" SYSTEMHEADERS = "${target_includedir}/"
@@ -172,9 +179,6 @@ SYSTEMLIBS = "${target_base_libdir}/"
SYSTEMLIBS1 = "${target_libdir}/" SYSTEMLIBS1 = "${target_libdir}/"
EXTRA_OECONF += "--enable-poison-system-directories" EXTRA_OECONF += "--enable-poison-system-directories"
EXTRA_OECONF:remove:elf = "--with-sysroot=/not/exist"
EXTRA_OECONF:remove:eabi = "--with-sysroot=/not/exist"
EXTRA_OECONF:append:elf = " --without-headers --with-newlib"
EXTRA_OECONF:append:eabi = " --without-headers --with-newlib"
# gcc 4.7 needs -isystem # gcc 4.7 needs -isystem
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}" export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"

View File

@@ -0,0 +1,5 @@
require gcc-for-nvcc-${PV}.inc
require gcc-for-nvcc-cross-canadian.inc

View File

@@ -9,19 +9,19 @@ python () {
d.setVar("EXTRADEPENDS", "linux-libc-headers") d.setVar("EXTRADEPENDS", "linux-libc-headers")
} }
PN = "gcc-8-cross-${TARGET_ARCH}" PN = "gcc-for-nvcc-cross-${TARGET_ARCH}"
# Ignore how TARGET_ARCH is computed. # Ignore how TARGET_ARCH is computed.
TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
require gcc-8-configure-common.inc require gcc-for-nvcc-configure-common.inc
# While we want the 'gnu' hash style, we explicitly set it to sysv here to # While we want the 'gnu' hash style, we explicitly set it to sysv here to
# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to # ensure that any recipe which doesn't obey our LDFLAGS (which also set it to
# gnu) will hit a QA failure. # gnu) will hit a QA failure.
LINKER_HASH_STYLE ?= "sysv" LINKER_HASH_STYLE ?= "sysv"
EXTRA_OECONF += "--enable-poison-system-directories" EXTRA_OECONF += "--enable-poison-system-directories=error"
EXTRA_OECONF:append:sh4 = " \ EXTRA_OECONF:append:sh4 = " \
--with-multilib-list= \ --with-multilib-list= \
--enable-incomplete-targets \ --enable-incomplete-targets \
@@ -77,7 +77,6 @@ do_compile () {
oe_runmake all-host configure-target-libgcc oe_runmake all-host configure-target-libgcc
(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h) (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
} }
INHIBIT_PACKAGE_STRIP = "1" INHIBIT_PACKAGE_STRIP = "1"
@@ -100,12 +99,11 @@ do_install () {
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
done done
# These are from this recipe, add suffix # These are from this recipe, and we built with version suffix
for t in gcc cpp; do for t in gcc cpp; do
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t-${BINV} $dest$t ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t-${BINV} $dest$t
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t-${BINV} ${dest}${TARGET_PREFIX}$t ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t-${BINV} ${dest}${TARGET_PREFIX}$t
done done
dest=${D}${exec_prefix}/bin/${TARGET_SYS}-${BINV}/ dest=${D}${exec_prefix}/bin/${TARGET_SYS}-${BINV}/
install -d $dest install -d $dest
for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip; do
@@ -126,6 +124,7 @@ do_install () {
cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f find ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed -type f -not -name "README" -not -name limits.h -not -name syslimits.h | xargs rm -f
} }
do_package[noexec] = "1" do_package[noexec] = "1"
@@ -155,8 +154,8 @@ do_gcc_stash_builddir () {
addtask do_gcc_stash_builddir after do_compile before do_install addtask do_gcc_stash_builddir after do_compile before do_install
SSTATETASKS += "do_gcc_stash_builddir" SSTATETASKS += "do_gcc_stash_builddir"
do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}" do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}"
do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-8-stashed-builddir-${TARGET_SYS}" do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-for-nvcc-stashed-builddir-${TARGET_SYS}"
do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-8-stashed-builddir-${TARGET_SYS}" do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-for-nvcc-stashed-builddir-${TARGET_SYS}"
python do_gcc_stash_builddir_setscene () { python do_gcc_stash_builddir_setscene () {
sstate_setscene(d) sstate_setscene(d)

View File

@@ -0,0 +1,3 @@
require gcc-for-nvcc-${PV}.inc
require gcc-for-nvcc-cross.inc

View File

@@ -1,6 +1,6 @@
inherit crosssdk inherit crosssdk
PN = "gcc-8-crosssdk-${SDK_SYS}" PN = "gcc-for-nvcc-crosssdk-${SDK_SYS}"
SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include" SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/" SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"

View File

@@ -0,0 +1,2 @@
require gcc-for-nvcc-cross_${PV}.bb
require gcc-for-nvcc-crosssdk.inc

View File

@@ -31,7 +31,9 @@ python gcc_multilib_setup() {
'%s/*/linux64.h' % src_conf_dir, '%s/*/linux64.h' % src_conf_dir,
'%s/aarch64/t-aarch64' % src_conf_dir, '%s/aarch64/t-aarch64' % src_conf_dir,
'%s/aarch64/aarch64.h' % src_conf_dir, '%s/aarch64/aarch64.h' % src_conf_dir,
'%s/aarch64/aarch64-linux.h' % src_conf_dir,
'%s/aarch64/aarch64-cores.def' % src_conf_dir, '%s/aarch64/aarch64-cores.def' % src_conf_dir,
'%s/arm/linux-eabi.h' % src_conf_dir,
'%s/*/linux.h' % src_conf_dir, '%s/*/linux.h' % src_conf_dir,
'%s/linux.h' % src_conf_dir) '%s/linux.h' % src_conf_dir)
@@ -102,6 +104,8 @@ python gcc_multilib_setup() {
r'\1' + wrap_libdir(libdir64) + r'\3'), r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$', (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'), r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$', (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'), r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$', (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
@@ -112,8 +116,18 @@ python gcc_multilib_setup() {
r'\1' + wrap_libdir(libdir64) + r'\3'), r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$', (r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirn32) + r'\3'), r'\1' + wrap_libdir(libdirn32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$', (r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'), r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
] ]
for (i, line) in enumerate(filelines): for (i, line) in enumerate(filelines):
@@ -138,15 +152,15 @@ python gcc_multilib_setup() {
} }
gcc_header_config_files = { gcc_header_config_files = {
'x86_64' : ['gcc/config/i386/linux64.h'], 'x86_64' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
'i586' : ['gcc/config/i386/linux64.h'], 'i586' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
'i686' : ['gcc/config/i386/linux64.h'], 'i686' : ['gcc/config/linux.h', 'gcc/config/i386/linux64.h'],
'mips' : ['gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'], 'mips' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
'mips64' : ['gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'], 'mips64' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
'powerpc' : ['gcc/config/rs6000/linux64.h'], 'powerpc' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
'powerpc64' : ['gcc/config/rs6000/linux64.h'], 'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
'aarch64' : ['gcc/config/aarch64/aarch64.h'], 'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
'arm' : ['gcc/config/aarch64/aarch64.h'], 'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
} }
libdir32 = 'SYSTEMLIBS_DIR' libdir32 = 'SYSTEMLIBS_DIR'

View File

@@ -1,8 +1,8 @@
require gcc-8-configure-common.inc require gcc-for-nvcc-configure-common.inc
SUMMARY = "Runtime libraries from GCC" SUMMARY = "Runtime libraries from GCC"
# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3" # Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPL-3.0-only"
# All gcc-runtime packages are now covered by the runtime exception. # All gcc-runtime packages are now covered by the runtime exception.
LICENSE = "GPL-3.0-with-GCC-exception" LICENSE = "GPL-3.0-with-GCC-exception"
@@ -16,6 +16,19 @@ EXTRA_OECONF_PATHS = "\
EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu" EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
EXTRA_OECONF:append = " --cache-file=${B}/config.cache" EXTRA_OECONF:append = " --cache-file=${B}/config.cache"
EXTRA_OECONF:append:libc-newlib = " --with-newlib"
# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no "
DISABLE_STATIC:class-nativesdk ?= ""
# Newlib does not support symbol versioning on libsdtcc++
SYMVERS_CONF:libc-newlib = ""
# Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm"
RUNTIMELIBITM = "libitm" RUNTIMELIBITM = "libitm"
RUNTIMELIBITM:arc = "" RUNTIMELIBITM:arc = ""
@@ -27,22 +40,35 @@ RUNTIMELIBITM:riscv64 = ""
RUNTIMELIBSSP ?= "" RUNTIMELIBSSP ?= ""
RUNTIMELIBSSP:mingw32 ?= "libssp" RUNTIMELIBSSP:mingw32 ?= "libssp"
RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM}" RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
"
# Only build libstdc++ for newlib
RUNTIMETARGET:libc-newlib = "libstdc++-v3"
SLIB = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}" # libiberty
SLIB_NEW = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" # libgfortran needs separate recipe due to libquadmath dependency
# Relative path to be repaced into debug info
REL_S = "/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
DEBUG_PREFIX_MAP:class-target = " \ DEBUG_PREFIX_MAP:class-target = " \
-fdebug-prefix-map=${WORKDIR}/recipe-sysroot= \ -fdebug-prefix-map=${WORKDIR}/${MLPREFIX}recipe-sysroot= \
-fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \ -fdebug-prefix-map=${WORKDIR}/recipe-sysroot-native= \
-fdebug-prefix-map=${SLIB}=${SLIB_NEW} \ -fdebug-prefix-map=${S}=${REL_S} \
-fdebug-prefix-map=${SLIB}/include=${SLIB_NEW}/libstdc++-v3/../include \ -fdebug-prefix-map=${S}/include=${REL_S}/libstdc++-v3/../include \
-fdebug-prefix-map=${SLIB}/libiberty=${SLIB_NEW}/libstdc++-v3/../libiberty \ -fdebug-prefix-map=${S}/libiberty=${REL_S}/libstdc++-v3/../libiberty \
-fdebug-prefix-map=${B}=${SLIB_NEW} \ -fdebug-prefix-map=${S}/libgcc=${REL_S}/libstdc++-v3/../libgcc \
-fdebug-prefix-map=${B}=${REL_S} \
-ffile-prefix-map=${B}/${HOST_SYS}/libstdc++-v3/include=${includedir}/c++/${BINV} \
" "
do_configure () { do_configure () {
export CXX="${CXX} -nostdinc++ -nostdlib++" export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
# tests. Create a dummy empty lib for the purposes of configure.
mkdir -p ${WORKDIR}/dummylib
${CC} -x c /dev/null -nostartfiles -shared -o ${WORKDIR}/dummylib/libstdc++.so
for d in libgcc ${RUNTIMETARGET}; do for d in libgcc ${RUNTIMETARGET}; do
echo "Configuring $d" echo "Configuring $d"
rm -rf ${B}/${TARGET_SYS}/$d/ rm -rf ${B}/${TARGET_SYS}/$d/
@@ -135,9 +161,8 @@ do_install:append:class-target () {
} }
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "virtual/${TARGET_PREFIX}cuda-gcc virtual/${TARGET_PREFIX}cuda-g++ libgcc-8 virtual/${MLPREFIX}libc virtual/${TARGET_PREFIX}compilerlibs" DEPENDS = "virtual/${TARGET_PREFIX}cuda-gcc virtual/${TARGET_PREFIX}cuda-g++ libgcc-for-nvcc libgcc virtual/${MLPREFIX}libc"
STAGING_BINDIR_TOOLCHAIN:append = "-${BINV}" STAGING_BINDIR_TOOLCHAIN:append = "-${BINV}"
#PROVIDES = "virtual/${TARGET_PREFIX}cuda-compilerlibs"
BBCLASSEXTEND = "nativesdk" BBCLASSEXTEND = "nativesdk"

View File

@@ -0,0 +1,2 @@
require gcc-for-nvcc-${PV}.inc
require gcc-for-nvcc-runtime.inc

View File

@@ -0,0 +1,21 @@
do_fetch() {
:
}
do_fetch[noexec] = "1"
deltask do_unpack
deltask do_patch
SRC_URI = ""
do_configure[depends] += "gcc-for-nvcc-source-${PV}:do_preconfigure"
do_populate_lic[depends] += "gcc-for-nvcc-source-${PV}:do_unpack"
do_deploy_source_date_epoch[depends] += "gcc-for-nvcc-source-${PV}:do_deploy_source_date_epoch"
# Copy the SDE from the shared workdir to the recipe workdir
do_deploy_source_date_epoch () {
sde_file=${SDE_FILE}
sde_file=${sde_file#${WORKDIR}/}
mkdir -p ${SDE_DEPLOYDIR} $(dirname ${SDE_FILE})
cp -p $(dirname ${S})/$sde_file ${SDE_DEPLOYDIR}
cp -p $(dirname ${S})/$sde_file ${SDE_FILE}
}

View File

@@ -7,7 +7,7 @@ RM_WORK_EXCLUDE += "${PN}"
inherit nopackages inherit nopackages
PN = "gcc-source-${PV}" PN = "gcc-for-nvcc-source-${PV}"
WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}" WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:" SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:"
@@ -17,15 +17,21 @@ STAMPCLEAN = "${STAMPS_DIR}/work-shared/gcc-${PV}-*"
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "" DEPENDS = ""
PACKAGES = "" PACKAGES = ""
TARGET_ARCH = "allarch"
TARGET_AS_ARCH = "none"
TARGET_CC_ARCH = "none"
TARGET_LD_ARCH = "none"
TARGET_OS = "linux"
baselib = "lib"
PACKAGE_ARCH = "all"
B = "${WORKDIR}/build"
# This needs to be Python to avoid lots of shell variables becoming dependencies. # This needs to be Python to avoid lots of shell variables becoming dependencies.
python do_preconfigure () { python do_preconfigure () {
import subprocess import subprocess
cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize') cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
# See 0044-gengtypes.patch, we need to regenerate this file
bb.utils.remove(d.expand("${S}/gcc/gengtype-lex.c"))
cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure") cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure")
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)

View File

@@ -0,0 +1,4 @@
require gcc-for-nvcc-${PV}.inc
require gcc-for-nvcc-source.inc
EXCLUDE_FROM_WORLD = "1"

View File

@@ -1,8 +1,7 @@
GCCMULTILIB = "--enable-multilib" GCCMULTILIB = "--enable-multilib"
require gcc-8-configure-common.inc require gcc-for-nvcc-configure-common.inc
DEPENDS += "virtual/${TARGET_PREFIX}cuda-gcc" DEPENDS += "virtual/${TARGET_PREFIX}/cuda-gcc"
SECURITY_STRINGFORMAT = "-Wformat -Wformat-security"
EXTRA_OECONF_PATHS = "\ EXTRA_OECONF_PATHS = "\
--with-build-sysroot=${STAGING_DIR_TARGET} \ --with-build-sysroot=${STAGING_DIR_TARGET} \
@@ -22,6 +21,7 @@ EXTRA_OECONF:append:armv6:class-target = " --with-arch=armv6${ARMFPARCHEXT}"
EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}" EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}" EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}" EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}"
EXTRA_OECONF:append:x86-64:class-target = " --with-arch=native"
# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is # libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
# set in subdir gcc, so subdir libcc1 can't use it, export it here to # set in subdir gcc, so subdir libcc1 can't use it, export it here to
@@ -32,9 +32,9 @@ EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
PACKAGES = "\ PACKAGES = "\
${PN} ${PN}-plugins ${PN}-symlinks \ ${PN} ${PN}-plugins ${PN}-symlinks \
g++-8 g++-8-symlinks \ g++-for-nvcc g++-for-nvcc-symlinks \
cpp-8 cpp-8-symlinks \ cpp-for-nvcc cpp-for-nvcc-symlinks \
gcov-8 gcov-8-symlinks \ gcov-for-nvcc gcov-for-nvcc-symlinks \
${PN}-doc \ ${PN}-doc \
${PN}-dev \ ${PN}-dev \
${PN}-dbg \ ${PN}-dbg \
@@ -42,8 +42,9 @@ PACKAGES = "\
FILES:${PN} = "\ FILES:${PN} = "\
${bindir}/${TARGET_PREFIX}gcc* \ ${bindir}/${TARGET_PREFIX}gcc* \
${bindir}/${TARGET_PREFIX}lto* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/g++-mapper-server \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
@@ -78,29 +79,54 @@ FILES:${PN}-plugins = "\
" "
ALLOW_EMPTY:${PN}-plugins = "1" ALLOW_EMPTY:${PN}-plugins = "1"
FILES:cpp-8 = "\ FILES:g77 = "\
${bindir}/${TARGET_PREFIX}g77 \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
"
FILES:g77-symlinks = "\
${bindir}/g77 \
${bindir}/f77 \
"
RRECOMMENDS:g77 = "\
libg2c \
libg2c-dev \
"
FILES:gfortran = "\
${bindir}/${TARGET_PREFIX}gfortran \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
"
RRECOMMENDS:gfortran = "\
libquadmath \
libquadmath-dev \
"
FILES:gfortran-symlinks = "\
${bindir}/gfortran \
${bindir}/f95"
FILES:cpp-for-nvcc = "\
${bindir}/${TARGET_PREFIX}cpp* \ ${bindir}/${TARGET_PREFIX}cpp* \
${base_libdir}/gcc/${TARGET_SYS}/${BINV}/cpp \ ${base_libdir}/gcc/${TARGET_SYS}/${BINV}/cpp \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1" ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
FILES:cpp-8-symlinks = "${bindir}/cpp-${BINV}" FILES:cpp-for-nvcc-symlinks = "${bindir}/cpp-${BINV}"
FILES:gcov-8 = "${bindir}/${TARGET_PREFIX}gcov-${BINV} \ FILES:gcov-for-nvcc = "${bindir}/${TARGET_PREFIX}gcov-${BINV} \
${bindir}/${TARGET_PREFIX}gcov-tool-${BINV} \ ${bindir}/${TARGET_PREFIX}gcov-tool-${BINV} \
${bindir}/${TARGET_PREFIX}gcov-dump-${BINV} \ ${bindir}/${TARGET_PREFIX}gcov-dump-${BINV} \
" "
FILES:gcov-8-symlinks = "${bindir}/gcov-${BINV} \ FILES:gcov-for-nvcc-symlinks = "${bindir}/gcov-${BINV} \
${bindir}/gcov-tool-${BINV} \ ${bindir}/gcov-tool-${BINV} \
" "
FILES:g++-8 = "\ FILES:g++-for-nvcc = "\
${bindir}/${TARGET_PREFIX}g++* \ ${bindir}/${TARGET_PREFIX}g++ \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \ ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
" "
FILES:g++-8-symlinks = "\ FILES:g++-for-nvcc-symlinks = "\
${bindir}/c++-${BINV} \ ${bindir}/c++-${BINV} \
${bindir}/g++-${BINV} \ ${bindir}/g++-${BINV} \
" "
RRECOMMENDS:g++-${BINV} = "\ RRECOMMENDS:g++-for-nvcc = "\
libstdc++ \ libstdc++ \
libstdc++-dev \ libstdc++-dev \
libatomic \ libatomic \
@@ -168,15 +194,15 @@ do_install () {
# Not sure why we end up with these but we don't want them... # Not sure why we end up with these but we don't want them...
rm -f ${TARGET_PREFIX}${TARGET_PREFIX}* rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
# Symlinks so we can use these trivially on the target
ln -sf ${TARGET_PREFIX}g++-${BINV} g++-${BINV} ln -sf ${TARGET_PREFIX}g++-${BINV} g++-${BINV}
ln -sf ${TARGET_PREFIX}gcc-${BINV} gcc-${BINV} ln -sf ${TARGET_PREFIX}gcc-${BINV} gcc-${BINV}
ln -sf ${TARGET_PREFIX}cpp-${BINV} cpp-${BINV} ln -sf ${TARGET_PREFIX}cpp-${BINV} cpp-${BINV}
ln -sf ${TARGET_PREFIX}gcov-${BINV} gcov-${BINV} ln -sf ${TARGET_PREFIX}gcov-${BINV} gcov-${BINV}
ln -sf ${TARGET_PREFIX}gcov-tool-${BINV} gcov-tool-${BINV} ln -sf ${TARGET_PREFIX}gcov-tool-${BINV} gcov-tool-${BINV}
install -d ${D}${base_libdir}
ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
ln -sf g++-${BINV} c++-${BINV} ln -sf g++-${BINV} c++-${BINV}
ln -sf gcc-${BINV} cc-${BINV} ln -sf gcc-${BINV} cc-${BINV}
chown -R root:root ${D} chown -R root:root ${D}
} }

View File

@@ -0,0 +1,138 @@
From 3929bca9ca95de9d35e82ae8828b188029e3eb70 Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 11 Jun 2021 16:02:05 +0100
Subject: [PATCH] arm: Add command-line option for enabling CVE-2021-35465
mitigation [PR102035]
Add a new option, -mfix-cmse-cve-2021-35465 and document it. Enable it
automatically for cortex-m33, cortex-m35p and cortex-m55.
gcc:
PR target/102035
* config/arm/arm.opt (mfix-cmse-cve-2021-35465): New option.
* doc/invoke.texi (Arm Options): Document it.
* config/arm/arm-cpus.in (quirk_vlldm): New feature bit.
(ALL_QUIRKS): Add quirk_vlldm.
(cortex-m33): Add quirk_vlldm.
(cortex-m35p, cortex-m55): Likewise.
* config/arm/arm.c (arm_option_override): Enable fix_vlldm if
targetting an affected CPU and not explicitly controlled on
the command line.
CVE: CVE-2021-35465
Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=3929bca9ca95de9d35e82ae8828b188029e3eb70]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
gcc/config/arm/arm-cpus.in | 9 +++++++--
gcc/config/arm/arm.c | 9 +++++++++
gcc/config/arm/arm.opt | 4 ++++
gcc/doc/invoke.texi | 9 +++++++++
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
--- a/gcc/config/arm/arm.c 2020-07-22 23:35:17.344384552 -0700
+++ b/gcc/config/arm/arm.c 2021-11-11 20:16:19.761241867 -0800
@@ -3610,6 +3610,15 @@ arm_option_override (void)
fix_cm3_ldrd = 0;
}
+ /* Enable fix_vlldm by default if required. */
+ if (fix_vlldm == 2)
+ {
+ if (bitmap_bit_p (arm_active_target.isa, isa_bit_quirk_vlldm))
+ fix_vlldm = 1;
+ else
+ fix_vlldm = 0;
+ }
+
/* Hot/Cold partitioning is not currently supported, since we can't
handle literal pool placement in that case. */
if (flag_reorder_blocks_and_partition)
diff --git a/gcc/config/arm/arm-cpus.in b/gcc/config/arm/arm-cpus.in
--- a/gcc/config/arm/arm-cpus.in 2020-07-22 23:35:17.340384509 -0700
+++ b/gcc/config/arm/arm-cpus.in 2021-11-11 20:17:01.364573561 -0800
@@ -186,6 +186,9 @@ define feature quirk_armv6kz
# Cortex-M3 LDRD quirk.
define feature quirk_cm3_ldrd
+# v8-m/v8.1-m VLLDM errata.
+define feature quirk_vlldm
+
# Don't use .cpu assembly directive
define feature quirk_no_asmcpu
@@ -322,7 +325,7 @@ define implied vfp_base MVE MVE_FP ALL_F
# architectures.
# xscale isn't really a 'quirk', but it isn't an architecture either and we
# need to ignore it for matching purposes.
-define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd xscale quirk_no_asmcpu
+define fgroup ALL_QUIRKS quirk_no_volatile_ce quirk_armv6kz quirk_cm3_ldrd quirk_vlldm xscale quirk_no_asmcpu
# Architecture entries
# format:
@@ -1524,6 +1527,7 @@ begin cpu cortex-m33
architecture armv8-m.main+dsp+fp
option nofp remove ALL_FP
option nodsp remove armv7em
+ isa quirk_vlldm
costs v7m
end cpu cortex-m33
@@ -1533,6 +1537,7 @@ begin cpu cortex-m35p
architecture armv8-m.main+dsp+fp
option nofp remove ALL_FP
option nodsp remove armv7em
+ isa quirk_vlldm
costs v7m
end cpu cortex-m35p
@@ -1544,7 +1549,7 @@ begin cpu cortex-m55
option nomve remove mve mve_float
option nofp remove ALL_FP mve_float
option nodsp remove MVE mve_float
- isa quirk_no_asmcpu
+ isa quirk_no_asmcpu quirk_vlldm
costs v7m
vendor 41
end cpu cortex-m55
diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt
--- a/gcc/config/arm/arm.opt 2020-07-22 23:35:17.344384552 -0700
+++ b/gcc/config/arm/arm.opt 2021-11-11 20:16:19.761241867 -0800
@@ -271,6 +271,10 @@ Target Report Var(fix_cm3_ldrd) Init(2)
Avoid overlapping destination and address registers on LDRD instructions
that may trigger Cortex-M3 errata.
+mfix-cmse-cve-2021-35465
+Target Var(fix_vlldm) Init(2)
+Mitigate issues with VLLDM on some M-profile devices (CVE-2021-35465).
+
munaligned-access
Target Report Var(unaligned_access) Init(2) Save
Enable unaligned word and halfword accesses to packed data.
diff -upr a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
--- a/gcc/doc/invoke.texi 2021-11-11 19:30:56.264523105 -0800
+++ b/gcc/doc/invoke.texi 2021-11-11 20:16:19.769241739 -0800
@@ -774,6 +774,7 @@ Objective-C and Objective-C++ Dialects}.
-mverbose-cost-dump @gol
-mpure-code @gol
-mcmse @gol
+-mfix-cmse-cve-2021-35465 @gol
-mfdpic}
@emph{AVR Options}
@@ -21266,6 +21267,14 @@ Use multiply and add/subtract instructio
Do not use multiply and add/subtract instructions.
+@item -mfix-cmse-cve-2021-35465
+@opindex mfix-cmse-cve-2021-35465
+Mitigate against a potential security issue with the @code{VLLDM} instruction
+in some M-profile devices when using CMSE (CVE-2021-365465). This option is
+enabled by default when the option @option{-mcpu=} is used with
+@code{cortex-m33}, @code{cortex-m35p} or @code{cortex-m55}. The option
+@option{-mno-fix-cmse-cve-2021-35465} can be used to disable the mitigation.
+
@item -mfdpic
@opindex mfdpic

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
From d7b284a9bede9d5059ad7e95a867254bf913c638 Mon Sep 17 00:00:00 2001 From f2a5dc3bc7e5727d6bf77e1c6e8a31a6f000883d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:37:11 +0400 Date: Fri, 29 Mar 2013 08:37:11 +0400
Subject: [PATCH 01/40] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
@@ -11,11 +11,11 @@ Upstream-Status: Inappropriate [embedded specific]
configure.ac | 2 +- configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-) 2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/configure diff --git a/configure b/configure
=================================================================== index 4cc938ebb7d..226a64939d1 100755
--- gcc-8.5.0.orig/configure --- a/configure
+++ gcc-8.5.0/configure +++ b/configure
@@ -7507,7 +7507,7 @@ fi @@ -7722,7 +7722,7 @@ fi
# for target_alias and gcc doesn't manage it consistently. # for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}" target_configargs="--cache-file=./config.cache ${target_configargs}"
@@ -24,11 +24,11 @@ Index: gcc-8.5.0/configure
case " $target_configdirs " in case " $target_configdirs " in
*" newlib "*) *" newlib "*)
case " $target_configargs " in case " $target_configargs " in
Index: gcc-8.5.0/configure.ac diff --git a/configure.ac b/configure.ac
=================================================================== index c78d9cbea62..f024f4bac9b 100644
--- gcc-8.5.0.orig/configure.ac --- a/configure.ac
+++ gcc-8.5.0/configure.ac +++ b/configure.ac
@@ -3096,7 +3096,7 @@ fi @@ -3227,7 +3227,7 @@ fi
# for target_alias and gcc doesn't manage it consistently. # for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}" target_configargs="--cache-file=./config.cache ${target_configargs}"

View File

@@ -0,0 +1,208 @@
From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 15 Jan 2021 13:12:59 +0100
Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454]
The recent changes to error on mixing -march=i386 and -fcf-protection broke
bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it
only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't
on by default already). Similarly, it will not use ifuncs if -mcx16
(or -march=i686 for 32-bit) is on by default.
2021-01-15 Jakub Jelinek <jakub@redhat.com>
PR target/70454
libatomic/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed
based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8.
libgomp/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
libitm/
* configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to
be added through preprocessor check on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
Upstream-Status: Backport [master post 10.x release]
---
libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------
libgomp/configure.tgt | 35 +++++++++++---------------
libitm/configure.tgt | 37 +++++++++++++--------------
3 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 5dd0926d20..6ea082a29b 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -81,32 +81,40 @@ case "${target_cpu}" in
ARCH=sparc
;;
- i[3456]86)
- case " ${CC} ${CFLAGS} " in
- *" -m64 "*|*" -mx32 "*)
- ;;
- *)
- if test -z "$with_arch"; then
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
- fi
- esac
- ARCH=x86
- # ??? Detect when -march=i686 is already enabled.
- try_ifunc=yes
- ;;
- x86_64)
- case " ${CC} ${CFLAGS} " in
- *" -m32 "*)
+ i[3456]86 | x86_64)
+ cat > conftestx.c <<EOF
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+#error need -march=i486
+#endif
+EOF
+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
+ :
+ else
+ if test "${target_cpu}" = x86_64; then
XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
- ;;
- *)
- ;;
- esac
+ else
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ fi
+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
+ fi
+ cat > conftestx.c <<EOF
+#ifdef __x86_64__
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
+#error need -mcx16
+#endif
+#else
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
+#error need -march=i686
+#endif
+#endif
+EOF
+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
+ try_ifunc=no
+ else
+ try_ifunc=yes
+ fi
+ rm -f conftestx.c
ARCH=x86
- # ??? Detect when -mcx16 is already enabled.
- try_ifunc=yes
;;
*) ARCH="${target_cpu}" ;;
diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt
index 4790a31e39..761ef2a7db 100644
--- a/libgomp/configure.tgt
+++ b/libgomp/configure.tgt
@@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then
;;
# Note that bare i386 is not included here. We need cmpxchg.
- i[456]86-*-linux*)
+ i[456]86-*-linux* | x86_64-*-linux*)
config_path="linux/x86 linux posix"
- case " ${CC} ${CFLAGS} " in
- *" -m64 "*|*" -mx32 "*)
- ;;
- *)
- if test -z "$with_arch"; then
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
- fi
- esac
- ;;
-
- # Similar jiggery-pokery for x86_64 multilibs, except here we
- # can't rely on the --with-arch configure option, since that
- # applies to the 64-bit side.
- x86_64-*-linux*)
- config_path="linux/x86 linux posix"
- case " ${CC} ${CFLAGS} " in
- *" -m32 "*)
+ cat > conftestx.c <<EOF
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+#error need -march=i486
+#endif
+EOF
+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
+ :
+ else
+ if test "${target_cpu}" = x86_64; then
XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
- ;;
- esac
+ else
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ fi
+ fi
+ rm -f conftestx.c
;;
# Note that sparcv7 and sparcv8 is not included here. We need cas.
diff --git a/libitm/configure.tgt b/libitm/configure.tgt
index 04109160e9..ca62bac627 100644
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -58,16 +58,23 @@ case "${target_cpu}" in
arm*) ARCH=arm ;;
- i[3456]86)
- case " ${CC} ${CFLAGS} " in
- *" -m64 "*|*" -mx32 "*)
- ;;
- *)
- if test -z "$with_arch"; then
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
- fi
- esac
+ i[3456]86 | x86_64)
+ cat > conftestx.c <<EOF
+#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
+#error need -march=i486
+#endif
+EOF
+ if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then
+ :
+ else
+ if test "${target_cpu}" = x86_64; then
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
+ else
+ XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}"
+ fi
+ XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
+ fi
+ rm -f conftestx.c
XCFLAGS="${XCFLAGS} -mrtm"
ARCH=x86
;;
@@ -102,16 +109,6 @@ case "${target_cpu}" in
ARCH=sparc
;;
- x86_64)
- case " ${CC} ${CFLAGS} " in
- *" -m32 "*)
- XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic"
- XCFLAGS="${XCFLAGS} -fomit-frame-pointer"
- ;;
- esac
- XCFLAGS="${XCFLAGS} -mrtm"
- ARCH=x86
- ;;
s390|s390x)
XCFLAGS="${XCFLAGS} -mzarch -mhtm"
ARCH=s390

View File

@@ -0,0 +1,40 @@
From 574e7950bd6b34e9e2cacce18c802b45505d1d0a Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 18 Jun 2021 17:16:25 +0100
Subject: [PATCH] arm: add erratum mitigation to __gnu_cmse_nonsecure_call
[PR102035]
Add the recommended erratum mitigation sequence to
__gnu_cmse_nonsecure_call for use on Armv8-m.main devices. Since this
is in the library code we cannot know in advance whether the core we
are running on will be affected by this, so always enable it.
libgcc:
PR target/102035
* config/arm/cmse_nonsecure_call.S (__gnu_cmse_nonsecure_call):
Add vlldm erratum work-around.
CVE: CVE-2021-35465
Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=574e7950bd6b34e9e2cacce18c802b45505d1d0a]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
libgcc/config/arm/cmse_nonsecure_call.S | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libgcc/config/arm/cmse_nonsecure_call.S b/libgcc/config/arm/cmse_nonsecure_call.S
index 00830ade98e..c8e0fbbe665 100644
--- a/libgcc/config/arm/cmse_nonsecure_call.S
+++ b/libgcc/config/arm/cmse_nonsecure_call.S
@@ -102,6 +102,11 @@ blxns r4
#ifdef __ARM_PCS_VFP
vpop.f64 {d8-d15}
#else
+/* VLLDM erratum mitigation sequence. */
+mrs r5, control
+tst r5, #8 /* CONTROL_S.SFPA */
+it ne
+.inst.w 0xeeb00a40 /* vmovne s0, s0 */
vlldm sp /* Lazy restore of d0-d16 and FPSCR. */
add sp, sp, #0x88 /* Free space used to save floating point registers. */
#endif /* __ARM_PCS_VFP */

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
From 95ec476dd7726cc9c1bfd6fb23ba3aea8bbf61a4 Mon Sep 17 00:00:00 2001 From 74cc21f474402cf3578e37e1d7a1a22bbd070f6a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:59:00 +0400 Date: Fri, 29 Mar 2013 08:59:00 +0400
Subject: [PATCH 02/40] gcc: poison-system-directories Subject: [PATCH] gcc: poison-system-directories
Add /sw/include and /opt/include based on the original Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for zecke-no-host-includes.patch patch. The original patch checked for
@@ -13,23 +13,24 @@ wants this to be a failure, they can add "-Werror=poison-system-directories".
Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
Upstream-Status: Pending Upstream-Status: Pending
--- ---
gcc/common.opt | 4 ++++ gcc/common.opt | 4 ++++
gcc/config.in | 6 ++++++ gcc/config.in | 10 ++++++++++
gcc/configure | 16 ++++++++++++++++ gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 10 ++++++++++ gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++ gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.c | 2 ++ gcc/gcc.c | 9 +++++++--
gcc/incpath.c | 21 +++++++++++++++++++++ gcc/incpath.c | 21 +++++++++++++++++++++
7 files changed, 68 insertions(+) 7 files changed, 86 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/gcc/common.opt diff --git a/gcc/common.opt b/gcc/common.opt
=================================================================== index 3ec7743ea..d3c3e51dc 100644
--- gcc-8.5.0.orig/gcc/common.opt --- a/gcc/common.opt
+++ gcc-8.5.0/gcc/common.opt +++ b/gcc/common.opt
@@ -679,6 +679,10 @@ Wreturn-local-addr @@ -682,6 +682,10 @@ Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable. Warn about returning a pointer/reference to a local or temporary variable.
@@ -40,11 +41,11 @@ Index: gcc-8.5.0/gcc/common.opt
Wshadow Wshadow
Common Var(warn_shadow) Warning Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global. Warn when one variable shadows another. Same as -Wshadow=global.
Index: gcc-8.5.0/gcc/config.in diff --git a/gcc/config.in b/gcc/config.in
=================================================================== index 364eba477..7d2c3bbf1 100644
--- gcc-8.5.0.orig/gcc/config.in --- a/gcc/config.in
+++ gcc-8.5.0/gcc/config.in +++ b/gcc/config.in
@@ -194,6 +194,12 @@ @@ -224,6 +224,16 @@
#endif #endif
@@ -52,16 +53,20 @@ Index: gcc-8.5.0/gcc/config.in
+#ifndef USED_FOR_TARGET +#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES +#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif +#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#endif
+ +
+ +
/* Define if you want all operations on RTL (the basic data structure of the /* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime. optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */ This is quite expensive. */
Index: gcc-8.5.0/gcc/configure diff --git a/gcc/configure b/gcc/configure
=================================================================== index 2a9d646b4..a848792f2 100755
--- gcc-8.5.0.orig/gcc/configure --- a/gcc/configure
+++ gcc-8.5.0/gcc/configure +++ b/gcc/configure
@@ -954,6 +954,7 @@ with_system_zlib @@ -1010,6 +1010,7 @@ with_system_zlib
enable_maintainer_mode enable_maintainer_mode
enable_link_mutex enable_link_mutex
enable_version_specific_runtime_libs enable_version_specific_runtime_libs
@@ -69,7 +74,7 @@ Index: gcc-8.5.0/gcc/configure
enable_plugin enable_plugin
enable_host_shared enable_host_shared
enable_libquadmath_support enable_libquadmath_support
@@ -1697,6 +1698,8 @@ Optional Features: @@ -1766,6 +1767,8 @@ Optional Features:
--enable-version-specific-runtime-libs --enable-version-specific-runtime-libs
specify that runtime libraries should be installed specify that runtime libraries should be installed
in a compiler-specific directory in a compiler-specific directory
@@ -78,7 +83,7 @@ Index: gcc-8.5.0/gcc/configure
--enable-plugin enable plugin support --enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries --enable-host-shared build host code as shared libraries
--disable-libquadmath-support --disable-libquadmath-support
@@ -29767,6 +29770,19 @@ if test "${enable_version_specific_runti @@ -30280,6 +30283,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi fi
@@ -89,49 +94,58 @@ Index: gcc-8.5.0/gcc/configure
+ enable_poison_system_directories=no + enable_poison_system_directories=no
+fi +fi
+ +
+if test "x${enable_poison_system_directories}" = "xyes"; then +if test "x${enable_poison_system_directories}" != "xno"; then
+ +
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h +$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+ +
+fi +fi
+ +
# Substitute configuration variables # Substitute configuration variables
Index: gcc-8.5.0/gcc/configure.ac diff --git a/gcc/configure.ac b/gcc/configure.ac
=================================================================== index 51cce36ce..66ffde305 100644
--- gcc-8.5.0.orig/gcc/configure.ac --- a/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac +++ b/gcc/configure.ac
@@ -6336,6 +6336,16 @@ AC_ARG_ENABLE(version-specific-runtime-l @@ -6614,6 +6614,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be [specify that runtime libraries should be
installed in a compiler-specific directory])]) installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories], +AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories], + AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories]),, + [warn for use of native system header directories (no/yes/error)]),,
+ [enable_poison_system_directories=no]) + [enable_poison_system_directories=no])
+if test "x${enable_poison_system_directories}" = "xyes"; then +AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], + AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1], + [1],
+ [Define to warn for use of native system header directories]) + [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi +fi
+ +
# Substitute configuration variables # Substitute configuration variables
AC_SUBST(subdirs) AC_SUBST(subdirs)
AC_SUBST(srcdir) AC_SUBST(srcdir)
Index: gcc-8.5.0/gcc/doc/invoke.texi diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
=================================================================== index d929eb109..aa5ff88b1 100644
--- gcc-8.5.0.orig/gcc/doc/invoke.texi --- a/gcc/doc/invoke.texi
+++ gcc-8.5.0/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi
@@ -304,6 +304,7 @@ Objective-C and Objective-C++ Dialects}. @@ -351,6 +351,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
-Wparentheses -Wno-pedantic-ms-format @gol -Wparentheses -Wno-pedantic-ms-format @gol
-Wplacement-new -Wplacement-new=@var{n} @gol -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
+-Wno-poison-system-directories @gol +-Wno-poison-system-directories @gol
-Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
-Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol -Wno-scalar-storage-order -Wsequence-point @gol
@@ -5748,6 +5749,14 @@ made up of data only and thus requires n @@ -6928,6 +6929,14 @@ made up of data only and thus requires no special treatment. But, for
most targets, it is made up of code and thus requires the stack to be most targets, it is made up of code and thus requires the stack to be
made executable in order for the program to work properly. made executable in order for the program to work properly.
@@ -146,23 +160,37 @@ Index: gcc-8.5.0/gcc/doc/invoke.texi
@item -Wfloat-equal @item -Wfloat-equal
@opindex Wfloat-equal @opindex Wfloat-equal
@opindex Wno-float-equal @opindex Wno-float-equal
Index: gcc-8.5.0/gcc/gcc.c diff --git a/gcc/gcc.c b/gcc/gcc.c
=================================================================== index 49c9c6c17..24a92bf27 100644
--- gcc-8.5.0.orig/gcc/gcc.c --- a/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c +++ b/gcc/gcc.c
@@ -1037,6 +1037,8 @@ proper position among the other output f @@ -1044,6 +1044,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \ "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\ "%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} \ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
+ %{Wno-poison-system-directories:--no-poison-system-directories} \ + %{Wno-poison-system-directories:--no-poison-system-directories} \
+ %{Werror=poison-system-directories:--error-poison-system-directories} \ + %{Werror=poison-system-directories:--error-poison-system-directories} \
%{static|no-pie|static-pie:} %{L*} %(mfwrap) %(link_libgcc) " \ %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \ VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
Index: gcc-8.5.0/gcc/incpath.c @@ -1138,8 +1140,11 @@ static const char *cpp_unique_options =
=================================================================== static const char *cpp_options =
--- gcc-8.5.0.orig/gcc/incpath.c "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+++ gcc-8.5.0/gcc/incpath.c %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
- %{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{!fno-working-directory:-fworking-directory}}} %{O*}"
+#ifdef POISON_BY_DEFAULT
+ " -Werror=poison-system-directories"
+#endif
+ " %{undef} %{save-temps*:-fpch-preprocess}";
/* This contains cpp options which are not passed when the preprocessor
output will be used by another program. */
diff --git a/gcc/incpath.c b/gcc/incpath.c
index 94eaba7b1..bfad4ebe3 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
#include "intl.h" #include "intl.h"
#include "incpath.h" #include "incpath.h"
@@ -171,7 +199,7 @@ Index: gcc-8.5.0/gcc/incpath.c
/* Microsoft Windows does not natively support inodes. /* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */ VMS has non-numeric inodes. */
@@ -393,6 +394,26 @@ merge_include_chains (const char *sysroo @@ -393,6 +394,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
} }
fprintf (stderr, _("End of search list.\n")); fprintf (stderr, _("End of search list.\n"));
} }
@@ -198,3 +226,6 @@ Index: gcc-8.5.0/gcc/incpath.c
} }
/* Use given -I paths for #include "..." but not #include <...>, and /* Use given -I paths for #include "..." but not #include <...>, and
--
2.25.1

View File

@@ -0,0 +1,103 @@
From 30461cf8dba3d3adb15a125e4da48800eb2b9b8f Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Fri, 18 Jun 2021 17:18:37 +0100
Subject: [PATCH] arm: fix vlldm erratum for Armv8.1-m [PR102035]
For Armv8.1-m we generate code that emits VLLDM directly and do not
rely on support code in the library, so emit the mitigation directly
as well, when required. In this case, we can use the compiler options
to determine when to apply the fix and when it is safe to omit it.
gcc:
PR target/102035
* config/arm/arm.md (attribute arch): Add fix_vlldm.
(arch_enabled): Use it.
* config/arm/vfp.md (lazy_store_multiple_insn): Add alternative to
use when erratum mitigation is needed.
CVE: CVE-2021-35465
Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=30461cf8dba3d3adb15a125e4da48800eb2b9b8f]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
gcc/config/arm/arm.md | 11 +++++++++--
gcc/config/arm/vfp.md | 10 +++++++---
2 files changed, 16 insertions(+), 5 deletions(-)
diff -upr a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
--- a/gcc/config/arm/arm.md 2020-07-22 23:35:17.344384552 -0700
+++ b/gcc/config/arm/arm.md 2021-11-11 20:33:58.431543947 -0800
@@ -132,9 +132,12 @@
; TARGET_32BIT, "t1" or "t2" to specify a specific Thumb mode. "v6"
; for ARM or Thumb-2 with arm_arch6, and nov6 for ARM without
; arm_arch6. "v6t2" for Thumb-2 with arm_arch6 and "v8mb" for ARMv8-M
-; Baseline. This attribute is used to compute attribute "enabled",
+; Baseline. "fix_vlldm" is for fixing the v8-m/v8.1-m VLLDM erratum.
+; This attribute is used to compute attribute "enabled",
; use type "any" to enable an alternative in all cases.
-(define_attr "arch" "any,a,t,32,t1,t2,v6,nov6,v6t2,v8mb,iwmmxt,iwmmxt2,armv6_or_vfpv3,neon,mve"
+(define_attr "arch" "any, a, t, 32, t1, t2, v6,nov6, v6t2, \
+ v8mb, fix_vlldm, iwmmxt, iwmmxt2, armv6_or_vfpv3, \
+ neon, mve"
(const_string "any"))
(define_attr "arch_enabled" "no,yes"
@@ -177,6 +180,10 @@
(match_test "TARGET_THUMB1 && arm_arch8"))
(const_string "yes")
+ (and (eq_attr "arch" "fix_vlldm")
+ (match_test "fix_vlldm"))
+ (const_string "yes")
+
(and (eq_attr "arch" "iwmmxt2")
(match_test "TARGET_REALLY_IWMMXT2"))
(const_string "yes")
diff -upr a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
--- a/gcc/config/arm/vfp.md 2020-07-22 23:35:17.356384684 -0700
+++ b/gcc/config/arm/vfp.md 2021-11-11 20:33:58.431543947 -0800
@@ -1703,12 +1703,15 @@
(set_attr "type" "mov_reg")]
)
+;; Both this and the next instruction are treated by GCC in the same
+;; way as a blockage pattern. That's perhaps stronger than it needs
+;; to be, but we do not want accesses to the VFP register bank to be
+;; moved across either instruction.
+
(define_insn "lazy_store_multiple_insn"
- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
- (post_dec:SI (match_dup 0)))
- (unspec_volatile [(const_int 0)
- (mem:SI (post_dec:SI (match_dup 0)))]
- VUNSPEC_VLSTM)]
+ [(unspec_volatile
+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk"))]
+ VUNSPEC_VLSTM)]
"use_cmse && reload_completed"
"vlstm%?\\t%0"
[(set_attr "predicable" "yes")
@@ -1716,14 +1719,16 @@
)
(define_insn "lazy_load_multiple_insn"
- [(set (match_operand:SI 0 "s_register_operand" "+&rk")
- (post_inc:SI (match_dup 0)))
- (unspec_volatile:SI [(const_int 0)
- (mem:SI (match_dup 0))]
- VUNSPEC_VLLDM)]
+ [(unspec_volatile
+ [(mem:BLK (match_operand:SI 0 "s_register_operand" "rk,rk"))]
+ VUNSPEC_VLLDM)]
"use_cmse && reload_completed"
- "vlldm%?\\t%0"
- [(set_attr "predicable" "yes")
+ "@
+ vscclrm\\t{vpr}\;vlldm\\t%0
+ vlldm\\t%0"
+ [(set_attr "arch" "fix_vlldm,*")
+ (set_attr "predicable" "no")
+ (set_attr "length" "8,4")
(set_attr "type" "load_4")]
)

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
From 6640d7e39b13d1ef26d249153ab15d510fda3566 Mon Sep 17 00:00:00 2001 From 6e3395c0bc933bdc3242d1dead4896d0aa4e11a8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:08:31 +0400 Date: Fri, 29 Mar 2013 09:08:31 +0400
Subject: [PATCH 03/40] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET Subject: [PATCH] gcc-4.3.3: SYSROOT_CFLAGS_FOR_TARGET
Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it. Before committing, I noticed that PR/32161 was marked as a dup of PR/32009, but my previous patch did not fix it.
@@ -25,11 +25,11 @@ Upstream-Status: Pending
configure | 32 ++++++++++++++++++++++++++++++++ configure | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+) 1 file changed, 32 insertions(+)
Index: gcc-8.5.0/configure diff --git a/configure b/configure
=================================================================== index 226a64939d1..b31dc137fc9 100755
--- gcc-8.5.0.orig/configure --- a/configure
+++ gcc-8.5.0/configure +++ b/configure
@@ -6768,6 +6768,38 @@ fi @@ -6971,6 +6971,38 @@ fi

View File

@@ -1,7 +1,7 @@
From 1e649d81ca662c4cdf73882ebb8a11f0f19f5baf Mon Sep 17 00:00:00 2001 From 85a7c5aeb82ed61e6ef6d8e061b9da9e6a4a652c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:10:06 +0400 Date: Fri, 29 Mar 2013 09:10:06 +0400
Subject: [PATCH 04/40] 64-bit multilib hack. Subject: [PATCH] 64-bit multilib hack.
GCC has internal multilib handling code but it assumes a very specific rigid directory GCC has internal multilib handling code but it assumes a very specific rigid directory
layout. The build system implementation of multilib layout is very generic and allows layout. The build system implementation of multilib layout is very generic and allows
@@ -19,22 +19,44 @@ and be able to patch these entries with a complete set of correct paths but this
don't have such code at this point. This is something the target gcc recipe should do don't have such code at this point. This is something the target gcc recipe should do
and override these platform defaults in its build config. and override these platform defaults in its build config.
Do same for riscv64 and aarch64
RP 15/8/11 RP 15/8/11
Upstream-Status: Inappropriate[OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com> Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Upstream-Status: Pending
--- ---
gcc/config/i386/t-linux64 | 6 ++---- gcc/config/aarch64/t-aarch64-linux | 8 ++++----
gcc/config/mips/t-linux64 | 10 +++------- gcc/config/i386/t-linux64 | 6 ++----
gcc/config/rs6000/t-linux64 | 5 ++--- gcc/config/mips/t-linux64 | 10 +++-------
3 files changed, 7 insertions(+), 14 deletions(-) gcc/config/riscv/t-linux | 6 ++++--
gcc/config/rs6000/t-linux64 | 5 ++---
5 files changed, 15 insertions(+), 20 deletions(-)
Index: gcc-8.5.0/gcc/config/i386/t-linux64 diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
=================================================================== index 83e59e33b85..b1356be1fb4 100644
--- gcc-8.5.0.orig/gcc/config/i386/t-linux64 --- a/gcc/config/aarch64/t-aarch64-linux
+++ gcc-8.5.0/gcc/config/i386/t-linux64 +++ b/gcc/config/aarch64/t-aarch64-linux
@@ -21,8 +21,8 @@
LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 1171e218578..5e057b7e5db 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -32,7 +32,5 @@ @@ -32,7 +32,5 @@
# #
comma=, comma=,
@@ -45,10 +67,10 @@ Index: gcc-8.5.0/gcc/config/i386/t-linux64
-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) -MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+MULTILIB_DIRNAMES = . . +MULTILIB_DIRNAMES = . .
+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) +MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
Index: gcc-8.5.0/gcc/config/mips/t-linux64 diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
=================================================================== index ceb58d3b5f3..43fe2bf28ab 100644
--- gcc-8.5.0.orig/gcc/config/mips/t-linux64 --- a/gcc/config/mips/t-linux64
+++ gcc-8.5.0/gcc/config/mips/t-linux64 +++ b/gcc/config/mips/t-linux64
@@ -17,10 +17,6 @@ @@ -17,10 +17,6 @@
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
@@ -63,10 +85,22 @@ Index: gcc-8.5.0/gcc/config/mips/t-linux64
+MULTILIB_DIRNAMES = . . . +MULTILIB_DIRNAMES = . . .
+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) +MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
+ +
Index: gcc-8.5.0/gcc/config/rs6000/t-linux64 diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
=================================================================== index 216d2776a18..e4d817621fc 100644
--- gcc-8.5.0.orig/gcc/config/rs6000/t-linux64 --- a/gcc/config/riscv/t-linux
+++ gcc-8.5.0/gcc/config/rs6000/t-linux64 +++ b/gcc/config/riscv/t-linux
@@ -1,3 +1,5 @@
# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
+MULTILIB_DIRNAMES := . .
+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 264a7e27524..dc9d440f66b 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -26,10 +26,9 @@ @@ -26,10 +26,9 @@
# MULTILIB_OSDIRNAMES according to what is found on the target. # MULTILIB_OSDIRNAMES according to what is found on the target.

View File

@@ -0,0 +1,304 @@
From 809330ab8450261e05919b472783bf15e4b000f7 Mon Sep 17 00:00:00 2001
From: Richard Earnshaw <rearnsha@arm.com>
Date: Tue, 6 Jul 2021 15:10:18 +0100
Subject: [PATCH] arm: Add tests for VLLDM mitigation [PR102035]
New tests for the erratum mitigation.
gcc/testsuite:
PR target/102035
* gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c: New test.
* gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c: Likewise.
* gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c: Likewise.
CVE: CVE-2021-35465
Upstream-Status: Backport[https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=809330ab8450261e05919b472783bf15e4b000f7]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
.../arm/cmse/mainline/8_1m/soft/cmse-13a.c | 31 +++++++++++++++++++
.../arm/cmse/mainline/8_1m/soft/cmse-7a.c | 28 +++++++++++++++++
.../arm/cmse/mainline/8_1m/soft/cmse-8a.c | 30 ++++++++++++++++++
.../cmse/mainline/8_1m/softfp-sp/cmse-7a.c | 27 ++++++++++++++++
.../cmse/mainline/8_1m/softfp-sp/cmse-8a.c | 29 +++++++++++++++++
.../arm/cmse/mainline/8_1m/softfp/cmse-13a.c | 30 ++++++++++++++++++
.../arm/cmse/mainline/8_1m/softfp/cmse-7a.c | 27 ++++++++++++++++
.../arm/cmse/mainline/8_1m/softfp/cmse-8a.c | 29 +++++++++++++++++
8 files changed, 231 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
create mode 100644 gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-13a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-13.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-7a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/soft/cmse-8a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=soft -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=soft" } } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler-not "vmov" } } */
+/* { dg-final { scan-assembler-not "vmsr" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-13a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-13.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[1,4-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr2, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr3, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r1, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[1,4-9\]|r10|fp|ip), ){9}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[1,4-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-7a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp/cmse-8a.c 2021-11-11 20:38:44.290766017 -0800
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing single precision" {*-*-*} {"-mfpu=*-sp-*"} {""} } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-7a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
+
+#include "../../../cmse-7.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[0-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r0, )?(r1, )?(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[0-9\]|r10|fp|ip), ){12}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[0-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */
diff --git a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c
--- a/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/gcc.target/arm/cmse/mainline/8_1m/softfp-sp/cmse-8a.c 2021-11-11 20:38:44.286766084 -0800
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-mcmse -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -mfix-cmse-cve-2021-35465" } */
+/* { dg-skip-if "Incompatible float ABI" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=softfp" } } */
+/* { dg-skip-if "Skip these if testing double precision" {*-*-*} {"-mfpu=fpv[4-5]-d16"} {""} } */
+
+#include "../../../cmse-8.x"
+
+/* Checks for saving and clearing prior to function call. */
+/* Shift on the same register as blxns. */
+/* { dg-final { scan-assembler "lsrs\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler "lsls\t(r\[2-9\]|r10|fp|ip), \\1, #1.*blxns\t\\1" } } */
+/* { dg-final { scan-assembler-not "mov\tr0, r4" } } */
+/* { dg-final { scan-assembler-not "mov\tr1, r4" } } */
+/* { dg-final { scan-assembler "push\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+/* { dg-final { scan-assembler "vlstm\tsp" } } */
+/* Check the right registers are cleared and none appears twice. */
+/* { dg-final { scan-assembler "clrm\t\{(r2, )?(r3, )?(r4, )?(r5, )?(r6, )?(r7, )?(r8, )?(r9, )?(r10, )?(fp, )?(ip, )?APSR\}" } } */
+/* Check that the right number of registers is cleared and thus only one
+ register is missing. */
+/* { dg-final { scan-assembler "clrm\t\{((r\[2-9\]|r10|fp|ip), ){10}APSR\}" } } */
+/* Check that no cleared register is used for blxns. */
+/* { dg-final { scan-assembler-not "clrm\t\{\[^\}\]\+(r\[2-9\]|r10|fp|ip),\[^\}\]\+\}.*blxns\t\\1" } } */
+/* Check for v8.1-m variant of erratum work-around. */
+/* { dg-final { scan-assembler "vscclrm\t\{vpr\}" } } */
+/* { dg-final { scan-assembler "vlldm\tsp" } } */
+/* { dg-final { scan-assembler "pop\t\{r4, r5, r6, r7, r8, r9, r10, fp\}" } } */
+
+/* Now we check that we use the correct intrinsic to call. */
+/* { dg-final { scan-assembler "blxns" } } */

View File

@@ -0,0 +1,138 @@
From 1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 2 Nov 2021 09:54:32 -0400
Subject: [PATCH] libcpp: escape non-ASCII source bytes in -Wbidi-chars=
[PR103026]
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
This flags rich_locations associated with -Wbidi-chars= so that
non-ASCII bytes will be escaped when printing the source lines
(using the diagnostics support I added in
r12-4825-gbd5e882cf6e0def3dd1bc106075d59a303fe0d1e).
In particular, this ensures that the printed source lines will
be pure ASCII, and thus the visual ordering of the characters
will be the same as the logical ordering.
Before:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*â® } â¦if (isAdmin)⩠⦠begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only â® { â¦*/
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE_âª_PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF_â¬_;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE_âª_PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_â¬";
| ^
After:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ^
Wbidi-chars-11.c:6:15: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
6 | int LRE_<U+202A>_PDF_\u202c;
| ^
Wbidi-chars-11.c:8:19: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
8 | int LRE_\u202a_PDF_<U+202C>_;
| ^
Wbidi-chars-11.c:10:28: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
10 | const char *s1 = "LRE_<U+202A>_PDF_\u202c";
| ^
Wbidi-chars-11.c:12:33: warning: UTF-8 vs UCN mismatch when closing a context by "U+202C (POP DIRECTIONAL FORMATTING)" [-Wbidi-chars=]
12 | const char *s2 = "LRE_\u202a_PDF_<U+202C>";
| ^
libcpp/ChangeLog:
PR preprocessor/103026
* lex.c (maybe_warn_bidi_on_close): Use a rich_location
and call set_escape_on_output (true) on it.
(maybe_warn_bidi_on_char): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
CVE: CVE-2021-42574
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=1a7f2c0774129750fdf73e9f1b78f0ce983c9ab3]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
libcpp/lex.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/libcpp/lex.c b/libcpp/lex.c
--- a/libcpp/lex.c 2021-12-14 20:44:11.647815287 -0800
+++ b/libcpp/lex.c 2021-12-14 20:43:38.008383220 -0800
@@ -1427,9 +1427,11 @@ maybe_warn_bidi_on_close (cpp_reader *pf
const location_t loc
= linemap_position_for_column (pfile->line_table,
CPP_BUF_COLUMN (pfile->buffer, p));
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "unpaired UTF-8 bidirectional control character "
- "detected");
+ rich_location rich_loc (pfile->line_table, loc);
+ rich_loc.set_escape_on_output (true);
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "unpaired UTF-8 bidirectional control character "
+ "detected");
}
/* We're done with this context. */
bidi::on_close ();
@@ -1454,6 +1456,9 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
const location_t loc
= linemap_position_for_column (pfile->line_table,
CPP_BUF_COLUMN (pfile->buffer, p));
+ rich_location rich_loc (pfile->line_table, loc);
+ rich_loc.set_escape_on_output (true);
+
/* It seems excessive to warn about a PDI/PDF that is closing
an opened context because we've already warned about the
opening character. Except warn when we have a UCN x UTF-8
@@ -1462,20 +1467,20 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
{
if (warn_bidi == bidirectional_unpaired
&& bidi::current_ctx_ucn_p () != ucn_p)
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "UTF-8 vs UCN mismatch when closing "
- "a context by \"%s\"", bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "UTF-8 vs UCN mismatch when closing "
+ "a context by \"%s\"", bidi::to_str (kind));
}
else if (warn_bidi == bidirectional_any)
{
if (kind == bidi::kind::PDF || kind == bidi::kind::PDI)
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "\"%s\" is closing an unopened context",
- bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "\"%s\" is closing an unopened context",
+ bidi::to_str (kind));
else
- cpp_warning_with_line (pfile, CPP_W_BIDIRECTIONAL, loc, 0,
- "found problematic Unicode character \"%s\"",
- bidi::to_str (kind));
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "found problematic Unicode character \"%s\"",
+ bidi::to_str (kind));
}
}
/* We're done with this context. */

View File

@@ -0,0 +1,575 @@
From bef32d4a28595e933f24fef378cf052a30b674a7 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 2 Nov 2021 15:45:22 -0400
Subject: [PATCH] libcpp: capture and underline ranges in -Wbidi-chars=
[PR103026]
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
This patch converts the bidi::vec to use a struct so that we can
capture location_t values for the bidirectional control characters.
Before:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ^
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control character detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ^
After:
Wbidi-chars-1.c: In function âmainâ:
Wbidi-chars-1.c:6:43: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
6 | /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
| ~~~~~~~~ ~~~~~~~~ ^
| | | |
| | | end of bidirectional context
| U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE)
Wbidi-chars-1.c:9:28: warning: unpaired UTF-8 bidirectional control characters detected [-Wbidi-chars=]
9 | /* end admins only <U+202E> { <U+2066>*/
| ~~~~~~~~ ~~~~~~~~ ^
| | | |
| | | end of bidirectional context
| | U+2066 (LEFT-TO-RIGHT ISOLATE)
| U+202E (RIGHT-TO-LEFT OVERRIDE)
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/testsuite/ChangeLog:
PR preprocessor/103026
* c-c++-common/Wbidi-chars-ranges.c: New test.
libcpp/ChangeLog:
PR preprocessor/103026
* lex.c (struct bidi::context): New.
(bidi::vec): Convert to a vec of context rather than unsigned
char.
(bidi::ctx_at): Rename to...
(bidi::pop_kind_at): ...this and reimplement for above change.
(bidi::current_ctx): Update for change to vec.
(bidi::current_ctx_ucn_p): Likewise.
(bidi::current_ctx_loc): New.
(bidi::on_char): Update for usage of context struct. Add "loc"
param and pass it when pushing contexts.
(get_location_for_byte_range_in_cur_line): New.
(get_bidi_utf8): Rename to...
(get_bidi_utf8_1): ...this, reintroducing...
(get_bidi_utf8): ...as a wrapper, setting *OUT when the result is
not NONE.
(get_bidi_ucn): Rename to...
(get_bidi_ucn_1): ...this, reintroducing...
(get_bidi_ucn): ...as a wrapper, setting *OUT when the result is
not NONE.
(class unpaired_bidi_rich_location): New.
(maybe_warn_bidi_on_close): Use unpaired_bidi_rich_location when
reporting on unpaired bidi chars. Split into singular vs plural
spellings.
(maybe_warn_bidi_on_char): Pass in a location_t rather than a
const uchar * and use it when emitting warnings, and when calling
bidi::on_char.
(_cpp_skip_block_comment): Capture location when kind is not NONE
and pass it to maybe_warn_bidi_on_char.
(skip_line_comment): Likewise.
(forms_identifier_p): Likewise.
(lex_raw_string): Likewise.
(lex_string): Likewise.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
CVE: CVE-2021-42574
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=bef32d4a28595e933f24fef378cf052a30b674a7]
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
---
.../c-c++-common/Wbidi-chars-ranges.c | 54 ++++
libcpp/lex.c | 251 ++++++++++++++----
2 files changed, 257 insertions(+), 48 deletions(-)
create mode 100644 gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c
diff --git a/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c
--- a/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c 1969-12-31 16:00:00.000000000 -0800
+++ b/gcc/testsuite/c-c++-common/Wbidi-chars-ranges.c 2021-12-25 01:39:55.116281847 -0800
@@ -0,0 +1,54 @@
+/* PR preprocessor/103026 */
+/* { dg-do compile } */
+/* { dg-options "-Wbidi-chars=unpaired -fdiagnostics-show-caret" } */
+/* Verify that we escape and underline pertinent bidirectional
+ control characters when quoting the source. */
+
+int test_unpaired_bidi () {
+ int isAdmin = 0;
+ /* } if (isAdmin) begin admins only */
+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
+#if 0
+ { dg-begin-multiline-output "" }
+ /*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */
+ ~~~~~~~~ ~~~~~~~~ ^
+ | | |
+ | | end of bidirectional context
+ U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE)
+ { dg-end-multiline-output "" }
+#endif
+
+ __builtin_printf("You are an admin.\n");
+ /* end admins only { */
+/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */
+#if 0
+ { dg-begin-multiline-output "" }
+ /* end admins only <U+202E> { <U+2066>*/
+ ~~~~~~~~ ~~~~~~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+2066 (LEFT-TO-RIGHT ISOLATE)
+ U+202E (RIGHT-TO-LEFT OVERRIDE)
+ { dg-end-multiline-output "" }
+#endif
+
+ return 0;
+}
+
+int LRE__PDF_\u202c;
+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
+#if 0
+ { dg-begin-multiline-output "" }
+ int LRE_<U+202A>_PDF_\u202c;
+ ~~~~~~~~ ^~~~~~
+ { dg-end-multiline-output "" }
+#endif
+
+const char *s1 = "LRE__PDF_\u202c";
+/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */
+#if 0
+ { dg-begin-multiline-output "" }
+ const char *s1 = "LRE_<U+202A>_PDF_\u202c";
+ ~~~~~~~~ ^~~~~~
+ { dg-end-multiline-output "" }
+#endif
diff --git a/libcpp/lex.c b/libcpp/lex.c
--- a/libcpp/lex.c 2021-12-25 01:41:16.522868808 -0800
+++ b/libcpp/lex.c 2021-12-25 06:28:58.530680302 -0800
@@ -1172,11 +1172,34 @@ namespace bidi {
/* All the UTF-8 encodings of bidi characters start with E2. */
constexpr uchar utf8_start = 0xe2;
+ struct context
+ {
+ context () {}
+ context (location_t loc, kind k, bool pdf, bool ucn)
+ : m_loc (loc), m_kind (k), m_pdf (pdf), m_ucn (ucn)
+ {
+ }
+
+ kind get_pop_kind () const
+ {
+ return m_pdf ? kind::PDF : kind::PDI;
+ }
+ bool ucn_p () const
+ {
+ return m_ucn;
+ }
+
+ location_t m_loc;
+ kind m_kind;
+ unsigned m_pdf : 1;
+ unsigned m_ucn : 1;
+ };
+
/* A vector holding currently open bidi contexts. We use a char for
each context, its LSB is 1 if it represents a PDF context, 0 if it
represents a PDI context. The next bit is 1 if this context was open
by a bidi character written as a UCN, and 0 when it was UTF-8. */
- semi_embedded_vec <unsigned char, 16> vec;
+ semi_embedded_vec <context, 16> vec;
/* Close the whole comment/identifier/string literal/character constant
context. */
@@ -1193,19 +1216,19 @@ namespace bidi {
vec.truncate (len - 1);
}
- /* Return the context of the Ith element. */
- kind ctx_at (unsigned int i)
+ /* Return the pop kind of the context of the Ith element. */
+ kind pop_kind_at (unsigned int i)
{
- return (vec[i] & 1) ? kind::PDF : kind::PDI;
+ return vec[i].get_pop_kind ();
}
- /* Return which context is currently opened. */
+ /* Return the pop kind of the context that is currently opened. */
kind current_ctx ()
{
unsigned int len = vec.count ();
if (len == 0)
return kind::NONE;
- return ctx_at (len - 1);
+ return vec[len - 1].get_pop_kind ();
}
/* Return true if the current context comes from a UCN origin, that is,
@@ -1214,11 +1237,19 @@ namespace bidi {
{
unsigned int len = vec.count ();
gcc_checking_assert (len > 0);
- return (vec[len - 1] >> 1) & 1;
+ return vec[len - 1].m_ucn;
}
- /* We've read a bidi char, update the current vector as necessary. */
- void on_char (kind k, bool ucn_p)
+ location_t current_ctx_loc ()
+ {
+ unsigned int len = vec.count ();
+ gcc_checking_assert (len > 0);
+ return vec[len - 1].m_loc;
+ }
+
+ /* We've read a bidi char, update the current vector as necessary.
+ LOC is only valid when K is not kind::NONE. */
+ void on_char (kind k, bool ucn_p, location_t loc)
{
switch (k)
{
@@ -1226,12 +1257,12 @@ namespace bidi {
case kind::RLE:
case kind::LRO:
case kind::RLO:
- vec.push (ucn_p ? 3u : 1u);
+ vec.push (context (loc, k, true, ucn_p));
break;
case kind::LRI:
case kind::RLI:
case kind::FSI:
- vec.push (ucn_p ? 2u : 0u);
+ vec.push (context (loc, k, false, ucn_p));
break;
/* PDF terminates the scope of the last LRE, RLE, LRO, or RLO
whose scope has not yet been terminated. */
@@ -1245,7 +1276,7 @@ namespace bidi {
yet been terminated. */
case kind::PDI:
for (int i = vec.count () - 1; i >= 0; --i)
- if (ctx_at (i) == kind::PDI)
+ if (pop_kind_at (i) == kind::PDI)
{
vec.truncate (i);
break;
@@ -1295,10 +1326,47 @@ namespace bidi {
}
}
+/* Get location_t for the range of bytes [START, START + NUM_BYTES)
+ within the current line in FILE, with the caret at START. */
+
+static location_t
+get_location_for_byte_range_in_cur_line (cpp_reader *pfile,
+ const unsigned char *const start,
+ size_t num_bytes)
+{
+ gcc_checking_assert (num_bytes > 0);
+
+ /* CPP_BUF_COLUMN and linemap_position_for_column both refer
+ to offsets in bytes, but CPP_BUF_COLUMN is 0-based,
+ whereas linemap_position_for_column is 1-based. */
+
+ /* Get 0-based offsets within the line. */
+ size_t start_offset = CPP_BUF_COLUMN (pfile->buffer, start);
+ size_t end_offset = start_offset + num_bytes - 1;
+
+ /* Now convert to location_t, where "columns" are 1-based byte offsets. */
+ location_t start_loc = linemap_position_for_column (pfile->line_table,
+ start_offset + 1);
+ location_t end_loc = linemap_position_for_column (pfile->line_table,
+ end_offset + 1);
+
+ if (start_loc == end_loc)
+ return start_loc;
+
+ source_range src_range;
+ src_range.m_start = start_loc;
+ src_range.m_finish = end_loc;
+ location_t combined_loc = COMBINE_LOCATION_DATA (pfile->line_table,
+ start_loc,
+ src_range,
+ NULL);
+ return combined_loc;
+}
+
/* Parse a sequence of 3 bytes starting with P and return its bidi code. */
static bidi::kind
-get_bidi_utf8 (const unsigned char *const p)
+get_bidi_utf8_1 (const unsigned char *const p)
{
gcc_checking_assert (p[0] == bidi::utf8_start);
@@ -1340,10 +1408,25 @@ get_bidi_utf8 (const unsigned char *cons
return bidi::kind::NONE;
}
+/* Parse a sequence of 3 bytes starting with P and return its bidi code.
+ If the kind is not NONE, write the location to *OUT.*/
+
+static bidi::kind
+get_bidi_utf8 (cpp_reader *pfile, const unsigned char *const p, location_t *out)
+{
+ bidi::kind result = get_bidi_utf8_1 (p);
+ if (result != bidi::kind::NONE)
+ {
+ /* We have a sequence of 3 bytes starting at P. */
+ *out = get_location_for_byte_range_in_cur_line (pfile, p, 3);
+ }
+ return result;
+}
+
/* Parse a UCN where P points just past \u or \U and return its bidi code. */
static bidi::kind
-get_bidi_ucn (const unsigned char *p, bool is_U)
+get_bidi_ucn_1 (const unsigned char *p, bool is_U)
{
/* 6.4.3 Universal Character Names
\u hex-quad
@@ -1412,6 +1495,62 @@ get_bidi_ucn (const unsigned char *p, bo
return bidi::kind::NONE;
}
+/* Parse a UCN where P points just past \u or \U and return its bidi code.
+ If the kind is not NONE, write the location to *OUT.*/
+
+static bidi::kind
+get_bidi_ucn (cpp_reader *pfile, const unsigned char *p, bool is_U,
+ location_t *out)
+{
+ bidi::kind result = get_bidi_ucn_1 (p, is_U);
+ if (result != bidi::kind::NONE)
+ {
+ const unsigned char *start = p - 2;
+ size_t num_bytes = 2 + (is_U ? 8 : 4);
+ *out = get_location_for_byte_range_in_cur_line (pfile, start, num_bytes);
+ }
+ return result;
+}
+
+/* Subclass of rich_location for reporting on unpaired UTF-8
+ bidirectional control character(s).
+ Escape the source lines on output, and show all unclosed
+ bidi context, labelling everything. */
+
+class unpaired_bidi_rich_location : public rich_location
+{
+ public:
+ class custom_range_label : public range_label
+ {
+ public:
+ label_text get_text (unsigned range_idx) const FINAL OVERRIDE
+ {
+ /* range 0 is the primary location; each subsequent range i + 1
+ is for bidi::vec[i]. */
+ if (range_idx > 0)
+ {
+ const bidi::context &ctxt (bidi::vec[range_idx - 1]);
+ return label_text::borrow (bidi::to_str (ctxt.m_kind));
+ }
+ else
+ return label_text::borrow (_("end of bidirectional context"));
+ }
+ };
+
+ unpaired_bidi_rich_location (cpp_reader *pfile, location_t loc)
+ : rich_location (pfile->line_table, loc, &m_custom_label)
+ {
+ set_escape_on_output (true);
+ for (unsigned i = 0; i < bidi::vec.count (); i++)
+ add_range (bidi::vec[i].m_loc,
+ SHOW_RANGE_WITHOUT_CARET,
+ &m_custom_label);
+ }
+
+ private:
+ custom_range_label m_custom_label;
+};
+
/* We're closing a bidi context, that is, we've encountered a newline,
are closing a C-style comment, or are at the end of a string literal,
character constant, or identifier. Warn if this context was not
@@ -1427,11 +1566,17 @@ maybe_warn_bidi_on_close (cpp_reader *pf
const location_t loc
= linemap_position_for_column (pfile->line_table,
CPP_BUF_COLUMN (pfile->buffer, p));
- rich_location rich_loc (pfile->line_table, loc);
- rich_loc.set_escape_on_output (true);
- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
- "unpaired UTF-8 bidirectional control character "
- "detected");
+ unpaired_bidi_rich_location rich_loc (pfile, loc);
+ /* cpp_callbacks doesn't yet have a way to handle singular vs plural
+ forms of a diagnostic, so fake it for now. */
+ if (bidi::vec.count () > 1)
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "unpaired UTF-8 bidirectional control characters "
+ "detected");
+ else
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "unpaired UTF-8 bidirectional control character "
+ "detected");
}
/* We're done with this context. */
bidi::on_close ();
@@ -1439,12 +1584,13 @@ maybe_warn_bidi_on_close (cpp_reader *pf
/* We're at the beginning or in the middle of an identifier/comment/string
literal/character constant. Warn if we've encountered a bidi character.
- KIND says which bidi character it was; P points to it in the character
- stream. UCN_P is true iff this bidi character was written as a UCN. */
+ KIND says which bidi control character it was; UCN_P is true iff this bidi
+ control character was written as a UCN. LOC is the location of the
+ character, but is only valid if KIND != bidi::kind::NONE. */
static void
-maybe_warn_bidi_on_char (cpp_reader *pfile, const uchar *p, bidi::kind kind,
- bool ucn_p)
+maybe_warn_bidi_on_char (cpp_reader *pfile, bidi::kind kind,
+ bool ucn_p, location_t loc)
{
if (__builtin_expect (kind == bidi::kind::NONE, 1))
return;
@@ -1453,9 +1599,6 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
if (warn_bidi != bidirectional_none)
{
- const location_t loc
- = linemap_position_for_column (pfile->line_table,
- CPP_BUF_COLUMN (pfile->buffer, p));
rich_location rich_loc (pfile->line_table, loc);
rich_loc.set_escape_on_output (true);
@@ -1467,9 +1610,12 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
{
if (warn_bidi == bidirectional_unpaired
&& bidi::current_ctx_ucn_p () != ucn_p)
- cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
- "UTF-8 vs UCN mismatch when closing "
- "a context by \"%s\"", bidi::to_str (kind));
+ {
+ rich_loc.add_range (bidi::current_ctx_loc ());
+ cpp_warning_at (pfile, CPP_W_BIDIRECTIONAL, &rich_loc,
+ "UTF-8 vs UCN mismatch when closing "
+ "a context by \"%s\"", bidi::to_str (kind));
+ }
}
else if (warn_bidi == bidirectional_any)
{
@@ -1484,7 +1630,7 @@ maybe_warn_bidi_on_char (cpp_reader *pfi
}
}
/* We're done with this context. */
- bidi::on_char (kind, ucn_p);
+ bidi::on_char (kind, ucn_p, loc);
}
/* Skip a C-style block comment. We find the end of the comment by
@@ -1552,8 +1698,9 @@ _cpp_skip_block_comment (cpp_reader *pfi
a bidirectional control character. */
else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
{
- bidi::kind kind = get_bidi_utf8 (cur - 1);
- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/false);
+ location_t loc;
+ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
}
}
@@ -1586,9 +1733,9 @@ skip_line_comment (cpp_reader *pfile)
{
if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0))
{
- bidi::kind kind = get_bidi_utf8 (buffer->cur);
- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
- /*ucn_p=*/false);
+ location_t loc;
+ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
}
buffer->cur++;
}
@@ -1734,9 +1881,9 @@ forms_identifier_p (cpp_reader *pfile, i
if (__builtin_expect (*buffer->cur == bidi::utf8_start, 0)
&& warn_bidi_p)
{
- bidi::kind kind = get_bidi_utf8 (buffer->cur);
- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
- /*ucn_p=*/false);
+ location_t loc;
+ bidi::kind kind = get_bidi_utf8 (pfile, buffer->cur, &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
}
if (_cpp_valid_utf8 (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
state, &s))
@@ -1748,10 +1895,12 @@ forms_identifier_p (cpp_reader *pfile, i
buffer->cur += 2;
if (warn_bidi_p)
{
- bidi::kind kind = get_bidi_ucn (buffer->cur,
- buffer->cur[-1] == 'U');
- maybe_warn_bidi_on_char (pfile, buffer->cur, kind,
- /*ucn_p=*/true);
+ location_t loc;
+ bidi::kind kind = get_bidi_ucn (pfile,
+ buffer->cur,
+ buffer->cur[-1] == 'U',
+ &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc);
}
if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first,
state, &s, NULL, NULL))
@@ -2327,12 +2476,15 @@ lex_raw_string (cpp_reader *pfile, cpp_t
}
else if (__builtin_expect ((unsigned char) c == bidi::utf8_start, 0)
&& warn_bidi_p)
- maybe_warn_bidi_on_char (pfile, pos - 1, get_bidi_utf8 (pos - 1),
- /*ucn_p=*/false);
+ {
+ location_t loc;
+ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
+ }
}
if (warn_bidi_p)
- maybe_warn_bidi_on_close (pfile, pos);
+ maybe_warn_bidi_on_close (pfile, cur);
if (CPP_OPTION (pfile, user_literals))
{
@@ -2438,8 +2590,10 @@ lex_string (cpp_reader *pfile, cpp_token
{
if ((cur[0] == 'u' || cur[0] == 'U') && warn_bidi_p)
{
- bidi::kind kind = get_bidi_ucn (cur + 1, cur[0] == 'U');
- maybe_warn_bidi_on_char (pfile, cur, kind, /*ucn_p=*/true);
+ location_t loc;
+ bidi::kind kind = get_bidi_ucn (pfile, cur + 1, cur[0] == 'U',
+ &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/true, loc);
}
cur++;
}
@@ -2467,8 +2621,9 @@ lex_string (cpp_reader *pfile, cpp_token
saw_NUL = true;
else if (__builtin_expect (c == bidi::utf8_start, 0) && warn_bidi_p)
{
- bidi::kind kind = get_bidi_utf8 (cur - 1);
- maybe_warn_bidi_on_char (pfile, cur - 1, kind, /*ucn_p=*/false);
+ location_t loc;
+ bidi::kind kind = get_bidi_utf8 (pfile, cur - 1, &loc);
+ maybe_warn_bidi_on_char (pfile, kind, /*ucn_p=*/false, loc);
}
}

View File

@@ -1,7 +1,7 @@
From b486380dcc4758e856ab6d847eb358d05bd79d64 Mon Sep 17 00:00:00 2001 From 6ddfb0bfcd1eea71acd37ab06f7a4510b9f1d12b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:12:56 +0400 Date: Fri, 29 Mar 2013 09:12:56 +0400
Subject: [PATCH 05/40] optional libstdc Subject: [PATCH] optional libstdc
gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++ gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++
will not run correctly since by default the linker will try to link against libstdc++ will not run correctly since by default the linker will try to link against libstdc++
@@ -24,11 +24,11 @@ Upstream-Status: Inappropriate [embedded specific]
gcc/gcc.c | 1 + gcc/gcc.c | 1 +
4 files changed, 37 insertions(+), 1 deletion(-) 4 files changed, 37 insertions(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/c-family/c.opt diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
=================================================================== index c49da99d395..35f712e2c84 100644
--- gcc-8.5.0.orig/gcc/c-family/c.opt --- a/gcc/c-family/c.opt
+++ gcc-8.5.0/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt
@@ -1901,6 +1901,10 @@ nostdinc++ @@ -2025,6 +2025,10 @@ nostdinc++
C++ ObjC++ C++ ObjC++
Do not search standard system include directories for C++. Do not search standard system include directories for C++.
@@ -39,11 +39,11 @@ Index: gcc-8.5.0/gcc/c-family/c.opt
o o
C ObjC C++ ObjC++ Joined Separate C ObjC C++ ObjC++ Joined Separate
; Documented in common.opt ; Documented in common.opt
Index: gcc-8.5.0/gcc/cp/g++spec.c diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
=================================================================== index 0ab63bcd211..7b081e9e4f0 100644
--- gcc-8.5.0.orig/gcc/cp/g++spec.c --- a/gcc/cp/g++spec.c
+++ gcc-8.5.0/gcc/cp/g++spec.c +++ b/gcc/cp/g++spec.c
@@ -137,6 +137,7 @@ lang_specific_driver (struct cl_decoded_ @@ -137,6 +137,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options,
switch (decoded_options[i].opt_index) switch (decoded_options[i].opt_index)
{ {
case OPT_nostdlib: case OPT_nostdlib:
@@ -51,11 +51,11 @@ Index: gcc-8.5.0/gcc/cp/g++spec.c
case OPT_nodefaultlibs: case OPT_nodefaultlibs:
library = -1; library = -1;
break; break;
Index: gcc-8.5.0/gcc/doc/invoke.texi diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
=================================================================== index f12d8d12150..cf6cb428e7d 100644
--- gcc-8.5.0.orig/gcc/doc/invoke.texi --- a/gcc/doc/invoke.texi
+++ gcc-8.5.0/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi
@@ -212,6 +212,9 @@ in the following sections. @@ -230,6 +230,9 @@ in the following sections.
-fno-weak -nostdinc++ @gol -fno-weak -nostdinc++ @gol
-fvisibility-inlines-hidden @gol -fvisibility-inlines-hidden @gol
-fvisibility-ms-compat @gol -fvisibility-ms-compat @gol
@@ -63,21 +63,28 @@ Index: gcc-8.5.0/gcc/doc/invoke.texi
+-fvtv-counts -fvtv-debug @gol +-fvtv-counts -fvtv-debug @gol
+-nostdlib++ @gol +-nostdlib++ @gol
-fext-numeric-literals @gol -fext-numeric-literals @gol
-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
-Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol -Wno-class-conversion -Wclass-memaccess @gol
@@ -510,7 +513,7 @@ Objective-C and Objective-C++ Dialects}. @@ -599,7 +602,7 @@ Objective-C and Objective-C++ Dialects}.
-s -static -static-pie -static-libgcc -static-libstdc++ @gol -pie -pthread -r -rdynamic @gol
-s -static -static-pie -static-libgcc -static-libstdc++ @gol
-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
-static-libmpx -static-libmpxwrappers @gol
--shared -shared-libgcc -symbolic @gol --shared -shared-libgcc -symbolic @gol
+-shared -shared-libgcc -symbolic -nostdlib++ @gol +-shared -shared-libgcc -symbolic -nostdlib++ @gol
-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
-u @var{symbol} -z @var{keyword}} -u @var{symbol} -z @var{keyword}}
@@ -12348,6 +12351,33 @@ mechanism when this option is specified. @@ -14407,6 +14410,33 @@ Specify that the program entry point is @var{entry}. The argument is
interpreted by the linker; the GNU linker accepts either a symbol name
or an address.
@cindex @option{-lgcc}, use with @option{-nostdlib} +@item -nostdlib++
@cindex @option{-nostdlib} and unresolved references +@opindex nostdlib++
+Do not use the standard system C++ runtime libraries when linking.
+Only the libraries you specify will be passed to the linker.
+
+@cindex @option{-lgcc}, use with @option{-nostdlib}
+@cindex @option{-nostdlib} and unresolved references
+@cindex unresolved references and @option{-nostdlib} +@cindex unresolved references and @option{-nostdlib}
+@cindex @option{-lgcc}, use with @option{-nodefaultlibs} +@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
+@cindex @option{-nodefaultlibs} and unresolved references +@cindex @option{-nodefaultlibs} and unresolved references
@@ -98,25 +105,18 @@ Index: gcc-8.5.0/gcc/doc/invoke.texi
+constructors are called; @pxref{Collect2,,@code{collect2}, gccint, +constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
+GNU Compiler Collection (GCC) Internals}.) +GNU Compiler Collection (GCC) Internals}.)
+ +
+@item -nostdlib++ @item -pie
+@opindex nostdlib++ @opindex pie
+Do not use the standard system C++ runtime libraries when linking. Produce a dynamically linked position independent executable on targets
+Only the libraries you specify will be passed to the linker. diff --git a/gcc/gcc.c b/gcc/gcc.c
+ index b2200c5185a..f8be58ce0a6 100644
+@cindex @option{-lgcc}, use with @option{-nostdlib} --- a/gcc/gcc.c
+@cindex @option{-nostdlib} and unresolved references +++ b/gcc/gcc.c
@cindex unresolved references and @option{-nostdlib} @@ -1051,6 +1051,7 @@ proper position among the other output files. */
@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
@cindex @option{-nodefaultlibs} and unresolved references
Index: gcc-8.5.0/gcc/gcc.c
===================================================================
--- gcc-8.5.0.orig/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c
@@ -1047,6 +1047,7 @@ proper position among the other output f
%(mflib) " STACK_SPLIT_SPEC "\ %(mflib) " STACK_SPLIT_SPEC "\
%{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \
%{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\
+ %{!nostdlib++:}\ + %{!nostdlib++:}\
%{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}" %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}"
#endif #endif

View File

@@ -1,7 +1,7 @@
From 209e46f45382088caab54425b92b5dfc43ebb4fc Mon Sep 17 00:00:00 2001 From a6c90d3a9c5010b4aa7cc30467cf81ca7e0f430e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:16:28 +0400 Date: Fri, 29 Mar 2013 09:16:28 +0400
Subject: [PATCH 07/40] COLLECT_GCC_OPTIONS Subject: [PATCH] COLLECT_GCC_OPTIONS
This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to This patch adds --sysroot into COLLECT_GCC_OPTIONS which is used to
invoke collect2. invoke collect2.
@@ -13,11 +13,11 @@ Upstream-Status: Pending
gcc/gcc.c | 9 +++++++++ gcc/gcc.c | 9 +++++++++
1 file changed, 9 insertions(+) 1 file changed, 9 insertions(+)
Index: gcc-8.5.0/gcc/gcc.c diff --git a/gcc/gcc.c b/gcc/gcc.c
=================================================================== index f8be58ce0a6..48b0f9dde81 100644
--- gcc-8.5.0.orig/gcc/gcc.c --- a/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c +++ b/gcc/gcc.c
@@ -4677,6 +4677,15 @@ set_collect_gcc_options (void) @@ -4806,6 +4806,15 @@ set_collect_gcc_options (void)
sizeof ("COLLECT_GCC_OPTIONS=") - 1); sizeof ("COLLECT_GCC_OPTIONS=") - 1);
first_time = TRUE; first_time = TRUE;

View File

@@ -1,8 +1,7 @@
From 3bcbdf5ade54a72820ad7798119d0bbad4baf6ec Mon Sep 17 00:00:00 2001 From 5670d4489f119d2da661734895ac0be99b606d1b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:17:25 +0400 Date: Fri, 29 Mar 2013 09:17:25 +0400
Subject: [PATCH 08/40] Use the defaults.h in ${B} instead of ${S}, and t-oe in Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
${B}
Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
the source can be shared between gcc-cross-initial, the source can be shared between gcc-cross-initial,
@@ -26,11 +25,11 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
gcc/mkconfig.sh | 4 ++-- gcc/mkconfig.sh | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-) 4 files changed, 7 insertions(+), 7 deletions(-)
Index: gcc-8.5.0/gcc/Makefile.in diff --git a/gcc/Makefile.in b/gcc/Makefile.in
=================================================================== index 543b477ff18..a67d2cc18d6 100644
--- gcc-8.5.0.orig/gcc/Makefile.in --- a/gcc/Makefile.in
+++ gcc-8.5.0/gcc/Makefile.in +++ b/gcc/Makefile.in
@@ -538,7 +538,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT @@ -540,7 +540,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
xmake_file=@xmake_file@ xmake_file=@xmake_file@
@@ -39,11 +38,11 @@ Index: gcc-8.5.0/gcc/Makefile.in
TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@ TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@ TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@ TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
Index: gcc-8.5.0/gcc/configure diff --git a/gcc/configure b/gcc/configure
=================================================================== index 8de766a942c..b26e8fc7fee 100755
--- gcc-8.5.0.orig/gcc/configure --- a/gcc/configure
+++ gcc-8.5.0/gcc/configure +++ b/gcc/configure
@@ -12159,8 +12159,8 @@ for f in $tm_file; do @@ -12705,8 +12705,8 @@ for f in $tm_file; do
tm_include_list="${tm_include_list} $f" tm_include_list="${tm_include_list} $f"
;; ;;
defaults.h ) defaults.h )
@@ -54,11 +53,11 @@ Index: gcc-8.5.0/gcc/configure
;; ;;
* ) * )
tm_file_list="${tm_file_list} \$(srcdir)/config/$f" tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
Index: gcc-8.5.0/gcc/configure.ac diff --git a/gcc/configure.ac b/gcc/configure.ac
=================================================================== index 8bfd6feb780..26fa46802c7 100644
--- gcc-8.5.0.orig/gcc/configure.ac --- a/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac +++ b/gcc/configure.ac
@@ -1922,8 +1922,8 @@ for f in $tm_file; do @@ -2138,8 +2138,8 @@ for f in $tm_file; do
tm_include_list="${tm_include_list} $f" tm_include_list="${tm_include_list} $f"
;; ;;
defaults.h ) defaults.h )
@@ -69,10 +68,10 @@ Index: gcc-8.5.0/gcc/configure.ac
;; ;;
* ) * )
tm_file_list="${tm_file_list} \$(srcdir)/config/$f" tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
Index: gcc-8.5.0/gcc/mkconfig.sh diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
=================================================================== index d2c677a4a42..d03852481cb 100644
--- gcc-8.5.0.orig/gcc/mkconfig.sh --- a/gcc/mkconfig.sh
+++ gcc-8.5.0/gcc/mkconfig.sh +++ b/gcc/mkconfig.sh
@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then @@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
if [ $# -ge 1 ]; then if [ $# -ge 1 ]; then
echo '#ifdef IN_GCC' >> ${output}T echo '#ifdef IN_GCC' >> ${output}T

View File

@@ -1,7 +1,7 @@
From e654573352d28f160f379ee77e4067cf108714d0 Mon Sep 17 00:00:00 2001 From f05062625e7a4751be723595a2f7a4b7fbeff311 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:20:01 +0400 Date: Fri, 29 Mar 2013 09:20:01 +0400
Subject: [PATCH 09/40] fortran cross-compile hack. Subject: [PATCH] fortran cross-compile hack.
* Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used * Fortran would have searched for arm-angstrom-gnueabi-gfortran but would have used
used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross used gfortan. For gcc_4.2.2.bb we want to use the gfortran compiler from our cross
@@ -15,11 +15,11 @@ Upstream-Status: Inappropriate [embedded specific]
libgfortran/configure.ac | 2 +- libgfortran/configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-) 2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/libgfortran/configure diff --git a/libgfortran/configure b/libgfortran/configure
=================================================================== index b4cf854ddb3..e8e0ac3b1cf 100755
--- gcc-8.5.0.orig/libgfortran/configure --- a/libgfortran/configure
+++ gcc-8.5.0/libgfortran/configure +++ b/libgfortran/configure
@@ -12883,7 +12883,7 @@ esac @@ -13090,7 +13090,7 @@ esac
# We need gfortran to compile parts of the library # We need gfortran to compile parts of the library
#AC_PROG_FC(gfortran) #AC_PROG_FC(gfortran)
@@ -28,11 +28,11 @@ Index: gcc-8.5.0/libgfortran/configure
ac_ext=${ac_fc_srcext-f} ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
Index: gcc-8.5.0/libgfortran/configure.ac diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
=================================================================== index 711dc60ff78..3c9bbfbf47d 100644
--- gcc-8.5.0.orig/libgfortran/configure.ac --- a/libgfortran/configure.ac
+++ gcc-8.5.0/libgfortran/configure.ac +++ b/libgfortran/configure.ac
@@ -250,7 +250,7 @@ AC_SUBST(enable_static) @@ -258,7 +258,7 @@ AC_SUBST(enable_static)
# We need gfortran to compile parts of the library # We need gfortran to compile parts of the library
#AC_PROG_FC(gfortran) #AC_PROG_FC(gfortran)

View File

@@ -1,7 +1,7 @@
From 2ae7af4eb70eff6aeda1fe96333ff50cfaa9d906 Mon Sep 17 00:00:00 2001 From 1d76de7f1f5c99f1fa1a4b14aedad3d702e4e136 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:22:00 +0400 Date: Fri, 29 Mar 2013 09:22:00 +0400
Subject: [PATCH 10/40] cpp: honor sysroot. Subject: [PATCH] cpp: honor sysroot.
Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
@@ -25,22 +25,22 @@ Upstream-Status: Pending
gcc/gcc.c | 2 +- gcc/gcc.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-) 2 files changed, 2 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/gcc/cp/lang-specs.h diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
=================================================================== index 0ad4a33b93e..16c744f4f90 100644
--- gcc-8.5.0.orig/gcc/cp/lang-specs.h --- a/gcc/cp/lang-specs.h
+++ gcc-8.5.0/gcc/cp/lang-specs.h +++ b/gcc/cp/lang-specs.h
@@ -64,5 +64,5 @@ along with GCC; see the file COPYING3. @@ -66,5 +66,5 @@ along with GCC; see the file COPYING3. If not see
{".ii", "@c++-cpp-output", 0, 0, 0}, {".ii", "@c++-cpp-output", 0, 0, 0},
{"@c++-cpp-output", {"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\ "%{!E:%{!M:%{!MM:"
- cc1plus -fpreprocessed %i %(cc1_options) %2\ - " cc1plus -fpreprocessed %i %(cc1_options) %2"
+ cc1plus -fpreprocessed %i %I %(cc1_options) %2\ + " cc1plus -fpreprocessed %i %I %(cc1_options) %2"
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, " %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: gcc-8.5.0/gcc/gcc.c diff --git a/gcc/gcc.c b/gcc/gcc.c
=================================================================== index 48b0f9dde81..c87f603955f 100644
--- gcc-8.5.0.orig/gcc/gcc.c --- a/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c +++ b/gcc/gcc.c
@@ -1343,7 +1343,7 @@ static const struct compiler default_com @@ -1348,7 +1348,7 @@ static const struct compiler default_compilers[] =
%W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0}, %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0}, {".i", "@cpp-output", 0, 0, 0},
{"@cpp-output", {"@cpp-output",

View File

@@ -1,7 +1,7 @@
From 1e1ea0eb55a594ac4cd7b838f74dec7405aae02b Mon Sep 17 00:00:00 2001 From 4fad4433c96bc9d0d9d124f9674fb3389f6f426e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:23:08 +0400 Date: Fri, 29 Mar 2013 09:23:08 +0400
Subject: [PATCH 11/40] MIPS64: Default to N64 ABI Subject: [PATCH] MIPS64: Default to N64 ABI
MIPS64 defaults to n32 ABI, this patch makes it MIPS64 defaults to n32 ABI, this patch makes it
so that it defaults to N64 ABI so that it defaults to N64 ABI
@@ -13,11 +13,11 @@ Upstream-Status: Inappropriate [OE config specific]
gcc/config.gcc | 10 +++++----- gcc/config.gcc | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-) 1 file changed, 5 insertions(+), 5 deletions(-)
Index: gcc-8.5.0/gcc/config.gcc diff --git a/gcc/config.gcc b/gcc/config.gcc
=================================================================== index cf1a87e2efd..37c4221a39f 100644
--- gcc-8.5.0.orig/gcc/config.gcc --- a/gcc/config.gcc
+++ gcc-8.5.0/gcc/config.gcc +++ b/gcc/config.gcc
@@ -2152,29 +2152,29 @@ mips*-*-linux*) # Linux MIPS, either @@ -2511,29 +2511,29 @@ mips*-*-linux*) # Linux MIPS, either endian.
default_mips_arch=mips32 default_mips_arch=mips32
;; ;;
mips64el-st-linux-gnu) mips64el-st-linux-gnu)

View File

@@ -1,7 +1,7 @@
From 6f8649936df3677109b8396f563c716ae8b237fe Mon Sep 17 00:00:00 2001 From 8fc016a53c22c19feccbfa13ebdf19090dc67058 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:24:50 +0400 Date: Fri, 29 Mar 2013 09:24:50 +0400
Subject: [PATCH 12/40] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
relative to SYSTEMLIBS_DIR relative to SYSTEMLIBS_DIR
This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
@@ -24,17 +24,17 @@ Upstream-Status: Inappropriate [OE configuration]
gcc/config/linux.h | 8 ++++---- gcc/config/linux.h | 8 ++++----
gcc/config/mips/linux.h | 12 ++++++------ gcc/config/mips/linux.h | 12 ++++++------
gcc/config/riscv/linux.h | 2 +- gcc/config/riscv/linux.h | 2 +-
gcc/config/rs6000/linux64.h | 16 ++++++---------- gcc/config/rs6000/linux64.h | 15 +++++----------
gcc/config/sh/linux.h | 2 +- gcc/config/sh/linux.h | 2 +-
gcc/config/sparc/linux.h | 2 +- gcc/config/sparc/linux.h | 2 +-
gcc/config/sparc/linux64.h | 4 ++-- gcc/config/sparc/linux64.h | 4 ++--
12 files changed, 30 insertions(+), 34 deletions(-) 12 files changed, 29 insertions(+), 34 deletions(-)
Index: gcc-8.5.0/gcc/config/alpha/linux-elf.h diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
=================================================================== index e25fcac3c59..01aca0c6542 100644
--- gcc-8.5.0.orig/gcc/config/alpha/linux-elf.h --- a/gcc/config/alpha/linux-elf.h
+++ gcc-8.5.0/gcc/config/alpha/linux-elf.h +++ b/gcc/config/alpha/linux-elf.h
@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
#define EXTRA_SPECS \ #define EXTRA_SPECS \
{ "elf_dynamic_linker", ELF_DYNAMIC_LINKER }, { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
@@ -45,11 +45,11 @@ Index: gcc-8.5.0/gcc/config/alpha/linux-elf.h
#if DEFAULT_LIBC == LIBC_UCLIBC #if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
#elif DEFAULT_LIBC == LIBC_GLIBC #elif DEFAULT_LIBC == LIBC_GLIBC
Index: gcc-8.5.0/gcc/config/arm/linux-eabi.h diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
=================================================================== index 5bdcfa0c5d3..0c0332f317f 100644
--- gcc-8.5.0.orig/gcc/config/arm/linux-eabi.h --- a/gcc/config/arm/linux-eabi.h
+++ gcc-8.5.0/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h
@@ -62,8 +62,8 @@ @@ -65,8 +65,8 @@
GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */ GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
#undef GLIBC_DYNAMIC_LINKER #undef GLIBC_DYNAMIC_LINKER
@@ -60,10 +60,10 @@ Index: gcc-8.5.0/gcc/config/arm/linux-eabi.h
#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
#define GLIBC_DYNAMIC_LINKER \ #define GLIBC_DYNAMIC_LINKER \
Index: gcc-8.5.0/gcc/config/arm/linux-elf.h diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
=================================================================== index 0ec3aa53189..abfa9566d74 100644
--- gcc-8.5.0.orig/gcc/config/arm/linux-elf.h --- a/gcc/config/arm/linux-elf.h
+++ gcc-8.5.0/gcc/config/arm/linux-elf.h +++ b/gcc/config/arm/linux-elf.h
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc" #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
@@ -73,11 +73,11 @@ Index: gcc-8.5.0/gcc/config/arm/linux-elf.h
#define LINUX_TARGET_LINK_SPEC "%{h*} \ #define LINUX_TARGET_LINK_SPEC "%{h*} \
%{static:-Bstatic} \ %{static:-Bstatic} \
Index: gcc-8.5.0/gcc/config/i386/linux.h diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
=================================================================== index 9f823f125ed..e0390b7d5e3 100644
--- gcc-8.5.0.orig/gcc/config/i386/linux.h --- a/gcc/config/i386/linux.h
+++ gcc-8.5.0/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. @@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */ <http://www.gnu.org/licenses/>. */
#define GNU_USER_LINK_EMULATION "elf_i386" #define GNU_USER_LINK_EMULATION "elf_i386"
@@ -86,11 +86,11 @@ Index: gcc-8.5.0/gcc/config/i386/linux.h
#undef MUSL_DYNAMIC_LINKER #undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
Index: gcc-8.5.0/gcc/config/i386/linux64.h diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
=================================================================== index 6cb68d1ccfa..7de09ec857c 100644
--- gcc-8.5.0.orig/gcc/config/i386/linux64.h --- a/gcc/config/i386/linux64.h
+++ gcc-8.5.0/gcc/config/i386/linux64.h +++ b/gcc/config/i386/linux64.h
@@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTI @@ -27,9 +27,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_LINK_EMULATION64 "elf_x86_64" #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
#define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64" #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
@@ -103,11 +103,11 @@ Index: gcc-8.5.0/gcc/config/i386/linux64.h
#undef MUSL_DYNAMIC_LINKER32 #undef MUSL_DYNAMIC_LINKER32
#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" #define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
Index: gcc-8.5.0/gcc/config/linux.h diff --git a/gcc/config/linux.h b/gcc/config/linux.h
=================================================================== index 95654bcdb5a..0c1a8118a26 100644
--- gcc-8.5.0.orig/gcc/config/linux.h --- a/gcc/config/linux.h
+++ gcc-8.5.0/gcc/config/linux.h +++ b/gcc/config/linux.h
@@ -81,10 +81,10 @@ see the files COPYING3 and COPYING.RUNTI @@ -94,10 +94,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GLIBC_DYNAMIC_LINKER must be defined for each target using them, or GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
supporting both 32-bit and 64-bit compilation. */ supporting both 32-bit and 64-bit compilation. */
@@ -122,11 +122,11 @@ Index: gcc-8.5.0/gcc/config/linux.h
#define BIONIC_DYNAMIC_LINKER "/system/bin/linker" #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker" #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64" #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
Index: gcc-8.5.0/gcc/config/mips/linux.h diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
=================================================================== index 54446e58e5f..4786ee304c1 100644
--- gcc-8.5.0.orig/gcc/config/mips/linux.h --- a/gcc/config/mips/linux.h
+++ gcc-8.5.0/gcc/config/mips/linux.h +++ b/gcc/config/mips/linux.h
@@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. @@ -22,20 +22,20 @@ along with GCC; see the file COPYING3. If not see
#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32" #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
#define GLIBC_DYNAMIC_LINKER32 \ #define GLIBC_DYNAMIC_LINKER32 \
@@ -153,11 +153,11 @@ Index: gcc-8.5.0/gcc/config/mips/linux.h
#undef MUSL_DYNAMIC_LINKER32 #undef MUSL_DYNAMIC_LINKER32
#define MUSL_DYNAMIC_LINKER32 \ #define MUSL_DYNAMIC_LINKER32 \
Index: gcc-8.5.0/gcc/config/riscv/linux.h diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
=================================================================== index 4afef7c228c..01997330741 100644
--- gcc-8.5.0.orig/gcc/config/riscv/linux.h --- a/gcc/config/riscv/linux.h
+++ gcc-8.5.0/gcc/config/riscv/linux.h +++ b/gcc/config/riscv/linux.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
GNU_USER_TARGET_OS_CPP_BUILTINS(); \ GNU_USER_TARGET_OS_CPP_BUILTINS(); \
} while (0) } while (0)
@@ -166,11 +166,11 @@ Index: gcc-8.5.0/gcc/config/riscv/linux.h
#define MUSL_ABI_SUFFIX \ #define MUSL_ABI_SUFFIX \
"%{mabi=ilp32:-sf}" \ "%{mabi=ilp32:-sf}" \
Index: gcc-8.5.0/gcc/config/rs6000/linux64.h diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
=================================================================== index 34776c8421e..967c1c43c63 100644
--- gcc-8.5.0.orig/gcc/config/rs6000/linux64.h --- a/gcc/config/rs6000/linux64.h
+++ gcc-8.5.0/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h
@@ -413,16 +413,11 @@ extern int dot_symbols; @@ -419,24 +419,19 @@ extern int dot_symbols;
#undef LINK_OS_DEFAULT_SPEC #undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
@@ -189,24 +189,22 @@ Index: gcc-8.5.0/gcc/config/rs6000/linux64.h
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}" +#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
#endif #endif
#undef MUSL_DYNAMIC_LINKER32
#define MUSL_DYNAMIC_LINKER32 \ #define MUSL_DYNAMIC_LINKER32 \
@@ -430,8 +425,9 @@ extern int dot_symbols; - "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#undef MUSL_DYNAMIC_LINKER64
#define MUSL_DYNAMIC_LINKER64 \ #define MUSL_DYNAMIC_LINKER64 \
"/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1" - "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" #undef DEFAULT_ASM_ENDIAN
-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0" diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0" index c1d0441d488..81373eb8336 100644
+ --- a/gcc/config/sh/linux.h
#if DEFAULT_LIBC == LIBC_UCLIBC +++ b/gcc/config/sh/linux.h
#define CHOOSE_DYNAMIC_LINKER(G, U, M) \ @@ -64,7 +64,7 @@ along with GCC; see the file COPYING3. If not see
"%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
Index: gcc-8.5.0/gcc/config/sh/linux.h
===================================================================
--- gcc-8.5.0.orig/gcc/config/sh/linux.h
+++ gcc-8.5.0/gcc/config/sh/linux.h
@@ -64,7 +64,7 @@ along with GCC; see the file COPYING3.
"/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
"%{mfdpic:-fdpic}.so.1" "%{mfdpic:-fdpic}.so.1"
@@ -215,11 +213,11 @@ Index: gcc-8.5.0/gcc/config/sh/linux.h
#undef SUBTARGET_LINK_EMUL_SUFFIX #undef SUBTARGET_LINK_EMUL_SUFFIX
#define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}" #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
Index: gcc-8.5.0/gcc/config/sparc/linux.h diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
=================================================================== index 81201e67a2f..8b6fc577594 100644
--- gcc-8.5.0.orig/gcc/config/sparc/linux.h --- a/gcc/config/sparc/linux.h
+++ gcc-8.5.0/gcc/config/sparc/linux.h +++ b/gcc/config/sparc/linux.h
@@ -83,7 +83,7 @@ extern const char *host_detect_local_cpu @@ -84,7 +84,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
When the -shared link option is used a final link is not being When the -shared link option is used a final link is not being
done. */ done. */
@@ -228,11 +226,11 @@ Index: gcc-8.5.0/gcc/config/sparc/linux.h
#undef LINK_SPEC #undef LINK_SPEC
#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
Index: gcc-8.5.0/gcc/config/sparc/linux64.h diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
=================================================================== index a1a0efd8f28..85d1084afc2 100644
--- gcc-8.5.0.orig/gcc/config/sparc/linux64.h --- a/gcc/config/sparc/linux64.h
+++ gcc-8.5.0/gcc/config/sparc/linux64.h +++ b/gcc/config/sparc/linux64.h
@@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. @@ -84,8 +84,8 @@ along with GCC; see the file COPYING3. If not see
When the -shared link option is used a final link is not being When the -shared link option is used a final link is not being
done. */ done. */

View File

@@ -1,7 +1,7 @@
From 9e815965fbaa90134be0e777cfc2fbcfab16b674 Mon Sep 17 00:00:00 2001 From a22d1264049d29b90663cf5667049ae6f9b7a5ce Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:26:37 +0400 Date: Fri, 29 Mar 2013 09:26:37 +0400
Subject: [PATCH 13/40] gcc: Fix argument list too long error. Subject: [PATCH] gcc: Fix argument list too long error.
There would be an "Argument list too long" error when the There would be an "Argument list too long" error when the
build directory is longer than 200, this is caused by: build directory is longer than 200, this is caused by:
@@ -17,21 +17,24 @@ $(sort list) doesn't need this.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
RP: gcc then added *.h and *.def additions to this list, breaking the original
fix. Add the sort to the original gcc code, leaving the tr+sort to fix the original
issue but include the new files too as reported by Zhuang <qiuguang.zqg@alibaba-inc.com>
Upstream-Status: Pending Upstream-Status: Pending
--- ---
gcc/Makefile.in | 2 +- gcc/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/Makefile.in diff --git a/gcc/Makefile.in b/gcc/Makefile.in
=================================================================== index a67d2cc18d6..480c9366418 100644
--- gcc-8.5.0.orig/gcc/Makefile.in --- a/gcc/Makefile.in
+++ gcc-8.5.0/gcc/Makefile.in +++ b/gcc/Makefile.in
@@ -3539,7 +3539,7 @@ install-plugin: installdirs lang.install # We keep the directory structure for files in config, common/config or
# We keep the directory structure for files in config or c-family and .def # c-family and .def files. All other files are flattened to a single directory.
# files. All other files are flattened to a single directory.
$(mkinstalldirs) $(DESTDIR)$(plugin_includedir) $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
- headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \ - headers=`echo $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
+ headers="$(sort $(PLUGIN_HEADERS) $$(cd $(srcdir); echo *.h *.def))"; \ + headers=`echo $(sort $(PLUGIN_HEADERS)) $$(cd $(srcdir); echo *.h *.def) | tr ' ' '\012' | sort -u`; \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
for file in $$headers; do \ for file in $$headers; do \
if [ -f $$file ] ; then \ if [ -f $$file ] ; then \

View File

@@ -1,7 +1,7 @@
From 00c7a7fdd4b4aad9e57d8b541de17ad209b6cd06 Mon Sep 17 00:00:00 2001 From fa47586935a18ecfc2ad5586802e326e21741b7b Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:28:10 +0400 Date: Fri, 29 Mar 2013 09:28:10 +0400
Subject: [PATCH 14/40] Disable sdt. Subject: [PATCH] Disable sdt.
We don't list dtrace in DEPENDS so we shouldn't be depending on this header. We don't list dtrace in DEPENDS so we shouldn't be depending on this header.
It may or may not exist from preivous builds though. To be determinstic, disable It may or may not exist from preivous builds though. To be determinstic, disable
@@ -24,11 +24,11 @@ Upstream-Status: Inappropriate [hack]
libstdc++-v3/configure.ac | 2 +- libstdc++-v3/configure.ac | 2 +-
4 files changed, 19 insertions(+), 19 deletions(-) 4 files changed, 19 insertions(+), 19 deletions(-)
Index: gcc-8.5.0/gcc/configure diff --git a/gcc/configure b/gcc/configure
=================================================================== index b26e8fc7fee..6080f86145e 100755
--- gcc-8.5.0.orig/gcc/configure --- a/gcc/configure
+++ gcc-8.5.0/gcc/configure +++ b/gcc/configure
@@ -29346,12 +29346,12 @@ fi @@ -29789,12 +29789,12 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
$as_echo_n "checking sys/sdt.h in the target C library... " >&6; } $as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
have_sys_sdt_h=no have_sys_sdt_h=no
@@ -47,11 +47,11 @@ Index: gcc-8.5.0/gcc/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
$as_echo "$have_sys_sdt_h" >&6; } $as_echo "$have_sys_sdt_h" >&6; }
Index: gcc-8.5.0/gcc/configure.ac diff --git a/gcc/configure.ac b/gcc/configure.ac
=================================================================== index 26fa46802c7..42be5252778 100644
--- gcc-8.5.0.orig/gcc/configure.ac --- a/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac +++ b/gcc/configure.ac
@@ -5950,15 +5950,15 @@ fi @@ -6190,15 +6190,15 @@ fi
AC_SUBST([enable_default_ssp]) AC_SUBST([enable_default_ssp])
# Test for <sys/sdt.h> on the target. # Test for <sys/sdt.h> on the target.
@@ -76,11 +76,11 @@ Index: gcc-8.5.0/gcc/configure.ac
# Check if TFmode long double should be used by default or not. # Check if TFmode long double should be used by default or not.
# Some glibc targets used DFmode long double, but with glibc 2.4 # Some glibc targets used DFmode long double, but with glibc 2.4
Index: gcc-8.5.0/libstdc++-v3/configure diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
=================================================================== index 9f9c5a2419a..71ed13b815b 100755
--- gcc-8.5.0.orig/libstdc++-v3/configure --- a/libstdc++-v3/configure
+++ gcc-8.5.0/libstdc++-v3/configure +++ b/libstdc++-v3/configure
@@ -22025,11 +22025,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS con @@ -22615,11 +22615,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
@@ -95,11 +95,11 @@ Index: gcc-8.5.0/libstdc++-v3/configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sys_sdt_h" >&5
$as_echo "$glibcxx_cv_sys_sdt_h" >&6; } $as_echo "$glibcxx_cv_sys_sdt_h" >&6; }
Index: gcc-8.5.0/libstdc++-v3/configure.ac diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
=================================================================== index 699e55fd829..5c7a7bda439 100644
--- gcc-8.5.0.orig/libstdc++-v3/configure.ac --- a/libstdc++-v3/configure.ac
+++ gcc-8.5.0/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac
@@ -232,7 +232,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN @@ -241,7 +241,7 @@ GLIBCXX_CHECK_SC_NPROCESSORS_ONLN
GLIBCXX_CHECK_SC_NPROC_ONLN GLIBCXX_CHECK_SC_NPROC_ONLN
GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP
GLIBCXX_CHECK_SYSCTL_HW_NCPU GLIBCXX_CHECK_SYSCTL_HW_NCPU

View File

@@ -1,7 +1,7 @@
From 80f2b01b3f917cea08294328c8bbc51dadece4af Mon Sep 17 00:00:00 2001 From 6ecd478881468934444ff85611fd43f7033b1e81 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:29:11 +0400 Date: Fri, 29 Mar 2013 09:29:11 +0400
Subject: [PATCH 15/40] libtool Subject: [PATCH] libtool
libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64 libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
when running on am x86_64 build host. when running on am x86_64 build host.
@@ -22,10 +22,10 @@ Upstream-Status: Pending
ltmain.sh | 4 ++++ ltmain.sh | 4 ++++
1 file changed, 4 insertions(+) 1 file changed, 4 insertions(+)
Index: gcc-8.5.0/ltmain.sh diff --git a/ltmain.sh b/ltmain.sh
=================================================================== index 70990740b6c..ee938056bef 100644
--- gcc-8.5.0.orig/ltmain.sh --- a/ltmain.sh
+++ gcc-8.5.0/ltmain.sh +++ b/ltmain.sh
@@ -6359,6 +6359,10 @@ func_mode_link () @@ -6359,6 +6359,10 @@ func_mode_link ()
func_warning "ignoring multiple \`-rpath's for a libtool library" func_warning "ignoring multiple \`-rpath's for a libtool library"

View File

@@ -1,7 +1,7 @@
From a66ec1e382bf869749588f072a4a7c09039f2b3a Mon Sep 17 00:00:00 2001 From de4427fa49c07dc651ee6ceaf5c5078700ca3b08 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:30:32 +0400 Date: Fri, 29 Mar 2013 09:30:32 +0400
Subject: [PATCH 16/40] gcc: armv4: pass fix-v4bx to linker to support EABI. Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
The LINK_SPEC for linux gets overwritten by linux-eabi.h which The LINK_SPEC for linux gets overwritten by linux-eabi.h which
means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
@@ -18,13 +18,13 @@ Upstream-Status: Pending
gcc/config/arm/linux-eabi.h | 6 +++++- gcc/config/arm/linux-eabi.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-) 1 file changed, 5 insertions(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/config/arm/linux-eabi.h diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
=================================================================== index 0c0332f317f..7b3769e8459 100644
--- gcc-8.5.0.orig/gcc/config/arm/linux-eabi.h --- a/gcc/config/arm/linux-eabi.h
+++ gcc-8.5.0/gcc/config/arm/linux-eabi.h +++ b/gcc/config/arm/linux-eabi.h
@@ -88,10 +88,14 @@ @@ -91,10 +91,14 @@
#define MUSL_DYNAMIC_LINKER \ #define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1" "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */ +/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC +#undef TARGET_FIX_V4BX_SPEC

View File

@@ -1,8 +1,8 @@
From 624db734f656ad8cdf8b3cf3fc8e860b70c6c251 Mon Sep 17 00:00:00 2001 From 6b363c2c1c089ee900efa6013aefba1003840a37 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:33:04 +0400 Date: Fri, 29 Mar 2013 09:33:04 +0400
Subject: [PATCH 17/40] Use the multilib config files from ${B} instead of Subject: [PATCH] Use the multilib config files from ${B} instead of using the
using the ones from ${S} ones from ${S}
Use the multilib config files from ${B} instead of using the ones from ${S} Use the multilib config files from ${B} instead of using the ones from ${S}
so that the source can be shared between gcc-cross-initial, so that the source can be shared between gcc-cross-initial,
@@ -17,11 +17,11 @@ Upstream-Status: Inappropriate [configuration]
gcc/configure.ac | 22 ++++++++++++++++++---- gcc/configure.ac | 22 ++++++++++++++++++----
2 files changed, 36 insertions(+), 8 deletions(-) 2 files changed, 36 insertions(+), 8 deletions(-)
Index: gcc-8.5.0/gcc/configure diff --git a/gcc/configure b/gcc/configure
=================================================================== index 6080f86145e..825a9652329 100755
--- gcc-8.5.0.orig/gcc/configure --- a/gcc/configure
+++ gcc-8.5.0/gcc/configure +++ b/gcc/configure
@@ -12139,10 +12139,20 @@ done @@ -12685,10 +12685,20 @@ done
tmake_file_= tmake_file_=
for f in ${tmake_file} for f in ${tmake_file}
do do
@@ -44,9 +44,9 @@ Index: gcc-8.5.0/gcc/configure
+ ;; + ;;
+ esac + esac
done done
tmake_file="${tmake_file_}" tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
@@ -12153,6 +12163,10 @@ tm_file_list="options.h" @@ -12699,6 +12709,10 @@ tm_file_list="options.h"
tm_include_list="options.h insn-constants.h" tm_include_list="options.h insn-constants.h"
for f in $tm_file; do for f in $tm_file; do
case $f in case $f in
@@ -57,11 +57,11 @@ Index: gcc-8.5.0/gcc/configure
./* ) ./* )
f=`echo $f | sed 's/^..//'` f=`echo $f | sed 's/^..//'`
tm_file_list="${tm_file_list} $f" tm_file_list="${tm_file_list} $f"
Index: gcc-8.5.0/gcc/configure.ac diff --git a/gcc/configure.ac b/gcc/configure.ac
=================================================================== index 42be5252778..6099eb3251f 100644
--- gcc-8.5.0.orig/gcc/configure.ac --- a/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac +++ b/gcc/configure.ac
@@ -1902,10 +1902,20 @@ done @@ -2118,10 +2118,20 @@ done
tmake_file_= tmake_file_=
for f in ${tmake_file} for f in ${tmake_file}
do do
@@ -84,9 +84,9 @@ Index: gcc-8.5.0/gcc/configure.ac
+ ;; + ;;
+ esac + esac
done done
tmake_file="${tmake_file_}" tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
@@ -1916,6 +1926,10 @@ tm_file_list="options.h" @@ -2132,6 +2142,10 @@ tm_file_list="options.h"
tm_include_list="options.h insn-constants.h" tm_include_list="options.h insn-constants.h"
for f in $tm_file; do for f in $tm_file; do
case $f in case $f in

View File

@@ -1,8 +1,8 @@
From 27cca95dcfeead8c52d292c4824ee96f178d6183 Mon Sep 17 00:00:00 2001 From 08752c2f1d21553301bee5757c453c6a36cbe03c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 09:39:38 +0000 Date: Fri, 20 Feb 2015 09:39:38 +0000
Subject: [PATCH 18/40] Avoid using libdir from .la which usually points to a Subject: [PATCH] Avoid using libdir from .la which usually points to a host
host path path
Upstream-Status: Inappropriate [embedded specific] Upstream-Status: Inappropriate [embedded specific]
@@ -12,10 +12,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ltmain.sh | 3 +++ ltmain.sh | 3 +++
1 file changed, 3 insertions(+) 1 file changed, 3 insertions(+)
Index: gcc-8.5.0/ltmain.sh diff --git a/ltmain.sh b/ltmain.sh
=================================================================== index ee938056bef..9ebc7e3d1e0 100644
--- gcc-8.5.0.orig/ltmain.sh --- a/ltmain.sh
+++ gcc-8.5.0/ltmain.sh +++ b/ltmain.sh
@@ -5628,6 +5628,9 @@ func_mode_link () @@ -5628,6 +5628,9 @@ func_mode_link ()
absdir="$abs_ladir" absdir="$abs_ladir"
libdir="$abs_ladir" libdir="$abs_ladir"

View File

@@ -1,7 +1,7 @@
From a2936382da81aefa9b69c1fc625f6c706b7ea1d8 Mon Sep 17 00:00:00 2001 From 5c3d66378c7ff60ca11a875aa4aa6f8a8529d43a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 09:40:59 +0000 Date: Fri, 20 Feb 2015 09:40:59 +0000
Subject: [PATCH 19/40] export CPP Subject: [PATCH] export CPP
The OE environment sets and exports CPP as being the target gcc. When The OE environment sets and exports CPP as being the target gcc. When
building gcc-cross-canadian for a mingw targetted sdk, the following can be found building gcc-cross-canadian for a mingw targetted sdk, the following can be found
@@ -36,10 +36,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
Makefile.in | 1 + Makefile.in | 1 +
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
Index: gcc-8.5.0/Makefile.in diff --git a/Makefile.in b/Makefile.in
=================================================================== index 36e369df6e7..c717903bb13 100644
--- gcc-8.5.0.orig/Makefile.in --- a/Makefile.in
+++ gcc-8.5.0/Makefile.in +++ b/Makefile.in
@@ -149,6 +149,7 @@ BUILD_EXPORTS = \ @@ -149,6 +149,7 @@ BUILD_EXPORTS = \
AR="$(AR_FOR_BUILD)"; export AR; \ AR="$(AR_FOR_BUILD)"; export AR; \
AS="$(AS_FOR_BUILD)"; export AS; \ AS="$(AS_FOR_BUILD)"; export AS; \

View File

@@ -0,0 +1,57 @@
From 378b752c5d9a3dba4e58cdadf8b4b4f34ea99a76 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:25:11 +0000
Subject: [PATCH] Ensure target gcc headers can be included
There are a few headers installed as part of the OpenEmbedded
gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
built for the target architecture, these are within the target
sysroot and not cross/nativesdk; thus they weren't able to be
found by gcc with the existing search paths. Add support for
picking up these headers under the sysroot supplied on the gcc
command line in order to resolve this.
Upstream-Status: Pending
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/Makefile.in | 2 ++
gcc/cppdefault.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 480c9366418..011c7ac2db6 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -618,6 +618,7 @@ libexecdir = @libexecdir@
# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+libsubdir_target = $(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
@@ -2946,6 +2947,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
PREPROCESSOR_DEFINES = \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
index af38cc494ea..2f43b88a0c3 100644
--- a/gcc/cppdefault.c
+++ b/gcc/cppdefault.c
@@ -59,6 +59,10 @@ const struct default_include cpp_include_defaults[]
/* This is the dir for gcc's private headers. */
{ GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+ /* This is the dir for gcc's private headers under the specified sysroot. */
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
{ LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },

View File

@@ -1,8 +1,8 @@
From 0409d2dd7322ecbed731cbe29b034fea43c5dddc Mon Sep 17 00:00:00 2001 From 870e805d705d99d9b9d7dbd09727f9c1d2ad9c1d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 3 Mar 2015 08:21:19 +0000 Date: Tue, 3 Mar 2015 08:21:19 +0000
Subject: [PATCH 23/40] Don't search host directory during "relink" if Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
$inst_prefix is provided is provided
http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
@@ -13,10 +13,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
ltmain.sh | 5 +++-- ltmain.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-) 1 file changed, 3 insertions(+), 2 deletions(-)
Index: gcc-8.5.0/ltmain.sh diff --git a/ltmain.sh b/ltmain.sh
=================================================================== index 9ebc7e3d1e0..7ea79fa8be6 100644
--- gcc-8.5.0.orig/ltmain.sh --- a/ltmain.sh
+++ gcc-8.5.0/ltmain.sh +++ b/ltmain.sh
@@ -6004,12 +6004,13 @@ func_mode_link () @@ -6004,12 +6004,13 @@ func_mode_link ()
fi fi
else else

View File

@@ -1,7 +1,8 @@
From 56e2e1fc2a27c4a5cc9b471d5d0af90bcb871bfa Mon Sep 17 00:00:00 2001 From aba42de763a619355471efd1573561b0cbf51162 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Apr 2015 23:15:27 -0700 Date: Tue, 28 Apr 2015 23:15:27 -0700
Subject: [PATCH 24/40] Use SYSTEMLIBS_DIR replacement instead of hardcoding base_libdir Subject: [PATCH] Use SYSTEMLIBS_DIR replacement instead of hardcoding
base_libdir
Upstream-Status: Pending Upstream-Status: Pending
@@ -10,10 +11,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/config/aarch64/aarch64-linux.h | 2 +- gcc/config/aarch64/aarch64-linux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/config/aarch64/aarch64-linux.h diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
=================================================================== index e587e2e9ad6..ddc62895693 100644
--- gcc-8.5.0.orig/gcc/config/aarch64/aarch64-linux.h --- a/gcc/config/aarch64/aarch64-linux.h
+++ gcc-8.5.0/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
#ifndef GCC_AARCH64_LINUX_H #ifndef GCC_AARCH64_LINUX_H
#define GCC_AARCH64_LINUX_H #define GCC_AARCH64_LINUX_H

View File

@@ -1,7 +1,7 @@
From b142e77e44e1acece6da54ccdc24c4da89cf4b99 Mon Sep 17 00:00:00 2001 From d63820a78d92f302410358293546f01c7ad17bd8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 28 Apr 2015 23:18:39 -0700 Date: Tue, 28 Apr 2015 23:18:39 -0700
Subject: [PATCH 25/40] aarch64: Add support for musl ldso Subject: [PATCH] aarch64: Add support for musl ldso
Upstream-Status: Pending Upstream-Status: Pending
@@ -10,10 +10,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/config/aarch64/aarch64-linux.h | 2 +- gcc/config/aarch64/aarch64-linux.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/config/aarch64/aarch64-linux.h diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
=================================================================== index ddc62895693..b301825313a 100644
--- gcc-8.5.0.orig/gcc/config/aarch64/aarch64-linux.h --- a/gcc/config/aarch64/aarch64-linux.h
+++ gcc-8.5.0/gcc/config/aarch64/aarch64-linux.h +++ b/gcc/config/aarch64/aarch64-linux.h
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1" #define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"

View File

@@ -1,7 +1,7 @@
From 3d4e53fc7cd71ce1181af8a5e9655398857af741 Mon Sep 17 00:00:00 2001 From 3474e16ad4ea8cf4e0e330568e3bc9039e723dce Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com> From: Robert Yang <liezhi.yang@windriver.com>
Date: Sun, 5 Jul 2015 20:25:18 -0700 Date: Sun, 5 Jul 2015 20:25:18 -0700
Subject: [PATCH 26/40] libcc1: fix libcc1's install path and rpath Subject: [PATCH] libcc1: fix libcc1's install path and rpath
* Install libcc1.so and libcc1plugin.so into * Install libcc1.so and libcc1plugin.so into
$(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
@@ -19,11 +19,11 @@ Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
libcc1/Makefile.in | 4 ++-- libcc1/Makefile.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-) 2 files changed, 4 insertions(+), 4 deletions(-)
Index: gcc-8.5.0/libcc1/Makefile.am diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
=================================================================== index c005b0dad4a..ec31d35b7b9 100644
--- gcc-8.5.0.orig/libcc1/Makefile.am --- a/libcc1/Makefile.am
+++ gcc-8.5.0/libcc1/Makefile.am +++ b/libcc1/Makefile.am
@@ -37,8 +37,8 @@ libiberty = $(if $(wildcard $(libiberty_ @@ -37,8 +37,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(Wc)$(libiberty_normal))) $(Wc)$(libiberty_normal)))
libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
@@ -34,11 +34,11 @@ Index: gcc-8.5.0/libcc1/Makefile.am
if ENABLE_PLUGIN if ENABLE_PLUGIN
plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
Index: gcc-8.5.0/libcc1/Makefile.in diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
=================================================================== index 7104b649026..2103c477468 100644
--- gcc-8.5.0.orig/libcc1/Makefile.in --- a/libcc1/Makefile.in
+++ gcc-8.5.0/libcc1/Makefile.in +++ b/libcc1/Makefile.in
@@ -303,8 +303,8 @@ libiberty = $(if $(wildcard $(libiberty_ @@ -393,8 +393,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(Wc)$(libiberty_normal))) $(Wc)$(libiberty_normal)))
libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty)) libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))

View File

@@ -1,7 +1,7 @@
From c033c1df11b692213d03db91d6cc145b4adedfac Mon Sep 17 00:00:00 2001 From 702daf2e9cb97337e0e594fcd435b1b61a917d14 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:39:54 +0000 Date: Mon, 7 Dec 2015 23:39:54 +0000
Subject: [PATCH 27/40] handle sysroot support for nativesdk-gcc Subject: [PATCH] handle sysroot support for nativesdk-gcc
Being able to build a nativesdk gcc is useful, particularly in cases Being able to build a nativesdk gcc is useful, particularly in cases
where the host compiler may be of an incompatible version (or a 32 where the host compiler may be of an incompatible version (or a 32
@@ -24,22 +24,47 @@ Upstream-Status: Inappropriate
RP 2015/7/28 RP 2015/7/28
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/cppdefault.c | 50 +++++++++++++++++++++++++++++++++++-------------
gcc/cppdefault.h | 3 ++-
gcc/gcc.c | 20 +++++++++++++------
3 files changed, 53 insertions(+), 20 deletions(-)
Index: gcc-8.5.0/gcc/cppdefault.c Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without
=================================================================== these as part of the gccrelocprefix the system can't do runtime relocation
--- gcc-8.5.0.orig/gcc/cppdefault.c if the executable is moved. (These paths were missed in the original
+++ gcc-8.5.0/gcc/cppdefault.c implementation.)
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
gcc/c-family/c-opts.c | 4 +--
gcc/cppdefault.c | 63 ++++++++++++++++++++++++++-----------------
gcc/cppdefault.h | 13 ++++-----
gcc/gcc.c | 20 +++++++++-----
gcc/incpath.c | 12 ++++-----
gcc/prefix.c | 6 +++--
6 files changed, 70 insertions(+), 48 deletions(-)
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 58ba0948e79..806bbcfb7a5 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1409,8 +1409,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
size_t prefix_len, suffix_len;
suffix_len = strlen (suffix);
- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
+ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR;
+ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7;
path = (char *) xmalloc (prefix_len + suffix_len + 1);
memcpy (path, prefix, prefix_len);
diff --git a/gcc/cppdefault.c b/gcc/cppdefault.c
index 2f43b88a0c3..6b6be04686c 100644
--- a/gcc/cppdefault.c
+++ b/gcc/cppdefault.c
@@ -35,6 +35,30 @@ @@ -35,6 +35,30 @@
# undef CROSS_INCLUDE_DIR # undef CROSS_INCLUDE_DIR
#endif #endif
+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR; +static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
+static char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR; +char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR; +static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR; +static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET; +static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
@@ -65,7 +90,7 @@ Index: gcc-8.5.0/gcc/cppdefault.c
const struct default_include cpp_include_defaults[] const struct default_include cpp_include_defaults[]
#ifdef INCLUDE_DEFAULTS #ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS; = INCLUDE_DEFAULTS;
@@ -42,38 +66,38 @@ const struct default_include cpp_include @@ -42,38 +66,38 @@ const struct default_include cpp_include_defaults[]
= { = {
#ifdef GPLUSPLUS_INCLUDE_DIR #ifdef GPLUSPLUS_INCLUDE_DIR
/* Pick up GNU C++ generic include files. */ /* Pick up GNU C++ generic include files. */
@@ -113,7 +138,7 @@ Index: gcc-8.5.0/gcc/cppdefault.c
/* A multilib suffix needs adding if different multilibs use /* A multilib suffix needs adding if different multilibs use
different headers. */ different headers. */
#ifdef SYSROOT_HEADERS_SUFFIX_SPEC #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
@@ -85,16 +109,16 @@ const struct default_include cpp_include @@ -85,33 +109,24 @@ const struct default_include cpp_include_defaults[]
#endif #endif
#ifdef CROSS_INCLUDE_DIR #ifdef CROSS_INCLUDE_DIR
/* One place the target system's headers might be. */ /* One place the target system's headers might be. */
@@ -134,10 +159,29 @@ Index: gcc-8.5.0/gcc/cppdefault.c
#endif #endif
{ 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0 }
}; };
Index: gcc-8.5.0/gcc/cppdefault.h #endif /* no INCLUDE_DEFAULTS */
===================================================================
--- gcc-8.5.0.orig/gcc/cppdefault.h -#ifdef GCC_INCLUDE_DIR
+++ gcc-8.5.0/gcc/cppdefault.h -const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
-#else
-const char cpp_GCC_INCLUDE_DIR[] = "";
-const size_t cpp_GCC_INCLUDE_DIR_len = 0;
-#endif
-
/* The configured prefix. */
-const char cpp_PREFIX[] = PREFIX;
-const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
+char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
+char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
/* This value is set by cpp_relocated at runtime */
const char *gcc_exec_prefix;
diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
index a681264f75e..5e10a2fa140 100644
--- a/gcc/cppdefault.h
+++ b/gcc/cppdefault.h
@@ -33,7 +33,8 @@ @@ -33,7 +33,8 @@
struct default_include struct default_include
@@ -148,11 +192,32 @@ Index: gcc-8.5.0/gcc/cppdefault.h
const char *const component; /* The component containing the directory const char *const component; /* The component containing the directory
(see update_path in prefix.c) */ (see update_path in prefix.c) */
const char cplusplus; /* Only look here if we're compiling C++. */ const char cplusplus; /* Only look here if we're compiling C++. */
Index: gcc-8.5.0/gcc/gcc.c @@ -50,17 +51,13 @@ struct default_include
=================================================================== };
--- gcc-8.5.0.orig/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c extern const struct default_include cpp_include_defaults[];
@@ -248,6 +248,8 @@ FILE *report_times_to_file = NULL; -extern const char cpp_GCC_INCLUDE_DIR[];
-extern const size_t cpp_GCC_INCLUDE_DIR_len;
+extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The configure-time prefix, i.e., the value supplied as the argument
to --prefix=. */
-extern const char cpp_PREFIX[];
+extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The length of the configure-time prefix. */
-extern const size_t cpp_PREFIX_len;
-/* The configure-time execution prefix. This is typically the lib/gcc
- subdirectory of cpp_PREFIX. */
-extern const char cpp_EXEC_PREFIX[];
+extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The run-time execution prefix. This is typically the lib/gcc
subdirectory of the actual installation. */
extern const char *gcc_exec_prefix;
diff --git a/gcc/gcc.c b/gcc/gcc.c
index c87f603955f..535d5c3bb65 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
#endif #endif
static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT; static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
@@ -161,7 +226,7 @@ Index: gcc-8.5.0/gcc/gcc.c
/* Nonzero means pass the updated target_system_root to the compiler. */ /* Nonzero means pass the updated target_system_root to the compiler. */
static int target_system_root_changed; static int target_system_root_changed;
@@ -519,6 +521,7 @@ or with constant text in a single argume @@ -526,6 +528,7 @@ or with constant text in a single argument.
%G process LIBGCC_SPEC as a spec. %G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and %R Output the concatenation of target_system_root and
target_sysroot_suffix. target_sysroot_suffix.
@@ -169,7 +234,7 @@ Index: gcc-8.5.0/gcc/gcc.c
%S process STARTFILE_SPEC as a spec. A capital S is actually used here. %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
%E process ENDFILE_SPEC as a spec. A capital E is actually used here. %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
%C process CPP_SPEC as a spec. %C process CPP_SPEC as a spec.
@@ -1487,10 +1490,10 @@ static const char *gcc_libexec_prefix; @@ -1499,10 +1502,10 @@ static const char *gcc_libexec_prefix;
gcc_exec_prefix is set because, in that case, we know where the gcc_exec_prefix is set because, in that case, we know where the
compiler has been installed, and use paths relative to that compiler has been installed, and use paths relative to that
location instead. */ location instead. */
@@ -184,7 +249,7 @@ Index: gcc-8.5.0/gcc/gcc.c
/* For native compilers, these are well-known paths containing /* For native compilers, these are well-known paths containing
components that may be provided by the system. For cross components that may be provided by the system. For cross
@@ -1498,9 +1501,9 @@ static const char *const standard_startf @@ -1510,9 +1513,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
static const char *md_exec_prefix = MD_EXEC_PREFIX; static const char *md_exec_prefix = MD_EXEC_PREFIX;
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
@@ -196,7 +261,7 @@ Index: gcc-8.5.0/gcc/gcc.c
= STANDARD_STARTFILE_PREFIX_2; = STANDARD_STARTFILE_PREFIX_2;
/* A relative path to be used in finding the location of tools /* A relative path to be used in finding the location of tools
@@ -5849,6 +5852,11 @@ do_spec_1 (const char *spec, int inswitc @@ -5952,6 +5955,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
} }
break; break;
@@ -208,3 +273,77 @@ Index: gcc-8.5.0/gcc/gcc.c
case 'S': case 'S':
value = do_spec_1 (startfile_spec, 0, NULL); value = do_spec_1 (startfile_spec, 0, NULL);
if (value != 0) if (value != 0)
diff --git a/gcc/incpath.c b/gcc/incpath.c
index 9098ab044ab..bfad4ebe382 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -131,7 +131,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
int relocated = cpp_relocated ();
size_t len;
- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
+ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0)
{
/* Look for directories that start with the standard prefix.
"Translate" them, i.e. replace /usr/local/lib/gcc... with
@@ -145,7 +145,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
now. */
if (sysroot && p->add_sysroot)
continue;
- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
+ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len))
{
char *str = concat (iprefix, p->fname + len, NULL);
if (p->multilib == 1 && imultilib)
@@ -185,7 +185,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
free (sysroot_no_trailing_dir_separator);
}
else if (!p->add_sysroot && relocated
- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
+ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR)))
{
static const char *relocated_prefix;
char *ostr;
@@ -202,12 +202,12 @@ add_standard_paths (const char *sysroot, const char *iprefix,
dummy = concat (gcc_exec_prefix, "dummy", NULL);
relocated_prefix
= make_relative_prefix (dummy,
- cpp_EXEC_PREFIX,
- cpp_PREFIX);
+ EXEC_PREFIXVAR,
+ PREFIXVAR);
free (dummy);
}
ostr = concat (relocated_prefix,
- p->fname + cpp_PREFIX_len,
+ p->fname + strlen(PREFIXVAR),
NULL);
str = update_path (ostr, p->component);
free (ostr);
diff --git a/gcc/prefix.c b/gcc/prefix.c
index 1a403e535bd..c26d07bde12 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see
#include "prefix.h"
#include "common/common-target.h"
-static const char *std_prefix = PREFIX;
+char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
+
+static const char *std_prefix = PREFIXVAR1;
static const char *get_key_value (char *);
static char *translate_name (char *);
@@ -212,7 +214,7 @@ translate_name (char *name)
prefix = getenv (key);
if (prefix == 0)
- prefix = PREFIX;
+ prefix = PREFIXVAR1;
/* We used to strip trailing DIR_SEPARATORs here, but that can
sometimes yield a result with no separator when one was coded
--
2.29.2

View File

@@ -1,7 +1,7 @@
From 62240d4c725ea0b43abfb901ddad90e83e29a25c Mon Sep 17 00:00:00 2001 From 9c0c73ee48dbee2aad57f4dcdad1b7b74e77b944 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:41:45 +0000 Date: Mon, 7 Dec 2015 23:41:45 +0000
Subject: [PATCH 28/40] Search target sysroot gcc version specific dirs with Subject: [PATCH] Search target sysroot gcc version specific dirs with
multilib. multilib.
We install the gcc libraries (such as crtbegin.p) into We install the gcc libraries (such as crtbegin.p) into
@@ -50,11 +50,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/gcc.c | 29 ++++++++++++++++++++++++++++- gcc/gcc.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-) 1 file changed, 28 insertions(+), 1 deletion(-)
Index: gcc-8.5.0/gcc/gcc.c diff --git a/gcc/gcc.c b/gcc/gcc.c
=================================================================== index 535d5c3bb65..04647ae812d 100644
--- gcc-8.5.0.orig/gcc/gcc.c --- a/gcc/gcc.c
+++ gcc-8.5.0/gcc/gcc.c +++ b/gcc/gcc.c
@@ -2527,7 +2527,7 @@ for_each_path (const struct path_prefix @@ -2616,7 +2616,7 @@ for_each_path (const struct path_prefix *paths,
if (path == NULL) if (path == NULL)
{ {
len = paths->max_len + extra_space + 1; len = paths->max_len + extra_space + 1;
@@ -63,7 +63,7 @@ Index: gcc-8.5.0/gcc/gcc.c
path = XNEWVEC (char, len); path = XNEWVEC (char, len);
} }
@@ -2539,6 +2539,33 @@ for_each_path (const struct path_prefix @@ -2628,6 +2628,33 @@ for_each_path (const struct path_prefix *paths,
/* Look first in MACHINE/VERSION subdirectory. */ /* Look first in MACHINE/VERSION subdirectory. */
if (!skip_multi_dir) if (!skip_multi_dir)
{ {

View File

@@ -1,7 +1,7 @@
From 1377c738e31a1e1599cfab189485a9459f803e79 Mon Sep 17 00:00:00 2001 From 3a003af8804dda90fdf4862eca5f66cb12faaf02 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:42:45 +0000 Date: Mon, 7 Dec 2015 23:42:45 +0000
Subject: [PATCH 29/40] Fix various _FOR_BUILD and related variables Subject: [PATCH] Fix various _FOR_BUILD and related variables
When doing a FOR_BUILD thing, you have to override CFLAGS with When doing a FOR_BUILD thing, you have to override CFLAGS with
CFLAGS_FOR_BUILD. And if you use C++, you also have to override CFLAGS_FOR_BUILD. And if you use C++, you also have to override
@@ -25,10 +25,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/configure.ac | 2 +- gcc/configure.ac | 2 +-
5 files changed, 14 insertions(+), 3 deletions(-) 5 files changed, 14 insertions(+), 3 deletions(-)
Index: gcc-8.5.0/Makefile.in diff --git a/Makefile.in b/Makefile.in
=================================================================== index c717903bb13..5abc649868d 100644
--- gcc-8.5.0.orig/Makefile.in --- a/Makefile.in
+++ gcc-8.5.0/Makefile.in +++ b/Makefile.in
@@ -152,6 +152,7 @@ BUILD_EXPORTS = \ @@ -152,6 +152,7 @@ BUILD_EXPORTS = \
CPP="$(CC_FOR_BUILD) -E"; export CPP; \ CPP="$(CC_FOR_BUILD) -E"; export CPP; \
CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
@@ -37,44 +37,6 @@ Index: gcc-8.5.0/Makefile.in
CXX="$(CXX_FOR_BUILD)"; export CXX; \ CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
@@ -169,6 +170,9 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ CPP="$(CC_FOR_BUILD) -E" \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
@@ -186,6 +190,7 @@ HOST_SUBDIR = @host_subdir@
HOST_EXPORTS = \
$(BASE_EXPORTS) \
CC="$(CC)"; export CC; \
+ CPP="$(CC) -E"; export CPP; \
ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
CFLAGS="$(CFLAGS)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
@@ -743,6 +748,7 @@ BASE_FLAGS_TO_PASS = \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
+ "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
"EXPECT=$(EXPECT)" \
"FLEX=$(FLEX)" \
"INSTALL=$(INSTALL)" \
Index: gcc-8.5.0/Makefile.tpl
===================================================================
--- gcc-8.5.0.orig/Makefile.tpl
+++ gcc-8.5.0/Makefile.tpl
@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
CC="$(CC_FOR_BUILD)"; export CC; \
CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
@@ -171,6 +172,9 @@ BUILD_EXPORTS = \ @@ -171,6 +172,9 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS. # built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \ EXTRA_BUILD_FLAGS = \
@@ -93,11 +55,49 @@ Index: gcc-8.5.0/Makefile.tpl
ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
CFLAGS="$(CFLAGS)"; export CFLAGS; \ CFLAGS="$(CFLAGS)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
Index: gcc-8.5.0/gcc/Makefile.in @@ -776,6 +781,7 @@ BASE_FLAGS_TO_PASS = \
=================================================================== "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
--- gcc-8.5.0.orig/gcc/Makefile.in "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
+++ gcc-8.5.0/gcc/Makefile.in "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
@@ -801,7 +801,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@ + "CXXFLAGS_FOR_BUILD=$(CXXFLAGS_FOR_BUILD)" \
"EXPECT=$(EXPECT)" \
"FLEX=$(FLEX)" \
"INSTALL=$(INSTALL)" \
diff --git a/Makefile.tpl b/Makefile.tpl
index efed1511750..778beb705b4 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -154,6 +154,7 @@ BUILD_EXPORTS = \
CC="$(CC_FOR_BUILD)"; export CC; \
CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
@@ -173,6 +174,9 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ CPP="$(CC_FOR_BUILD) -E" \
+ CPPFLAGS="$(CPPFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
@@ -190,6 +194,7 @@ HOST_SUBDIR = @host_subdir@
HOST_EXPORTS = \
$(BASE_EXPORTS) \
CC="$(CC)"; export CC; \
+ CPP="$(CC) -E"; export CPP; \
ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \
CFLAGS="$(CFLAGS)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 011c7ac2db6..2f1165f7b5e 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -805,7 +805,7 @@ BUILD_LDFLAGS=@BUILD_LDFLAGS@
BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@ BUILD_NO_PIE_FLAG = @BUILD_NO_PIE_FLAG@
BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG) BUILD_LDFLAGS += $(BUILD_NO_PIE_FLAG)
BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ BUILD_CPPFLAGS= -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
@@ -106,11 +106,11 @@ Index: gcc-8.5.0/gcc/Makefile.in
# Actual name to use when installing a native compiler. # Actual name to use when installing a native compiler.
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)') GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
Index: gcc-8.5.0/gcc/configure diff --git a/gcc/configure b/gcc/configure
=================================================================== index 825a9652329..ff46cf58960 100755
--- gcc-8.5.0.orig/gcc/configure --- a/gcc/configure
+++ gcc-8.5.0/gcc/configure +++ b/gcc/configure
@@ -11798,7 +11798,7 @@ else @@ -12314,7 +12314,7 @@ else
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
@@ -118,12 +118,12 @@ Index: gcc-8.5.0/gcc/configure
+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
${realsrcdir}/configure \ ${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \ --enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \
Index: gcc-8.5.0/gcc/configure.ac diff --git a/gcc/configure.ac b/gcc/configure.ac
=================================================================== index 6099eb3251f..b3c345b61dc 100644
--- gcc-8.5.0.orig/gcc/configure.ac --- a/gcc/configure.ac
+++ gcc-8.5.0/gcc/configure.ac +++ b/gcc/configure.ac
@@ -1708,7 +1708,7 @@ else @@ -1898,7 +1898,7 @@ else
CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \ CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \ CXX="${CXX_FOR_BUILD}" CXXFLAGS="${CXXFLAGS_FOR_BUILD}" \
LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \ LD="${LD_FOR_BUILD}" LDFLAGS="${LDFLAGS_FOR_BUILD}" \
@@ -131,4 +131,4 @@ Index: gcc-8.5.0/gcc/configure.ac
+ GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \ + GMPINC="" CPPFLAGS="${CPPFLAGS_FOR_BUILD} -DGENERATOR_FILE" \
${realsrcdir}/configure \ ${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \ --enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias ${enable_obsolete+--enable-obsolete="$enable_obsolete"} \

View File

@@ -1,7 +1,7 @@
From 75da3cc9ca2d3de8c2062f23bf4f72415741ef83 Mon Sep 17 00:00:00 2001 From 4e53d0ae70af85af0e112a48a3e4dfe4c39f4a8d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 2 Feb 2016 10:26:10 -0800 Date: Tue, 2 Feb 2016 10:26:10 -0800
Subject: [PATCH 30/40] nios2: Define MUSL_DYNAMIC_LINKER Subject: [PATCH] nios2: Define MUSL_DYNAMIC_LINKER
Upstream-Status: Pending Upstream-Status: Pending
@@ -11,10 +11,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/config/nios2/linux.h | 1 + gcc/config/nios2/linux.h | 1 +
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
Index: gcc-8.5.0/gcc/config/nios2/linux.h diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
=================================================================== index 4bdcdcca1f0..e7943a9d640 100644
--- gcc-8.5.0.orig/gcc/config/nios2/linux.h --- a/gcc/config/nios2/linux.h
+++ gcc-8.5.0/gcc/config/nios2/linux.h +++ b/gcc/config/nios2/linux.h
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"

View File

@@ -1,7 +1,7 @@
From f715aeef294b85fa593ef69e6d0114cc7b15312b Mon Sep 17 00:00:00 2001 From 5db0404eb770ac477fd99d444226bcf021067584 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Jun 2017 18:10:54 -0700 Date: Tue, 27 Jun 2017 18:10:54 -0700
Subject: [PATCH 31/40] Add ssp_nonshared to link commandline for musl targets Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
when -fstack-protector options are enabled we need to when -fstack-protector options are enabled we need to
link with ssp_shared on musl since it does not provide link with ssp_shared on musl since it does not provide
@@ -22,11 +22,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/config/rs6000/linux64.h | 10 ++++++++++ gcc/config/rs6000/linux64.h | 10 ++++++++++
3 files changed, 27 insertions(+) 3 files changed, 27 insertions(+)
Index: gcc-8.5.0/gcc/config/linux.h diff --git a/gcc/config/linux.h b/gcc/config/linux.h
=================================================================== index 0c1a8118a26..bdc2a2d0659 100644
--- gcc-8.5.0.orig/gcc/config/linux.h --- a/gcc/config/linux.h
+++ gcc-8.5.0/gcc/config/linux.h +++ b/gcc/config/linux.h
@@ -182,6 +182,13 @@ see the files COPYING3 and COPYING.RUNTI @@ -195,6 +195,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \ { 0, 0, 0, 0, 0, 0 } \
} }
@@ -40,11 +40,11 @@ Index: gcc-8.5.0/gcc/config/linux.h
#endif #endif
#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
Index: gcc-8.5.0/gcc/config/rs6000/linux.h diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
=================================================================== index b7026fcbee7..dd54d6c393e 100644
--- gcc-8.5.0.orig/gcc/config/rs6000/linux.h --- a/gcc/config/rs6000/linux.h
+++ gcc-8.5.0/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h
@@ -92,6 +92,16 @@ @@ -94,6 +94,16 @@
" -m elf32ppclinux") " -m elf32ppclinux")
#endif #endif
@@ -61,11 +61,11 @@ Index: gcc-8.5.0/gcc/config/rs6000/linux.h
#undef LINK_OS_LINUX_SPEC #undef LINK_OS_LINUX_SPEC
#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \ #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
%{!static-pie: \ %{!static-pie: \
Index: gcc-8.5.0/gcc/config/rs6000/linux64.h diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
=================================================================== index 967c1c43c63..dc5e4d97975 100644
--- gcc-8.5.0.orig/gcc/config/rs6000/linux64.h --- a/gcc/config/rs6000/linux64.h
+++ gcc-8.5.0/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h
@@ -466,6 +466,16 @@ extern int dot_symbols; @@ -452,6 +452,16 @@ extern int dot_symbols;
" -m elf64ppc") " -m elf64ppc")
#endif #endif

View File

@@ -1,7 +1,7 @@
From 7e55147e8e609ace6f9eecd86a956636687671f0 Mon Sep 17 00:00:00 2001 From fbc926dbf6a47fa623b9c94cd9b09a0e90448fdc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 4 May 2016 21:11:34 -0700 Date: Wed, 4 May 2016 21:11:34 -0700
Subject: [PATCH 33/40] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS Subject: [PATCH] Link libgcc using LDFLAGS, not just SHLIB_LDFLAGS
Upstream-Status: Pending Upstream-Status: Pending
@@ -11,11 +11,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
libgcc/config/t-slibgcc | 2 +- libgcc/config/t-slibgcc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
Index: gcc-8.5.0/libgcc/config/t-slibgcc diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
=================================================================== index c997553447c..330352c2c81 100644
--- gcc-8.5.0.orig/libgcc/config/t-slibgcc --- a/libgcc/config/t-slibgcc
+++ gcc-8.5.0/libgcc/config/t-slibgcc +++ b/libgcc/config/t-slibgcc
@@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_S @@ -32,7 +32,7 @@ SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK) $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \ SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \

View File

@@ -1,7 +1,7 @@
From 38d401fb6ab555d09f4a9a677721dde0743876e1 Mon Sep 17 00:00:00 2001 From 24dc04dc8d69e3bf61322615b3ef18e02ccd311e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 3 Feb 2017 12:56:00 -0800 Date: Fri, 3 Feb 2017 12:56:00 -0800
Subject: [PATCH 35/40] sync gcc stddef.h with musl Subject: [PATCH] sync gcc stddef.h with musl
musl defines ptrdiff_t size_t and wchar_t musl defines ptrdiff_t size_t and wchar_t
so dont define them here if musl is definining them so dont define them here if musl is definining them
@@ -13,11 +13,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/ginclude/stddef.h | 9 +++++++++ gcc/ginclude/stddef.h | 9 +++++++++
1 file changed, 9 insertions(+) 1 file changed, 9 insertions(+)
Index: gcc-8.5.0/gcc/ginclude/stddef.h diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
=================================================================== index 9d67eac4947..6cb5edbedb4 100644
--- gcc-8.5.0.orig/gcc/ginclude/stddef.h --- a/gcc/ginclude/stddef.h
+++ gcc-8.5.0/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h
@@ -134,6 +134,7 @@ _TYPE_wchar_t; @@ -128,6 +128,7 @@ _TYPE_wchar_t;
#ifndef ___int_ptrdiff_t_h #ifndef ___int_ptrdiff_t_h
#ifndef _GCC_PTRDIFF_T #ifndef _GCC_PTRDIFF_T
#ifndef _PTRDIFF_T_DECLARED /* DragonFly */ #ifndef _PTRDIFF_T_DECLARED /* DragonFly */
@@ -25,7 +25,7 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
#define _PTRDIFF_T #define _PTRDIFF_T
#define _T_PTRDIFF_ #define _T_PTRDIFF_
#define _T_PTRDIFF #define _T_PTRDIFF
@@ -143,10 +144,12 @@ _TYPE_wchar_t; @@ -137,10 +138,12 @@ _TYPE_wchar_t;
#define ___int_ptrdiff_t_h #define ___int_ptrdiff_t_h
#define _GCC_PTRDIFF_T #define _GCC_PTRDIFF_T
#define _PTRDIFF_T_DECLARED #define _PTRDIFF_T_DECLARED
@@ -38,7 +38,7 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
#endif /* _PTRDIFF_T_DECLARED */ #endif /* _PTRDIFF_T_DECLARED */
#endif /* _GCC_PTRDIFF_T */ #endif /* _GCC_PTRDIFF_T */
#endif /* ___int_ptrdiff_t_h */ #endif /* ___int_ptrdiff_t_h */
@@ -184,6 +187,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -178,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef _GCC_SIZE_T #ifndef _GCC_SIZE_T
#ifndef _SIZET_ #ifndef _SIZET_
#ifndef __size_t #ifndef __size_t
@@ -46,15 +46,15 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
#define __size_t__ /* BeOS */ #define __size_t__ /* BeOS */
#define __SIZE_T__ /* Cray Unicos/Mk */ #define __SIZE_T__ /* Cray Unicos/Mk */
#define _SIZE_T #define _SIZE_T
@@ -200,6 +204,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -194,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#define ___int_size_t_h #define ___int_size_t_h
#define _GCC_SIZE_T #define _GCC_SIZE_T
#define _SIZET_ #define _SIZET_
+#define __DEFINED_size_t /* musl */ +#define __DEFINED_size_t /* musl */
#if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ #if defined (__FreeBSD__) \
|| defined(__DragonFly__) \ || defined(__DragonFly__) \
|| defined(__FreeBSD_kernel__) || defined(__FreeBSD_kernel__) \
@@ -235,6 +240,7 @@ typedef long ssize_t; @@ -228,6 +233,7 @@ typedef long ssize_t;
#endif /* _SIZE_T */ #endif /* _SIZE_T */
#endif /* __SIZE_T__ */ #endif /* __SIZE_T__ */
#endif /* __size_t__ */ #endif /* __size_t__ */
@@ -62,7 +62,7 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
#undef __need_size_t #undef __need_size_t
#endif /* _STDDEF_H or __need_size_t. */ #endif /* _STDDEF_H or __need_size_t. */
@@ -264,6 +270,7 @@ typedef long ssize_t; @@ -257,6 +263,7 @@ typedef long ssize_t;
#ifndef ___int_wchar_t_h #ifndef ___int_wchar_t_h
#ifndef __INT_WCHAR_T_H #ifndef __INT_WCHAR_T_H
#ifndef _GCC_WCHAR_T #ifndef _GCC_WCHAR_T
@@ -70,7 +70,7 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
#define __wchar_t__ /* BeOS */ #define __wchar_t__ /* BeOS */
#define __WCHAR_T__ /* Cray Unicos/Mk */ #define __WCHAR_T__ /* Cray Unicos/Mk */
#define _WCHAR_T #define _WCHAR_T
@@ -279,6 +286,7 @@ typedef long ssize_t; @@ -272,6 +279,7 @@ typedef long ssize_t;
#define __INT_WCHAR_T_H #define __INT_WCHAR_T_H
#define _GCC_WCHAR_T #define _GCC_WCHAR_T
#define _WCHAR_T_DECLARED #define _WCHAR_T_DECLARED
@@ -78,7 +78,7 @@ Index: gcc-8.5.0/gcc/ginclude/stddef.h
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_ /* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
@@ -344,6 +352,7 @@ typedef __WCHAR_TYPE__ wchar_t; @@ -337,6 +345,7 @@ typedef __WCHAR_TYPE__ wchar_t;
#endif #endif
#endif /* __WCHAR_T__ */ #endif /* __WCHAR_T__ */
#endif /* __wchar_t__ */ #endif /* __wchar_t__ */

View File

@@ -1,7 +1,7 @@
From a9bb29a4e9b478f9b126e483467ce9031c33fe4f Mon Sep 17 00:00:00 2001 From 27b8ba5555ada2dab076988529bfb84d00a4b901 Mon Sep 17 00:00:00 2001
From: Juro Bystricky <juro.bystricky@intel.com> From: Juro Bystricky <juro.bystricky@intel.com>
Date: Mon, 19 Mar 2018 22:31:20 -0700 Date: Mon, 19 Mar 2018 22:31:20 -0700
Subject: [PATCH 36/40] fix segmentation fault in precompiled header generation Subject: [PATCH] fix segmentation fault in precompiled header generation
Prevent a segmentation fault which occurs when using incorrect Prevent a segmentation fault which occurs when using incorrect
structure trying to access name of some named operators, such as structure trying to access name of some named operators, such as
@@ -18,11 +18,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
libcpp/lex.c | 26 +++++++++++++++++++++----- libcpp/lex.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-) 1 file changed, 21 insertions(+), 5 deletions(-)
Index: gcc-8.5.0/libcpp/lex.c diff --git a/libcpp/lex.c b/libcpp/lex.c
=================================================================== index 56ac3a1dd73..73a951148b3 100644
--- gcc-8.5.0.orig/libcpp/lex.c --- a/libcpp/lex.c
+++ gcc-8.5.0/libcpp/lex.c +++ b/libcpp/lex.c
@@ -3279,11 +3279,27 @@ cpp_spell_token (cpp_reader *pfile, cons @@ -3311,11 +3311,27 @@ cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
spell_ident: spell_ident:
case SPELL_IDENT: case SPELL_IDENT:
if (forstring) if (forstring)

View File

@@ -1,7 +1,7 @@
From 1e5c1ef34d92b4157e1a24ca743d45f3a7375a5e Mon Sep 17 00:00:00 2001 From 2512aacf023c679d86d8f40caff4f6ff412b32ff Mon Sep 17 00:00:00 2001
From: RAGHUNATH LOLUR <raghunath.lolur@kpit.com> From: RAGHUNATH LOLUR <raghunath.lolur@kpit.com>
Date: Wed, 6 Dec 2017 22:52:26 -0800 Date: Wed, 6 Dec 2017 22:52:26 -0800
Subject: [PATCH 37/40] Fix for testsuite failure Subject: [PATCH] Fix for testsuite failure
2017-11-16 Raghunath Lolur <raghunath.lolur@kpit.com> 2017-11-16 Raghunath Lolur <raghunath.lolur@kpit.com>
@@ -55,10 +55,10 @@ Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
gcc/testsuite/gcc.target/i386/warn-vect-op-1.c | 2 +- gcc/testsuite/gcc.target/i386/warn-vect-op-1.c | 2 +-
17 files changed, 17 insertions(+), 16 deletions(-) 17 files changed, 17 insertions(+), 16 deletions(-)
Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr56275.c diff --git a/gcc/testsuite/gcc.dg/pr56275.c b/gcc/testsuite/gcc.dg/pr56275.c
=================================================================== index b901bb2b199..a4f6c95e1a1 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.dg/pr56275.c --- a/gcc/testsuite/gcc.dg/pr56275.c
+++ gcc-8.5.0/gcc/testsuite/gcc.dg/pr56275.c +++ b/gcc/testsuite/gcc.dg/pr56275.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2" } */ /* { dg-options "-O2" } */
@@ -67,10 +67,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr56275.c
typedef long long v2tw __attribute__ ((vector_size (2 * sizeof (long long)))); typedef long long v2tw __attribute__ ((vector_size (2 * sizeof (long long))));
Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-2.c diff --git a/gcc/testsuite/gcc.dg/pr68306-2.c b/gcc/testsuite/gcc.dg/pr68306-2.c
=================================================================== index 4672ebe7987..2a368c484b6 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.dg/pr68306-2.c --- a/gcc/testsuite/gcc.dg/pr68306-2.c
+++ gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-2.c +++ b/gcc/testsuite/gcc.dg/pr68306-2.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3" } */ /* { dg-options "-O3" } */
@@ -79,10 +79,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-2.c
struct { struct {
int tz_minuteswest; int tz_minuteswest;
Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-3.c diff --git a/gcc/testsuite/gcc.dg/pr68306-3.c b/gcc/testsuite/gcc.dg/pr68306-3.c
=================================================================== index f5a8c102cf8..df3390c64c2 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.dg/pr68306-3.c --- a/gcc/testsuite/gcc.dg/pr68306-3.c
+++ gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-3.c +++ b/gcc/testsuite/gcc.dg/pr68306-3.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3" } */ /* { dg-options "-O3" } */
@@ -91,10 +91,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306-3.c
/* { dg-additional-options "-mno-altivec -mno-vsx" { target powerpc*-*-* } } */ /* { dg-additional-options "-mno-altivec -mno-vsx" { target powerpc*-*-* } } */
extern void fn2(); extern void fn2();
Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306.c diff --git a/gcc/testsuite/gcc.dg/pr68306.c b/gcc/testsuite/gcc.dg/pr68306.c
=================================================================== index 54e5b40f221..0813389e2c1 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.dg/pr68306.c --- a/gcc/testsuite/gcc.dg/pr68306.c
+++ gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306.c +++ b/gcc/testsuite/gcc.dg/pr68306.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3" } */ /* { dg-options "-O3" } */
@@ -103,10 +103,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr68306.c
enum powerpc_pmc_type { PPC_PMC_IBM }; enum powerpc_pmc_type { PPC_PMC_IBM };
struct { struct {
Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr69634.c diff --git a/gcc/testsuite/gcc.dg/pr69634.c b/gcc/testsuite/gcc.dg/pr69634.c
=================================================================== index 60a56149463..bcc23f9ccd6 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.dg/pr69634.c --- a/gcc/testsuite/gcc.dg/pr69634.c
+++ gcc-8.5.0/gcc/testsuite/gcc.dg/pr69634.c +++ b/gcc/testsuite/gcc.dg/pr69634.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-vrp -fcompare-debug -Wno-psabi" } */ /* { dg-options "-O2 -fno-dce -fschedule-insns -fno-tree-vrp -fcompare-debug -Wno-psabi" } */
@@ -115,10 +115,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.dg/pr69634.c
/* { dg-require-effective-target scheduling } */ /* { dg-require-effective-target scheduling } */
typedef unsigned short u16; typedef unsigned short u16;
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/amd64-abi-1.c diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
=================================================================== index 69fde57bf06..7f1f1c03edf 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/amd64-abi-1.c --- a/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/amd64-abi-1.c +++ b/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-mno-sse" } */ -/* { dg-options "-mno-sse" } */
@@ -126,10 +126,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/amd64-abi-1.c
/* { dg-additional-options "-mabi=sysv" { target *-*-mingw* } } */ /* { dg-additional-options "-mabi=sysv" { target *-*-mingw* } } */
double foo(void) { return 0; } /* { dg-error "SSE disabled" } */ double foo(void) { return 0; } /* { dg-error "SSE disabled" } */
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/funcspec-6.c diff --git a/gcc/testsuite/gcc.target/i386/funcspec-6.c b/gcc/testsuite/gcc.target/i386/funcspec-6.c
=================================================================== index ea896b7ebfd..bf15569b826 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/funcspec-6.c --- a/gcc/testsuite/gcc.target/i386/funcspec-6.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/funcspec-6.c +++ b/gcc/testsuite/gcc.target/i386/funcspec-6.c
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
/* Test whether all of the 64-bit function specific options are accepted /* Test whether all of the 64-bit function specific options are accepted
without error. */ without error. */
@@ -138,10 +138,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/funcspec-6.c
#include "funcspec-56.inc" #include "funcspec-56.inc"
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c diff --git a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
=================================================================== index 8561a3c26d6..6377f814645 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c --- a/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
-/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387" } */ -/* { dg-options "-O2 -mgeneral-regs-only -mno-cld -mno-iamcu -m80387" } */
@@ -149,10 +149,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/interrupt-387-err-1.c
typedef unsigned int uword_t __attribute__ ((mode (__word__))); typedef unsigned int uword_t __attribute__ ((mode (__word__)));
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/isa-14.c diff --git a/gcc/testsuite/gcc.target/i386/isa-14.c b/gcc/testsuite/gcc.target/i386/isa-14.c
=================================================================== index 5d49e6e77fe..1de2db92bdd 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/isa-14.c --- a/gcc/testsuite/gcc.target/i386/isa-14.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/isa-14.c +++ b/gcc/testsuite/gcc.target/i386/isa-14.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do run } */ /* { dg-do run } */
-/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse" } */ -/* { dg-options "-march=x86-64 -msse4a -mfma4 -mno-sse" } */
@@ -160,10 +160,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/isa-14.c
extern void abort (void); extern void abort (void);
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr44948-2b.c diff --git a/gcc/testsuite/gcc.target/i386/pr44948-2b.c b/gcc/testsuite/gcc.target/i386/pr44948-2b.c
=================================================================== index fa1769b62fb..f79fb12726f 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr44948-2b.c --- a/gcc/testsuite/gcc.target/i386/pr44948-2b.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr44948-2b.c +++ b/gcc/testsuite/gcc.target/i386/pr44948-2b.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
-/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic" } */ -/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic" } */
@@ -171,10 +171,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr44948-2b.c
struct A struct A
{ {
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-1.c diff --git a/gcc/testsuite/gcc.target/i386/pr53425-1.c b/gcc/testsuite/gcc.target/i386/pr53425-1.c
=================================================================== index 2e89ff7d81d..6339bf6b736 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr53425-1.c --- a/gcc/testsuite/gcc.target/i386/pr53425-1.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-1.c +++ b/gcc/testsuite/gcc.target/i386/pr53425-1.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* PR target/53425 */ /* PR target/53425 */
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-do compile { target { ! ia32 } } } */
@@ -183,10 +183,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-1.c
/* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */ /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */
typedef double __v2df __attribute__ ((__vector_size__ (16))); typedef double __v2df __attribute__ ((__vector_size__ (16)));
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-2.c diff --git a/gcc/testsuite/gcc.target/i386/pr53425-2.c b/gcc/testsuite/gcc.target/i386/pr53425-2.c
=================================================================== index 61f6283dbe9..2c5a55f0ac3 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr53425-2.c --- a/gcc/testsuite/gcc.target/i386/pr53425-2.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-2.c +++ b/gcc/testsuite/gcc.target/i386/pr53425-2.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* PR target/53425 */ /* PR target/53425 */
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-do compile { target { ! ia32 } } } */
@@ -195,10 +195,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr53425-2.c
/* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */ /* { dg-skip-if "no SSE vector" { x86_64-*-mingw* } } */
typedef float __v2sf __attribute__ ((__vector_size__ (8))); typedef float __v2sf __attribute__ ((__vector_size__ (8)));
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr55247.c diff --git a/gcc/testsuite/gcc.target/i386/pr55247.c b/gcc/testsuite/gcc.target/i386/pr55247.c
=================================================================== index 23366d0909d..9810e3abb76 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr55247.c --- a/gcc/testsuite/gcc.target/i386/pr55247.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr55247.c +++ b/gcc/testsuite/gcc.target/i386/pr55247.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-do compile { target { ! ia32 } } } */
/* { dg-require-effective-target maybe_x32 } */ /* { dg-require-effective-target maybe_x32 } */
@@ -207,10 +207,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr55247.c
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef uint32_t Elf32_Word; typedef uint32_t Elf32_Word;
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr59644.c diff --git a/gcc/testsuite/gcc.target/i386/pr59644.c b/gcc/testsuite/gcc.target/i386/pr59644.c
=================================================================== index 96006b3e338..4287e4538bf 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr59644.c --- a/gcc/testsuite/gcc.target/i386/pr59644.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr59644.c +++ b/gcc/testsuite/gcc.target/i386/pr59644.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* PR target/59644 */ /* PR target/59644 */
/* { dg-do run { target lp64 } } */ /* { dg-do run { target lp64 } } */
@@ -219,10 +219,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr59644.c
/* This test uses __builtin_trap () instead of e.g. abort, /* This test uses __builtin_trap () instead of e.g. abort,
because due to -mpreferred-stack-boundary=3 it should not call because due to -mpreferred-stack-boundary=3 it should not call
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr62120.c diff --git a/gcc/testsuite/gcc.target/i386/pr62120.c b/gcc/testsuite/gcc.target/i386/pr62120.c
=================================================================== index 28d85d37712..c93266bd4bc 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr62120.c --- a/gcc/testsuite/gcc.target/i386/pr62120.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr62120.c +++ b/gcc/testsuite/gcc.target/i386/pr62120.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do compile } */ /* { dg-do compile } */
-/* { dg-options "-mno-sse" } */ -/* { dg-options "-mno-sse" } */
@@ -230,10 +230,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr62120.c
void foo () void foo ()
{ {
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr70467-1.c diff --git a/gcc/testsuite/gcc.target/i386/pr70467-1.c b/gcc/testsuite/gcc.target/i386/pr70467-1.c
=================================================================== index 4e112c88d07..bcfb396a68d 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/pr70467-1.c --- a/gcc/testsuite/gcc.target/i386/pr70467-1.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr70467-1.c +++ b/gcc/testsuite/gcc.target/i386/pr70467-1.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* PR rtl-optimization/70467 */ /* PR rtl-optimization/70467 */
/* { dg-do compile } */ /* { dg-do compile } */
@@ -242,10 +242,10 @@ Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/pr70467-1.c
void foo (unsigned long long *); void foo (unsigned long long *);
Index: gcc-8.5.0/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c diff --git a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
=================================================================== index 6cda1534311..26e37f5b8ba 100644
--- gcc-8.5.0.orig/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c --- a/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
+++ gcc-8.5.0/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c +++ b/gcc/testsuite/gcc.target/i386/warn-vect-op-1.c
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */ /* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-mno-sse -Wvector-operation-performance" } */ -/* { dg-options "-mno-sse -Wvector-operation-performance" } */

View File

@@ -1,7 +1,7 @@
From f0bea96434ac478c3cff8c29dd97cccfac5b35e3 Mon Sep 17 00:00:00 2001 From 3fc06241ce37e2e4b3ed21ace28d347eb511448d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 6 Jun 2018 12:10:22 -0700 Date: Wed, 6 Jun 2018 12:10:22 -0700
Subject: [PATCH 38/40] Re-introduce spe commandline options Subject: [PATCH] Re-introduce spe commandline options
This should ensure that we keep accepting This should ensure that we keep accepting
spe options spe options
@@ -13,11 +13,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
gcc/config/rs6000/rs6000.opt | 12 ++++++++++++ gcc/config/rs6000/rs6000.opt | 12 ++++++++++++
1 file changed, 12 insertions(+) 1 file changed, 12 insertions(+)
Index: gcc-8.5.0/gcc/config/rs6000/rs6000.opt diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
=================================================================== index f95b8279270..0e52d51409d 100644
--- gcc-8.5.0.orig/gcc/config/rs6000/rs6000.opt --- a/gcc/config/rs6000/rs6000.opt
+++ gcc-8.5.0/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt
@@ -365,6 +365,18 @@ mdebug= @@ -344,6 +344,18 @@ mdebug=
Target RejectNegative Joined Target RejectNegative Joined
-mdebug= Enable debug output. -mdebug= Enable debug output.
@@ -33,6 +33,6 @@ Index: gcc-8.5.0/gcc/config/rs6000/rs6000.opt
+Target RejectNegative Var(rs6000_spe_abi, 0) +Target RejectNegative Var(rs6000_spe_abi, 0)
+Do not use the SPE ABI extensions. +Do not use the SPE ABI extensions.
+ +
; Altivec ABI
mabi=altivec mabi=altivec
Target RejectNegative Var(rs6000_altivec_abi) Save Target RejectNegative Var(rs6000_altivec_abi) Save
Use the AltiVec ABI extensions.

View File

@@ -1,7 +1,8 @@
From 46ca51dd413330bb8425b06283e7667bfb507c3d Mon Sep 17 00:00:00 2001 From b42ff59c3fe2967d37815c8db72a47b9b7f585b4 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net> From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000 Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 34/40] libgcc_s: Use alias for __cpu_indicator_init instead of symver Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
symver
Adapter from Adapter from
@@ -25,23 +26,23 @@ gcc/Changelog:
2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com> 2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/i386/i386.c (ix86_expand_builtin): Make __builtin_cpu_init * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
call __cpu_indicator_init_local instead of __cpu_indicator_init. call __cpu_indicator_init_local instead of __cpu_indicator_init.
Upstream-Status: Pending Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- ---
gcc/config/i386/i386.c | 4 ++-- gcc/config/i386/i386-expand.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++--- libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +- libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-) 3 files changed, 6 insertions(+), 6 deletions(-)
Index: gcc-8.5.0/gcc/config/i386/i386.c diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
=================================================================== index 48f00c5fcfc..468f5f71fac 100644
--- gcc-8.5.0.orig/gcc/config/i386/i386.c --- a/gcc/config/i386/i386-expand.c
+++ gcc-8.5.0/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386-expand.c
@@ -36509,10 +36509,10 @@ ix86_expand_builtin (tree exp, rtx targe @@ -10941,10 +10941,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{ {
case IX86_BUILTIN_CPU_INIT: case IX86_BUILTIN_CPU_INIT:
{ {
@@ -54,11 +55,11 @@ Index: gcc-8.5.0/gcc/config/i386/i386.c
call_expr = build_call_expr (fndecl, 0); call_expr = build_call_expr (fndecl, 0);
return expand_expr (call_expr, target, mode, EXPAND_NORMAL); return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
} }
Index: gcc-8.5.0/libgcc/config/i386/cpuinfo.c diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
=================================================================== index 00322c58622..f42bbb8af98 100644
--- gcc-8.5.0.orig/libgcc/config/i386/cpuinfo.c --- a/libgcc/config/i386/cpuinfo.c
+++ gcc-8.5.0/libgcc/config/i386/cpuinfo.c +++ b/libgcc/config/i386/cpuinfo.c
@@ -485,7 +485,7 @@ __cpu_indicator_init (void) @@ -508,7 +508,7 @@ __cpu_indicator_init (void)
return 0; return 0;
} }
@@ -69,10 +70,10 @@ Index: gcc-8.5.0/libgcc/config/i386/cpuinfo.c
+int __cpu_indicator_init_local (void) +int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init"))); + __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif #endif
Index: gcc-8.5.0/libgcc/config/i386/t-linux diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
=================================================================== index 8506a635790..564296f788e 100644
--- gcc-8.5.0.orig/libgcc/config/i386/t-linux --- a/libgcc/config/i386/t-linux
+++ gcc-8.5.0/libgcc/config/i386/t-linux +++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@ @@ -3,5 +3,5 @@
# t-slibgcc-elf-ver and t-linux # t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver

View File

@@ -0,0 +1,182 @@
From 0395060a7dcf98c5f5a65103f6aaa71d6b862259 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Tue, 10 Mar 2020 08:26:53 -0700
Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
reproducibility
Inserting line numbers into generated code means its not always reproducible wth
differing versions of host gcc. Void the issue by not adding these.
Upstream-Status: Inappropriate [OE Reproducibility specific]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/gengtype.c | 6 +++---
gcc/genmodes.c | 32 ++++++++++++++++----------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 981577481af..d5700fff401 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -991,7 +991,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
/* Create a fake field with the given type and name. NEXT is the next
field in the chain. */
#define create_field(next,type,name) \
- create_field_all (next,type,name, 0, this_file, __LINE__)
+ create_field_all (next,type,name, 0, this_file, 0)
/* Like create_field, but the field is only valid when condition COND
is true. */
@@ -1024,7 +1024,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
}
#define create_optional_field(next,type,name,cond) \
- create_optional_field_(next,type,name,cond,__LINE__)
+ create_optional_field_(next,type,name,cond,0)
/* Reverse a linked list of 'struct pair's in place. */
pair_p
@@ -5187,7 +5187,7 @@ main (int argc, char **argv)
/* These types are set up with #define or else outside of where
we can see them. We should initialize them before calling
read_input_list. */
-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
+#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \
Call;} while (0)
POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index bd78310ea24..dbd02c51a4c 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -430,7 +430,7 @@ complete_all_modes (void)
}
/* For each mode in class CLASS, construct a corresponding complex mode. */
-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
+#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0)
static void
make_complex_modes (enum mode_class cl,
const char *file, unsigned int line)
@@ -489,7 +489,7 @@ make_complex_modes (enum mode_class cl,
having as many components as necessary. ORDER is the sorting order
of the mode, with smaller numbers indicating a higher priority. */
#define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
- make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__)
+ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, 0)
#define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
static void ATTRIBUTE_UNUSED
make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
@@ -541,7 +541,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
/* Create a vector of booleans called NAME with COUNT elements and
BYTESIZE bytes in total. */
#define VECTOR_BOOL_MODE(NAME, COUNT, BYTESIZE) \
- make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, __LINE__)
+ make_vector_bool_mode (#NAME, COUNT, BYTESIZE, __FILE__, 0)
static void ATTRIBUTE_UNUSED
make_vector_bool_mode (const char *name, unsigned int count,
unsigned int bytesize, const char *file,
@@ -563,7 +563,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
/* Input. */
#define _SPECIAL_MODE(C, N) \
- make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
+ make_special_mode (MODE_##C, #N, __FILE__, 0)
#define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
#define CC_MODE(N) _SPECIAL_MODE (CC, N)
@@ -576,7 +576,7 @@ make_special_mode (enum mode_class cl, const char *name,
#define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
#define FRACTIONAL_INT_MODE(N, B, Y) \
- make_int_mode (#N, B, Y, __FILE__, __LINE__)
+ make_int_mode (#N, B, Y, __FILE__, 0)
static void
make_int_mode (const char *name,
@@ -589,16 +589,16 @@ make_int_mode (const char *name,
}
#define FRACT_MODE(N, Y, F) \
- make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__)
+ make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0)
#define UFRACT_MODE(N, Y, F) \
- make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__)
+ make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0)
#define ACCUM_MODE(N, Y, I, F) \
- make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__)
+ make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0)
#define UACCUM_MODE(N, Y, I, F) \
- make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__)
+ make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0)
/* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
FILE, and LINE. */
@@ -619,7 +619,7 @@ make_fixed_point_mode (enum mode_class cl,
#define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
#define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
+ make_float_mode (#N, B, Y, #F, __FILE__, 0)
static void
make_float_mode (const char *name,
@@ -636,7 +636,7 @@ make_float_mode (const char *name,
#define DECIMAL_FLOAT_MODE(N, Y, F) \
FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
#define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \
- make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
+ make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0)
static void
make_decimal_float_mode (const char *name,
@@ -651,7 +651,7 @@ make_decimal_float_mode (const char *name,
}
#define RESET_FLOAT_FORMAT(N, F) \
- reset_float_format (#N, #F, __FILE__, __LINE__)
+ reset_float_format (#N, #F, __FILE__, 0)
static void ATTRIBUTE_UNUSED
reset_float_format (const char *name, const char *format,
const char *file, unsigned int line)
@@ -672,7 +672,7 @@ reset_float_format (const char *name, const char *format,
/* __intN support. */
#define INT_N(M,PREC) \
- make_int_n (#M, PREC, __FILE__, __LINE__)
+ make_int_n (#M, PREC, __FILE__, 0)
static void ATTRIBUTE_UNUSED
make_int_n (const char *m, int bitsize,
const char *file, unsigned int line)
@@ -701,7 +701,7 @@ make_int_n (const char *m, int bitsize,
/* Partial integer modes are specified by relation to a full integer
mode. */
#define PARTIAL_INT_MODE(M,PREC,NAME) \
- make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__)
+ make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0)
static void ATTRIBUTE_UNUSED
make_partial_integer_mode (const char *base, const char *name,
unsigned int precision,
@@ -728,7 +728,7 @@ make_partial_integer_mode (const char *base, const char *name,
/* A single vector mode can be specified by naming its component
mode and the number of components. */
#define VECTOR_MODE(C, M, N) \
- make_vector_mode (MODE_##C, #M, N, __FILE__, __LINE__);
+ make_vector_mode (MODE_##C, #M, N, __FILE__, 0);
static void ATTRIBUTE_UNUSED
make_vector_mode (enum mode_class bclass,
const char *base,
@@ -771,7 +771,7 @@ make_vector_mode (enum mode_class bclass,
/* Adjustability. */
#define _ADD_ADJUST(A, M, X, C1, C2) \
- new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
+ new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0)
#define ADJUST_NUNITS(M, X) _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM)
#define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)

View File

@@ -0,0 +1,26 @@
From 6f87a095f0e696bec07a50df789c9db8bdbca43d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 12 May 2020 10:39:09 -0700
Subject: [PATCH] mingw32: Enable operation_not_supported
Fixes nativesdk build errors on mingw32 gcc-runtime
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libstdc++-v3/config/os/mingw32/error_constants.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h
index 68ac72a78fb..71cd5815b81 100644
--- a/libstdc++-v3/config/os/mingw32/error_constants.h
+++ b/libstdc++-v3/config/os/mingw32/error_constants.h
@@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef EPERM
operation_not_permitted = EPERM,
#endif
-// operation_not_supported = EOPNOTSUPP,
+ operation_not_supported = EOPNOTSUPP,
#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif

View File

@@ -0,0 +1,42 @@
From 38d262bfe7c0c894c364dc6e4dc7971e78a73974 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 13 May 2020 15:10:38 -0700
Subject: [PATCH] libatomic: Do not enforce march on aarch64
OE passes the right options via gcc compiler cmdline via TUNE_CCARGS
this can conflict between -mcpu settings and -march setting here, since
-mcpu will translate into an appropriate -march, lets depend on that
instead of setting it explicitly
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libatomic/Makefile.am | 1 -
libatomic/Makefile.in | 1 -
2 files changed, 2 deletions(-)
diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
index 133fbbca77e..ac1ca645876 100644
--- a/libatomic/Makefile.am
+++ b/libatomic/Makefile.am
@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
## On a target-specific basis, include alternates to be selected by IFUNC.
if HAVE_IFUNC
if ARCH_AARCH64_LINUX
-IFUNC_OPTIONS = -march=armv8-a+lse
libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
endif
if ARCH_ARM_LINUX
diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
index a51807e95c9..97df2d7ff03 100644
--- a/libatomic/Makefile.in
+++ b/libatomic/Makefile.in
@@ -431,7 +431,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
_$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
$(am__append_3) $(am__append_4)
-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
@ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
@ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
@ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16

View File

@@ -1,5 +1,5 @@
require gcc-${PV}.inc require gcc-for-nvcc-${PV}.inc
require gcc-8-target.inc require gcc-for-nvcc-target.inc
# Building with thumb enabled on armv4t armv5t fails with # Building with thumb enabled on armv4t armv5t fails with
# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs # | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs

View File

@@ -1,4 +0,0 @@
require gcc-${PV}.inc
require gcc-8-source.inc
EXCLUDE_FROM_WORLD = "1"

View File

@@ -1,6 +1,6 @@
BPN = "libgcc" BPN = "libgcc"
require gcc-8-configure-common.inc require gcc-for-nvcc-configure-common.inc
INHIBIT_DEFAULT_DEPS = "1" INHIBIT_DEFAULT_DEPS = "1"
@@ -41,14 +41,19 @@ do_install () {
} }
do_install:append:libc-baremetal () { do_install:append:libc-baremetal () {
rmdir ${D}${base_libdir} if [ "${base_libdir}" != "${libdir}" ]; then
rmdir ${D}${base_libdir}
fi
} }
do_install:append:libc-newlib () { do_install:append:libc-newlib () {
rmdir ${D}${base_libdir} if [ "${base_libdir}" != "${libdir}" ]; then
rmdir ${D}${base_libdir}
fi
} }
# No rpm package is actually created but -dev depends on it, avoid dnf error # No rpm package is actually created but -dev depends on it, avoid dnf error
RDEPENDS:${PN}-dev = "" RDEPENDS:${PN}-dev:libc-baremetal = ""
RDEPENDS:${PN}-dev:libc-newlib = ""
BBCLASSEXTEND = "nativesdk" BBCLASSEXTEND = "nativesdk"

View File

@@ -27,7 +27,7 @@
# any exception handler, we can safely symlink to libgcc.a. # any exception handler, we can safely symlink to libgcc.a.
# #
require libgcc-8-common.inc require libgcc-for-nvcc-common.inc
DEPENDS = "virtual/${TARGET_PREFIX}gcc" DEPENDS = "virtual/${TARGET_PREFIX}gcc"

View File

@@ -1,5 +1,5 @@
require gcc-${PV}.inc require gcc-for-nvcc-${PV}.inc
require libgcc-8-initial.inc require libgcc-for-nvcc-initial.inc
# Building with thumb enabled on armv6t fails # Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm" ARM_INSTRUCTION_SET:armv6 = "arm"

View File

@@ -1,4 +1,4 @@
require libgcc-8-common.inc require libgcc-for-nvcc-common.inc
DEPENDS = "virtual/${TARGET_PREFIX}cuda-gcc virtual/${TARGET_PREFIX}cuda-g++ virtual/${MLPREFIX}libc" DEPENDS = "virtual/${TARGET_PREFIX}cuda-gcc virtual/${TARGET_PREFIX}cuda-g++ virtual/${MLPREFIX}libc"
STAGING_BINDIR_TOOLCHAIN:append = "-${BINV}" STAGING_BINDIR_TOOLCHAIN:append = "-${BINV}"

View File

@@ -1,5 +1,5 @@
require gcc-${PV}.inc require gcc-for-nvcc-${PV}.inc
require libgcc-8.inc require libgcc-for-nvcc.inc
# Building with thumb enabled on armv6t fails # Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm" ARM_INSTRUCTION_SET:armv6 = "arm"