summaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2023-06-08 11:42:27 -0600
committerMark Hatle <mark.hatle@amd.com>2023-06-08 11:42:27 -0600
commit80dc01609f4cf24329cd71adac4dacd2882f82dc (patch)
tree847ea5add462b99a5721b1c308fec597804521d2 /meta-microblaze/recipes-devtools
parent03f59dec170c92ce4cecc89ddc8b6e2b8698c77e (diff)
downloadmeta-xilinx-80dc01609f4cf24329cd71adac4dacd2882f82dc.tar.gz
meta-microblaze: Import last version of gcc 12.2
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
Diffstat (limited to 'meta-microblaze/recipes-devtools')
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc114
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-common.inc118
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc123
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc187
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross.inc163
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-cross_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc12
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc249
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc310
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb2
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc120
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb7
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc21
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source.inc45
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb4
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-target.inc259
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc107
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch239
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch134
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch64
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch53
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch403
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch40
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch99
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch55
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch113
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch35
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch51
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch510
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch99
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch84
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch39
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch83
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch182
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch31
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch42
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch28
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch31
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch92
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch19
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch63
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb14
-rw-r--r--meta-microblaze/recipes-devtools/gcc/gcc_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-common.inc163
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc58
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc.inc53
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb5
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgcc_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran.inc88
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb3
-rw-r--r--meta-microblaze/recipes-devtools/gcc/libgfortran_13.1.bbappend1
-rw-r--r--meta-microblaze/recipes-devtools/gcc/microblaze-block.inc1
67 files changed, 5107 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc
new file mode 100644
index 00000000..0dbbecad
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-12.2.inc
@@ -0,0 +1,114 @@
1require gcc-common.inc
2
3# Third digit in PV should be incremented after a minor release
4
5PV = "12.2.0"
6
7# BINV should be incremented to a revision after a minor gcc release
8
9BINV = "12.2.0"
10
11FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
12
13DEPENDS =+ "mpfr gmp libmpc zlib flex-native"
14NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
15
16LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
17
18LIC_FILES_CHKSUM = "\
19 file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
20 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
21 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
22 file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
23 file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
24"
25# from git
26#RELEASE ?= "7092b7aea122a91824d048aeb23834cf1d19b1a1"
27#BASEURI ?= "https://repo.or.cz/official-gcc.git/snapshot/${RELEASE}.tar.gz;downloadfilename=gcc-${PV}-${RELEASE}.tar.gz"
28#SOURCEDIR ?= "official-gcc-${@'${RELEASE}'[0:7]}"
29
30# from snapshot
31#RELEASE ?= "12.1.0-RC-20220429"
32#SOURCEDIR ?= "gcc-${RELEASE}"
33#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
34
35# official release
36RELEASE ?= "${PV}"
37BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
38SOURCEDIR ?= "gcc-${PV}"
39
40SRC_URI = "${BASEURI} \
41 file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
42 file://0002-gcc-poison-system-directories.patch \
43 file://0003-64-bit-multilib-hack.patch \
44 file://0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch \
45 file://0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
46 file://0006-cpp-honor-sysroot.patch \
47 file://0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
48 file://0008-libtool.patch \
49 file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
50 file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
51 file://0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
52 file://0013-Ensure-target-gcc-headers-can-be-included.patch \
53 file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
54 file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
55 file://0016-handle-sysroot-support-for-nativesdk-gcc.patch \
56 file://0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
57 file://0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
58 file://0019-Re-introduce-spe-commandline-options.patch \
59 file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
60 file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
61 file://0023-libatomic-Do-not-enforce-march-on-aarch64.patch \
62 file://0024-Fix-install-path-of-linux64.h.patch \
63 file://0026-rust-recursion-limit.patch \
64 file://prefix-map-realpath.patch \
65 file://hardcoded-paths.patch \
66"
67SRC_URI[sha256sum] = "e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff"
68
69S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
70B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
71
72# Language Overrides
73FORTRAN = ""
74JAVA = ""
75
76SSP ?= "--disable-libssp"
77SSP:mingw32 = "--enable-libssp"
78
79EXTRA_OECONF_BASE = "\
80 ${SSP} \
81 --enable-libitm \
82 --enable-lto \
83 --disable-bootstrap \
84 --with-system-zlib \
85 ${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
86 --enable-linker-build-id \
87 --with-ppl=no \
88 --with-cloog=no \
89 --enable-checking=release \
90 --enable-cheaders=c_global \
91 --without-isl \
92"
93
94EXTRA_OECONF_INITIAL = "\
95 --disable-libgomp \
96 --disable-libitm \
97 --disable-libquadmath \
98 --with-system-zlib \
99 --disable-lto \
100 --disable-plugin \
101 --enable-linker-build-id \
102 --enable-decimal-float=no \
103 --without-isl \
104 --disable-libssp \
105"
106
107EXTRA_OECONF_PATHS = "\
108 --with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
109 --with-sysroot=/not/exist \
110 --with-build-sysroot=${STAGING_DIR_TARGET} \
111"
112
113# Is a binutils 2.26 issue, not gcc
114CVE_CHECK_IGNORE += "CVE-2021-37322"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc
new file mode 100644
index 00000000..5ac82b1b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-common.inc
@@ -0,0 +1,118 @@
1SUMMARY = "GNU cc and gcc C compilers"
2HOMEPAGE = "http://www.gnu.org/software/gcc/"
3DESCRIPTION = "The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system."
4SECTION = "devel"
5LICENSE = "GPL"
6
7NATIVEDEPS = ""
8
9CVE_PRODUCT = "gcc"
10
11inherit autotools gettext texinfo
12
13BPN = "gcc"
14COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
15
16python extract_stashed_builddir () {
17 src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
18 dest = d.getVar("B")
19 oe.path.copyhardlinktree(src, dest)
20 staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
21}
22
23def get_gcc_float_setting(bb, d):
24 if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
25 return "--with-float=hard"
26 if d.getVar('TARGET_FPU') in [ 'soft' ]:
27 return "--with-float=soft"
28 if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
29 return "--enable-e500_double"
30 return ""
31
32get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
33
34def get_gcc_x86_64_arch_setting(bb, d):
35 import re
36 march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
37 if march:
38 return "--with-arch=%s " % march.group(1)
39 # The earliest supported x86-64 CPU
40 return "--with-arch=core2"
41
42get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
43
44def get_gcc_mips_plt_setting(bb, d):
45 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
46 return "--with-mips-plt"
47 return ""
48
49def get_gcc_ppc_plt_settings(bb, d):
50 if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
51 return "--enable-secureplt"
52 return ""
53
54def get_gcc_multiarch_setting(bb, d):
55 target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
56 multiarch_options = {
57 "i586": "--enable-targets=all",
58 "i686": "--enable-targets=all",
59 "powerpc": "--enable-targets=powerpc64",
60 "powerpc64le": "--enable-targets=powerpcle",
61 "mips": "--enable-targets=all",
62 "sparc": "--enable-targets=all",
63 }
64
65 if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
66 if target_arch in multiarch_options :
67 return multiarch_options[target_arch]
68 return ""
69
70# this is used by the multilib setup of gcc
71def get_tune_parameters(tune, d):
72 availtunes = d.getVar('AVAILTUNES')
73 if tune not in availtunes.split():
74 bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
75
76 localdata = bb.data.createCopy(d)
77 override = ':tune-' + tune
78 localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
79
80 retdict = {}
81 retdict['tune'] = tune
82 retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
83 retdict['features'] = localdata.getVar('TUNE_FEATURES')
84 # BASELIB is used by the multilib code to change library paths
85 retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
86 retdict['arch'] = localdata.getVar('TUNE_ARCH')
87 retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
88 retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
89 retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
90 retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
91 return retdict
92
93get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
94
95DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
96
97MIRRORS =+ "\
98 ${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
99"
100#
101# Set some default values
102#
103gcclibdir = "${libdir}/gcc"
104BINV = "${PV}"
105#S = "${WORKDIR}/gcc-${PV}"
106S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
107
108B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
109
110target_includedir ?= "${includedir}"
111target_libdir ?= "${libdir}"
112target_base_libdir ?= "${base_libdir}"
113target_prefix ?= "${prefix}"
114
115# We need to ensure that for the shared work directory, the do_patch signatures match
116# The real WORKDIR location isn't a dependency for the shared workdir.
117src_patches[vardepsexclude] = "WORKDIR"
118should_apply[vardepsexclude] += "PN"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
new file mode 100644
index 00000000..e4cdb73f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-configure-common.inc
@@ -0,0 +1,123 @@
1require gcc-multilib-config.inc
2require gcc-shared-source.inc
3#
4# Build the list of lanaguages to build.
5#
6# These can be overridden by the version specific .inc file.
7
8# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
9FORTRAN ?= ",f77"
10LANGUAGES ?= "c,c++${FORTRAN}"
11
12EXTRA_OECONF_BASE ?= ""
13EXTRA_OECONF_PATHS ?= ""
14
15GCCMULTILIB ?= "--disable-multilib"
16GCCTHREADS ?= "posix"
17
18GCCPIE ??= ""
19
20SYMVERS_CONF ?= "--enable-symvers=gnu"
21
22EXTRA_OECONF = "\
23 ${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
24 --with-gnu-ld \
25 --enable-shared \
26 --enable-languages=${LANGUAGES} \
27 --enable-threads=${GCCTHREADS} \
28 ${GCCMULTILIB} \
29 ${GCCPIE} \
30 --enable-c99 \
31 --enable-long-long \
32 ${SYMVERS_CONF} \
33 --enable-libstdcxx-pch \
34 --program-prefix=${TARGET_PREFIX} \
35 --without-local-prefix \
36 --disable-install-libiberty \
37 ${EXTRA_OECONF_BASE} \
38 ${EXTRA_OECONF_GCC_FLOAT} \
39 ${EXTRA_OECONF_PATHS} \
40 ${@get_gcc_mips_plt_setting(bb, d)} \
41 ${@get_gcc_ppc_plt_settings(bb, d)} \
42 ${@get_gcc_multiarch_setting(bb, d)} \
43 --enable-standard-branch-protection \
44"
45
46# glibc version is a minimum controlling whether features are enabled.
47# Doesn't need to track glibc exactly
48EXTRA_OECONF:append:libc-glibc = " --with-glibc-version=2.28 "
49
50# Set this here since GCC configure won't auto-detect and enable
51# initfini-arry when cross compiling.
52EXTRA_OECONF:append = " --enable-initfini-array"
53
54export gcc_cv_collect2_libs = 'none required'
55# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
56# in the config.log files (which might not get generated until do_compile
57# hence being missed by the insane do_configure check).
58
59EXTRA_OECONF:append:linux = " --enable-__cxa_atexit"
60
61EXTRA_OECONF:append:mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
62EXTRA_OECONF:append:mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
63EXTRA_OECONF:append:mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
64EXTRA_OECONF:append:mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
65EXTRA_OECONF:append:mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
66EXTRA_OECONF:append:mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
67EXTRA_OECONF:append:mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
68EXTRA_OECONF:append:mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
69
70EXTRA_OECONF_GCC_FLOAT ??= ""
71CPPFLAGS = ""
72
73SYSTEMHEADERS = "${target_includedir}"
74SYSTEMLIBS = "${target_base_libdir}/"
75SYSTEMLIBS1 = "${target_libdir}/"
76
77do_configure:prepend () {
78 # teach gcc to find correct target includedir when checking libc ssp support
79 mkdir -p ${B}/gcc
80 echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
81 cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
82 cat >>${B}/gcc/defaults.h.new <<_EOF
83#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
84#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
85#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
86#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
87#endif /* ! GCC_DEFAULTS_H */
88_EOF
89 mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
90}
91
92do_configure () {
93 # Setup these vars for cross building only
94 # ... because foo_FOR_TARGET apparently gets misinterpreted inside the
95 # gcc build stuff when the build is producing a cross compiler - i.e.
96 # when the 'current' target is the 'host' system, and the host is not
97 # the target (because the build is actually making a cross compiler!)
98 if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
99 export CC_FOR_TARGET="${CC}"
100 export GCC_FOR_TARGET="${CC}"
101 export CXX_FOR_TARGET="${CXX}"
102 export AS_FOR_TARGET="${HOST_PREFIX}as"
103 export LD_FOR_TARGET="${HOST_PREFIX}ld"
104 export NM_FOR_TARGET="${HOST_PREFIX}nm"
105 export AR_FOR_TARGET="${HOST_PREFIX}ar"
106 export GFORTRAN_FOR_TARGET="gfortran"
107 export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
108 fi
109 export CC_FOR_BUILD="${BUILD_CC}"
110 export CXX_FOR_BUILD="${BUILD_CXX}"
111 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
112 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
113 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
114 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
115 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
116 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
117 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
118 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
119
120
121 oe_runconf
122}
123
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc
new file mode 100644
index 00000000..ec87b462
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian.inc
@@ -0,0 +1,187 @@
1inherit cross-canadian
2
3SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
4PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5
6DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
7
8GCCMULTILIB = "--enable-multilib"
9
10require gcc-configure-common.inc
11
12EXTRA_OECONF += "--with-plugin-ld=ld"
13EXTRA_OECONF_PATHS = "\
14 --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
15 --with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
16 --with-sysroot=/not/exist \
17 --with-build-sysroot=${STAGING_DIR_TARGET} \
18"
19# We have to point gcc at a sysroot but we don't need to rebuild if this changes
20# e.g. we switch between different machines with different tunes.
21EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
22TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
23get_gcc_float_setting[vardepvalue] = ""
24
25#
26# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
27# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
28#
29export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
30export AS_FOR_TARGET = "${TARGET_PREFIX}as"
31export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
32export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
33export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
34export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc"
35export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
36export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
37export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
38export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
39export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
40export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
41export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
42
43#
44# We need to override this and make sure the compiler can find staging
45#
46export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
47
48do_configure () {
49 if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
50 mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
51 fi
52 export CC_FOR_BUILD="${BUILD_CC}"
53 export CXX_FOR_BUILD="${BUILD_CXX}"
54 export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
55 export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
56 export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
57 export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
58 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
59 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
60 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
61 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
62 oe_runconf
63}
64
65do_compile () {
66 oe_runmake all-host configure-target-libgcc
67 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
68}
69
70PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"
71
72FILES:${PN} = "\
73 ${exec_prefix}/bin/* \
74 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
75 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
76 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
77 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
78 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
80 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
81 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
82 ${libdir}/bfd-plugins/*.so \
83 ${includedir}/c++/${BINV} \
84 ${prefix}/${TARGET_SYS}/bin/* \
85 ${prefix}/${TARGET_SYS}/lib/* \
86 ${prefix}/${TARGET_SYS}${target_includedir}/* \
87"
88INSANE_SKIP:${PN} += "dev-so"
89
90FILES:${PN}-doc = "\
91 ${infodir} \
92 ${mandir} \
93 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
94"
95
96EXEEXT = ""
97
98# Compute how to get from libexecdir to bindir in python (easier than shell)
99BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
100# linker plugin path
101LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${libdir}/bfd-plugins"))}"
102
103do_install () {
104 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
105 oe_runmake 'DESTDIR=${D}' install-host
106
107 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
108 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
109 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
110 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
111
112 # We care about g++ not c++
113 rm -f ${D}${bindir}/*c++
114
115 # We don't care about the gcc-<version> copies
116 rm -f ${D}${bindir}/*gcc-${BINV}*
117
118 # Cleanup empty directories which are not shipped
119 # we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
120 # ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
121 local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
122 for i in $empty_dirs; do
123 [ -d $i ] && rmdir --ignore-fail-on-non-empty $i
124 done
125
126 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
127 # found.
128 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
129 install -d $dest
130 suffix=${EXEEXT}
131 for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
132 if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
133 continue
134 fi
135
136 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
137 done
138
139 # libquadmath headers need to be available in the gcc libexec dir
140 install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
141 cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
142 cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
143
144 # install LTO linker plugins where binutils tools can find it
145 install -d ${D}${libdir}/bfd-plugins
146 ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
147
148 chown -R root:root ${D}
149
150 cross_canadian_bindirlinks
151
152 for i in linux ${CANADIANEXTRAOS}
153 do
154 for v in ${CANADIANEXTRAVENDOR}
155 do
156 d=${D}${bindir}/../${TARGET_ARCH}$v-$i
157 install -d $d
158 for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT}
159 do
160 p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
161 case $i in
162 *musl*)
163 rm -rf $d/$p
164 echo "#!/usr/bin/env sh" > $d/$p
165 echo "exec \`dirname \$0\`/../${TARGET_SYS}/$j -mmusl \$@" >> $d/$p
166 chmod 0755 $d/$p
167 ;;
168 *)
169 ;;
170 esac
171 done
172 done
173 done
174}
175
176ELFUTILS = "nativesdk-elfutils"
177DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib nativesdk-zstd"
178RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
179
180SYSTEMHEADERS = "${target_includedir}/"
181SYSTEMLIBS = "${target_base_libdir}/"
182SYSTEMLIBS1 = "${target_libdir}/"
183
184EXTRA_OECONF += "--enable-poison-system-directories"
185
186# gcc 4.7 needs -isystem
187export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb
new file mode 100644
index 00000000..bf53c5cd
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross-canadian.inc
3
4
5
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross-canadian_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc
new file mode 100644
index 00000000..a540fb24
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross.inc
@@ -0,0 +1,163 @@
1inherit cross
2
3INHIBIT_DEFAULT_DEPS = "1"
4EXTRADEPENDS = ""
5DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
6PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
7python () {
8 if d.getVar("TARGET_OS").startswith("linux"):
9 d.setVar("EXTRADEPENDS", "linux-libc-headers")
10}
11
12PN = "gcc-cross-${TARGET_ARCH}"
13
14# Ignore how TARGET_ARCH is computed.
15TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
16
17require gcc-configure-common.inc
18
19# While we want the 'gnu' hash style, we explicitly set it to sysv here to
20# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to
21# gnu) will hit a QA failure.
22LINKER_HASH_STYLE ?= "sysv"
23
24EXTRA_OECONF += "--enable-poison-system-directories=error"
25EXTRA_OECONF:append:sh4 = " \
26 --with-multilib-list= \
27 --enable-incomplete-targets \
28"
29
30EXTRA_OECONF += "\
31 --with-system-zlib \
32"
33
34EXTRA_OECONF:append:libc-baremetal = " --without-headers"
35EXTRA_OECONF:remove:libc-baremetal = "--enable-threads=posix"
36EXTRA_OECONF:remove:libc-newlib = "--enable-threads=posix"
37
38EXTRA_OECONF_PATHS = "\
39 --with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
40 --with-sysroot=/not/exist \
41 --with-build-sysroot=${STAGING_DIR_TARGET} \
42"
43
44ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
45
46
47do_configure:prepend () {
48 install -d ${RECIPE_SYSROOT}${target_includedir}
49 touch ${RECIPE_SYSROOT}${target_includedir}/limits.h
50}
51
52do_compile () {
53 export CC="${BUILD_CC}"
54 export AR_FOR_TARGET="${TARGET_SYS}-ar"
55 export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
56 export LD_FOR_TARGET="${TARGET_SYS}-ld"
57 export NM_FOR_TARGET="${TARGET_SYS}-nm"
58 export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc"
59 export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
60 export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
61 export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
62 export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
63
64 # Prevent native/host sysroot path from being used in configargs.h header,
65 # as it will be rewritten when used by other sysroots preventing support
66 # for gcc plugins
67 oe_runmake configure-gcc
68 sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h
69 sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h
70
71 # Prevent sysroot/workdir paths from being used in checksum-options.
72 # checksum-options is used to generate a checksum which is embedded into
73 # the output binary.
74 oe_runmake TARGET-gcc=checksum-options all-gcc
75 sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
76 sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options
77
78 oe_runmake all-host configure-target-libgcc
79 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
80}
81
82INHIBIT_PACKAGE_STRIP = "1"
83
84# Compute how to get from libexecdir to bindir in python (easier than shell)
85BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
86# linker plugin path
87LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}"
88
89do_install () {
90 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
91 oe_runmake 'DESTDIR=${D}' install-host
92
93 install -d ${D}${target_base_libdir}
94 install -d ${D}${target_libdir}
95
96 # Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
97 # gfortran is fully backwards compatible. This is a safe and practical solution.
98 if [ -n "${@d.getVar('FORTRAN')}" ]; then
99 ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
100 fortsymlinks="g77 gfortran"
101 fi
102
103 # Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
104 # found. These need to be relative paths so they work in different locations.
105 dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
106 install -d $dest
107 for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do
108 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
109 ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
110 done
111
112 # Remove things we don't need but keep share/java
113 for d in info man share/doc share/locale share/man share/info; do
114 rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
115 done
116
117 # libquadmath headers need to be available in the gcc libexec dir
118 install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
119 cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
120 cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
121
122 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
123
124 # install LTO linker plugins where binutils tools can find it
125 install -d ${D}${libdir}/bfd-plugins
126 ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
127}
128
129do_package[noexec] = "1"
130do_packagedata[noexec] = "1"
131do_package_write_ipk[noexec] = "1"
132do_package_write_rpm[noexec] = "1"
133do_package_write_deb[noexec] = "1"
134
135inherit chrpath
136
137python gcc_stash_builddir_fixrpaths() {
138 # rewrite rpaths, breaking hardlinks as required
139 process_dir("/", d.getVar("BUILDDIRSTASH"), d, break_hardlinks = True)
140}
141
142BUILDDIRSTASH = "${WORKDIR}/stashed-builddir/build"
143do_gcc_stash_builddir[dirs] = "${B}"
144do_gcc_stash_builddir[cleandirs] = "${BUILDDIRSTASH}"
145do_gcc_stash_builddir[postfuncs] += "gcc_stash_builddir_fixrpaths"
146do_gcc_stash_builddir () {
147 dest=${BUILDDIRSTASH}
148 hardlinkdir . $dest
149 # Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files
150 rm $dest/gcc/include/*.h
151 cp gcc/include/*.h $dest/gcc/include/
152 sysroot-relativelinks.py $dest
153}
154addtask do_gcc_stash_builddir after do_compile before do_install
155SSTATETASKS += "do_gcc_stash_builddir"
156do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}"
157do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
158do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
159
160python do_gcc_stash_builddir_setscene () {
161 sstate_setscene(d)
162}
163addtask do_gcc_stash_builddir_setscene
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb
new file mode 100644
index 00000000..b43cca0c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_12.2.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-cross.inc
3
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-cross_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
new file mode 100644
index 00000000..bd65b1fe
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk.inc
@@ -0,0 +1,12 @@
1inherit crosssdk
2
3PN = "gcc-crosssdk-${SDK_SYS}"
4
5SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
6SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
7SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
8
9GCCMULTILIB = "--disable-multilib"
10
11DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
12PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb
new file mode 100644
index 00000000..40a6c4fe
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_12.2.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-cross_${PV}.bb
2require gcc-crosssdk.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-crosssdk_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc
new file mode 100644
index 00000000..2dbbc23c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-multilib-config.inc
@@ -0,0 +1,249 @@
1# following code modifies these definitions in the gcc config
2# MULTILIB_OPTIONS
3# MULTILIB_DIRNAMES
4# MULTILIB_OSDIRNAMES
5# GLIBC_DYNAMIC_LINKER32
6# GLIBC_DYNAMIC_LINKER64
7# GLIBC_DYNAMIC_LINKERX32
8# GLIBC_DYNAMIC_LINKERN32
9# For more information on use of these variables look at these files in the gcc source code
10# gcc/config/i386/t-linux64
11# gcc/config/mips/t-linux64
12# gcc/config/rs6000/t-linux64
13# gcc/config/i386/linux64.h
14# gcc/config/mips/linux64.h
15# gcc/config/rs6000/linux64.h
16
17MULTILIB_OPTION_WHITELIST ??= "-m32 -m64 -mx32 -mabi=n32 -mabi=32 -mabi=64"
18
19python gcc_multilib_setup() {
20 import re
21 import shutil
22 import glob
23
24 srcdir = d.getVar('S')
25 builddir = d.getVar('B')
26 src_conf_dir = '%s/gcc/config' % srcdir
27 build_conf_dir = '%s/gcc/config' % builddir
28
29 bb.utils.remove(build_conf_dir, True)
30 ml_globs = ('%s/*/t-linux64' % src_conf_dir,
31 '%s/*/linux64.h' % src_conf_dir,
32 '%s/aarch64/t-aarch64' % src_conf_dir,
33 '%s/aarch64/aarch64.h' % src_conf_dir,
34 '%s/aarch64/aarch64-linux.h' % src_conf_dir,
35 '%s/aarch64/aarch64-cores.def' % src_conf_dir,
36 '%s/arm/linux-eabi.h' % src_conf_dir,
37 '%s/*/linux.h' % src_conf_dir,
38 '%s/linux.h' % src_conf_dir)
39
40 # copy the target multilib config files to ${B}
41 for ml_glob in ml_globs:
42 for fn in glob.glob(ml_glob):
43 rel_path = os.path.relpath(fn, src_conf_dir)
44 parent_dir = os.path.dirname(rel_path)
45 bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
46 bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
47
48 pn = d.getVar('PN')
49 multilibs = (d.getVar('MULTILIB_VARIANTS') or '').split()
50 if not multilibs and pn != "nativesdk-gcc":
51 return
52
53 mlprefix = d.getVar('MLPREFIX')
54
55 if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc":
56 return
57
58
59 def write_config(root, files, options, dirnames, osdirnames):
60 for ml_conf_file in files:
61 with open(root + '/' + ml_conf_file, 'r') as f:
62 filelines = f.readlines()
63 # recreate multilib configuration variables
64 substs = [
65 (r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)),
66 (r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''),
67 (r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)),
68 (r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''),
69 (r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)),
70 (r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''),
71 ]
72
73 for (i, line) in enumerate(filelines):
74 for subst in substs:
75 line = re.sub(subst[0], subst[1], line)
76 filelines[i] = line
77
78 with open(root + '/' + ml_conf_file, 'w') as f:
79 f.write(''.join(filelines))
80
81 def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
82 def wrap_libdir(libdir):
83 if libdir.find('SYSTEMLIBS_DIR') != -1:
84 return '"%r"'
85 else:
86 return '"/%s/"' % libdir
87
88 for ml_conf_file in files:
89 fn = root + '/' + ml_conf_file
90 if not os.path.exists(fn):
91 continue
92 with open(fn, 'r') as f:
93 filelines = f.readlines()
94
95 # replace lines like
96 # #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
97 # by
98 # #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
99 # this is needed to put the correct dynamic loader path in the generated binaries
100 substs = [
101 (r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
102 r'\1' + wrap_libdir(libdir32) + r'\3'),
103 (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\"\S+\")$',
104 r'\1' + wrap_libdir(libdir64) + r'\3'),
105 (r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$',
106 r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'),
107 (r'^(#define\s*GLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
108 r'\1' + wrap_libdir(libdir32) + r'\3'),
109 (r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
110 r'\1' + wrap_libdir(libdirx32) + r'\3'),
111 (r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
112 r'\1' + wrap_libdir(libdirn32) + r'\3'),
113 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
114 r'\1' + wrap_libdir(libdir32) + r'\3'),
115 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
116 r'\1' + wrap_libdir(libdir64) + r'\3'),
117 (r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
118 r'\1' + wrap_libdir(libdirn32) + r'\3'),
119 (r'^(#define\s*UCLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
120 r'\1' + wrap_libdir(libdirx32) + r'\3'),
121 (r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
122 r'\1' + wrap_libdir(libdir32) + r'\3'),
123 (r'^(#define\s*MUSL_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
124 r'\1' + wrap_libdir(libdir32) + r'\3'),
125 (r'^(#define\s*MUSL_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
126 r'\1' + wrap_libdir(libdir64) + r'\3'),
127 (r'^(#define\s*MUSL_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
128 r'\1' + wrap_libdir(libdirx32) + r'\3'),
129 (r'^(#define\s*MUSL_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
130 r'\1' + wrap_libdir(libdir32) + r'\3'),
131 ]
132
133 for (i, line) in enumerate(filelines):
134 for subst in substs:
135 line = re.sub(subst[0], subst[1], line)
136 filelines[i] = line
137
138 with open(root + '/' + ml_conf_file, 'w') as f:
139 f.write(''.join(filelines))
140
141
142 gcc_target_config_files = {
143 'x86_64' : ['gcc/config/i386/t-linux64'],
144 'i586' : ['gcc/config/i386/t-linux64'],
145 'i686' : ['gcc/config/i386/t-linux64'],
146 'mips' : ['gcc/config/mips/t-linux64'],
147 'mips64' : ['gcc/config/mips/t-linux64'],
148 'powerpc' : ['gcc/config/rs6000/t-linux64'],
149 'powerpc64' : ['gcc/config/rs6000/t-linux64'],
150 'aarch64' : ['gcc/config/aarch64/t-aarch64'],
151 'arm' : ['gcc/config/aarch64/t-aarch64'],
152 }
153
154 gcc_header_config_files = {
155 'x86_64' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
156 'i586' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
157 'i686' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
158 'mips' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
159 'mips64' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
160 'powerpc' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
161 'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
162 'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
163 'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
164 }
165
166 libdir32 = 'SYSTEMLIBS_DIR'
167 libdir64 = 'SYSTEMLIBS_DIR'
168 libdirx32 = 'SYSTEMLIBS_DIR'
169 libdirn32 = 'SYSTEMLIBS_DIR'
170
171
172 target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix
173 else d.getVar('TARGET_ARCH'))
174 if pn == "nativesdk-gcc":
175 header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH")]
176 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
177 return
178
179 if target_arch not in gcc_target_config_files:
180 bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
181 return
182
183 target_config_files = gcc_target_config_files[target_arch]
184 header_config_files = gcc_header_config_files[target_arch]
185
186 ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE']
187 mltunes = [('DEFAULTTUNE:virtclass-multilib-%s' % ml) for ml in multilibs]
188 if mlprefix:
189 mlindex = 0
190 for ml in multilibs:
191 if mlprefix == ml + '-':
192 break
193 mlindex += 1
194
195 ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
196 else:
197 ml_list.extend(mltunes)
198
199 options = []
200 dirnames = []
201 osdirnames = []
202 optsets = []
203
204 for ml in ml_list:
205 tune = d.getVar(ml)
206 if not tune:
207 bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
208 continue
209 tune_parameters = get_tune_parameters(tune, d)
210
211 tune_baselib = tune_parameters['baselib']
212 if not tune_baselib:
213 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
214 continue
215
216 if tune_baselib == 'lib64':
217 libdir64 = tune_baselib
218 elif tune_baselib == 'libx32':
219 libdirx32 = tune_baselib
220 elif tune_baselib == 'lib32':
221 libdirn32 = tune_baselib
222 elif tune_baselib == 'lib':
223 libdir32 = tune_baselib
224 else:
225 bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
226
227 # take out '-' mcpu='s and march='s from parameters
228 opts = []
229 whitelist = (d.getVar("MULTILIB_OPTION_WHITELIST") or "").split()
230 for i in d.expand(tune_parameters['ccargs']).split():
231 if i in whitelist:
232 # Need to strip '-' from option
233 opts.append(i[1:])
234 options.append(" ".join(opts))
235
236 if tune_baselib == 'lib':
237 dirnames.append('32') # /lib => 32bit lib
238 else:
239 dirnames.append(tune_baselib.replace('lib', ''))
240 osdirnames.append('../' + tune_baselib)
241
242 write_config(builddir, target_config_files, options, dirnames, osdirnames)
243 write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
244}
245
246gcc_multilib_setup[cleandirs] = "${B}/gcc/config"
247gcc_multilib_setup[vardepsexclude] = "SDK_ARCH"
248
249EXTRACONFFUNCS += "gcc_multilib_setup"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
new file mode 100644
index 00000000..8bb58631
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime.inc
@@ -0,0 +1,310 @@
1require gcc-configure-common.inc
2
3SUMMARY = "Runtime libraries from GCC"
4
5# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
6# All gcc-runtime packages are now covered by the runtime exception.
7LICENSE = "GPL-3.0-with-GCC-exception"
8
9CXXFLAGS:remove = "-fvisibility-inlines-hidden"
10
11EXTRA_OECONF_PATHS = "\
12 --with-gxx-include-dir=${includedir}/c++/${BINV} \
13 --with-sysroot=/not/exist \
14 --with-build-sysroot=${STAGING_DIR_TARGET} \
15"
16
17EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
18EXTRA_OECONF:append = " --cache-file=${B}/config.cache"
19EXTRA_OECONF:append:libc-newlib = " --with-newlib --with-target-subdir"
20EXTRA_OECONF:append:libc-baremetal = " --with-target-subdir"
21
22# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
23EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
24EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no "
25
26DISABLE_STATIC:class-nativesdk ?= ""
27
28# Newlib does not support symbol versioning on libsdtcc++
29SYMVERS_CONF:libc-newlib = ""
30
31# Building with thumb enabled on armv6t fails
32ARM_INSTRUCTION_SET:armv6 = "arm"
33
34RUNTIMELIBITM = "libitm"
35RUNTIMELIBITM:arc = ""
36RUNTIMELIBITM:mipsarch = ""
37RUNTIMELIBITM:nios2 = ""
38RUNTIMELIBITM:microblaze = ""
39RUNTIMELIBITM:riscv32 = ""
40RUNTIMELIBITM:riscv64 = ""
41RUNTIMELIBITM:loongarch64 = ""
42RUNTIMELIBSSP ?= ""
43RUNTIMELIBSSP:mingw32 ?= "libssp"
44
45RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
46 ${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
47"
48# Only build libstdc++ for newlib
49RUNTIMETARGET:libc-newlib = "libstdc++-v3"
50
51# libiberty
52# libgfortran needs separate recipe due to libquadmath dependency
53
54do_configure () {
55 export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
56 # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
57 # tests. Create a dummy empty lib for the purposes of configure.
58 mkdir -p ${WORKDIR}/dummylib
59 ${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o
60 ${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o
61 for d in libgcc ${RUNTIMETARGET}; do
62 echo "Configuring $d"
63 rm -rf ${B}/${TARGET_SYS}/$d/
64 mkdir -p ${B}/${TARGET_SYS}/$d/
65 cd ${B}/${TARGET_SYS}/$d/
66 chmod a+x ${S}/$d/configure
67 ${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
68 if [ "$d" = "libgcc" ]; then
69 (cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
70 fi
71 done
72}
73EXTRACONFFUNCS += "extract_stashed_builddir"
74do_configure[depends] += "${COMPILERDEP}"
75
76do_compile () {
77 for d in libgcc ${RUNTIMETARGET}; do
78 cd ${B}/${TARGET_SYS}/$d/
79 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/
80 done
81}
82
83do_install () {
84 for d in ${RUNTIMETARGET}; do
85 cd ${B}/${TARGET_SYS}/$d/
86 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
87 done
88 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
89 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
90 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
91 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
92 fi
93 rm -rf ${D}${infodir}/libgomp.info ${D}${infodir}/dir
94 rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
95 rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
96 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
97 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
98 fi
99 if [ -d ${D}${infodir} ]; then
100 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
101 fi
102}
103
104do_install:append:class-target () {
105 if [ "${TARGET_OS}" = "linux-gnuspe" ]; then
106 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
107 fi
108
109 if [ "${TARGET_OS}" = "linux-gnun32" ]; then
110 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
111 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
112 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32
113 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
114 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
115 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
116 else
117 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
118 fi
119 elif [ "${TARGET_OS}" = "linux-gnux32" ]; then
120 if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
121 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
122 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32
123 elif [ "${MULTILIB_VARIANTS}" != "" ]; then
124 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
125 ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
126 else
127 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
128 fi
129 elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
130 mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}
131 ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits
132 ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
133 fi
134
135 if [ "${TARGET_ARCH}" == "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then
136 ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32
137 fi
138
139 if [ "${TCLIBC}" != "glibc" ]; then
140 case "${TARGET_OS}" in
141 "linux-musl" | "linux-*spe") extra_target_os="linux";;
142 "linux-musleabi") extra_target_os="linux-gnueabi";;
143 *) extra_target_os="linux";;
144 esac
145 ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
146 fi
147 chown -R root:root ${D}
148}
149
150INHIBIT_DEFAULT_DEPS = "1"
151DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
152PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
153
154#BBCLASSEXTEND = "nativesdk"
155
156PACKAGES = "\
157 ${PN}-dbg \
158 libstdc++ \
159 libstdc++-precompile-dev \
160 libstdc++-dev \
161 libstdc++-staticdev \
162 libg2c \
163 libg2c-dev \
164 libssp \
165 libssp-dev \
166 libssp-staticdev \
167 libquadmath \
168 libquadmath-dev \
169 libquadmath-staticdev \
170 libgomp \
171 libgomp-dev \
172 libgomp-staticdev \
173 libatomic \
174 libatomic-dev \
175 libatomic-staticdev \
176 libitm \
177 libitm-dev \
178 libitm-staticdev \
179"
180# The base package doesn't exist, so we clear the recommends.
181RRECOMMENDS:${PN}-dbg = ""
182
183# include python debugging scripts
184FILES:${PN}-dbg += "\
185 ${libdir}/libstdc++.*-gdb.py \
186 ${datadir}/gcc-${BINV}/python/libstdcxx \
187"
188
189FILES:libg2c = "${target_libdir}/libg2c.so.*"
190SUMMARY:libg2c = "Companion runtime library for g77"
191FILES:libg2c-dev = "\
192 ${libdir}/libg2c.so \
193 ${libdir}/libg2c.a \
194 ${libdir}/libfrtbegin.a \
195"
196SUMMARY:libg2c-dev = "Companion runtime library for g77 - development files"
197
198FILES:libstdc++ = "${libdir}/libstdc++.so.*"
199SUMMARY:libstdc++ = "GNU standard C++ library"
200FILES:libstdc++-dev = "\
201 ${includedir}/c++/ \
202 ${libdir}/libstdc++.so \
203 ${libdir}/libstdc++*.la \
204 ${libdir}/libsupc++.la \
205"
206SUMMARY:libstdc++-dev = "GNU standard C++ library - development files"
207FILES:libstdc++-staticdev = "\
208 ${libdir}/libstdc++*.a \
209 ${libdir}/libsupc++.a \
210"
211SUMMARY:libstdc++-staticdev = "GNU standard C++ library - static development files"
212
213FILES:libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
214SUMMARY:libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files"
215
216FILES:libssp = "${libdir}/libssp.so.*"
217SUMMARY:libssp = "GNU stack smashing protection library"
218FILES:libssp-dev = "\
219 ${libdir}/libssp*.so \
220 ${libdir}/libssp*_nonshared.a \
221 ${libdir}/libssp*.la \
222 ${libdir}/${TARGET_SYS}/${BINV}/include/ssp \
223"
224SUMMARY:libssp-dev = "GNU stack smashing protection library - development files"
225FILES:libssp-staticdev = "${libdir}/libssp*.a"
226SUMMARY:libssp-staticdev = "GNU stack smashing protection library - static development files"
227
228FILES:libquadmath = "${libdir}/libquadmath*.so.*"
229SUMMARY:libquadmath = "GNU quad-precision math library"
230FILES:libquadmath-dev = "\
231 ${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \
232 ${libdir}/libquadmath*.so \
233 ${libdir}/libquadmath.la \
234"
235SUMMARY:libquadmath-dev = "GNU quad-precision math library - development files"
236FILES:libquadmath-staticdev = "${libdir}/libquadmath.a"
237SUMMARY:libquadmath-staticdev = "GNU quad-precision math library - static development files"
238
239FILES:libgomp = "${libdir}/libgomp*${SOLIBS}"
240SUMMARY:libgomp = "GNU OpenMP parallel programming library"
241FILES:libgomp-dev = "\
242 ${libdir}/libgomp*${SOLIBSDEV} \
243 ${libdir}/libgomp*.la \
244 ${libdir}/libgomp.spec \
245 ${libdir}/${TARGET_SYS}/${BINV}/include/acc_prof.h \
246 ${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \
247 ${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \
248"
249SUMMARY:libgomp-dev = "GNU OpenMP parallel programming library - development files"
250FILES:libgomp-staticdev = "${libdir}/libgomp*.a"
251SUMMARY:libgomp-staticdev = "GNU OpenMP parallel programming library - static development files"
252
253FILES:libatomic = "${libdir}/libatomic.so.*"
254SUMMARY:libatomic = "GNU C++11 atomics support library"
255FILES:libatomic-dev = "\
256 ${libdir}/libatomic.so \
257 ${libdir}/libatomic.la \
258"
259SUMMARY:libatomic-dev = "GNU C++11 atomics support library - development files"
260FILES:libatomic-staticdev = "${libdir}/libatomic.a"
261SUMMARY:libatomic-staticdev = "GNU C++11 atomics support library - static development files"
262
263FILES:libitm = "${libdir}/libitm.so.*"
264SUMMARY:libitm = "GNU transactional memory support library"
265FILES:libitm-dev = "\
266 ${libdir}/libitm.so \
267 ${libdir}/libitm.la \
268 ${libdir}/libitm.spec \
269"
270SUMMARY:libitm-dev = "GNU transactional memory support library - development files"
271FILES:libitm-staticdev = "${libdir}/libitm.a"
272SUMMARY:libitm-staticdev = "GNU transactional memory support library - static development files"
273
274require gcc-testsuite.inc
275
276EXTRA_OEMAKE:prepend:task-check = "${PARALLEL_MAKE} "
277
278MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}"
279# prettyprinters and xmethods require gdb tooling
280MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp"
281MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'"
282
283# specific host and target dependencies required for test suite running
284do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot"
285do_check[depends] += "virtual/libc:do_populate_sysroot"
286# only depend on qemu if targeting linux user execution
287do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}"
288# extend the recipe sysroot to include the built libraries (for qemu usermode)
289do_check[prefuncs] += "extend_recipe_sysroot"
290do_check[prefuncs] += "check_prepare"
291do_check[dirs] = "${WORKDIR}/dejagnu ${B}"
292do_check[nostamp] = "1"
293do_check() {
294 export DEJAGNU="${WORKDIR}/dejagnu/site.exp"
295
296 # HACK: this works around the configure setting CXX with -nostd* args
297 sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1)
298
299 if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then
300 # qemu user has issues allocating large amounts of memory
301 export G_SLICE=always-malloc
302 # no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory
303 ulimit -m 4194304
304 ulimit -v 10485760
305 fi
306
307 oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}"
308}
309addtask check after do_compile do_populate_sysroot
310
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb
new file mode 100644
index 00000000..dd430b57
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_12.2.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-runtime.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-runtime_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
new file mode 100644
index 00000000..f6aa9c99
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -0,0 +1,120 @@
1require gcc-configure-common.inc
2
3LICENSE = "NCSA | MIT"
4
5LIC_FILES_CHKSUM = "\
6 file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \
7"
8
9EXTRA_OECONF_PATHS = "\
10 --with-sysroot=/not/exist \
11 --with-build-sysroot=${STAGING_DIR_TARGET} \
12"
13
14do_configure () {
15 rm -rf ${B}/${TARGET_SYS}/libsanitizer/
16 mkdir -p ${B}/${TARGET_SYS}/libsanitizer/
17 cd ${B}/${TARGET_SYS}/libsanitizer/
18 chmod a+x ${S}/libsanitizer/configure
19 relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")}
20 $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
21 # Easiest way to stop bad RPATHs getting into the library since we have a
22 # broken libtool here
23 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool
24 # Link to the sysroot's libstdc++ instead of one gcc thinks it just built
25 sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile
26}
27EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
29
30do_compile () {
31 cd ${B}/${TARGET_SYS}/libsanitizer/
32 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/
33}
34
35do_install () {
36 cd ${B}/${TARGET_SYS}/libsanitizer/
37 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install
38 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
39 install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
40 mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
41 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
42 fi
43 if [ -d ${D}${infodir} ]; then
44 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
45 fi
46 chown -R root:root ${D}
47}
48
49INHIBIT_DEFAULT_DEPS = "1"
50ALLOW_EMPTY:${PN} = "1"
51DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
52
53# used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized]
54DEBUG_OPTIMIZATION:append = " -Wno-error"
55
56#BBCLASSEXTEND = "nativesdk"
57
58PACKAGES = "${PN} ${PN}-dbg"
59PACKAGES += "libasan libubsan liblsan libtsan"
60PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
61PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
62
63RDEPENDS:libasan += "libstdc++"
64RDEPENDS:libubsan += "libstdc++"
65RDEPENDS:liblsan += "libstdc++"
66RDEPENDS:libtsan += "libstdc++"
67RDEPENDS:libasan-dev += "${PN}"
68RDEPENDS:libubsan-dev += "${PN}"
69RDEPENDS:liblsan-dev += "${PN}"
70RDEPENDS:libtsan-dev += "${PN}"
71RRECOMMENDS:${PN} += "libasan libubsan"
72RRECOMMENDS:${PN}:append:x86 = " liblsan"
73RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan"
74RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan"
75RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan"
76
77do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
78do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
79do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
80
81# Only x86, powerpc, sparc, s390, arm, and aarch64 are supported
82COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux'
83# musl is currently broken entirely
84COMPATIBLE_HOST:libc-musl = 'null'
85
86FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
87FILES:libasan-dev += "\
88 ${libdir}/libasan_preinit.o \
89 ${libdir}/libasan.so \
90 ${libdir}/libhwasan.so \
91 ${libdir}/libasan.la \
92"
93FILES:libasan-staticdev += "${libdir}/libasan.a \
94 ${libdir}/libhwasan.a \
95"
96
97FILES:libubsan += "${libdir}/libubsan.so.*"
98FILES:libubsan-dev += "\
99 ${libdir}/libubsan.so \
100 ${libdir}/libubsan.la \
101"
102FILES:libubsan-staticdev += "${libdir}/libubsan.a"
103
104FILES:liblsan += "${libdir}/liblsan.so.*"
105FILES:liblsan-dev += "\
106 ${libdir}/liblsan.so \
107 ${libdir}/liblsan.la \
108 ${libdir}/liblsan_preinit.o \
109"
110FILES:liblsan-staticdev += "${libdir}/liblsan.a"
111
112FILES:libtsan += "${libdir}/libtsan.so.*"
113FILES:libtsan-dev += "\
114 ${libdir}/libtsan.so \
115 ${libdir}/libtsan.la \
116 ${libdir}/libtsan_*.o \
117"
118FILES:libtsan-staticdev += "${libdir}/libtsan.a"
119
120FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
new file mode 100644
index 00000000..8bda2cca
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_12.2.bb
@@ -0,0 +1,7 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
3
4# Building with thumb enabled on armv4t armv5t fails with
5# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
6ARM_INSTRUCTION_SET:armv4 = "arm"
7ARM_INSTRUCTION_SET:armv5 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc
new file mode 100644
index 00000000..03f520b0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-shared-source.inc
@@ -0,0 +1,21 @@
1do_fetch() {
2 :
3}
4do_fetch[noexec] = "1"
5deltask do_unpack
6deltask do_patch
7
8SRC_URI = ""
9
10do_configure[depends] += "gcc-source-${PV}:do_preconfigure"
11do_populate_lic[depends] += "gcc-source-${PV}:do_unpack"
12do_deploy_source_date_epoch[depends] += "gcc-source-${PV}:do_deploy_source_date_epoch"
13
14# Copy the SDE from the shared workdir to the recipe workdir
15do_deploy_source_date_epoch () {
16 sde_file=${SDE_FILE}
17 sde_file=${sde_file#${WORKDIR}/}
18 mkdir -p ${SDE_DEPLOYDIR} $(dirname ${SDE_FILE})
19 cp -p $(dirname ${S})/$sde_file ${SDE_DEPLOYDIR}
20 cp -p $(dirname ${S})/$sde_file ${SDE_FILE}
21}
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source.inc b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc
new file mode 100644
index 00000000..265bcf4b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source.inc
@@ -0,0 +1,45 @@
1deltask do_configure
2deltask do_compile
3deltask do_install
4deltask do_populate_sysroot
5deltask do_populate_lic
6RM_WORK_EXCLUDE += "${PN}"
7
8inherit nopackages
9
10PN = "gcc-source-${PV}"
11WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
12SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:"
13
14STAMP = "${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}"
15STAMPCLEAN = "${STAMPS_DIR}/work-shared/gcc-${PV}-*"
16
17INHIBIT_DEFAULT_DEPS = "1"
18DEPENDS = ""
19PACKAGES = ""
20TARGET_ARCH = "allarch"
21TARGET_AS_ARCH = "none"
22TARGET_CC_ARCH = "none"
23TARGET_LD_ARCH = "none"
24TARGET_OS = "linux"
25baselib = "lib"
26PACKAGE_ARCH = "all"
27
28B = "${WORKDIR}/build"
29
30# This needs to be Python to avoid lots of shell variables becoming dependencies.
31python do_preconfigure () {
32 import subprocess
33 cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
34 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
35 cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure")
36 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
37
38 # Easiest way to stop bad RPATHs getting into the library since we have a
39 # broken libtool here (breaks cross-canadian and target at least)
40 cmd = d.expand("sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure")
41 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
42}
43addtask do_preconfigure after do_patch
44do_preconfigure[depends] += "gnu-config-native:do_populate_sysroot autoconf-native:do_populate_sysroot"
45
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb
new file mode 100644
index 00000000..b890fa33
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-source_12.2.bb
@@ -0,0 +1,4 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require recipes-devtools/gcc/gcc-source.inc
3
4EXCLUDE_FROM_WORLD = "1"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-target.inc b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc
new file mode 100644
index 00000000..7dac3ef4
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-target.inc
@@ -0,0 +1,259 @@
1GCCMULTILIB = "--enable-multilib"
2require gcc-configure-common.inc
3
4EXTRA_OECONF_PATHS = "\
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
9
10# Configure gcc running on the target to default to an architecture which will
11# be compatible with that of gcc-runtime (which is cross compiled to be target
12# specific). For example, for ARM, ARMv6+ adds atomic instructions that may
13# affect the ABI in the gcc-runtime libs. Since we can't rely on gcc on the
14# target to always be passed -march etc, its built-in default needs to be safe.
15
16ARMFPARCHEXT ?= ""
17
18EXTRA_OECONF:append:armv6:class-target = " --with-arch=armv6${ARMFPARCHEXT}"
19EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
20EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
21EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}"
22EXTRA_OECONF:append:x86-64:class-target = " ${@get_gcc_x86_64_arch_setting(bb, d)}"
23
24# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
25# set in subdir gcc, so subdir libcc1 can't use it, export it here to
26# fix the problem.
27export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
28
29EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
30
31PACKAGES = "\
32 ${PN} ${PN}-plugins ${PN}-symlinks \
33 g++ g++-symlinks \
34 cpp cpp-symlinks \
35 g77 g77-symlinks \
36 gfortran gfortran-symlinks \
37 gcov gcov-symlinks \
38 ${PN}-doc \
39 ${PN}-dev \
40 ${PN}-dbg \
41"
42
43FILES:${PN} = "\
44 ${bindir}/${TARGET_PREFIX}gcc* \
45 ${bindir}/${TARGET_PREFIX}lto* \
46 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
47 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/g++-mapper-server \
48 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
49 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
50 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
51 ${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
52 ${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
53 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
54 ${gcclibdir}/${TARGET_SYS}/${BINV}/include \
55 ${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
56 ${libdir}/bfd-plugins/*.so \
57"
58INSANE_SKIP:${PN} += "dev-so"
59RRECOMMENDS:${PN} += "\
60 libssp \
61 libssp-dev \
62"
63RDEPENDS:${PN} += "cpp"
64
65FILES:${PN}-dev = "\
66 ${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
67 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
68 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
69 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
70 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
71"
72FILES:${PN}-symlinks = "\
73 ${bindir}/cc \
74 ${bindir}/gcc \
75 ${bindir}/gccbug \
76"
77
78FILES:${PN}-plugins = "\
79 ${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
80"
81ALLOW_EMPTY:${PN}-plugins = "1"
82
83FILES:g77 = "\
84 ${bindir}/${TARGET_PREFIX}g77 \
85 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
86"
87FILES:g77-symlinks = "\
88 ${bindir}/g77 \
89 ${bindir}/f77 \
90"
91RRECOMMENDS:g77 = "\
92 libg2c \
93 libg2c-dev \
94"
95
96FILES:gfortran = "\
97 ${bindir}/${TARGET_PREFIX}gfortran \
98 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
99"
100RRECOMMENDS:gfortran = "\
101 libquadmath \
102 libquadmath-dev \
103"
104FILES:gfortran-symlinks = "\
105 ${bindir}/gfortran \
106 ${bindir}/f95"
107
108FILES:cpp = "\
109 ${bindir}/${TARGET_PREFIX}cpp* \
110 ${base_libdir}/cpp \
111 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
112FILES:cpp-symlinks = "${bindir}/cpp"
113
114FILES:gcov = "${bindir}/${TARGET_PREFIX}gcov* \
115 ${bindir}/${TARGET_PREFIX}gcov-tool* \
116"
117FILES:gcov-symlinks = "${bindir}/gcov \
118 ${bindir}/gcov-tool \
119"
120
121FILES:g++ = "\
122 ${bindir}/${TARGET_PREFIX}g++* \
123 ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
124"
125FILES:g++-symlinks = "\
126 ${bindir}/c++ \
127 ${bindir}/g++ \
128"
129RRECOMMENDS:g++ = "\
130 libstdc++ \
131 libstdc++-dev \
132 libatomic \
133 libatomic-dev \
134"
135
136FILES:${PN}-doc = "\
137 ${infodir} \
138 ${mandir} \
139 ${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
140"
141
142do_compile () {
143 # Prevent full target sysroot path from being used in configargs.h header,
144 # as it will be rewritten when used by other sysroots preventing support
145 # for gcc plugins. Additionally the path is embeddeded into the output
146 # binary, this prevents building a reproducible binary.
147 oe_runmake configure-gcc
148 sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/configargs.h
149 sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h
150
151 # Prevent sysroot/workdir paths from being used in checksum-options.
152 # checksum-options is used to generate a checksum which is embedded into
153 # the output binary.
154 oe_runmake TARGET-gcc=checksum-options all-gcc
155 sed -i 's@${DEBUG_PREFIX_MAP}@@g' ${B}/gcc/checksum-options
156 sed -i 's@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/checksum-options
157
158 oe_runmake all-host
159}
160
161do_install () {
162 oe_runmake 'DESTDIR=${D}' install-host
163
164 # Add unwind.h, it comes from libgcc which we don't want to build again
165 install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
166
167 # Info dir listing isn't interesting at this point so remove it if it exists.
168 if [ -e "${D}${infodir}/dir" ]; then
169 rm -f ${D}${infodir}/dir
170 fi
171
172 # Cleanup some of the ${libdir}{,exec}/gcc stuff ...
173 rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
174 rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
175 rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
176 rmdir ${D}${includedir}
177 rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
178
179 # Hack around specs file assumptions
180 test -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs && sed -i -e '/^*cross_compile:$/ { n; s/1/0/; }' ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/specs
181
182 # Cleanup manpages..
183 rm -rf ${D}${mandir}/man7
184
185 # Don't package details about the build host
186 rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/auto-build.h
187 rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/bconfig.h
188
189 cd ${D}${bindir}
190
191 # We care about g++ not c++
192 rm -f *c++*
193
194 # We don't care about the gcc-<version> ones for this
195 rm -f *gcc-?*.?*
196
197 # Not sure why we end up with these but we don't want them...
198 rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
199
200 # Symlinks so we can use these trivially on the target
201 if [ -e ${TARGET_PREFIX}g77 ]; then
202 ln -sf ${TARGET_PREFIX}g77 g77 || true
203 ln -sf g77 f77 || true
204 fi
205 if [ -e ${TARGET_PREFIX}gfortran ]; then
206 ln -sf ${TARGET_PREFIX}gfortran gfortran || true
207 ln -sf gfortran f95 || true
208 fi
209 ln -sf ${TARGET_PREFIX}g++ g++
210 ln -sf ${TARGET_PREFIX}gcc gcc
211 ln -sf ${TARGET_PREFIX}cpp cpp
212 ln -sf ${TARGET_PREFIX}gcov gcov
213 ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool
214 install -d ${D}${base_libdir}
215 ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
216 ln -sf g++ c++
217 ln -sf gcc cc
218 install -d ${D}${libdir}/bfd-plugins
219 ln -sf ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
220 chown -R root:root ${D}
221}
222
223do_install:append () {
224 #
225 # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header
226 # files and places the modified files into
227 # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the
228 # build not deterministic. The following code prunes all those headers
229 # except those under include-fixed/linux, *limits.h and README, yielding
230 # the same include-fixed folders no matter what sysroot
231
232 include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed"
233 for f in $(find ${include_fixed} -type f); do
234 case $f in
235 */include-fixed/linux/*)
236 continue
237 ;;
238 */include-fixed/*limits.h)
239 continue
240 ;;
241 */include-fixed/README)
242 continue
243 ;;
244 *)
245 # remove file and directory if empty
246 bbdebug 2 "Pruning $f"
247 rm $f
248 find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \;
249 ;;
250 esac
251 done
252}
253
254# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
255# and one from here. These can confuse gcc cross where includes use #include_next
256# and builds track file dependencies (e.g. perl and its makedepends code).
257# For determinism we don't install this ever and rely on the copy from gcc-cross.
258# [YOCTO #7287]
259SYSROOT_DIRS_IGNORE += "${libdir}/gcc"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
new file mode 100644
index 00000000..f68fec58
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc-testsuite.inc
@@ -0,0 +1,107 @@
1inherit qemu
2
3TOOLCHAIN_TEST_TARGET ??= "user"
4TOOLCHAIN_TEST_HOST ??= "localhost"
5TOOLCHAIN_TEST_HOST_USER ??= "root"
6TOOLCHAIN_TEST_HOST_PORT ??= "2222"
7
8MAKE_CHECK_BOARDFLAGS ??= ""
9MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}"
10
11python () {
12 # Provide the targets compiler args via targets options. This allows dejagnu to
13 # correctly mark incompatible tests as UNSUPPORTED (e.g. needs soft-float
14 # but running on hard-float target).
15 #
16 # These options are called "multilib_flags" within the gcc test suite. Most
17 # architectures handle these options in a sensible way such that tests that
18 # are incompatible with the provided multilib are marked as UNSUPPORTED.
19 #
20 # Note: multilib flags are added to the compile command after the args
21 # provided by any test (through dg-options), CFLAGS_FOR_TARGET is always
22 # added to the compile command before any other args but is not interpted
23 # as options like multilib flags.
24 #
25 # i686, x86-64 and aarch64 are special, since most toolchains built for
26 # these targets don't do multilib the tests do not get correctly marked as
27 # UNSUPPORTED. More importantly the test suite itself does not handle
28 # overriding the multilib flags where it could (like other archs do). As
29 # such do not pass the target compiler args for these targets.
30 args = d.getVar("TUNE_CCARGS").split()
31 if d.getVar("TUNE_ARCH") in ["i686", "x86_64", "aarch64"]:
32 args = []
33 d.setVar("MAKE_CHECK_BOARDFLAGS", ("/" + "/".join(args)) if len(args) != 0 else "")
34}
35
36python check_prepare() {
37 def generate_qemu_linux_user_config(d):
38 content = []
39 content.append('load_generic_config "sim"')
40 content.append('load_base_board_description "basic-sim"')
41 content.append('process_multilib_options ""')
42
43 # qemu args
44 qemu_binary = qemu_target_binary(d)
45 if not qemu_binary:
46 bb.fatal("Missing target qemu linux-user binary")
47
48 args = []
49 # QEMU_OPTIONS is not always valid due to -cross recipe
50 args += ["-r", d.getVar("OLDEST_KERNEL")]
51 # enable all valid instructions, since the test suite itself does not
52 # limit itself to the target cpu options.
53 # - valid for x86*, powerpc, arm, arm64
54 if qemu_binary.lstrip("qemu-") in ["x86_64", "i386", "ppc", "arm", "aarch64"]:
55 args += ["-cpu", "max"]
56
57 sysroot = d.getVar("RECIPE_SYSROOT")
58 args += ["-L", sysroot]
59 # lib paths are static here instead of using $libdir since this is used by a -cross recipe
60 libpaths = [sysroot + "/usr/lib", sysroot + "/lib"]
61 args += ["-E", "LD_LIBRARY_PATH={0}".format(":".join(libpaths))]
62
63 content.append('set_board_info is_simulator 1')
64 content.append('set_board_info sim "{0}"'.format(qemu_binary))
65 content.append('set_board_info sim,options "{0}"'.format(" ".join(args)))
66
67 # target build/test config
68 content.append('set_board_info target_install {%s}' % d.getVar("TARGET_SYS"))
69 content.append('set_board_info ldscript ""')
70 #content.append('set_board_info needs_status_wrapper 1') # qemu-linux-user return codes work, and abort works fine
71 content.append('set_board_info gcc,stack_size 16834')
72 content.append('set_board_info gdb,nosignals 1')
73 content.append('set_board_info gcc,timeout 60')
74
75 return "\n".join(content)
76
77 def generate_remote_ssh_linux_config(d):
78 content = []
79 content.append('load_generic_config "unix"')
80 content.append('process_multilib_options ""')
81 content.append("set_board_info hostname {0}".format(d.getVar("TOOLCHAIN_TEST_HOST")))
82 content.append("set_board_info username {0}".format(d.getVar("TOOLCHAIN_TEST_HOST_USER")))
83
84 port = d.getVar("TOOLCHAIN_TEST_HOST_PORT")
85 content.append("set_board_info rsh_prog \"/usr/bin/ssh -p {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
86 content.append("set_board_info rcp_prog \"/usr/bin/scp -P {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
87
88 return "\n".join(content)
89
90 dejagnudir = d.expand("${WORKDIR}/dejagnu")
91 if not os.path.isdir(dejagnudir):
92 os.makedirs(dejagnudir)
93
94 # write out target qemu board config
95 with open(os.path.join(dejagnudir, "user.exp"), "w") as f:
96 f.write(generate_qemu_linux_user_config(d))
97
98 # write out target ssh board config
99 with open(os.path.join(dejagnudir, "ssh.exp"), "w") as f:
100 f.write(generate_remote_ssh_linux_config(d))
101
102 # generate site.exp to provide boards
103 with open(os.path.join(dejagnudir, "site.exp"), "w") as f:
104 f.write("lappend boards_dir {0}\n".format(dejagnudir))
105 f.write("set CFLAGS_FOR_TARGET \"{0}\"\n".format(d.getVar("TOOLCHAIN_OPTIONS")))
106}
107
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
new file mode 100644
index 00000000..66e582ca
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
@@ -0,0 +1,39 @@
1From 31f94ef5b43a984a98f0eebd2dcf1b53aa1d7bce Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 08:37:11 +0400
4Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7
8Upstream-Status: Inappropriate [embedded specific]
9---
10 configure | 2 +-
11 configure.ac | 2 +-
12 2 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/configure b/configure
15index 5dcaab14ae9..f76310a36bb 100755
16--- a/configure
17+++ b/configure
18@@ -10165,7 +10165,7 @@ fi
19 # for target_alias and gcc doesn't manage it consistently.
20 target_configargs="--cache-file=./config.cache ${target_configargs}"
21
22-FLAGS_FOR_TARGET=
23+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
24 case " $target_configdirs " in
25 *" newlib "*)
26 case " $target_configargs " in
27diff --git a/configure.ac b/configure.ac
28index 85977482aee..8b9097c7a45 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -3346,7 +3346,7 @@ fi
32 # for target_alias and gcc doesn't manage it consistently.
33 target_configargs="--cache-file=./config.cache ${target_configargs}"
34
35-FLAGS_FOR_TARGET=
36+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
37 case " $target_configdirs " in
38 *" newlib "*)
39 case " $target_configargs " in
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
new file mode 100644
index 00000000..5aa635b3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
@@ -0,0 +1,239 @@
1From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 8 Mar 2021 16:04:20 -0800
4Subject: [PATCH] gcc: poison-system-directories
5
6Add /sw/include and /opt/include based on the original
7zecke-no-host-includes.patch patch. The original patch checked for
8/usr/include, /sw/include and /opt/include and then triggered a failure and
9aborted.
10
11Instead, we add the two missing items to the current scan. If the user
12wants this to be a failure, they can add "-Werror=poison-system-directories".
13
14Upstream-Status: Pending
15Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17---
18 gcc/common.opt | 4 ++++
19 gcc/config.in | 10 ++++++++++
20 gcc/configure | 19 +++++++++++++++++++
21 gcc/configure.ac | 16 ++++++++++++++++
22 gcc/doc/invoke.texi | 9 +++++++++
23 gcc/gcc.cc | 15 ++++++++++++---
24 gcc/incpath.cc | 21 +++++++++++++++++++++
25 7 files changed, 91 insertions(+), 3 deletions(-)
26
27diff --git a/gcc/common.opt b/gcc/common.opt
28index 8a0dafc52..0357868e2 100644
29--- a/gcc/common.opt
30+++ b/gcc/common.opt
31@@ -710,6 +710,10 @@ Wreturn-local-addr
32 Common Var(warn_return_local_addr) Init(1) Warning
33 Warn about returning a pointer/reference to a local or temporary variable.
34
35+Wpoison-system-directories
36+Common Var(flag_poison_system_directories) Init(1) Warning
37+Warn for -I and -L options using system directories if cross compiling
38+
39 Wshadow
40 Common Var(warn_shadow) Warning
41 Warn when one variable shadows another. Same as -Wshadow=global.
42diff --git a/gcc/config.in b/gcc/config.in
43index 64c27c9cf..a693cb8a8 100644
44--- a/gcc/config.in
45+++ b/gcc/config.in
46@@ -230,6 +230,16 @@
47 #endif
48
49
50+/* Define to warn for use of native system header directories */
51+#ifndef USED_FOR_TARGET
52+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
53+#endif
54+/* Define to warn for use of native system header directories */
55+#ifndef USED_FOR_TARGET
56+#undef POISON_BY_DEFAULT
57+#endif
58+
59+
60 /* Define if you want all operations on RTL (the basic data structure of the
61 optimizer and back end) to be checked for dynamic type safety at runtime.
62 This is quite expensive. */
63diff --git a/gcc/configure b/gcc/configure
64index 2b83acfb0..8bb97578c 100755
65--- a/gcc/configure
66+++ b/gcc/configure
67@@ -1023,6 +1023,7 @@ enable_maintainer_mode
68 enable_link_mutex
69 enable_link_serialization
70 enable_version_specific_runtime_libs
71+enable_poison_system_directories
72 enable_plugin
73 enable_host_shared
74 enable_libquadmath_support
75@@ -1785,6 +1786,8 @@ Optional Features:
76 --enable-version-specific-runtime-libs
77 specify that runtime libraries should be installed
78 in a compiler-specific directory
79+ --enable-poison-system-directories
80+ warn for use of native system header directories
81 --enable-plugin enable plugin support
82 --enable-host-shared build host code as shared libraries
83 --disable-libquadmath-support
84@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
85 fi
86
87
88+# Check whether --enable-poison-system-directories was given.
89+if test "${enable_poison_system_directories+set}" = set; then :
90+ enableval=$enable_poison_system_directories;
91+else
92+ enable_poison_system_directories=no
93+fi
94+
95+if test "x${enable_poison_system_directories}" != "xno"; then
96+
97+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
98+if test "$enable_poison_system_directories" = "error"; then
99+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
100+fi
101+
102+fi
103+
104 # Substitute configuration variables
105
106
107diff --git a/gcc/configure.ac b/gcc/configure.ac
108index daf2a708c..6155b83a7 100644
109--- a/gcc/configure.ac
110+++ b/gcc/configure.ac
111@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
112 [specify that runtime libraries should be
113 installed in a compiler-specific directory])])
114
115+AC_ARG_ENABLE([poison-system-directories],
116+ AS_HELP_STRING([--enable-poison-system-directories],
117+ [warn for use of native system header directories (no/yes/error)]),,
118+ [enable_poison_system_directories=no])
119+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
120+if test "x${enable_poison_system_directories}" != "xno"; then
121+ AC_MSG_NOTICE([poisoned directories enabled])
122+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
123+ [1],
124+ [Define to warn for use of native system header directories])
125+ if test $enable_poison_system_directories = "error"; then
126+ AC_MSG_NOTICE([poisoned directories are fatal])
127+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
128+ fi
129+fi
130+
131 # Substitute configuration variables
132 AC_SUBST(subdirs)
133 AC_SUBST(srcdir)
134diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
135index ff6c338be..a8ebfa59a 100644
136--- a/gcc/doc/invoke.texi
137+++ b/gcc/doc/invoke.texi
138@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
139 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
140 -Wparentheses -Wno-pedantic-ms-format @gol
141 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
142+-Wno-poison-system-directories @gol
143 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
144 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
145 -Wno-scalar-storage-order -Wsequence-point @gol
146@@ -8029,6 +8030,14 @@ made up of data only and thus requires no special treatment. But, for
147 most targets, it is made up of code and thus requires the stack to be
148 made executable in order for the program to work properly.
149
150+@item -Wno-poison-system-directories
151+@opindex Wno-poison-system-directories
152+Do not warn for @option{-I} or @option{-L} options using system
153+directories such as @file{/usr/include} when cross compiling. This
154+option is intended for use in chroot environments when such
155+directories contain the correct headers and libraries for the target
156+system rather than the host.
157+
158 @item -Wfloat-equal
159 @opindex Wfloat-equal
160 @opindex Wno-float-equal
161diff --git a/gcc/gcc.cc b/gcc/gcc.cc
162index beefde7f6..4e6557b3c 100644
163--- a/gcc/gcc.cc
164+++ b/gcc/gcc.cc
165@@ -1162,6 +1162,8 @@ proper position among the other output files. */
166 "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
167 "%X %{o*} %{e*} %{N} %{n} %{r}\
168 %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
169+ %{Wno-poison-system-directories:--no-poison-system-directories} \
170+ %{Werror=poison-system-directories:--error-poison-system-directories} \
171 %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
172 VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
173 %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
174@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
175 static const char *cpp_options =
176 "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
177 %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
178- %{!fno-working-directory:-fworking-directory}}} %{O*}\
179- %{undef} %{save-temps*:-fpch-preprocess}";
180+ %{!fno-working-directory:-fworking-directory}}} %{O*}"
181+#ifdef POISON_BY_DEFAULT
182+ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
183+#endif
184+ " %{undef} %{save-temps*:-fpch-preprocess}";
185
186 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
187
188@@ -1287,7 +1292,11 @@ static const char *cc1_options =
189 %{coverage:-fprofile-arcs -ftest-coverage}\
190 %{fprofile-arcs|fprofile-generate*|coverage:\
191 %{!fprofile-update=single:\
192- %{pthread:-fprofile-update=prefer-atomic}}}";
193+ %{pthread:-fprofile-update=prefer-atomic}}}"
194+#ifdef POISON_BY_DEFAULT
195+ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
196+#endif
197+ ;
198
199 static const char *asm_options =
200 "%{-target-help:%:print-asm-header()} "
201diff --git a/gcc/incpath.cc b/gcc/incpath.cc
202index 622204a38..5ac03c086 100644
203--- a/gcc/incpath.cc
204+++ b/gcc/incpath.cc
205@@ -26,6 +26,7 @@
206 #include "intl.h"
207 #include "incpath.h"
208 #include "cppdefault.h"
209+#include "diagnostic-core.h"
210
211 /* Microsoft Windows does not natively support inodes.
212 VMS has non-numeric inodes. */
213@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
214 }
215 fprintf (stderr, _("End of search list.\n"));
216 }
217+
218+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
219+ if (flag_poison_system_directories)
220+ {
221+ struct cpp_dir *p;
222+
223+ for (p = heads[INC_QUOTE]; p; p = p->next)
224+ {
225+ if ((!strncmp (p->name, "/usr/include", 12))
226+ || (!strncmp (p->name, "/usr/local/include", 18))
227+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
228+ || (!strncmp (p->name, "/sw/include", 11))
229+ || (!strncmp (p->name, "/opt/include", 12)))
230+ warning (OPT_Wpoison_system_directories,
231+ "include location \"%s\" is unsafe for "
232+ "cross-compilation",
233+ p->name);
234+ }
235+ }
236+#endif
237 }
238
239 /* Use given -I paths for #include "..." but not #include <...>, and
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
new file mode 100644
index 00000000..e83f05b8
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch
@@ -0,0 +1,134 @@
1From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:10:06 +0400
4Subject: [PATCH] 64-bit multilib hack.
5
6GCC has internal multilib handling code but it assumes a very specific rigid directory
7layout. The build system implementation of multilib layout is very generic and allows
8complete customisation of the library directories.
9
10This patch is a partial solution to allow any custom directories to be passed into gcc
11and handled correctly. It forces gcc to use the base_libdir (which is the current
12directory, "."). We need to do this for each multilib that is configured as we don't
13know which compiler options may be being passed into the compiler. Since we have a compiler
14per mulitlib at this point that isn't an issue.
15
16The one problem is the target compiler is only going to work for the default multlilib at
17this point. Ideally we'd figure out which multilibs were being enabled with which paths
18and be able to patch these entries with a complete set of correct paths but this we
19don't have such code at this point. This is something the target gcc recipe should do
20and override these platform defaults in its build config.
21
22Do same for riscv64, aarch64 & arc
23
24RP 15/8/11
25
26Upstream-Status: Inappropriate [OE-Specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
30Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
31Signed-off-by: Khem Raj <raj.khem@gmail.com>
32---
33 gcc/config/aarch64/t-aarch64-linux | 8 ++++----
34 gcc/config/arc/t-multilib-linux | 4 ++--
35 gcc/config/i386/t-linux64 | 6 ++----
36 gcc/config/mips/t-linux64 | 10 +++-------
37 gcc/config/riscv/t-linux | 6 ++++--
38 gcc/config/rs6000/t-linux64 | 5 ++---
39 6 files changed, 17 insertions(+), 22 deletions(-)
40
41diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
42index d0cd546002a..f4056d68372 100644
43--- a/gcc/config/aarch64/t-aarch64-linux
44+++ b/gcc/config/aarch64/t-aarch64-linux
45@@ -21,8 +21,8 @@
46 LIB1ASMSRC = aarch64/lib1funcs.asm
47 LIB1ASMFUNCS = _aarch64_sync_cache_range
48
49-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
50-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
51-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
52+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
53+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
54+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
55
56-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
57+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
58diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
59index ecb9ae6859f..12a164028d4 100644
60--- a/gcc/config/arc/t-multilib-linux
61+++ b/gcc/config/arc/t-multilib-linux
62@@ -16,9 +16,9 @@
63 # along with GCC; see the file COPYING3. If not see
64 # <http://www.gnu.org/licenses/>.
65
66-MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
67+#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
68
69-MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
70+#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
71
72 # Aliases:
73 MULTILIB_MATCHES += mcpu?arc700=mA7
74diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
75index 5526ad0e6cc..fa51c88912b 100644
76--- a/gcc/config/i386/t-linux64
77+++ b/gcc/config/i386/t-linux64
78@@ -32,7 +32,5 @@
79 #
80 comma=,
81 MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
82-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
83-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
84-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
85-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
86+MULTILIB_DIRNAMES = . .
87+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
88diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
89index 2fdd8e00407..04f2099250f 100644
90--- a/gcc/config/mips/t-linux64
91+++ b/gcc/config/mips/t-linux64
92@@ -17,10 +17,6 @@
93 # <http://www.gnu.org/licenses/>.
94
95 MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
96-MULTILIB_DIRNAMES = n32 32 64
97-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
98-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
99-MULTILIB_OSDIRNAMES = \
100- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
101- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
102- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
103+MULTILIB_DIRNAMES = . . .
104+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
105+
106diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
107index 216d2776a18..e4d817621fc 100644
108--- a/gcc/config/riscv/t-linux
109+++ b/gcc/config/riscv/t-linux
110@@ -1,3 +1,5 @@
111 # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
112-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
113-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
114+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
115+MULTILIB_DIRNAMES := . .
116+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
117+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
118diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
119index 47e0efd5764..05f5a3f188e 100644
120--- a/gcc/config/rs6000/t-linux64
121+++ b/gcc/config/rs6000/t-linux64
122@@ -26,10 +26,9 @@
123 # MULTILIB_OSDIRNAMES according to what is found on the target.
124
125 MULTILIB_OPTIONS := m64/m32
126-MULTILIB_DIRNAMES := 64 32
127+MULTILIB_DIRNAMES := . .
128 MULTILIB_EXTRA_OPTS :=
129-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
130-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
131+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
132
133 rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
134 $(COMPILE) $<
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
new file mode 100644
index 00000000..e8f21634
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch
@@ -0,0 +1,64 @@
1From 7f40f8321fb999e9b34d948724517d3fb0d26820 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 28 Oct 2021 11:33:40 +0100
4Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these
5 errors.
6
7If CXXFLAGS contains something unsupported by the build CXX, we see build failures (e.g. using -fmacro-prefix-map for the target).
8
92021-10-28 Richard Purdie <richard.purdie@linuxfoundation.org>
10
11ChangeLog:
12
13 * Makefile.in: Regenerate.
14 * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
15
16Upstream-Status: Pending [should be submittable]
17
18Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 Makefile.in | 2 ++
22 Makefile.tpl | 2 ++
23 2 files changed, 4 insertions(+)
24
25diff --git a/Makefile.in b/Makefile.in
26index 593495e1650..1d9c83cc566 100644
27--- a/Makefile.in
28+++ b/Makefile.in
29@@ -176,6 +176,7 @@ BUILD_EXPORTS = \
30 # built for the build system to override those in BASE_FLAGS_TO_PASS.
31 EXTRA_BUILD_FLAGS = \
32 CFLAGS="$(CFLAGS_FOR_BUILD)" \
33+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
34 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
35
36 # This is the list of directories to built for the host system.
37@@ -207,6 +208,7 @@ HOST_EXPORTS = \
38 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
39 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
40 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
41+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
42 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
43 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
44 LD="$(LD)"; export LD; \
45diff --git a/Makefile.tpl b/Makefile.tpl
46index ef58fac2b9a..bab04f335c2 100644
47--- a/Makefile.tpl
48+++ b/Makefile.tpl
49@@ -179,6 +179,7 @@ BUILD_EXPORTS = \
50 # built for the build system to override those in BASE_FLAGS_TO_PASS.
51 EXTRA_BUILD_FLAGS = \
52 CFLAGS="$(CFLAGS_FOR_BUILD)" \
53+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
54 LDFLAGS="$(LDFLAGS_FOR_BUILD)"
55
56 # This is the list of directories to built for the host system.
57@@ -210,6 +211,7 @@ HOST_EXPORTS = \
58 CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
59 CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
60 CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
61+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
62 DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
63 DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
64 LD="$(LD)"; export LD; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
new file mode 100644
index 00000000..e34eb2cf
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch
@@ -0,0 +1,92 @@
1From 5455fc1de74897a27c1199dc5611ec02243e24af Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:17:25 +0400
4Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
5
6Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
7the source can be shared between gcc-cross-initial,
8gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11
12Upstream-Status: Pending
13
14While compiling gcc-crosssdk-initial-x86_64 on some host, there is
15occasionally failure that test the existance of default.h doesn't
16work, the reason is tm_include_list='** defaults.h' rather than
17tm_include_list='** ./defaults.h'
18
19So we add the test condition for this situation.
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21---
22 gcc/Makefile.in | 2 +-
23 gcc/configure | 4 ++--
24 gcc/configure.ac | 4 ++--
25 gcc/mkconfig.sh | 4 ++--
26 4 files changed, 7 insertions(+), 7 deletions(-)
27
28diff --git a/gcc/Makefile.in b/gcc/Makefile.in
29index 31ff95500c9..a8277254696 100644
30--- a/gcc/Makefile.in
31+++ b/gcc/Makefile.in
32@@ -553,7 +553,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
33 TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
34
35 xmake_file=@xmake_file@
36-tmake_file=@tmake_file@
37+tmake_file=@tmake_file@ ./t-oe
38 TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
39 TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
40 TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
41diff --git a/gcc/configure b/gcc/configure
42index dc2d59701ad..3fc0e2f5813 100755
43--- a/gcc/configure
44+++ b/gcc/configure
45@@ -13381,8 +13381,8 @@ for f in $tm_file; do
46 tm_include_list="${tm_include_list} $f"
47 ;;
48 defaults.h )
49- tm_file_list="${tm_file_list} \$(srcdir)/$f"
50- tm_include_list="${tm_include_list} $f"
51+ tm_file_list="${tm_file_list} ./$f"
52+ tm_include_list="${tm_include_list} ./$f"
53 ;;
54 * )
55 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
56diff --git a/gcc/configure.ac b/gcc/configure.ac
57index 36ce78924de..46de496b256 100644
58--- a/gcc/configure.ac
59+++ b/gcc/configure.ac
60@@ -2332,8 +2332,8 @@ for f in $tm_file; do
61 tm_include_list="${tm_include_list} $f"
62 ;;
63 defaults.h )
64- tm_file_list="${tm_file_list} \$(srcdir)/$f"
65- tm_include_list="${tm_include_list} $f"
66+ tm_file_list="${tm_file_list} ./$f"
67+ tm_include_list="${tm_include_list} ./$f"
68 ;;
69 * )
70 tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
71diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
72index 91cc43f69ff..8de33713cd8 100644
73--- a/gcc/mkconfig.sh
74+++ b/gcc/mkconfig.sh
75@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
76 if [ $# -ge 1 ]; then
77 echo '#ifdef IN_GCC' >> ${output}T
78 for file in "$@"; do
79- if test x"$file" = x"defaults.h"; then
80+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
81 postpone_defaults_h="yes"
82 else
83 echo "# include \"$file\"" >> ${output}T
84@@ -106,7 +106,7 @@ esac
85
86 # If we postponed including defaults.h, add the #include now.
87 if test x"$postpone_defaults_h" = x"yes"; then
88- echo "# include \"defaults.h\"" >> ${output}T
89+ echo "# include \"./defaults.h\"" >> ${output}T
90 fi
91
92 # Add multiple inclusion protection guard, part two.
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
new file mode 100644
index 00000000..b08aecc7
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch
@@ -0,0 +1,53 @@
1From abc3b82ab24169277f2090e9df1ceac3573142be Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:22:00 +0400
4Subject: [PATCH] cpp: honor sysroot.
5
6Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
7preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
8rather than the --sysroot option specified on the commandline. If access to that directory is
9permission denied (unreadable), gcc will error.
10
11This happens when ccache is in use due to the fact it uses preprocessed source files.
12
13The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
14-isystem, -isysroot happen and the correct sysroot is used.
15
16[YOCTO #2074]
17
18RP 2012/04/13
19
20Signed-off-by: Khem Raj <raj.khem@gmail.com>
21
22Upstream-Status: Pending
23---
24 gcc/cp/lang-specs.h | 2 +-
25 gcc/gcc.cc | 2 +-
26 2 files changed, 2 insertions(+), 2 deletions(-)
27
28diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
29index f35c9fab76b..19ddc98ce7f 100644
30--- a/gcc/cp/lang-specs.h
31+++ b/gcc/cp/lang-specs.h
32@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see
33 {".ii", "@c++-cpp-output", 0, 0, 0},
34 {"@c++-cpp-output",
35 "%{!E:%{!M:%{!MM:"
36- " cc1plus -fpreprocessed %i %(cc1_options) %2"
37+ " cc1plus -fpreprocessed %i %I %(cc1_options) %2"
38 " %{!fsyntax-only:"
39 " %{fmodule-only:%{!S:-o %g.s%V}}"
40 " %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
41diff --git a/gcc/gcc.cc b/gcc/gcc.cc
42index ce161d3c853..aa4cf92fb78 100644
43--- a/gcc/gcc.cc
44+++ b/gcc/gcc.cc
45@@ -1476,7 +1476,7 @@ static const struct compiler default_compilers[] =
46 %W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
47 {".i", "@cpp-output", 0, 0, 0},
48 {"@cpp-output",
49- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
50+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
51 {".s", "@assembler", 0, 0, 0},
52 {"@assembler",
53 "%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
new file mode 100644
index 00000000..b59eed57
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch
@@ -0,0 +1,403 @@
1From 4de00af67b57b5440bdf61ab364ad959ad0aeee7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:24:50 +0400
4Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
5 relative to SYSTEMLIBS_DIR
6
7This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
8relative to SYSTEMLIBS_DIR which can be set in generated headers
9This breaks the assumption of hardcoded multilib in gcc
10Change is only for the supported architectures in OE including
11SH, sparc, alpha for possible future support (if any)
12
13Removes the do_headerfix task in metadata
14
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16
17Upstream-Status: Inappropriate [OE configuration]
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/aarch64/aarch64-linux.h | 4 ++--
21 gcc/config/alpha/linux-elf.h | 4 ++--
22 gcc/config/arm/linux-eabi.h | 6 +++---
23 gcc/config/arm/linux-elf.h | 2 +-
24 gcc/config/i386/linux.h | 4 ++--
25 gcc/config/i386/linux64.h | 12 ++++++------
26 gcc/config/linux.h | 8 ++++----
27 gcc/config/loongarch/gnu-user.h | 4 ++--
28 gcc/config/microblaze/linux.h | 4 ++--
29 gcc/config/mips/linux.h | 18 +++++++++---------
30 gcc/config/nios2/linux.h | 4 ++--
31 gcc/config/riscv/linux.h | 4 ++--
32 gcc/config/rs6000/linux64.h | 15 +++++----------
33 gcc/config/rs6000/sysv4.h | 4 ++--
34 gcc/config/s390/linux.h | 8 ++++----
35 gcc/config/sh/linux.h | 4 ++--
36 gcc/config/sparc/linux.h | 2 +-
37 gcc/config/sparc/linux64.h | 4 ++--
38 18 files changed, 53 insertions(+), 58 deletions(-)
39
40diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
41index 5e4553d79f5..877e8841eb2 100644
42--- a/gcc/config/aarch64/aarch64-linux.h
43+++ b/gcc/config/aarch64/aarch64-linux.h
44@@ -21,10 +21,10 @@
45 #ifndef GCC_AARCH64_LINUX_H
46 #define GCC_AARCH64_LINUX_H
47
48-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
49+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
50
51 #undef MUSL_DYNAMIC_LINKER
52-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
53+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
54
55 #undef ASAN_CC1_SPEC
56 #define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
57diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
58index 17f16a55910..0a7be38fa63 100644
59--- a/gcc/config/alpha/linux-elf.h
60+++ b/gcc/config/alpha/linux-elf.h
61@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
62 #define EXTRA_SPECS \
63 { "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
64
65-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
66-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
67+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
68+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
69 #if DEFAULT_LIBC == LIBC_UCLIBC
70 #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
71 #elif DEFAULT_LIBC == LIBC_GLIBC
72diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
73index 50cc0bc6d08..17c18b27145 100644
74--- a/gcc/config/arm/linux-eabi.h
75+++ b/gcc/config/arm/linux-eabi.h
76@@ -65,8 +65,8 @@
77 GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
78
79 #undef GLIBC_DYNAMIC_LINKER
80-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
81-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
82+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
83+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
84 #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
85
86 #define GLIBC_DYNAMIC_LINKER \
87@@ -89,7 +89,7 @@
88 #define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
89 #endif
90 #define MUSL_DYNAMIC_LINKER \
91- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
92+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
93
94 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
95 use the GNU/Linux version, not the generic BPABI version. */
96diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
97index df3da67c4f0..37456e9d5a4 100644
98--- a/gcc/config/arm/linux-elf.h
99+++ b/gcc/config/arm/linux-elf.h
100@@ -60,7 +60,7 @@
101
102 #define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
103
104-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
105+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
106
107 #define LINUX_TARGET_LINK_SPEC "%{h*} \
108 %{static:-Bstatic} \
109diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
110index 5d99ee56d5b..a76022c9ccc 100644
111--- a/gcc/config/i386/linux.h
112+++ b/gcc/config/i386/linux.h
113@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
114 <http://www.gnu.org/licenses/>. */
115
116 #define GNU_USER_LINK_EMULATION "elf_i386"
117-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
118+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
119
120 #undef MUSL_DYNAMIC_LINKER
121-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
122+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
123diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
124index 8681e36f10d..ddce49b6b60 100644
125--- a/gcc/config/i386/linux64.h
126+++ b/gcc/config/i386/linux64.h
127@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
128 #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
129 #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
130
131-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
132-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
133-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
134+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
135+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
136+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
137
138 #undef MUSL_DYNAMIC_LINKER32
139-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
140+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
141 #undef MUSL_DYNAMIC_LINKER64
142-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
143+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
144 #undef MUSL_DYNAMIC_LINKERX32
145-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
146+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
147diff --git a/gcc/config/linux.h b/gcc/config/linux.h
148index 74f70793d90..4ce173384ef 100644
149--- a/gcc/config/linux.h
150+++ b/gcc/config/linux.h
151@@ -99,10 +99,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
152 GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
153 GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
154 supporting both 32-bit and 64-bit compilation. */
155-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
156-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
157-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
158-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
159+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
160+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
161+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
162+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
163 #define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
164 #define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
165 #define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
166diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
167index 664dc9206ad..082bd7cfc6f 100644
168--- a/gcc/config/loongarch/gnu-user.h
169+++ b/gcc/config/loongarch/gnu-user.h
170@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see
171
172 #undef GLIBC_DYNAMIC_LINKER
173 #define GLIBC_DYNAMIC_LINKER \
174- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
175+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1"
176
177 #undef MUSL_DYNAMIC_LINKER
178 #define MUSL_DYNAMIC_LINKER \
179- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
180+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1"
181
182 #undef GNU_USER_TARGET_LINK_SPEC
183 #define GNU_USER_TARGET_LINK_SPEC \
184diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h
185index 5b1a365eda4..2e63df1ae9c 100644
186--- a/gcc/config/microblaze/linux.h
187+++ b/gcc/config/microblaze/linux.h
188@@ -28,7 +28,7 @@
189 #undef TLS_NEEDS_GOT
190 #define TLS_NEEDS_GOT 1
191
192-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
193+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "/ld.so.1"
194 #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
195
196 #if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
197@@ -38,7 +38,7 @@
198 #endif
199
200 #undef MUSL_DYNAMIC_LINKER
201-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
202+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
203
204 #undef SUBTARGET_EXTRA_SPECS
205 #define SUBTARGET_EXTRA_SPECS \
206diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
207index 230b7789bb8..d96d134bfcf 100644
208--- a/gcc/config/mips/linux.h
209+++ b/gcc/config/mips/linux.h
210@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see
211 #define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
212
213 #define GLIBC_DYNAMIC_LINKER32 \
214- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
215+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
216 #define GLIBC_DYNAMIC_LINKER64 \
217- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
218+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
219 #define GLIBC_DYNAMIC_LINKERN32 \
220- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
221+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
222
223 #undef UCLIBC_DYNAMIC_LINKER32
224 #define UCLIBC_DYNAMIC_LINKER32 \
225- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
226+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
227 #undef UCLIBC_DYNAMIC_LINKER64
228 #define UCLIBC_DYNAMIC_LINKER64 \
229- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
230+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
231 #define UCLIBC_DYNAMIC_LINKERN32 \
232- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
233+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
234
235 #undef MUSL_DYNAMIC_LINKER32
236 #define MUSL_DYNAMIC_LINKER32 \
237- "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
238+ SYSTEMLIBS_DIR "ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
239 #undef MUSL_DYNAMIC_LINKER64
240 #define MUSL_DYNAMIC_LINKER64 \
241- "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
242+ SYSTEMLIBS_DIR "ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
243 #define MUSL_DYNAMIC_LINKERN32 \
244- "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
245+ SYSTEMLIBS_DIR "ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
246
247 #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
248 #define GNU_USER_DYNAMIC_LINKERN32 \
249diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
250index f5dd813acad..7a13e1c9799 100644
251--- a/gcc/config/nios2/linux.h
252+++ b/gcc/config/nios2/linux.h
253@@ -29,8 +29,8 @@
254 #undef CPP_SPEC
255 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
256
257-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
258-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
259+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-nios2.so.1"
260+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1"
261
262 #undef LINK_SPEC
263 #define LINK_SPEC LINK_SPEC_ENDIAN \
264diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
265index 38803723ba9..d5ef8a96a19 100644
266--- a/gcc/config/riscv/linux.h
267+++ b/gcc/config/riscv/linux.h
268@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
269 GNU_USER_TARGET_OS_CPP_BUILTINS(); \
270 } while (0)
271
272-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
273+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
274
275 #define MUSL_ABI_SUFFIX \
276 "%{mabi=ilp32:-sf}" \
277@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
278 "%{mabi=lp64d:}"
279
280 #undef MUSL_DYNAMIC_LINKER
281-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
282+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
283
284 /* Because RISC-V only has word-sized atomics, it requries libatomic where
285 others do not. So link libatomic by default, as needed. */
286diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
287index b2a7afabc73..364c1a5b155 100644
288--- a/gcc/config/rs6000/linux64.h
289+++ b/gcc/config/rs6000/linux64.h
290@@ -339,24 +339,19 @@ extern int dot_symbols;
291 #undef LINK_OS_DEFAULT_SPEC
292 #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
293
294-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
295-
296+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
297 #ifdef LINUX64_DEFAULT_ABI_ELFv2
298-#define GLIBC_DYNAMIC_LINKER64 \
299-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
300-":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
301+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
302 #else
303-#define GLIBC_DYNAMIC_LINKER64 \
304-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
305-":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
306+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
307 #endif
308
309 #undef MUSL_DYNAMIC_LINKER32
310 #define MUSL_DYNAMIC_LINKER32 \
311- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
312+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
313 #undef MUSL_DYNAMIC_LINKER64
314 #define MUSL_DYNAMIC_LINKER64 \
315- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
316+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
317
318 #undef DEFAULT_ASM_ENDIAN
319 #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
320diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
321index 7e2519de5d4..a73954d9de5 100644
322--- a/gcc/config/rs6000/sysv4.h
323+++ b/gcc/config/rs6000/sysv4.h
324@@ -779,10 +779,10 @@ GNU_USER_TARGET_CC1_SPEC
325
326 #define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
327
328-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
329+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
330 #undef MUSL_DYNAMIC_LINKER
331 #define MUSL_DYNAMIC_LINKER \
332- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
333+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
334
335 #ifndef GNU_USER_DYNAMIC_LINKER
336 #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
337diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
338index d7b7e7a7b02..0139b4d06ca 100644
339--- a/gcc/config/s390/linux.h
340+++ b/gcc/config/s390/linux.h
341@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see
342 #define MULTILIB_DEFAULTS { "m31" }
343 #endif
344
345-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
346-#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
347+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
348+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
349
350 #undef MUSL_DYNAMIC_LINKER32
351-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
352+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-s390.so.1"
353 #undef MUSL_DYNAMIC_LINKER64
354-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
355+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-s390x.so.1"
356
357 #undef LINK_SPEC
358 #define LINK_SPEC \
359diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
360index d96d077c99e..7d27f9893ee 100644
361--- a/gcc/config/sh/linux.h
362+++ b/gcc/config/sh/linux.h
363@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see
364
365 #undef MUSL_DYNAMIC_LINKER
366 #define MUSL_DYNAMIC_LINKER \
367- "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
368+ SYSTEMLIBS_DIR "ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
369 "%{mfdpic:-fdpic}.so.1"
370
371-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
372+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
373
374 #undef SUBTARGET_LINK_EMUL_SUFFIX
375 #define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
376diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
377index 6a809e9092d..60603765ad6 100644
378--- a/gcc/config/sparc/linux.h
379+++ b/gcc/config/sparc/linux.h
380@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
381 When the -shared link option is used a final link is not being
382 done. */
383
384-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
385+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
386
387 #undef LINK_SPEC
388 #define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
389diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
390index d08a2ef96fe..e6955da0a5b 100644
391--- a/gcc/config/sparc/linux64.h
392+++ b/gcc/config/sparc/linux64.h
393@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see
394 When the -shared link option is used a final link is not being
395 done. */
396
397-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
398-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
399+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
400+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
401
402 #ifdef SPARC_BI_ARCH
403
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
new file mode 100644
index 00000000..c9bc38cc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0008-libtool.patch
@@ -0,0 +1,39 @@
1From 5117519c1897a49b09fe7fff213b9c2ea15d37f5 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:29:11 +0400
4Subject: [PATCH] libtool
5
6libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
7when running on am x86_64 build host.
8
9This patch stops this speading to libdir in the libstdc++.la file within libtool.
10Arguably, it shouldn't be passing this into libtool in the first place but
11for now this resolves the nastiest problems this causes.
12
13func_normal_abspath would resolve an empty path to `pwd` so we need
14to filter the zero case.
15
16RP 2012/8/24
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19
20Upstream-Status: Pending
21---
22 ltmain.sh | 4 ++++
23 1 file changed, 4 insertions(+)
24
25diff --git a/ltmain.sh b/ltmain.sh
26index 70990740b6c..ee938056bef 100644
27--- a/ltmain.sh
28+++ b/ltmain.sh
29@@ -6359,6 +6359,10 @@ func_mode_link ()
30 func_warning "ignoring multiple \`-rpath's for a libtool library"
31
32 install_libdir="$1"
33+ if test -n "$install_libdir"; then
34+ func_normal_abspath "$install_libdir"
35+ install_libdir=$func_normal_abspath_result
36+ fi
37
38 oldlibs=
39 if test -z "$rpath"; then
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
new file mode 100644
index 00000000..dd67b115
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch
@@ -0,0 +1,40 @@
1From 32129f9682d0d27fc67af10f077ad2768935cbe6 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:30:32 +0400
4Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
5
6The LINK_SPEC for linux gets overwritten by linux-eabi.h which
7means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
8the option is not passed to linker when chosing march=armv4
9This patch redefines this in linux-eabi.h and reinserts it
10for eabi defaulting toolchains.
11
12We might want to send it upstream.
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15
16Upstream-Status: Pending
17---
18 gcc/config/arm/linux-eabi.h | 6 +++++-
19 1 file changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
22index 17c18b27145..8eacb099317 100644
23--- a/gcc/config/arm/linux-eabi.h
24+++ b/gcc/config/arm/linux-eabi.h
25@@ -91,10 +91,14 @@
26 #define MUSL_DYNAMIC_LINKER \
27 SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
28
29+/* For armv4 we pass --fix-v4bx to linker to support EABI */
30+#undef TARGET_FIX_V4BX_SPEC
31+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
32+
33 /* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
34 use the GNU/Linux version, not the generic BPABI version. */
35 #undef LINK_SPEC
36-#define LINK_SPEC EABI_LINK_SPEC \
37+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
38 LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
39 LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
40
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
new file mode 100644
index 00000000..45edc62e
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch
@@ -0,0 +1,99 @@
1From bf85b8bbcb4b77725d4c22c1bb25a29f6ff21038 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 29 Mar 2013 09:33:04 +0400
4Subject: [PATCH] Use the multilib config files from ${B} instead of using the
5 ones from ${S}
6
7Use the multilib config files from ${B} instead of using the ones from ${S}
8so that the source can be shared between gcc-cross-initial,
9gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
13
14Upstream-Status: Inappropriate [configuration]
15---
16 gcc/configure | 22 ++++++++++++++++++----
17 gcc/configure.ac | 22 ++++++++++++++++++----
18 2 files changed, 36 insertions(+), 8 deletions(-)
19
20diff --git a/gcc/configure b/gcc/configure
21index 3fc0e2f5813..2f0f0e057a9 100755
22--- a/gcc/configure
23+++ b/gcc/configure
24@@ -13361,10 +13361,20 @@ done
25 tmake_file_=
26 for f in ${tmake_file}
27 do
28- if test -f ${srcdir}/config/$f
29- then
30- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
31- fi
32+ case $f in
33+ */t-linux64 )
34+ if test -f ./config/$f
35+ then
36+ tmake_file_="${tmake_file_} ./config/$f"
37+ fi
38+ ;;
39+ * )
40+ if test -f ${srcdir}/config/$f
41+ then
42+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
43+ fi
44+ ;;
45+ esac
46 done
47 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
48
49@@ -13375,6 +13385,10 @@ tm_file_list="options.h"
50 tm_include_list="options.h insn-constants.h"
51 for f in $tm_file; do
52 case $f in
53+ */linux64.h )
54+ tm_file_list="${tm_file_list} ./config/$f"
55+ tm_include_list="${tm_include_list} ./config/$f"
56+ ;;
57 ./* )
58 f=`echo $f | sed 's/^..//'`
59 tm_file_list="${tm_file_list} $f"
60diff --git a/gcc/configure.ac b/gcc/configure.ac
61index 46de496b256..6155b83a732 100644
62--- a/gcc/configure.ac
63+++ b/gcc/configure.ac
64@@ -2312,10 +2312,20 @@ done
65 tmake_file_=
66 for f in ${tmake_file}
67 do
68- if test -f ${srcdir}/config/$f
69- then
70- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
71- fi
72+ case $f in
73+ */t-linux64 )
74+ if test -f ./config/$f
75+ then
76+ tmake_file_="${tmake_file_} ./config/$f"
77+ fi
78+ ;;
79+ * )
80+ if test -f ${srcdir}/config/$f
81+ then
82+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
83+ fi
84+ ;;
85+ esac
86 done
87 tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
88
89@@ -2326,6 +2336,10 @@ tm_file_list="options.h"
90 tm_include_list="options.h insn-constants.h"
91 for f in $tm_file; do
92 case $f in
93+ */linux64.h )
94+ tm_file_list="${tm_file_list} ./config/$f"
95+ tm_include_list="${tm_include_list} ./config/$f"
96+ ;;
97 ./* )
98 f=`echo $f | sed 's/^..//'`
99 tm_file_list="${tm_file_list} $f"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
new file mode 100644
index 00000000..352c6eec
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,28 @@
1From e5463727ff028cee5e452da38f5b4c44d52e412e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH] Avoid using libdir from .la which usually points to a host
5 path
6
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Jonathan Liu <net147@gmail.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 ltmain.sh | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/ltmain.sh b/ltmain.sh
16index ee938056bef..9ebc7e3d1e0 100644
17--- a/ltmain.sh
18+++ b/ltmain.sh
19@@ -5628,6 +5628,9 @@ func_mode_link ()
20 absdir="$abs_ladir"
21 libdir="$abs_ladir"
22 else
23+ # Instead of using libdir from .la which usually points to a host path,
24+ # use the path the .la is contained in.
25+ libdir="$abs_ladir"
26 dir="$libdir"
27 absdir="$libdir"
28 fi
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
new file mode 100644
index 00000000..f52e21ed
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0011-aarch64-Fix-include-paths-when-S-B.patch
@@ -0,0 +1,55 @@
1From 710d1325474e708e6b34eebe09f3f130420af293 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 31 Jan 2023 22:03:38 -0800
4Subject: [PATCH] aarch64: Fix include paths when S != B
5
6aarch64.h gets copied into build directory when built out of tree, in
7this case build uses this file but does not find the includes inside it
8since they are not found in any of include paths specified in compiler
9cmdline.
10
11Fixes build errors like
12
13% g++ -c -isystem/mnt/b/yoe/master/build/tmp/work/x86_64-linux/gcc-cross-aarch64/13.0.1-r0/recipe-sysroot-native/usr/include -O2 -pipe -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/build -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../include -I../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/../libcpp/include -o build/gencheck.o ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc
14In file included from ./tm.h:34,
15 from ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc:23:
16./config/aarch64/aarch64.h:164:10: fatal error: aarch64-option-extensions.def: No such file or directory
17 164 | #include "aarch64-option-extensions.def"
18 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19compilation terminated.
20
21See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105144
22
23Upstream-Status: Pending
24
25Signed-off-by: Khem Raj <raj.khem@gmail.com>
26---
27 gcc/config/aarch64/aarch64.h | 8 ++++----
28 1 file changed, 4 insertions(+), 4 deletions(-)
29
30diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
31index 155cace6afe..07d68958908 100644
32--- a/gcc/config/aarch64/aarch64.h
33+++ b/gcc/config/aarch64/aarch64.h
34@@ -161,8 +161,8 @@
35 enum class aarch64_feature : unsigned char {
36 #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) IDENT,
37 #define AARCH64_ARCH(A, B, IDENT, D, E) IDENT,
38-#include "aarch64-option-extensions.def"
39-#include "aarch64-arches.def"
40+#include "config/aarch64/aarch64-option-extensions.def"
41+#include "config/aarch64/aarch64-arches.def"
42 };
43
44 /* Define unique flags for each of the above. */
45@@ -171,8 +171,8 @@ enum class aarch64_feature : unsigned char {
46 = aarch64_feature_flags (1) << int (aarch64_feature::IDENT);
47 #define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) HANDLE (IDENT)
48 #define AARCH64_ARCH(A, B, IDENT, D, E) HANDLE (IDENT)
49-#include "aarch64-option-extensions.def"
50-#include "aarch64-arches.def"
51+#include "config/aarch64/aarch64-option-extensions.def"
52+#include "config/aarch64/aarch64-arches.def"
53 #undef HANDLE
54
55 #endif
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
new file mode 100644
index 00000000..b05be59c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch
@@ -0,0 +1,28 @@
1From e8e8a0ab572cfceb9758f99599c0db4c962e49c0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 09:39:38 +0000
4Subject: [PATCH] Avoid using libdir from .la which usually points to a host
5 path
6
7Upstream-Status: Inappropriate [embedded specific]
8
9Signed-off-by: Jonathan Liu <net147@gmail.com>
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 ltmain.sh | 3 +++
13 1 file changed, 3 insertions(+)
14
15diff --git a/ltmain.sh b/ltmain.sh
16index ee938056bef..9ebc7e3d1e0 100644
17--- a/ltmain.sh
18+++ b/ltmain.sh
19@@ -5628,6 +5628,9 @@ func_mode_link ()
20 absdir="$abs_ladir"
21 libdir="$abs_ladir"
22 else
23+ # Instead of using libdir from .la which usually points to a host path,
24+ # use the path the .la is contained in.
25+ libdir="$abs_ladir"
26 dir="$libdir"
27 absdir="$libdir"
28 fi
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
new file mode 100644
index 00000000..61e61ecc
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch
@@ -0,0 +1,113 @@
1From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 20 Feb 2015 10:25:11 +0000
4Subject: [PATCH] Ensure target gcc headers can be included
5
6There are a few headers installed as part of the OpenEmbedded
7gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
8built for the target architecture, these are within the target
9sysroot and not cross/nativesdk; thus they weren't able to be
10found by gcc with the existing search paths. Add support for
11picking up these headers under the sysroot supplied on the gcc
12command line in order to resolve this.
13
14Extend target gcc headers search to musl too
15
16Upstream-Status: Pending
17
18Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 gcc/Makefile.in | 2 ++
22 gcc/config/linux.h | 8 ++++++++
23 gcc/config/rs6000/sysv4.h | 8 ++++++++
24 gcc/cppdefault.cc | 4 ++++
25 4 files changed, 22 insertions(+)
26
27diff --git a/gcc/Makefile.in b/gcc/Makefile.in
28index a8277254696..07fa63b6640 100644
29--- a/gcc/Makefile.in
30+++ b/gcc/Makefile.in
31@@ -632,6 +632,7 @@ libexecdir = @libexecdir@
32
33 # Directory in which the compiler finds libraries etc.
34 libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
35+libsubdir_target = $(target_noncanonical)/$(version)
36 # Directory in which the compiler finds executables
37 libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
38 # Directory in which all plugin resources are installed
39@@ -3024,6 +3025,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
40
41 PREPROCESSOR_DEFINES = \
42 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
43+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
44 -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
45 -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
46 -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
47diff --git a/gcc/config/linux.h b/gcc/config/linux.h
48index 4ce173384ef..8a3cd4f2d34 100644
49--- a/gcc/config/linux.h
50+++ b/gcc/config/linux.h
51@@ -170,6 +170,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
52 #define INCLUDE_DEFAULTS_MUSL_TOOL
53 #endif
54
55+#ifdef GCC_INCLUDE_SUBDIR_TARGET
56+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
57+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
58+#else
59+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
60+#endif
61+
62 #ifdef NATIVE_SYSTEM_HEADER_DIR
63 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
64 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
65@@ -196,6 +203,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
66 INCLUDE_DEFAULTS_MUSL_PREFIX \
67 INCLUDE_DEFAULTS_MUSL_CROSS \
68 INCLUDE_DEFAULTS_MUSL_TOOL \
69+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
70 INCLUDE_DEFAULTS_MUSL_NATIVE \
71 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
72 { 0, 0, 0, 0, 0, 0 } \
73diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
74index a73954d9de5..e5dd6538358 100644
75--- a/gcc/config/rs6000/sysv4.h
76+++ b/gcc/config/rs6000/sysv4.h
77@@ -994,6 +994,13 @@ ncrtn.o%s"
78 #define INCLUDE_DEFAULTS_MUSL_TOOL
79 #endif
80
81+#ifdef GCC_INCLUDE_SUBDIR_TARGET
82+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
83+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
84+#else
85+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
86+#endif
87+
88 #ifdef NATIVE_SYSTEM_HEADER_DIR
89 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
90 { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
91@@ -1020,6 +1027,7 @@ ncrtn.o%s"
92 INCLUDE_DEFAULTS_MUSL_PREFIX \
93 INCLUDE_DEFAULTS_MUSL_CROSS \
94 INCLUDE_DEFAULTS_MUSL_TOOL \
95+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
96 INCLUDE_DEFAULTS_MUSL_NATIVE \
97 { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
98 { 0, 0, 0, 0, 0, 0 } \
99diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
100index 7888300f277..52cf14e92f8 100644
101--- a/gcc/cppdefault.cc
102+++ b/gcc/cppdefault.cc
103@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
104 /* This is the dir for gcc's private headers. */
105 { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
106 #endif
107+#ifdef GCC_INCLUDE_SUBDIR_TARGET
108+ /* This is the dir for gcc's private headers under the specified sysroot. */
109+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
110+#endif
111 #ifdef LOCAL_INCLUDE_DIR
112 /* /usr/local/include comes before the fixincluded header files. */
113 { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
new file mode 100644
index 00000000..94308b2a
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch
@@ -0,0 +1,35 @@
1From 9ae49e7b88c208ab79ec9c2fc4a2fa8a3f1e85bb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Mar 2015 08:21:19 +0000
4Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
5 is provided
6
7http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
8
9Upstream-Status: Submitted
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 ltmain.sh | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/ltmain.sh b/ltmain.sh
17index 9ebc7e3d1e0..7ea79fa8be6 100644
18--- a/ltmain.sh
19+++ b/ltmain.sh
20@@ -6004,12 +6004,13 @@ func_mode_link ()
21 fi
22 else
23 # We cannot seem to hardcode it, guess we'll fake it.
24+ # Default if $libdir is not relative to the prefix:
25 add_dir="-L$libdir"
26- # Try looking first in the location we're being installed to.
27+
28 if test -n "$inst_prefix_dir"; then
29 case $libdir in
30 [\\/]*)
31- add_dir="$add_dir -L$inst_prefix_dir$libdir"
32+ add_dir="-L$inst_prefix_dir$libdir"
33 ;;
34 esac
35 fi
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
new file mode 100644
index 00000000..ce9635ce
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch
@@ -0,0 +1,51 @@
1From bf918db7117f41d3c04162095641165ca241707d Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 5 Jul 2015 20:25:18 -0700
4Subject: [PATCH] libcc1: fix libcc1's install path and rpath
5
6* Install libcc1.so and libcc1plugin.so into
7 $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
8 had done to lto-plugin.
9* Fix bad RPATH iussue:
10 gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file
11 /path/to/gcc/5.2.0-r0/packages-split/gcc-plugins/usr/lib64/gcc/x86_64-poky-linux/5.2.0/plugin/libcc1plugin.so.0.0.0
12 [rpaths]
13
14Upstream-Status: Inappropriate [OE configuration]
15
16Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
17---
18 libcc1/Makefile.am | 4 ++--
19 libcc1/Makefile.in | 4 ++--
20 2 files changed, 4 insertions(+), 4 deletions(-)
21
22diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
23index 6e3a34ff7e2..3f3f6391aba 100644
24--- a/libcc1/Makefile.am
25+++ b/libcc1/Makefile.am
26@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
27 $(Wc)$(libiberty_normal)))
28 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
29
30-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
31-cc1libdir = $(libdir)/$(libsuffix)
32+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
33+plugindir = $(cc1libdir)
34
35 if ENABLE_PLUGIN
36 plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
37diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
38index f8f590d71e9..56462492045 100644
39--- a/libcc1/Makefile.in
40+++ b/libcc1/Makefile.in
41@@ -396,8 +396,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
42 $(Wc)$(libiberty_normal)))
43
44 libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
45-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
46-cc1libdir = $(libdir)/$(libsuffix)
47+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
48+plugindir = $(cc1libdir)
49 @ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
50 @ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
51 shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
new file mode 100644
index 00000000..3b547195
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch
@@ -0,0 +1,510 @@
1From 4fbbd40d7db89cdbeaf93df1e1da692b1f80a5bc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:39:54 +0000
4Subject: [PATCH] handle sysroot support for nativesdk-gcc
5
6Being able to build a nativesdk gcc is useful, particularly in cases
7where the host compiler may be of an incompatible version (or a 32
8bit compiler is needed).
9
10Sadly, building nativesdk-gcc is not straight forward. We install
11nativesdk-gcc into a relocatable location and this means that its
12library locations can change. "Normal" sysroot support doesn't help
13in this case since the values of paths like "libdir" change, not just
14base root directory of the system.
15
16In order to handle this we do two things:
17
18a) Add %r into spec file markup which can be used for injected paths
19 such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
20b) Add other paths which need relocation into a .gccrelocprefix section
21 which the relocation code will notice and adjust automatically.
22
23Upstream-Status: Inappropriate
24RP 2015/7/28
25
26Extend the gccrelocprefix support to musl config too, this ensures
27that gcc will get right bits in SDK installations
28
29Signed-off-by: Khem Raj <raj.khem@gmail.com>
30
31Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without
32these as part of the gccrelocprefix the system can't do runtime relocation
33if the executable is moved. (These paths were missed in the original
34implementation.)
35
36Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
37---
38 gcc/c-family/c-opts.cc | 4 +--
39 gcc/config/linux.h | 24 +++++++--------
40 gcc/config/rs6000/sysv4.h | 24 +++++++--------
41 gcc/cppdefault.cc | 63 ++++++++++++++++++++++++---------------
42 gcc/cppdefault.h | 13 ++++----
43 gcc/gcc.cc | 20 +++++++++----
44 gcc/incpath.cc | 12 ++++----
45 gcc/prefix.cc | 6 ++--
46 8 files changed, 94 insertions(+), 72 deletions(-)
47
48diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
49index a341a061758..83b0bef4dbb 100644
50--- a/gcc/c-family/c-opts.cc
51+++ b/gcc/c-family/c-opts.cc
52@@ -1458,8 +1458,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
53 size_t prefix_len, suffix_len;
54
55 suffix_len = strlen (suffix);
56- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
57- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
58+ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR;
59+ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7;
60
61 path = (char *) xmalloc (prefix_len + suffix_len + 1);
62 memcpy (path, prefix, prefix_len);
63diff --git a/gcc/config/linux.h b/gcc/config/linux.h
64index 8a3cd4f2d34..58143dff731 100644
65--- a/gcc/config/linux.h
66+++ b/gcc/config/linux.h
67@@ -134,53 +134,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
68 * Unfortunately, this is mostly duplicated from cppdefault.cc */
69 #if DEFAULT_LIBC == LIBC_MUSL
70 #define INCLUDE_DEFAULTS_MUSL_GPP \
71- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
72+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
73 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
74- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
75+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
76 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
77- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
78+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
79 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
80
81 #ifdef LOCAL_INCLUDE_DIR
82 #define INCLUDE_DEFAULTS_MUSL_LOCAL \
83- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
84- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
85+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
86+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
87 #else
88 #define INCLUDE_DEFAULTS_MUSL_LOCAL
89 #endif
90
91 #ifdef PREFIX_INCLUDE_DIR
92 #define INCLUDE_DEFAULTS_MUSL_PREFIX \
93- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
94+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
95 #else
96 #define INCLUDE_DEFAULTS_MUSL_PREFIX
97 #endif
98
99 #ifdef CROSS_INCLUDE_DIR
100 #define INCLUDE_DEFAULTS_MUSL_CROSS \
101- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
102+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
103 #else
104 #define INCLUDE_DEFAULTS_MUSL_CROSS
105 #endif
106
107 #ifdef TOOL_INCLUDE_DIR
108 #define INCLUDE_DEFAULTS_MUSL_TOOL \
109- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
110+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
111 #else
112 #define INCLUDE_DEFAULTS_MUSL_TOOL
113 #endif
114
115 #ifdef GCC_INCLUDE_SUBDIR_TARGET
116 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
117- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
118+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
119 #else
120 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
121 #endif
122
123 #ifdef NATIVE_SYSTEM_HEADER_DIR
124 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
125- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
126- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
127+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
128+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
129 #else
130 #define INCLUDE_DEFAULTS_MUSL_NATIVE
131 #endif
132@@ -205,7 +205,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
133 INCLUDE_DEFAULTS_MUSL_TOOL \
134 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
135 INCLUDE_DEFAULTS_MUSL_NATIVE \
136- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
137+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
138 { 0, 0, 0, 0, 0, 0 } \
139 }
140 #endif
141diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
142index e5dd6538358..b496849b792 100644
143--- a/gcc/config/rs6000/sysv4.h
144+++ b/gcc/config/rs6000/sysv4.h
145@@ -958,53 +958,53 @@ ncrtn.o%s"
146 /* Include order changes for musl, same as in generic linux.h. */
147 #if DEFAULT_LIBC == LIBC_MUSL
148 #define INCLUDE_DEFAULTS_MUSL_GPP \
149- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
150+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
151 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
152- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
153+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
154 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
155- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
156+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
157 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
158
159 #ifdef LOCAL_INCLUDE_DIR
160 #define INCLUDE_DEFAULTS_MUSL_LOCAL \
161- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
162- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
163+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
164+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
165 #else
166 #define INCLUDE_DEFAULTS_MUSL_LOCAL
167 #endif
168
169 #ifdef PREFIX_INCLUDE_DIR
170 #define INCLUDE_DEFAULTS_MUSL_PREFIX \
171- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
172+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
173 #else
174 #define INCLUDE_DEFAULTS_MUSL_PREFIX
175 #endif
176
177 #ifdef CROSS_INCLUDE_DIR
178 #define INCLUDE_DEFAULTS_MUSL_CROSS \
179- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
180+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
181 #else
182 #define INCLUDE_DEFAULTS_MUSL_CROSS
183 #endif
184
185 #ifdef TOOL_INCLUDE_DIR
186 #define INCLUDE_DEFAULTS_MUSL_TOOL \
187- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
188+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
189 #else
190 #define INCLUDE_DEFAULTS_MUSL_TOOL
191 #endif
192
193 #ifdef GCC_INCLUDE_SUBDIR_TARGET
194 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
195- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
196+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
197 #else
198 #define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
199 #endif
200
201 #ifdef NATIVE_SYSTEM_HEADER_DIR
202 #define INCLUDE_DEFAULTS_MUSL_NATIVE \
203- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
204- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
205+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
206+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
207 #else
208 #define INCLUDE_DEFAULTS_MUSL_NATIVE
209 #endif
210@@ -1029,7 +1029,7 @@ ncrtn.o%s"
211 INCLUDE_DEFAULTS_MUSL_TOOL \
212 INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
213 INCLUDE_DEFAULTS_MUSL_NATIVE \
214- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
215+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
216 { 0, 0, 0, 0, 0, 0 } \
217 }
218 #endif
219diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
220index 52cf14e92f8..d8977afc05e 100644
221--- a/gcc/cppdefault.cc
222+++ b/gcc/cppdefault.cc
223@@ -35,6 +35,30 @@
224 # undef CROSS_INCLUDE_DIR
225 #endif
226
227+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
228+char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
229+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
230+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
231+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
232+#ifdef LOCAL_INCLUDE_DIR
233+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
234+#endif
235+#ifdef PREFIX_INCLUDE_DIR
236+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
237+#endif
238+#ifdef FIXED_INCLUDE_DIR
239+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
240+#endif
241+#ifdef CROSS_INCLUDE_DIR
242+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
243+#endif
244+#ifdef TOOL_INCLUDE_DIR
245+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
246+#endif
247+#ifdef NATIVE_SYSTEM_HEADER_DIR
248+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
249+#endif
250+
251 const struct default_include cpp_include_defaults[]
252 #ifdef INCLUDE_DEFAULTS
253 = INCLUDE_DEFAULTS;
254@@ -42,17 +66,17 @@ const struct default_include cpp_include_defaults[]
255 = {
256 #ifdef GPLUSPLUS_INCLUDE_DIR
257 /* Pick up GNU C++ generic include files. */
258- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
259+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
260 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
261 #endif
262 #ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
263 /* Pick up GNU C++ target-dependent include files. */
264- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
265+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
266 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
267 #endif
268 #ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
269 /* Pick up GNU C++ backward and deprecated include files. */
270- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
271+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
272 GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
273 #endif
274 #ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR
275@@ -62,23 +86,23 @@ const struct default_include cpp_include_defaults[]
276 #endif
277 #ifdef GCC_INCLUDE_DIR
278 /* This is the dir for gcc's private headers. */
279- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
280+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
281 #endif
282 #ifdef GCC_INCLUDE_SUBDIR_TARGET
283 /* This is the dir for gcc's private headers under the specified sysroot. */
284- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
285+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
286 #endif
287 #ifdef LOCAL_INCLUDE_DIR
288 /* /usr/local/include comes before the fixincluded header files. */
289- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
290- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
291+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
292+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
293 #endif
294 #ifdef PREFIX_INCLUDE_DIR
295- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
296+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
297 #endif
298 #ifdef FIXED_INCLUDE_DIR
299 /* This is the dir for fixincludes. */
300- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
301+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
302 /* A multilib suffix needs adding if different multilibs use
303 different headers. */
304 #ifdef SYSROOT_HEADERS_SUFFIX_SPEC
305@@ -90,33 +114,24 @@ const struct default_include cpp_include_defaults[]
306 #endif
307 #ifdef CROSS_INCLUDE_DIR
308 /* One place the target system's headers might be. */
309- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
310+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
311 #endif
312 #ifdef TOOL_INCLUDE_DIR
313 /* Another place the target system's headers might be. */
314- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
315+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
316 #endif
317 #ifdef NATIVE_SYSTEM_HEADER_DIR
318 /* /usr/include comes dead last. */
319- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
320- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
321+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
322+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
323 #endif
324 { 0, 0, 0, 0, 0, 0 }
325 };
326 #endif /* no INCLUDE_DEFAULTS */
327
328-#ifdef GCC_INCLUDE_DIR
329-const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
330-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
331-#else
332-const char cpp_GCC_INCLUDE_DIR[] = "";
333-const size_t cpp_GCC_INCLUDE_DIR_len = 0;
334-#endif
335-
336 /* The configured prefix. */
337-const char cpp_PREFIX[] = PREFIX;
338-const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
339-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
340+char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
341+char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
342
343 /* This value is set by cpp_relocated at runtime */
344 const char *gcc_exec_prefix;
345diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
346index fb97c0b5814..6267150facc 100644
347--- a/gcc/cppdefault.h
348+++ b/gcc/cppdefault.h
349@@ -33,7 +33,8 @@
350
351 struct default_include
352 {
353- const char *const fname; /* The name of the directory. */
354+ const char *fname; /* The name of the directory. */
355+
356 const char *const component; /* The component containing the directory
357 (see update_path in prefix.cc) */
358 const char cplusplus; /* When this is non-zero, we should only
359@@ -55,17 +56,13 @@ struct default_include
360 };
361
362 extern const struct default_include cpp_include_defaults[];
363-extern const char cpp_GCC_INCLUDE_DIR[];
364-extern const size_t cpp_GCC_INCLUDE_DIR_len;
365+extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix")));
366
367 /* The configure-time prefix, i.e., the value supplied as the argument
368 to --prefix=. */
369-extern const char cpp_PREFIX[];
370+extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
371 /* The length of the configure-time prefix. */
372-extern const size_t cpp_PREFIX_len;
373-/* The configure-time execution prefix. This is typically the lib/gcc
374- subdirectory of cpp_PREFIX. */
375-extern const char cpp_EXEC_PREFIX[];
376+extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
377 /* The run-time execution prefix. This is typically the lib/gcc
378 subdirectory of the actual installation. */
379 extern const char *gcc_exec_prefix;
380diff --git a/gcc/gcc.cc b/gcc/gcc.cc
381index aa4cf92fb78..5569a39a14a 100644
382--- a/gcc/gcc.cc
383+++ b/gcc/gcc.cc
384@@ -252,6 +252,8 @@ FILE *report_times_to_file = NULL;
385 #endif
386 static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
387
388+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
389+
390 /* Nonzero means pass the updated target_system_root to the compiler. */
391
392 static int target_system_root_changed;
393@@ -575,6 +577,7 @@ or with constant text in a single argument.
394 %G process LIBGCC_SPEC as a spec.
395 %R Output the concatenation of target_system_root and
396 target_sysroot_suffix.
397+ %r Output the base path target_relocatable_prefix
398 %S process STARTFILE_SPEC as a spec. A capital S is actually used here.
399 %E process ENDFILE_SPEC as a spec. A capital E is actually used here.
400 %C process CPP_SPEC as a spec.
401@@ -1627,10 +1630,10 @@ static const char *gcc_libexec_prefix;
402 gcc_exec_prefix is set because, in that case, we know where the
403 compiler has been installed, and use paths relative to that
404 location instead. */
405-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
406-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
407-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
408-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
409+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
410+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
411+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
412+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
413
414 /* For native compilers, these are well-known paths containing
415 components that may be provided by the system. For cross
416@@ -1638,9 +1641,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
417 static const char *md_exec_prefix = MD_EXEC_PREFIX;
418 static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
419 static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
420-static const char *const standard_startfile_prefix_1
421+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
422 = STANDARD_STARTFILE_PREFIX_1;
423-static const char *const standard_startfile_prefix_2
424+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
425 = STANDARD_STARTFILE_PREFIX_2;
426
427 /* A relative path to be used in finding the location of tools
428@@ -6676,6 +6679,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
429 }
430 break;
431
432+ case 'r':
433+ obstack_grow (&obstack, target_relocatable_prefix,
434+ strlen (target_relocatable_prefix));
435+ break;
436+
437 case 'S':
438 value = do_spec_1 (startfile_spec, 0, NULL);
439 if (value != 0)
440diff --git a/gcc/incpath.cc b/gcc/incpath.cc
441index c80f100f476..5ac03c08693 100644
442--- a/gcc/incpath.cc
443+++ b/gcc/incpath.cc
444@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
445 int relocated = cpp_relocated ();
446 size_t len;
447
448- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
449+ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0)
450 {
451 /* Look for directories that start with the standard prefix.
452 "Translate" them, i.e. replace /usr/local/lib/gcc... with
453@@ -150,7 +150,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
454 now. */
455 if (sysroot && p->add_sysroot)
456 continue;
457- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
458+ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len))
459 {
460 char *str = concat (iprefix, p->fname + len, NULL);
461 if (p->multilib == 1 && imultilib)
462@@ -191,7 +191,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
463 free (sysroot_no_trailing_dir_separator);
464 }
465 else if (!p->add_sysroot && relocated
466- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
467+ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR)))
468 {
469 static const char *relocated_prefix;
470 char *ostr;
471@@ -208,12 +208,12 @@ add_standard_paths (const char *sysroot, const char *iprefix,
472 dummy = concat (gcc_exec_prefix, "dummy", NULL);
473 relocated_prefix
474 = make_relative_prefix (dummy,
475- cpp_EXEC_PREFIX,
476- cpp_PREFIX);
477+ EXEC_PREFIXVAR,
478+ PREFIXVAR);
479 free (dummy);
480 }
481 ostr = concat (relocated_prefix,
482- p->fname + cpp_PREFIX_len,
483+ p->fname + strlen(PREFIXVAR),
484 NULL);
485 str = update_path (ostr, p->component);
486 free (ostr);
487diff --git a/gcc/prefix.cc b/gcc/prefix.cc
488index 096ed5afa3d..2526f0ecc39 100644
489--- a/gcc/prefix.cc
490+++ b/gcc/prefix.cc
491@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see
492 #include "prefix.h"
493 #include "common/common-target.h"
494
495-static const char *std_prefix = PREFIX;
496+char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
497+
498+static const char *std_prefix = PREFIXVAR1;
499
500 static const char *get_key_value (char *);
501 static char *translate_name (char *);
502@@ -212,7 +214,7 @@ translate_name (char *name)
503 prefix = getenv (key);
504
505 if (prefix == 0)
506- prefix = PREFIX;
507+ prefix = PREFIXVAR1;
508
509 /* We used to strip trailing DIR_SEPARATORs here, but that can
510 sometimes yield a result with no separator when one was coded
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
new file mode 100644
index 00000000..9b05da64
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch
@@ -0,0 +1,99 @@
1From 33a1f07a4417247dc24819d4e583ca09f56d5a7b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 7 Dec 2015 23:41:45 +0000
4Subject: [PATCH] Search target sysroot gcc version specific dirs with
5 multilib.
6
7We install the gcc libraries (such as crtbegin.p) into
8<sysroot><libdir>/<target-sys>/5.2.0/
9which is a default search path for GCC (aka multi_suffix in the
10code below). <target-sys> is 'machine' in gcc's terminology. We use
11these directories so that multiple gcc versions could in theory
12co-exist on target.
13
14We only want to build one gcc-cross-canadian per arch and have this work
15for all multilibs. <target-sys> can be handled by mapping the multilib
16<target-sys> to the one used by gcc-cross-canadian, e.g.
17mips64-polkmllib32-linux
18is symlinked to by mips64-poky-linux.
19
20The default gcc search path in the target sysroot for a "lib64" mutlilib
21is:
22
23<sysroot>/lib32/mips64-poky-linux/5.2.0/
24<sysroot>/lib32/../lib64/
25<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
26<sysroot>/usr/lib32/../lib64/
27<sysroot>/lib32/
28<sysroot>/usr/lib32/
29
30which means that the lib32 crtbegin.o will be found and the lib64 ones
31will not which leads to compiler failures.
32
33This patch injects a multilib version of that path first so the lib64
34binaries can be found first. With this change the search path becomes:
35
36<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
37<sysroot>/lib32/mips64-poky-linux/5.2.0/
38<sysroot>/lib32/../lib64/
39<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
40<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
41<sysroot>/usr/lib32/../lib64/
42<sysroot>/lib32/
43<sysroot>/usr/lib32/
44
45Upstream-Status: Pending
46RP 2015/7/31
47
48Signed-off-by: Khem Raj <raj.khem@gmail.com>
49---
50 gcc/gcc.cc | 29 ++++++++++++++++++++++++++++-
51 1 file changed, 28 insertions(+), 1 deletion(-)
52
53diff --git a/gcc/gcc.cc b/gcc/gcc.cc
54index 5569a39a14a..4598f6cd7c9 100644
55--- a/gcc/gcc.cc
56+++ b/gcc/gcc.cc
57@@ -2817,7 +2817,7 @@ for_each_path (const struct path_prefix *paths,
58 if (path == NULL)
59 {
60 len = paths->max_len + extra_space + 1;
61- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
62+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
63 path = XNEWVEC (char, len);
64 }
65
66@@ -2829,6 +2829,33 @@ for_each_path (const struct path_prefix *paths,
67 /* Look first in MACHINE/VERSION subdirectory. */
68 if (!skip_multi_dir)
69 {
70+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
71+ {
72+ const char *this_multi;
73+ size_t this_multi_len;
74+
75+ if (pl->os_multilib)
76+ {
77+ this_multi = multi_os_dir;
78+ this_multi_len = multi_os_dir_len;
79+ }
80+ else
81+ {
82+ this_multi = multi_dir;
83+ this_multi_len = multi_dir_len;
84+ }
85+
86+ /* Look in multilib MACHINE/VERSION subdirectory first */
87+ if (this_multi_len)
88+ {
89+ memcpy (path + len, this_multi, this_multi_len + 1);
90+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
91+ ret = callback (path, callback_info);
92+ if (ret)
93+ break;
94+ }
95+ }
96+
97 memcpy (path + len, multi_suffix, suffix_len + 1);
98 ret = callback (path, callback_info);
99 if (ret)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
new file mode 100644
index 00000000..56793e03
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
@@ -0,0 +1,84 @@
1From d7dc2861840e88a4592817a398a054a886c3f3ee Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 18:10:54 -0700
4Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
5
6when -fstack-protector options are enabled we need to
7link with ssp_shared on musl since it does not provide
8the __stack_chk_fail_local() so essentially it provides
9libssp but not libssp_nonshared something like
10TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
11 where-as for glibc the needed symbols
12are already present in libc_nonshared library therefore
13we do not need any library helper on glibc based systems
14but musl needs the libssp_noshared from gcc
15
16Upstream-Status: Pending
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 gcc/config/linux.h | 7 +++++++
21 gcc/config/rs6000/linux.h | 10 ++++++++++
22 gcc/config/rs6000/linux64.h | 10 ++++++++++
23 3 files changed, 27 insertions(+)
24
25diff --git a/gcc/config/linux.h b/gcc/config/linux.h
26index 58143dff731..d2409ccac26 100644
27--- a/gcc/config/linux.h
28+++ b/gcc/config/linux.h
29@@ -208,6 +208,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
30 { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
31 { 0, 0, 0, 0, 0, 0 } \
32 }
33+#ifdef TARGET_LIBC_PROVIDES_SSP
34+#undef LINK_SSP_SPEC
35+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
36+ "|fstack-protector-strong|fstack-protector-explicit" \
37+ ":-lssp_nonshared}"
38+#endif
39+
40 #endif
41
42 #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
43diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
44index 8c9039ac1e5..259cd485973 100644
45--- a/gcc/config/rs6000/linux.h
46+++ b/gcc/config/rs6000/linux.h
47@@ -99,6 +99,16 @@
48 " -m elf32ppclinux")
49 #endif
50
51+/* link libssp_nonshared.a with musl */
52+#if DEFAULT_LIBC == LIBC_MUSL
53+#ifdef TARGET_LIBC_PROVIDES_SSP
54+#undef LINK_SSP_SPEC
55+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
56+ "|fstack-protector-strong|fstack-protector-explicit" \
57+ ":-lssp_nonshared}"
58+#endif
59+#endif
60+
61 #undef LINK_OS_LINUX_SPEC
62 #define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
63 %{!static-pie: \
64diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
65index 364c1a5b155..e33d9ae98e0 100644
66--- a/gcc/config/rs6000/linux64.h
67+++ b/gcc/config/rs6000/linux64.h
68@@ -372,6 +372,16 @@ extern int dot_symbols;
69 " -m elf64ppc")
70 #endif
71
72+/* link libssp_nonshared.a with musl */
73+#if DEFAULT_LIBC == LIBC_MUSL
74+#ifdef TARGET_LIBC_PROVIDES_SSP
75+#undef LINK_SSP_SPEC
76+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
77+ "|fstack-protector-strong|fstack-protector-explicit" \
78+ ":-lssp_nonshared}"
79+#endif
80+#endif
81+
82 #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
83 %{!static-pie: \
84 %{rdynamic:-export-dynamic} \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
new file mode 100644
index 00000000..bb1699be
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch
@@ -0,0 +1,39 @@
1From bf0d7c463e1fab62804556099b56319fe94be1eb Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 6 Jun 2018 12:10:22 -0700
4Subject: [PATCH] Re-introduce spe commandline options
5
6This should ensure that we keep accepting
7spe options
8
9Upstream-Status: Inappropriate [SPE port is removed from rs600 port]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 gcc/config/rs6000/rs6000.opt | 13 +++++++++++++
14 1 file changed, 13 insertions(+)
15
16diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
17index 4931d781c4e..3fb87b6f7d5 100644
18--- a/gcc/config/rs6000/rs6000.opt
19+++ b/gcc/config/rs6000/rs6000.opt
20@@ -348,6 +348,19 @@ mdebug=
21 Target RejectNegative Joined
22 -mdebug= Enable debug output.
23
24+; PPC SPE ABI
25+mspe
26+Target Var(rs6000_spe) Save
27+Generate SPE SIMD instructions on E500.
28+
29+mabi=spe
30+Target RejectNegative Var(rs6000_spe_abi) Save
31+Use the SPE ABI extensions.
32+
33+mabi=no-spe
34+Target RejectNegative Var(rs6000_spe_abi, 0)
35+Do not use the SPE ABI extensions.
36+
37 ; Altivec ABI
38 mabi=altivec
39 Target RejectNegative Var(rs6000_altivec_abi) Save
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
new file mode 100644
index 00000000..f3709208
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch
@@ -0,0 +1,83 @@
1From a32c75b37209d6836eaaa943dc6b1207acba5d27 Mon Sep 17 00:00:00 2001
2From: Szabolcs Nagy <nsz@port70.net>
3Date: Sat, 24 Oct 2015 20:09:53 +0000
4Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
5 symver
6
7Adapter from
8
9https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
10
11This fix was debated but hasnt been applied gcc upstream since
12they expect musl to support '@' in symbol versioning which is
13a sun/gnu versioning extention. This patch however avoids the
14need for the '@' symbols at all
15
16libgcc/Changelog:
17
182015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
19
20 * config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
21 (__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
22
23 * config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
24
25gcc/Changelog:
26
272015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
28
29 * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
30 call __cpu_indicator_init_local instead of __cpu_indicator_init.
31
32Upstream-Status: Pending
33
34Signed-off-by: Khem Raj <raj.khem@gmail.com>
35---
36 gcc/config/i386/i386-expand.cc | 4 ++--
37 libgcc/config/i386/cpuinfo.c | 6 +++---
38 libgcc/config/i386/t-linux | 2 +-
39 3 files changed, 6 insertions(+), 6 deletions(-)
40
41diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
42index 68978ef8dc2..0c71f36b572 100644
43--- a/gcc/config/i386/i386-expand.cc
44+++ b/gcc/config/i386/i386-expand.cc
45@@ -12321,10 +12321,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
46 {
47 case IX86_BUILTIN_CPU_INIT:
48 {
49- /* Make it call __cpu_indicator_init in libgcc. */
50+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
51 tree call_expr, fndecl, type;
52 type = build_function_type_list (integer_type_node, NULL_TREE);
53- fndecl = build_fn_decl ("__cpu_indicator_init", type);
54+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
55 call_expr = build_call_expr (fndecl, 0);
56 return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
57 }
58diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
59index dab1d98060f..cf824b4114a 100644
60--- a/libgcc/config/i386/cpuinfo.c
61+++ b/libgcc/config/i386/cpuinfo.c
62@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
63 __cpu_features2);
64 }
65
66-#if defined SHARED && defined USE_ELF_SYMVER
67-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
68-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
69+#ifndef SHARED
70+int __cpu_indicator_init_local (void)
71+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
72 #endif
73diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
74index 8506a635790..564296f788e 100644
75--- a/libgcc/config/i386/t-linux
76+++ b/libgcc/config/i386/t-linux
77@@ -3,5 +3,5 @@
78 # t-slibgcc-elf-ver and t-linux
79 SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
80
81-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
82+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
83 CRTSTUFF_T_CFLAGS += $(CET_FLAGS)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
new file mode 100644
index 00000000..f5f04ae3
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch
@@ -0,0 +1,182 @@
1From 4efc42b99c96b026f560b0918de7e237ac3dc8d1 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 10 Mar 2020 08:26:53 -0700
4Subject: [PATCH] gentypes/genmodes: Do not use __LINE__ for maintaining
5 reproducibility
6
7Inserting line numbers into generated code means its not always reproducible wth
8differing versions of host gcc. Void the issue by not adding these.
9
10Upstream-Status: Inappropriate [OE Reproducibility specific]
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 gcc/gengtype.cc | 6 +++---
16 gcc/genmodes.cc | 32 ++++++++++++++++----------------
17 2 files changed, 19 insertions(+), 19 deletions(-)
18
19diff --git a/gcc/gengtype.cc b/gcc/gengtype.cc
20index 386ae1b0506..9762e914296 100644
21--- a/gcc/gengtype.cc
22+++ b/gcc/gengtype.cc
23@@ -1006,7 +1006,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
24 /* Create a fake field with the given type and name. NEXT is the next
25 field in the chain. */
26 #define create_field(next,type,name) \
27- create_field_all (next,type,name, 0, this_file, __LINE__)
28+ create_field_all (next,type,name, 0, this_file, 0)
29
30 /* Like create_field, but the field is only valid when condition COND
31 is true. */
32@@ -1039,7 +1039,7 @@ create_optional_field_ (pair_p next, type_p type, const char *name,
33 }
34
35 #define create_optional_field(next,type,name,cond) \
36- create_optional_field_(next,type,name,cond,__LINE__)
37+ create_optional_field_(next,type,name,cond,0)
38
39 /* Reverse a linked list of 'struct pair's in place. */
40 pair_p
41@@ -5238,7 +5238,7 @@ main (int argc, char **argv)
42 /* These types are set up with #define or else outside of where
43 we can see them. We should initialize them before calling
44 read_input_list. */
45-#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
46+#define POS_HERE(Call) do { pos.file = this_file; pos.line = 0; \
47 Call;} while (0)
48 POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
49 POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
50diff --git a/gcc/genmodes.cc b/gcc/genmodes.cc
51index 59850bb070a..e187f8542a1 100644
52--- a/gcc/genmodes.cc
53+++ b/gcc/genmodes.cc
54@@ -440,7 +440,7 @@ complete_all_modes (void)
55 }
56
57 /* For each mode in class CLASS, construct a corresponding complex mode. */
58-#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
59+#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, 0)
60 static void
61 make_complex_modes (enum mode_class cl,
62 const char *file, unsigned int line)
63@@ -499,7 +499,7 @@ make_complex_modes (enum mode_class cl,
64 having as many components as necessary. ORDER is the sorting order
65 of the mode, with smaller numbers indicating a higher priority. */
66 #define VECTOR_MODES_WITH_PREFIX(PREFIX, C, W, ORDER) \
67- make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, __LINE__)
68+ make_vector_modes (MODE_##C, #PREFIX, W, ORDER, __FILE__, 0)
69 #define VECTOR_MODES(C, W) VECTOR_MODES_WITH_PREFIX (V, C, W, 0)
70 static void ATTRIBUTE_UNUSED
71 make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
72@@ -552,7 +552,7 @@ make_vector_modes (enum mode_class cl, const char *prefix, unsigned int width,
73 BYTESIZE bytes in total. */
74 #define VECTOR_BOOL_MODE(NAME, COUNT, COMPONENT, BYTESIZE) \
75 make_vector_bool_mode (#NAME, COUNT, #COMPONENT, BYTESIZE, \
76- __FILE__, __LINE__)
77+ __FILE__, 0)
78 static void ATTRIBUTE_UNUSED
79 make_vector_bool_mode (const char *name, unsigned int count,
80 const char *component, unsigned int bytesize,
81@@ -574,7 +574,7 @@ make_vector_bool_mode (const char *name, unsigned int count,
82 /* Input. */
83
84 #define _SPECIAL_MODE(C, N) \
85- make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
86+ make_special_mode (MODE_##C, #N, __FILE__, 0)
87 #define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
88 #define CC_MODE(N) _SPECIAL_MODE (CC, N)
89
90@@ -587,7 +587,7 @@ make_special_mode (enum mode_class cl, const char *name,
91
92 #define INT_MODE(N, Y) FRACTIONAL_INT_MODE (N, -1U, Y)
93 #define FRACTIONAL_INT_MODE(N, B, Y) \
94- make_int_mode (#N, B, Y, __FILE__, __LINE__)
95+ make_int_mode (#N, B, Y, __FILE__, 0)
96
97 static void
98 make_int_mode (const char *name,
99@@ -628,16 +628,16 @@ make_opaque_mode (const char *name,
100 }
101
102 #define FRACT_MODE(N, Y, F) \
103- make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, __LINE__)
104+ make_fixed_point_mode (MODE_FRACT, #N, Y, 0, F, __FILE__, 0)
105
106 #define UFRACT_MODE(N, Y, F) \
107- make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, __LINE__)
108+ make_fixed_point_mode (MODE_UFRACT, #N, Y, 0, F, __FILE__, 0)
109
110 #define ACCUM_MODE(N, Y, I, F) \
111- make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, __LINE__)
112+ make_fixed_point_mode (MODE_ACCUM, #N, Y, I, F, __FILE__, 0)
113
114 #define UACCUM_MODE(N, Y, I, F) \
115- make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, __LINE__)
116+ make_fixed_point_mode (MODE_UACCUM, #N, Y, I, F, __FILE__, 0)
117
118 /* Create a fixed-point mode by setting CL, NAME, BYTESIZE, IBIT, FBIT,
119 FILE, and LINE. */
120@@ -658,7 +658,7 @@ make_fixed_point_mode (enum mode_class cl,
121
122 #define FLOAT_MODE(N, Y, F) FRACTIONAL_FLOAT_MODE (N, -1U, Y, F)
123 #define FRACTIONAL_FLOAT_MODE(N, B, Y, F) \
124- make_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
125+ make_float_mode (#N, B, Y, #F, __FILE__, 0)
126
127 static void
128 make_float_mode (const char *name,
129@@ -675,7 +675,7 @@ make_float_mode (const char *name,
130 #define DECIMAL_FLOAT_MODE(N, Y, F) \
131 FRACTIONAL_DECIMAL_FLOAT_MODE (N, -1U, Y, F)
132 #define FRACTIONAL_DECIMAL_FLOAT_MODE(N, B, Y, F) \
133- make_decimal_float_mode (#N, B, Y, #F, __FILE__, __LINE__)
134+ make_decimal_float_mode (#N, B, Y, #F, __FILE__, 0)
135
136 static void
137 make_decimal_float_mode (const char *name,
138@@ -690,7 +690,7 @@ make_decimal_float_mode (const char *name,
139 }
140
141 #define RESET_FLOAT_FORMAT(N, F) \
142- reset_float_format (#N, #F, __FILE__, __LINE__)
143+ reset_float_format (#N, #F, __FILE__, 0)
144 static void ATTRIBUTE_UNUSED
145 reset_float_format (const char *name, const char *format,
146 const char *file, unsigned int line)
147@@ -711,7 +711,7 @@ reset_float_format (const char *name, const char *format,
148
149 /* __intN support. */
150 #define INT_N(M,PREC) \
151- make_int_n (#M, PREC, __FILE__, __LINE__)
152+ make_int_n (#M, PREC, __FILE__, 0)
153 static void ATTRIBUTE_UNUSED
154 make_int_n (const char *m, int bitsize,
155 const char *file, unsigned int line)
156@@ -740,7 +740,7 @@ make_int_n (const char *m, int bitsize,
157 /* Partial integer modes are specified by relation to a full integer
158 mode. */
159 #define PARTIAL_INT_MODE(M,PREC,NAME) \
160- make_partial_integer_mode (#M, #NAME, PREC, __FILE__, __LINE__)
161+ make_partial_integer_mode (#M, #NAME, PREC, __FILE__, 0)
162 static void ATTRIBUTE_UNUSED
163 make_partial_integer_mode (const char *base, const char *name,
164 unsigned int precision,
165@@ -767,7 +767,7 @@ make_partial_integer_mode (const char *base, const char *name,
166 /* A single vector mode can be specified by naming its component
167 mode and the number of components. */
168 #define VECTOR_MODE_WITH_PREFIX(PREFIX, C, M, N, ORDER) \
169- make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, __LINE__);
170+ make_vector_mode (MODE_##C, #PREFIX, #M, N, ORDER, __FILE__, 0);
171 #define VECTOR_MODE(C, M, N) VECTOR_MODE_WITH_PREFIX(V, C, M, N, 0);
172 static void ATTRIBUTE_UNUSED
173 make_vector_mode (enum mode_class bclass,
174@@ -814,7 +814,7 @@ make_vector_mode (enum mode_class bclass,
175
176 /* Adjustability. */
177 #define _ADD_ADJUST(A, M, X, C1, C2) \
178- new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
179+ new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, 0)
180
181 #define ADJUST_NUNITS(M, X) _ADD_ADJUST (nunits, M, X, RANDOM, RANDOM)
182 #define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
new file mode 100644
index 00000000..cb8969b1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0022-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -0,0 +1,42 @@
1From c3870d073eb9e5d82f9d3067d0fa15038b69713a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 May 2020 15:10:38 -0700
4Subject: [PATCH] libatomic: Do not enforce march on aarch64
5
6OE passes the right options via gcc compiler cmdline via TUNE_CCARGS
7this can conflict between -mcpu settings and -march setting here, since
8-mcpu will translate into an appropriate -march, lets depend on that
9instead of setting it explicitly
10
11Upstream-Status: Inappropriate [OE-Specific]
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 libatomic/Makefile.am | 1 -
16 libatomic/Makefile.in | 1 -
17 2 files changed, 2 deletions(-)
18
19diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
20index c6c8d81c56a..d959a5d040e 100644
21--- a/libatomic/Makefile.am
22+++ b/libatomic/Makefile.am
23@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
24 ## On a target-specific basis, include alternates to be selected by IFUNC.
25 if HAVE_IFUNC
26 if ARCH_AARCH64_LINUX
27-IFUNC_OPTIONS = -march=armv8-a+lse
28 libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
29 libatomic_la_SOURCES += atomic_16.S
30
31diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
32index a0fa3dfc8cc..e70d389874a 100644
33--- a/libatomic/Makefile.in
34+++ b/libatomic/Makefile.in
35@@ -447,7 +447,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
36 libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
37 _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_3) \
38 $(am__append_4) $(am__append_5)
39-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
40 @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
41 @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
42 @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
new file mode 100644
index 00000000..11f42c59
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-Fix-install-path-of-linux64.h.patch
@@ -0,0 +1,31 @@
1From 7bd6e631e4a5273f5ecc41a5a48830a1342e5926 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei.gherzan@huawei.com>
3Date: Wed, 22 Dec 2021 12:49:25 +0100
4Subject: [PATCH] Fix install path of linux64.h
5
6We add linux64.h to tm includes[1] as a relative path to B. This patch
7adapts the install path of linux64.h to match the include in tm.h.
8
9[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
10
11Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
12
13Upstream-Status: Inappropriate [configuration]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 gcc/Makefile.in | 2 ++
17 1 file changed, 2 insertions(+)
18
19diff --git a/gcc/Makefile.in b/gcc/Makefile.in
20index 065ce7e9a5b..d4c723968aa 100644
21--- a/gcc/Makefile.in
22+++ b/gcc/Makefile.in
23@@ -3738,6 +3738,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
24 "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
25 | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
26 base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
27+ */linux64.h ) \
28+ base=`dirname $$path`;;\
29 *) base=`basename $$path` ;; \
30 esac; \
31 dest=$(plugin_includedir)/$$base; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch
new file mode 100644
index 00000000..2f016598
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch
@@ -0,0 +1,42 @@
1From 52931ec7a708b58d68e69ce9eb99001ae9f099dd Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 May 2020 15:10:38 -0700
4Subject: [PATCH] libatomic: Do not enforce march on aarch64
5
6OE passes the right options via gcc compiler cmdline via TUNE_CCARGS
7this can conflict between -mcpu settings and -march setting here, since
8-mcpu will translate into an appropriate -march, lets depend on that
9instead of setting it explicitly
10
11Upstream-Status: Inappropriate [OE-Specific]
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 libatomic/Makefile.am | 1 -
16 libatomic/Makefile.in | 1 -
17 2 files changed, 2 deletions(-)
18
19diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am
20index d88515e4a03..e0e2f8b442a 100644
21--- a/libatomic/Makefile.am
22+++ b/libatomic/Makefile.am
23@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS)))
24 ## On a target-specific basis, include alternates to be selected by IFUNC.
25 if HAVE_IFUNC
26 if ARCH_AARCH64_LINUX
27-IFUNC_OPTIONS = -march=armv8-a+lse
28 libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)))
29 endif
30 if ARCH_ARM_LINUX
31diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in
32index 80d25653dc7..7377689ab34 100644
33--- a/libatomic/Makefile.in
34+++ b/libatomic/Makefile.in
35@@ -434,7 +434,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files)))
36 libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \
37 _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \
38 $(am__append_3) $(am__append_4)
39-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse
40 @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64
41 @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586
42 @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
new file mode 100644
index 00000000..ad826901
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch
@@ -0,0 +1,28 @@
1From 4623d87d779853a2862ee92a15a41fded81eddb8 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Sat, 20 Aug 2022 09:04:14 -0700
4Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc
5
6Avoid encoding build paths into sources used for floating point on powerpc.
7(MACHINE=qemuppc bitbake libgcc).
8
9Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html]
10Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libgcc/config/rs6000/t-float128 | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
17index b09b5664af0..513e63748f1 100644
18--- a/libgcc/config/rs6000/t-float128
19+++ b/libgcc/config/rs6000/t-float128
20@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
21 $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
22 @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
23 echo "Create $@"; \
24- (echo "/* file created from $$src */"; \
25+ (echo "/* file created from `basename $$src` */"; \
26 echo; \
27 sed -f $(fp128_sed) < $$src) > $@
28
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch
new file mode 100644
index 00000000..555be623
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch
@@ -0,0 +1,31 @@
1From 3e67c9c77e46132c252911bf1e5e4222dfd3aa34 Mon Sep 17 00:00:00 2001
2From: Andrei Gherzan <andrei.gherzan@huawei.com>
3Date: Wed, 22 Dec 2021 12:49:25 +0100
4Subject: [PATCH] Fix install path of linux64.h
5
6We add linux64.h to tm includes[1] as a relative path to B. This patch
7adapts the install path of linux64.h to match the include in tm.h.
8
9[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
10
11Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
12
13Upstream-Status: Inappropriate [configuration]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 gcc/Makefile.in | 2 ++
17 1 file changed, 2 insertions(+)
18
19diff --git a/gcc/Makefile.in b/gcc/Makefile.in
20index 07fa63b6640..0def7394454 100644
21--- a/gcc/Makefile.in
22+++ b/gcc/Makefile.in
23@@ -3706,6 +3706,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
24 "$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
25 | "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
26 base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
27+ */linux64.h ) \
28+ base=`dirname $$path`;;\
29 *) base=`basename $$path` ;; \
30 esac; \
31 dest=$(plugin_includedir)/$$base; \
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
new file mode 100644
index 00000000..bbe2f18f
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch
@@ -0,0 +1,92 @@
1From 9234cdca6ee88badfc00297e72f13dac4e540c79 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Fri, 1 Jul 2022 15:58:52 +0100
4Subject: [PATCH] Add a recursion limit to the demangle_const function in the
5 Rust demangler.
6
7libiberty/
8 PR demangler/105039
9 * rust-demangle.c (demangle_const): Add recursion limit.
10
11Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9234cdca6ee88badfc00297e72f13dac4e540c79]
12---
13 libiberty/rust-demangle.c | 29 ++++++++++++++++++++---------
14 1 file changed, 20 insertions(+), 9 deletions(-)
15
16diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
17index bb58d900e27..36afcfae278 100644
18--- a/libiberty/rust-demangle.c
19+++ b/libiberty/rust-demangle.c
20@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm)
21 return 0;
22
23 x = 0;
24- while (!eat (rdm, '_'))
25+ while (!eat (rdm, '_') && !rdm->errored)
26 {
27 c = next (rdm);
28 x *= 62;
29@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm)
30 if (rdm->errored)
31 return;
32
33+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
34+ {
35+ ++ rdm->recursion;
36+ if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
37+ /* FIXME: There ought to be a way to report
38+ that the recursion limit has been reached. */
39+ goto fail_return;
40+ }
41+
42 if (eat (rdm, 'B'))
43 {
44 backref = parse_integer_62 (rdm);
45@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm)
46 demangle_const (rdm);
47 rdm->next = old_next;
48 }
49- return;
50+ goto pass_return;
51 }
52
53 ty_tag = next (rdm);
54@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm)
55 /* Placeholder. */
56 case 'p':
57 PRINT ("_");
58- return;
59+ goto pass_return;
60
61 /* Unsigned integer types. */
62 case 'h':
63@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm)
64 break;
65
66 default:
67- rdm->errored = 1;
68- return;
69+ goto fail_return;
70 }
71
72- if (rdm->errored)
73- return;
74-
75- if (rdm->verbose)
76+ if (!rdm->errored && rdm->verbose)
77 {
78 PRINT (": ");
79 PRINT (basic_type (ty_tag));
80 }
81+
82+ fail_return:
83+ rdm->errored = 1;
84+ pass_return:
85+ if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
86+ -- rdm->recursion;
87 }
88
89 static void
90--
912.31.1
92
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
new file mode 100644
index 00000000..f3485858
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/hardcoded-paths.patch
@@ -0,0 +1,19 @@
1Avoid encoding build paths into sources used for floating point on powerpc.
2(MACHINE=qemuppc bitbake libgcc).
3
4Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html]
5Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
6
7Index: gcc-12.1.0/libgcc/config/rs6000/t-float128
8===================================================================
9--- gcc-12.1.0.orig/libgcc/config/rs6000/t-float128
10+++ gcc-12.1.0/libgcc/config/rs6000/t-float128
11@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS +=
12 $(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
13 @src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
14 echo "Create $@"; \
15- (echo "/* file created from $$src */"; \
16+ (echo "/* file created from `basename $$src` */"; \
17 echo; \
18 sed -f $(fp128_sed) < $$src) > $@
19
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch
new file mode 100644
index 00000000..7f1a2dee
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc/prefix-map-realpath.patch
@@ -0,0 +1,63 @@
1Relative paths don't work with -fdebug-prefix-map and friends. This
2can lead to paths which the user wanted to be remapped being missed.
3Setting -fdebug-prefix-map to work with a relative path isn't practical
4either.
5
6Instead, call gcc's realpath function on the incomming path name before
7comparing it with the remapping. This means other issues like symlinks
8are also accounted for and leads to a more consistent remapping experience.
9
10Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599885.html]
11[Also https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599884.html]
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14
15Index: gcc-12.1.0/gcc/file-prefix-map.cc
16===================================================================
17--- gcc-12.1.0.orig/gcc/file-prefix-map.cc
18+++ gcc-12.1.0/gcc/file-prefix-map.cc
19@@ -70,19 +70,28 @@ remap_filename (file_prefix_map *maps, c
20 file_prefix_map *map;
21 char *s;
22 const char *name;
23+ char *realname;
24 size_t name_len;
25
26+ if (lbasename (filename) == filename)
27+ return filename;
28+
29+ realname = lrealpath (filename);
30+
31 for (map = maps; map; map = map->next)
32- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0)
33+ if (filename_ncmp (realname, map->old_prefix, map->old_len) == 0)
34 break;
35- if (!map)
36+ if (!map) {
37+ free (realname);
38 return filename;
39- name = filename + map->old_len;
40+ }
41+ name = realname + map->old_len;
42 name_len = strlen (name) + 1;
43
44 s = (char *) ggc_alloc_atomic (name_len + map->new_len);
45 memcpy (s, map->new_prefix, map->new_len);
46 memcpy (s + map->new_len, name, name_len);
47+ free (realname);
48 return s;
49 }
50
51Index: gcc-12.1.0/libcpp/macro.cc
52===================================================================
53--- gcc-12.1.0.orig/libcpp/macro.cc
54+++ gcc-12.1.0/libcpp/macro.cc
55@@ -563,7 +563,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
56 if (!name)
57 abort ();
58 }
59- if (pfile->cb.remap_filename)
60+ if (pfile->cb.remap_filename && !pfile->state.in_directive)
61 name = pfile->cb.remap_filename (name);
62 len = strlen (name);
63 buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb
new file mode 100644
index 00000000..c1996ab1
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc_12.2.bb
@@ -0,0 +1,14 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-target.inc
3
4# Building with thumb enabled on armv4t armv5t fails with
5# | 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
6# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
7ARM_INSTRUCTION_SET:armv4 = "arm"
8ARM_INSTRUCTION_SET:armv5 = "arm"
9
10ARMFPARCHEXT:armv6 = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
11ARMFPARCHEXT:armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
12ARMFPARCHEXT:armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
13
14#BBCLASSEXTEND = "nativesdk"
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/gcc_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/gcc_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
new file mode 100644
index 00000000..ac0a5a7b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-common.inc
@@ -0,0 +1,163 @@
1BPN = "libgcc"
2
3require gcc-configure-common.inc
4
5INHIBIT_DEFAULT_DEPS = "1"
6
7do_configure () {
8 install -d ${D}${base_libdir} ${D}${libdir}
9 mkdir -p ${B}/${BPN}
10 mkdir -p ${B}/${TARGET_SYS}/${BPN}/
11 cd ${B}/${BPN}
12 chmod a+x ${S}/${BPN}/configure
13 ${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
14}
15EXTRACONFFUNCS += "extract_stashed_builddir"
16do_configure[depends] += "${COMPILERDEP}"
17
18do_compile () {
19 cd ${B}/${BPN}
20 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/
21}
22
23do_install () {
24 cd ${B}/${BPN}
25 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ install
26
27 # Move libgcc_s into /lib
28 mkdir -p ${D}${base_libdir}
29 if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
30 mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
31 else
32 mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
33 fi
34
35 # install the runtime in /usr/lib/ not in /usr/lib/gcc on target
36 # so that cross-gcc can find it in the sysroot
37
38 mv ${D}${libdir}/gcc/* ${D}${libdir}
39 rm -rf ${D}${libdir}/gcc/
40 # unwind.h is installed here which is shipped in gcc-cross
41 # as well as target gcc and they are identical so we dont
42 # ship one with libgcc here
43 rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
44}
45
46do_install:append:libc-baremetal () {
47 if [ "${base_libdir}" != "${libdir}" ]; then
48 rmdir ${D}${base_libdir}
49 fi
50}
51do_install:append:libc-newlib () {
52 if [ "${base_libdir}" != "${libdir}" ]; then
53 rmdir ${D}${base_libdir}
54 fi
55}
56
57# No rpm package is actually created but -dev depends on it, avoid dnf error
58DEV_PKG_DEPENDENCY:libc-baremetal = ""
59DEV_PKG_DEPENDENCY:libc-newlib = ""
60
61#BBCLASSEXTEND = "nativesdk"
62
63addtask multilib_install after do_install before do_package do_populate_sysroot
64# this makes multilib gcc files findable for target gcc
65# e.g.
66# /usr/lib/i586-pokymllib32-linux/4.7/
67# by creating this symlink to it
68# /usr/lib64/x86_64-poky-linux/4.7/32
69
70fakeroot python do_multilib_install() {
71 import re
72
73 multilibs = d.getVar('MULTILIB_VARIANTS')
74 if not multilibs or bb.data.inherits_class('nativesdk', d):
75 return
76
77 binv = d.getVar('BINV')
78
79 mlprefix = d.getVar('MLPREFIX')
80 if ('%slibgcc' % mlprefix) != d.getVar('PN'):
81 return
82
83 if mlprefix:
84 orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL')
85 orig_tune_params = get_tune_parameters(orig_tune, d)
86 orig_tune_baselib = orig_tune_params['baselib']
87 orig_tune_bitness = orig_tune_baselib.replace('lib', '')
88 if not orig_tune_bitness:
89 orig_tune_bitness = '32'
90
91 src = '../../../' + orig_tune_baselib + '/' + \
92 d.getVar('TARGET_SYS_MULTILIB_ORIGINAL') + '/' + binv + '/'
93
94 dest = d.getVar('D') + d.getVar('libdir') + '/' + \
95 d.getVar('TARGET_SYS') + '/' + binv + '/' + orig_tune_bitness
96
97 if os.path.lexists(dest):
98 os.unlink(dest)
99 os.symlink(src, dest)
100 return
101
102
103 for ml in multilibs.split():
104 tune = d.getVar('DEFAULTTUNE:virtclass-multilib-' + ml)
105 if not tune:
106 bb.warn('DEFAULTTUNE:virtclass-multilib-%s is not defined. Skipping...' % ml)
107 continue
108
109 tune_parameters = get_tune_parameters(tune, d)
110 tune_baselib = tune_parameters['baselib']
111 if not tune_baselib:
112 bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
113 continue
114
115 tune_arch = tune_parameters['arch']
116 tune_bitness = tune_baselib.replace('lib', '')
117 if not tune_bitness:
118 tune_bitness = '32' # /lib => 32bit lib
119
120 tune_abiextension = tune_parameters['abiextension']
121 if tune_abiextension:
122 libcextension = '-gnu' + tune_abiextension
123 else:
124 libcextension = ''
125
126 src = '../../../' + tune_baselib + '/' + \
127 tune_arch + d.getVar('TARGET_VENDOR') + 'ml' + ml + \
128 '-' + d.getVar('TARGET_OS') + libcextension + '/' + binv + '/'
129
130 dest = d.getVar('D') + d.getVar('libdir') + '/' + \
131 d.getVar('TARGET_SYS') + '/' + binv + '/' + tune_bitness
132
133 if os.path.lexists(dest):
134 os.unlink(dest)
135 os.symlink(src, dest)
136}
137
138def get_original_os(d):
139 vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}')
140 for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]:
141 if suffix and vendoros.endswith(suffix):
142 vendoros = vendoros[:-len(suffix)]
143 # Arm must use linux-gnueabi not linux as only the former is accepted by gcc
144 if vendoros.startswith("arm-") and not vendoros.endswith("-gnueabi"):
145 vendoros = vendoros + "-gnueabi"
146 return vendoros
147
148ORIG_TARGET_VENDOR := "${TARGET_VENDOR}"
149BASETARGET_SYS = "${@get_original_os(d)}"
150
151addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
152fakeroot python do_extra_symlinks() {
153 if bb.data.inherits_class('nativesdk', d):
154 return
155
156 targetsys = d.getVar('BASETARGET_SYS')
157
158 if targetsys != d.getVar('TARGET_SYS'):
159 dest = d.getVar('D') + d.getVar('libdir') + '/' + targetsys
160 src = d.getVar('TARGET_SYS')
161 if not os.path.lexists(dest) and os.path.lexists(d.getVar('D') + d.getVar('libdir')):
162 os.symlink(src, dest)
163}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc
new file mode 100644
index 00000000..8251e3c2
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial.inc
@@ -0,0 +1,58 @@
1#
2# Notes on the way the OE cross toolchain now works
3#
4# We need a libgcc to build glibc. Tranditionally we therefore built
5# a non-threaded and non-shared compiler (gcc-cross-initial), then use
6# that to build libgcc-initial which is used to build glibc which we can
7# then build gcc-cross and libgcc against.
8#
9# We were able to drop the glibc dependency from gcc-cross, with two tweaks:
10
11# a) specify the minimum glibc version to support in a configure option
12# b) create a dummy limits.h file so that later when glibc creates one,
13# the headers structure has support for it. We can do this with a simple
14# empty file
15#
16# Once gcc-cross is libc independent, we can use it to build both
17# libgcc-initial and then later libgcc.
18#
19# libgcc-initial is tricky as we need to imitate the non-threaded and
20# non-shared case. We can do that by hacking the threading mode back to
21# "single" even if gcc reports "posix" and disable libc presence for the
22# libgcc-intial build. We have to create the dummy limits.h to avoid
23# compiler errors from a missing header.
24#
25# glibc will fail to link with libgcc-initial due to a missing "exception
26# handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need
27# any exception handler, we can safely symlink to libgcc.a.
28#
29
30require libgcc-common.inc
31
32DEPENDS = "virtual/${TARGET_PREFIX}gcc"
33
34LICENSE = "GPL-3.0-with-GCC-exception"
35
36PACKAGES = ""
37
38EXTRA_OECONF += "--disable-shared"
39
40inherit nopackages
41
42# We really only want this built by things that need it, not any recrdeptask
43deltask do_build
44
45do_configure:prepend () {
46 install -d ${STAGING_INCDIR}
47 touch ${STAGING_INCDIR}/limits.h
48 sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
49 sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
50}
51
52do_configure:append () {
53 sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile
54}
55
56do_install:append () {
57 ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a
58}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb
new file mode 100644
index 00000000..a259082b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc-initial.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET:armv6 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc-initial_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc.inc b/meta-microblaze/recipes-devtools/gcc/libgcc.inc
new file mode 100644
index 00000000..84a2d930
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc.inc
@@ -0,0 +1,53 @@
1require libgcc-common.inc
2
3DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc"
4
5do_install:append:class-target () {
6 if [ "${TCLIBC}" != "glibc" ]; then
7 case "${TARGET_OS}" in
8 "linux-musl" | "linux-*spe") extra_target_os="linux";;
9 "linux-musleabi") extra_target_os="linux-gnueabi";;
10 *) extra_target_os="linux";;
11 esac
12 if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
13 ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
14 fi
15 fi
16 if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
17 case "${TARGET_OS}" in
18 "linux-musleabi") extra_target_os="linux-musleabihf";;
19 "linux-gnueabi") extra_target_os="linux-gnueabihf";;
20 esac
21 if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
22 ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
23 fi
24 fi
25}
26
27PACKAGES = "\
28 ${PN} \
29 ${PN}-dev \
30 ${PN}-dbg \
31"
32
33# All libgcc source is marked with the exception.
34#
35LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
36LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
37LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
38
39
40FILES:${PN}-dev = "\
41 ${base_libdir}/libgcc*.so \
42 ${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
43 ${libdir}/${TARGET_SYS}/${BINV}* \
44 ${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
45"
46
47do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
48do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
49do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
50do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
51
52INSANE_SKIP:${PN}-dev = "staticdev"
53
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb
new file mode 100644
index 00000000..f88963b0
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc_12.2.bb
@@ -0,0 +1,5 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgcc.inc
3
4# Building with thumb enabled on armv6t fails
5ARM_INSTRUCTION_SET:armv6 = "arm"
diff --git a/meta-microblaze/recipes-devtools/gcc/libgcc_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/libgcc_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgcc_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran.inc b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
new file mode 100644
index 00000000..99fdd89c
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran.inc
@@ -0,0 +1,88 @@
1require gcc-configure-common.inc
2
3EXTRA_OECONF_PATHS = "\
4 --with-sysroot=/not/exist \
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8# An arm hard float target like raspberrypi4 won't build
9# as CFLAGS don't make it to the fortran compiler otherwise
10# (the configure script sets FC to $GFORTRAN unconditionally)
11export GFORTRAN = "${FC}"
12
13do_configure () {
14 for target in libbacktrace libgfortran
15 do
16 rm -rf ${B}/${TARGET_SYS}/$target/
17 mkdir -p ${B}/${TARGET_SYS}/$target/
18 cd ${B}/${TARGET_SYS}/$target/
19 chmod a+x ${S}/$target/configure
20 relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
21 ../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
22 # Easiest way to stop bad RPATHs getting into the library since we have a
23 # broken libtool here
24 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
25 done
26}
27EXTRACONFFUNCS += "extract_stashed_builddir"
28do_configure[depends] += "${COMPILERDEP}"
29
30do_compile () {
31 for target in libbacktrace libgfortran
32 do
33 cd ${B}/${TARGET_SYS}/$target/
34 oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
35 done
36}
37
38do_install () {
39 cd ${B}/${TARGET_SYS}/libgfortran/
40 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
41 if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
42 rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
43 fi
44 if [ -d ${D}${infodir} ]; then
45 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
46 fi
47 chown -R root:root ${D}
48}
49
50INHIBIT_DEFAULT_DEPS = "1"
51DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}"
52
53#BBCLASSEXTEND = "nativesdk"
54
55PACKAGES = "\
56 ${PN}-dbg \
57 libgfortran \
58 libgfortran-dev \
59 libgfortran-staticdev \
60"
61
62LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
63LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
64LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
65
66FILES:${PN} = "${libdir}/libgfortran.so.*"
67FILES:${PN}-dev = "\
68 ${libdir}/libgfortran*.so \
69 ${libdir}/libgfortran.spec \
70 ${libdir}/libgfortran.la \
71 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
72 ${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
73 ${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
74 ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
75"
76FILES:${PN}-staticdev = "${libdir}/libgfortran.a"
77
78INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev"
79
80do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
81do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
82do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
83
84python __anonymous () {
85 f = d.getVar("FORTRAN")
86 if "fortran" not in f:
87 raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
88}
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb
new file mode 100644
index 00000000..71dd8b4b
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_12.2.bb
@@ -0,0 +1,3 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require libgfortran.inc
3
diff --git a/meta-microblaze/recipes-devtools/gcc/libgfortran_13.1.bbappend b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.1.bbappend
new file mode 100644
index 00000000..d1df2061
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/libgfortran_13.1.bbappend
@@ -0,0 +1 @@
require microblaze-block.inc
diff --git a/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
new file mode 100644
index 00000000..67c40845
--- /dev/null
+++ b/meta-microblaze/recipes-devtools/gcc/microblaze-block.inc
@@ -0,0 +1 @@
COMPATIBLE_HOST:microblaze = "^$"