Complete Yocto mirror with license table for TQMa6UL (2038-compliance)

- 264 license table entries with exact download URLs (224/264 resolved)
- Complete sources/ directory with all BitBake recipes
- Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl)
- Full traceability for Softwarefreigabeantrag
- GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4
- License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
Siggi (OpenClaw Agent)
2026-03-01 20:58:18 +00:00
commit 16accb6b24
15086 changed files with 1292356 additions and 0 deletions

View File

@@ -0,0 +1,117 @@
require gcc-common.inc
# Third digit in PV should be incremented after a minor release
PV = "13.4.0"
# BINV should be incremented to a revision after a minor gcc release
BINV = "13.4.0"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
DEPENDS =+ "mpfr gmp libmpc zlib zstd flex-native"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
LICENSE = "GPL-3.0-with-GCC-exception & GPL-3.0-only"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
"
# snapshot from git
#RELEASE ?= "9b6bf076c11cba0f9ccdace63e8b4044b1a858ea"
#BASEURI ?= "https://git.linaro.org/toolchain/gcc.git/snapshot/gcc-${RELEASE}.tar.gz"
#SOURCEDIR = "gcc-${RELEASE}"
#BASEURI ?= "https://repo.or.cz/official-gcc.git/snapshot/${RELEASE}.tar.gz;downloadfilename=gcc-${PV}-${RELEASE}.tar.gz"
#SOURCEDIR ?= "official-gcc-${@'${RELEASE}'[0:7]}"
# from snapshot
#RELEASE ?= "13-20230520"
#SOURCEDIR ?= "gcc-${RELEASE}"
#BASEURI ?= "https://gcc.gnu.org/pub/gcc/snapshots/${RELEASE}/gcc-${RELEASE}.tar.xz"
# official release
RELEASE ?= "${PV}"
BASEURI ?= "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.xz"
SOURCEDIR ?= "gcc-${PV}"
SRC_URI = "${BASEURI} \
file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \
file://0002-gcc-poison-system-directories.patch \
file://0003-64-bit-multilib-hack.patch \
file://0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch \
file://0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \
file://0006-cpp-honor-sysroot.patch \
file://0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \
file://0008-libtool.patch \
file://0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch \
file://0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch \
file://0011-aarch64-Fix-include-paths-when-S-B.patch \
file://0012-Avoid-using-libdir-from-.la-which-usually-points-to-.patch \
file://0013-Ensure-target-gcc-headers-can-be-included.patch \
file://0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch \
file://0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0016-handle-sysroot-support-for-nativesdk-gcc.patch \
file://0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch \
file://0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch \
file://0019-Re-introduce-spe-commandline-options.patch \
file://0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
file://0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
file://0022-libatomic-Do-not-enforce-march-on-aarch64.patch \
file://0023-Fix-install-path-of-linux64.h.patch \
file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \
file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \
file://0027-Fix-gcc-vect-module-testcases.patch \
"
SRC_URI[sha256sum] = "9c4ce6dbb040568fdc545588ac03c5cbc95a8dbf0c7aa490170843afb59ca8f5"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
# Language Overrides
FORTRAN = ""
JAVA = ""
SSP ?= "--disable-libssp"
SSP:mingw32 = "--enable-libssp"
EXTRA_OECONF_BASE = "\
${SSP} \
--enable-libitm \
--enable-lto \
--disable-bootstrap \
--with-system-zlib \
${@'--with-linker-hash-style=${LINKER_HASH_STYLE}' if '${LINKER_HASH_STYLE}' else ''} \
--enable-linker-build-id \
--with-ppl=no \
--with-cloog=no \
--enable-checking=release \
--enable-cheaders=c_global \
--without-isl \
"
EXTRA_OECONF_INITIAL = "\
--disable-libgomp \
--disable-libitm \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--enable-linker-build-id \
--enable-decimal-float=no \
--without-isl \
--disable-libssp \
"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist{target_includedir}/c++/${BINV} \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
CVE_STATUS[CVE-2021-37322] = "cpe-incorrect: Is a binutils 2.26 issue, not gcc"
CVE_STATUS[CVE-2023-4039] = "fixed-version: Fixed via CVE-2023-4039.patch included here. Set the status explictly to deal with all recipes that share the gcc-source"

View File

@@ -0,0 +1,144 @@
SUMMARY = "GNU cc and gcc C compilers"
HOMEPAGE = "http://www.gnu.org/software/gcc/"
DESCRIPTION = "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."
SECTION = "devel"
LICENSE = "GPL"
NATIVEDEPS = ""
CVE_PRODUCT = "gcc"
inherit autotools gettext texinfo
BPN = "gcc"
COMPILERDEP = "virtual/${TARGET_PREFIX}gcc:do_gcc_stash_builddir"
python extract_stashed_builddir () {
src = d.expand("${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}")
dest = d.getVar("B")
oe.path.copyhardlinktree(src, dest)
staging_processfixme([src + "/fixmepath"], dest, d.getVar("RECIPE_SYSROOT"), d.getVar("RECIPE_SYSROOT_NATIVE"), d)
}
def get_gcc_float_setting(bb, d):
if d.getVar('ARMPKGSFX_EABI') == "hf" and d.getVar('TRANSLATED_TARGET_ARCH') == "arm":
return "--with-float=hard"
if d.getVar('TARGET_FPU') in [ 'soft' ]:
return "--with-float=soft"
if d.getVar('TARGET_FPU') in [ 'ppc-efd' ]:
return "--enable-e500_double"
return ""
get_gcc_float_setting[vardepvalue] = "${@get_gcc_float_setting(bb, d)}"
def get_gcc_x86_64_arch_setting(bb, d):
import re
march = re.match(r'^.*-march=([^\s]*)', d.getVar('TUNE_CCARGS'))
if march:
return "--with-arch=%s " % march.group(1)
# The earliest supported x86-64 CPU
return "--with-arch=core2"
get_gcc_x86_64_arch_setting[vardepvalue] = "${@get_gcc_x86_64_arch_setting(bb, d)}"
def get_gcc_mips_plt_setting(bb, d):
if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d):
return "--with-mips-plt"
return ""
def get_gcc_ppc_plt_settings(bb, d):
if d.getVar('TRANSLATED_TARGET_ARCH') in [ 'powerpc', 'powerpc64' ] and not bb.utils.contains('DISTRO_FEATURES', 'bssplt', True, False, d):
return "--enable-secureplt"
return ""
def get_gcc_multiarch_setting(bb, d):
target_arch = d.getVar('TRANSLATED_TARGET_ARCH')
multiarch_options = {
"i586": "--enable-targets=all",
"i686": "--enable-targets=all",
"powerpc": "--enable-targets=powerpc64",
"powerpc64le": "--enable-targets=powerpcle",
"mips": "--enable-targets=all",
"sparc": "--enable-targets=all",
}
if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d):
if target_arch in multiarch_options :
return multiarch_options[target_arch]
return ""
# this is used by the multilib setup of gcc
def get_tune_parameters(tune, d):
availtunes = d.getVar('AVAILTUNES')
if tune not in availtunes.split():
bb.error('The tune: %s is not one of the available tunes: %s' % (tune or None, availtunes))
localdata = bb.data.createCopy(d)
override = ':tune-' + tune
localdata.setVar('OVERRIDES', localdata.getVar('OVERRIDES', False) + override)
retdict = {}
retdict['tune'] = tune
retdict['ccargs'] = localdata.getVar('TUNE_CCARGS')
retdict['features'] = localdata.getVar('TUNE_FEATURES')
# BASELIB is used by the multilib code to change library paths
retdict['baselib'] = localdata.getVar('BASE_LIB') or localdata.getVar('BASELIB')
retdict['arch'] = localdata.getVar('TUNE_ARCH')
retdict['abiextension'] = localdata.getVar('ABIEXTENSION')
retdict['target_fpu'] = localdata.getVar('TARGET_FPU')
retdict['pkgarch'] = localdata.getVar('TUNE_PKGARCH')
retdict['package_extra_archs'] = localdata.getVar('PACKAGE_EXTRA_ARCHS')
return retdict
get_tune_parameters[vardepsexclude] = "AVAILTUNES TUNE_CCARGS OVERRIDES TUNE_FEATURES BASE_LIB BASELIB TUNE_ARCH ABIEXTENSION TARGET_FPU TUNE_PKGARCH PACKAGE_EXTRA_ARCHS"
DEBIANNAME:${MLPREFIX}libgcc = "libgcc1"
MIRRORS =+ "\
${GNU_MIRROR}/gcc https://gcc.gnu.org/pub/gcc/releases/ \
"
#
# Set some default values
#
gcclibdir = "${libdir}/gcc"
BINV = "${PV}"
#S = "${WORKDIR}/gcc-${PV}"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
target_includedir ?= "${includedir}"
target_libdir ?= "${libdir}"
target_base_libdir ?= "${base_libdir}"
target_prefix ?= "${prefix}"
# We need to ensure that for the shared work directory, the do_patch signatures match
# The real WORKDIR location isn't a dependency for the shared workdir.
src_patches[vardepsexclude] = "WORKDIR"
should_apply[vardepsexclude] += "PN"
remove_sysroot_paths_from_configargs () {
replacement=${1}
# Prevent sysroot path from being used in configargs.h header, as it will
# be rewritten when used by other sysroots preventing support for gcc
# plugins. Additionally the path is embeddeded into the output binary, this
# prevents building a reproducible binary.
oe_runmake configure-gcc
sed -i "s@${STAGING_DIR_TARGET}@$replacement@g" ${B}/gcc/configargs.h
sed -i "s@${STAGING_DIR_HOST}@/$replacement@g" ${B}/gcc/configargs.h
}
remove_sysroot_paths_from_checksum_options () {
stagingdir=${1}
replacement=${2}
# Prevent sysroot/workdir paths from being used in checksum-options.
# checksum-options is used to generate a checksum which is embedded into
# the output binary.
oe_runmake TARGET-gcc=checksum-options all-gcc
sed -i "s@${DEBUG_PREFIX_MAP}@@g" ${B}/gcc/checksum-options
sed -i "s@$stagingdir@$replacement@g" ${B}/gcc/checksum-options
}
cleanup_installed_include_fixed () {
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
}

View File

@@ -0,0 +1,121 @@
require gcc-multilib-config.inc
require gcc-shared-source.inc
#
# Build the list of lanaguages to build.
#
# These can be overridden by the version specific .inc file.
# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
FORTRAN ?= ",f77"
LANGUAGES ?= "c,c++${FORTRAN}"
EXTRA_OECONF_BASE ?= ""
EXTRA_OECONF_PATHS ?= ""
GCCMULTILIB ?= "--disable-multilib"
GCCTHREADS ?= "posix"
GCCPIE ??= ""
SYMVERS_CONF ?= "--enable-symvers=gnu"
EXTRA_OECONF = "\
${@['--enable-clocale=generic', ''][d.getVar('USE_NLS') != 'no']} \
--with-gnu-ld \
--enable-shared \
--enable-languages=${LANGUAGES} \
--enable-threads=${GCCTHREADS} \
${GCCMULTILIB} \
${GCCPIE} \
--enable-c99 \
--enable-long-long \
${SYMVERS_CONF} \
--enable-libstdcxx-pch \
--program-prefix=${TARGET_PREFIX} \
--without-local-prefix \
--disable-install-libiberty \
${EXTRA_OECONF_BASE} \
${EXTRA_OECONF_GCC_FLOAT} \
${EXTRA_OECONF_PATHS} \
${@get_gcc_mips_plt_setting(bb, d)} \
${@get_gcc_ppc_plt_settings(bb, d)} \
${@get_gcc_multiarch_setting(bb, d)} \
"
# glibc version is a minimum controlling whether features are enabled.
# Doesn't need to track glibc exactly
EXTRA_OECONF:append:libc-glibc = " --with-glibc-version=2.28 "
# Set this here since GCC configure won't auto-detect and enable
# initfini-arry when cross compiling.
EXTRA_OECONF:append = " --enable-initfini-array"
export gcc_cv_collect2_libs = 'none required'
# We need to set gcc_cv_collect2_libs else there is cross-compilation badness
# in the config.log files (which might not get generated until do_compile
# hence being missed by the insane do_configure check).
EXTRA_OECONF:append:linux = " --enable-__cxa_atexit"
EXTRA_OECONF:append:mips64 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
EXTRA_OECONF:append:mips64el = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
EXTRA_OECONF:append:mips64n32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
EXTRA_OECONF:append:mips64eln32 = " --with-abi=64 --with-arch-64=mips64 --with-tune-64=mips64"
EXTRA_OECONF:append:mipsisa32r6el = " --with-abi=32 --with-arch=mips32r6"
EXTRA_OECONF:append:mipsisa32r6 = " --with-abi=32 --with-arch=mips32r6"
EXTRA_OECONF:append:mipsisa64r6el = " --with-abi=64 --with-arch-64=mips64r6"
EXTRA_OECONF:append:mipsisa64r6 = " --with-abi=64 --with-arch-64=mips64r6"
EXTRA_OECONF_GCC_FLOAT ??= ""
CPPFLAGS = ""
SYSTEMHEADERS = "${target_includedir}"
SYSTEMLIBS = "${target_base_libdir}/"
SYSTEMLIBS1 = "${target_libdir}/"
do_configure:prepend () {
# teach gcc to find correct target includedir when checking libc ssp support
mkdir -p ${B}/gcc
echo "NATIVE_SYSTEM_HEADER_DIR = ${SYSTEMHEADERS}" > ${B}/gcc/t-oe
cat ${S}/gcc/defaults.h | grep -v "\#endif.*GCC_DEFAULTS_H" > ${B}/gcc/defaults.h.new
cat >>${B}/gcc/defaults.h.new <<_EOF
#define NATIVE_SYSTEM_HEADER_DIR "${SYSTEMHEADERS}"
#define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}"
#define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}"
#define SYSTEMLIBS_DIR "${SYSTEMLIBS}"
#endif /* ! GCC_DEFAULTS_H */
_EOF
mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h
}
do_configure () {
# Setup these vars for cross building only
# ... because foo_FOR_TARGET apparently gets misinterpreted inside the
# gcc build stuff when the build is producing a cross compiler - i.e.
# when the 'current' target is the 'host' system, and the host is not
# the target (because the build is actually making a cross compiler!)
if [ "${BUILD_SYS}" != "${HOST_SYS}" ]; then
export CC_FOR_TARGET="${CC}"
export GCC_FOR_TARGET="${CC}"
export CXX_FOR_TARGET="${CXX}"
export AS_FOR_TARGET="${HOST_PREFIX}as"
export LD_FOR_TARGET="${HOST_PREFIX}ld"
export NM_FOR_TARGET="${HOST_PREFIX}nm"
export AR_FOR_TARGET="${HOST_PREFIX}ar"
export GFORTRAN_FOR_TARGET="gfortran"
export RANLIB_FOR_TARGET="${HOST_PREFIX}ranlib"
fi
export CC_FOR_BUILD="${BUILD_CC}"
export CXX_FOR_BUILD="${BUILD_CXX}"
export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
oe_runconf
}

View File

@@ -0,0 +1,192 @@
inherit cross-canadian
SUMMARY = "GNU cc and gcc C compilers (cross-canadian for ${TARGET_ARCH} target)"
PN = "gcc-cross-canadian-${TRANSLATED_TARGET_ARCH}"
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc nativesdk-gettext flex-native virtual/libc"
GCCMULTILIB = "--enable-multilib"
require gcc-configure-common.inc
EXTRA_OECONF += "--with-plugin-ld=ld"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
--with-build-time-tools=${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS}/bin \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
# We have to point gcc at a sysroot but we don't need to rebuild if this changes
# e.g. we switch between different machines with different tunes.
EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH"
TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
get_gcc_float_setting[vardepvalue] = ""
#
# gcc-cross looks and finds these in ${exec_prefix} but we're not so lucky
# for the sdk. Hardcoding the paths ensures the build doesn't go canadian or worse.
#
export AR_FOR_TARGET = "${TARGET_PREFIX}ar"
export AS_FOR_TARGET = "${TARGET_PREFIX}as"
export DLLTOOL_FOR_TARGET = "${TARGET_PREFIX}dlltool"
export CC_FOR_TARGET = "${TARGET_PREFIX}gcc"
export CXX_FOR_TARGET = "${TARGET_PREFIX}g++"
export GCC_FOR_TARGET = "${TARGET_PREFIX}gcc"
export LD_FOR_TARGET = "${TARGET_PREFIX}ld"
export LIPO_FOR_TARGET = "${TARGET_PREFIX}lipo"
export NM_FOR_TARGET = "${TARGET_PREFIX}nm"
export OBJDUMP_FOR_TARGET = "${TARGET_PREFIX}objdump"
export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib"
export STRIP_FOR_TARGET = "${TARGET_PREFIX}strip"
export WINDRES_FOR_TARGET = "${TARGET_PREFIX}windres"
#
# We need to override this and make sure the compiler can find staging
#
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET}"
do_configure () {
if [ ! -d ${RECIPE_SYSROOT}/${target_includedir} ]; then
mkdir -p ${RECIPE_SYSROOT}/${target_includedir}
fi
export CC_FOR_BUILD="${BUILD_CC}"
export CXX_FOR_BUILD="${BUILD_CXX}"
export CFLAGS_FOR_BUILD="${BUILD_CFLAGS}"
export CPPFLAGS_FOR_BUILD="${BUILD_CPPFLAGS}"
export CXXFLAGS_FOR_BUILD="${BUILD_CXXFLAGS}"
export LDFLAGS_FOR_BUILD="${BUILD_LDFLAGS}"
export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
oe_runconf
}
do_compile () {
remove_sysroot_paths_from_configargs '/host'
remove_sysroot_paths_from_checksum_options '${STAGING_DIR_HOST}' '/host'
oe_runmake all-host configure-target-libgcc
(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
}
PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"
FILES:${PN} = "\
${exec_prefix}/bin/* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/* \
${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
${gcclibdir}/${TARGET_SYS}/${BINV}/lib* \
${gcclibdir}/${TARGET_SYS}/${BINV}/include \
${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.* \
${libdir}/bfd-plugins/*.so \
${includedir}/c++/${BINV} \
${prefix}/${TARGET_SYS}/bin/* \
${prefix}/${TARGET_SYS}/lib/* \
${prefix}/${TARGET_SYS}${target_includedir}/* \
"
INSANE_SKIP:${PN} += "dev-so"
FILES:${PN}-doc = "\
${infodir} \
${mandir} \
${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
"
EXEEXT = ""
# Compute how to get from libexecdir to bindir in python (easier than shell)
BINRELPATH = "${@os.path.relpath(d.expand("${bindir}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
# linker plugin path
LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${libdir}/bfd-plugins"))}"
do_install () {
( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
oe_runmake 'DESTDIR=${D}' install-host
# Cleanup some of the ${libdir}{,exec}/gcc stuff ...
rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
# We care about g++ not c++
rm -f ${D}${bindir}/*c++
# We don't care about the gcc-<version> copies
rm -f ${D}${bindir}/*gcc-${BINV}*
# Cleanup empty directories which are not shipped
# we use rmdir instead of 'rm -f' to ensure the non empty directories are not deleted
# ${D}${libdir}/../lib only seems to appear with SDKMACHINE=i686
local empty_dirs="${D}${libdir}/../lib ${D}${prefix}/${TARGET_SYS}/lib ${D}${prefix}/${TARGET_SYS} ${D}${includedir}"
for i in $empty_dirs; do
[ -d $i ] && rmdir --ignore-fail-on-non-empty $i
done
# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
# found.
dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
install -d $dest
suffix=${EXEEXT}
for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip g77 gcc cpp gfortran; do
if [ "$t" = "g77" -o "$t" = "gfortran" ] && [ ! -e ${D}${bindir}/${TARGET_PREFIX}$t$suffix ]; then
continue
fi
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t$suffix $dest$t$suffix
done
# libquadmath headers need to be available in the gcc libexec dir
install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
# install LTO linker plugins where binutils tools can find it
install -d ${D}${libdir}/bfd-plugins
ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
chown -R root:root ${D}
cross_canadian_bindirlinks
for i in linux ${CANADIANEXTRAOS}
do
for v in ${CANADIANEXTRAVENDOR}
do
d=${D}${bindir}/../${TARGET_ARCH}$v-$i
install -d $d
for j in ${TARGET_PREFIX}gcc${EXEEXT} ${TARGET_PREFIX}g++${EXEEXT}
do
p=${TARGET_ARCH}$v-$i-`echo $j | sed -e s,${TARGET_PREFIX},,`
case $i in
*musl*)
rm -rf $d/$p
echo "#!/usr/bin/env sh" > $d/$p
echo "exec \`dirname \$0\`/../${TARGET_SYS}/$j -mmusl \$@" >> $d/$p
chmod 0755 $d/$p
;;
*)
;;
esac
done
done
done
cleanup_installed_include_fixed
}
ELFUTILS = "nativesdk-elfutils"
DEPENDS += "nativesdk-gmp nativesdk-mpfr nativesdk-libmpc ${ELFUTILS} nativesdk-zlib nativesdk-zstd"
RDEPENDS:${PN} += "nativesdk-mpfr nativesdk-libmpc ${ELFUTILS}"
SYSTEMHEADERS = "${target_includedir}/"
SYSTEMLIBS = "${target_base_libdir}/"
SYSTEMLIBS1 = "${target_libdir}/"
EXTRA_OECONF += "--enable-poison-system-directories"
# gcc 4.7 needs -isystem
export ARCH_FLAGS_FOR_TARGET = "--sysroot=${STAGING_DIR_TARGET} -isystem=${target_includedir}"

View File

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

View File

@@ -0,0 +1,152 @@
inherit cross
INHIBIT_DEFAULT_DEPS = "1"
EXTRADEPENDS = ""
DEPENDS = "virtual/${TARGET_PREFIX}binutils ${EXTRADEPENDS} ${NATIVEDEPS}"
PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
python () {
if d.getVar("TARGET_OS").startswith("linux"):
d.setVar("EXTRADEPENDS", "linux-libc-headers")
}
PN = "gcc-cross-${TARGET_ARCH}"
# Ignore how TARGET_ARCH is computed.
TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}"
require gcc-configure-common.inc
# While we want the 'gnu' hash style, we explicitly set it to sysv here to
# ensure that any recipe which doesn't obey our LDFLAGS (which also set it to
# gnu) will hit a QA failure.
LINKER_HASH_STYLE ?= "sysv"
EXTRA_OECONF += "--enable-poison-system-directories=error"
EXTRA_OECONF:append:sh4 = " \
--with-multilib-list= \
--enable-incomplete-targets \
"
EXTRA_OECONF += "\
--with-system-zlib \
"
EXTRA_OECONF:append:libc-baremetal = " --without-headers"
EXTRA_OECONF:remove:libc-baremetal = "--enable-threads=posix"
EXTRA_OECONF:remove:libc-newlib = "--enable-threads=posix"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=/not/exist${target_includedir}/c++/${BINV} \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_TARGET}${target_includedir}"
do_configure:prepend () {
install -d ${RECIPE_SYSROOT}${target_includedir}
touch ${RECIPE_SYSROOT}${target_includedir}/limits.h
}
do_compile () {
export CC="${BUILD_CC}"
export AR_FOR_TARGET="${TARGET_SYS}-ar"
export RANLIB_FOR_TARGET="${TARGET_SYS}-ranlib"
export LD_FOR_TARGET="${TARGET_SYS}-ld"
export NM_FOR_TARGET="${TARGET_SYS}-nm"
export CC_FOR_TARGET="${CCACHE} ${TARGET_SYS}-gcc"
export CFLAGS_FOR_TARGET="${TARGET_CFLAGS}"
export CPPFLAGS_FOR_TARGET="${TARGET_CPPFLAGS}"
export CXXFLAGS_FOR_TARGET="${TARGET_CXXFLAGS}"
export LDFLAGS_FOR_TARGET="${TARGET_LDFLAGS}"
remove_sysroot_paths_from_configargs '/host'
remove_sysroot_paths_from_checksum_options '${STAGING_DIR_HOST}' '/host'
oe_runmake all-host configure-target-libgcc
(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
}
INHIBIT_PACKAGE_STRIP = "1"
# Compute how to get from libexecdir to bindir in python (easier than shell)
BINRELPATH = "${@os.path.relpath(d.expand("${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_SYS}"), d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"))}"
# linker plugin path
LIBRELPATH = "${@os.path.relpath(d.expand("${libexecdir}/gcc/${TARGET_SYS}/${BINV}"), d.expand("${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/bfd-plugins"))}"
do_install () {
( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h-forbuild install-unwind_h )
oe_runmake 'DESTDIR=${D}' install-host
install -d ${D}${target_base_libdir}
install -d ${D}${target_libdir}
# Link gfortran to g77 to satisfy not-so-smart configure or hard coded g77
# gfortran is fully backwards compatible. This is a safe and practical solution.
if [ -n "${@d.getVar('FORTRAN')}" ]; then
ln -sf ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}gfortran ${STAGING_DIR_NATIVE}${prefix_native}/bin/${TARGET_PREFIX}g77 || true
fortsymlinks="g77 gfortran"
fi
# Insert symlinks into libexec so when tools without a prefix are searched for, the correct ones are
# found. These need to be relative paths so they work in different locations.
dest=${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/
install -d $dest
for t in ar as ld ld.bfd ld.gold nm objcopy objdump ranlib strip gcc cpp $fortsymlinks; do
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t $dest$t
ln -sf ${BINRELPATH}/${TARGET_PREFIX}$t ${dest}${TARGET_PREFIX}$t
done
# Remove things we don't need but keep share/java
for d in info man share/doc share/locale share/man share/info; do
rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/$d
done
# libquadmath headers need to be available in the gcc libexec dir
install -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
cp ${S}/libquadmath/quadmath.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
cp ${S}/libquadmath/quadmath_weak.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
cleanup_installed_include_fixed
# install LTO linker plugins where binutils tools can find it
install -d ${D}${libdir}/bfd-plugins
ln -sf ${LIBRELPATH}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
}
do_package[noexec] = "1"
do_packagedata[noexec] = "1"
do_package_write_ipk[noexec] = "1"
do_package_write_rpm[noexec] = "1"
do_package_write_deb[noexec] = "1"
inherit chrpath
python gcc_stash_builddir_fixrpaths() {
# rewrite rpaths, breaking hardlinks as required
process_dir("/", d.getVar("BUILDDIRSTASH"), d, break_hardlinks = True)
}
BUILDDIRSTASH = "${WORKDIR}/stashed-builddir/build"
do_gcc_stash_builddir[dirs] = "${B}"
do_gcc_stash_builddir[cleandirs] = "${BUILDDIRSTASH}"
do_gcc_stash_builddir[postfuncs] += "gcc_stash_builddir_fixrpaths"
do_gcc_stash_builddir () {
dest=${BUILDDIRSTASH}
hardlinkdir . $dest
# Makefile does move-if-change which can end up with 'timestamp' as file contents so break links to those files
rm $dest/gcc/include/*.h
cp gcc/include/*.h $dest/gcc/include/
sysroot-relativelinks.py $dest
}
addtask do_gcc_stash_builddir after do_compile before do_install
SSTATETASKS += "do_gcc_stash_builddir"
do_gcc_stash_builddir[sstate-inputdirs] = "${BUILDDIRSTASH}"
do_gcc_stash_builddir[sstate-outputdirs] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
do_gcc_stash_builddir[sstate-fixmedir] = "${COMPONENTS_DIR}/${BUILD_ARCH}/gcc-stashed-builddir-${TARGET_SYS}"
python do_gcc_stash_builddir_setscene () {
sstate_setscene(d)
}
addtask do_gcc_stash_builddir_setscene

View File

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

View File

@@ -0,0 +1,14 @@
inherit crosssdk
PN = "gcc-crosssdk-${SDK_SYS}"
SYSTEMHEADERS = "${SDKPATHNATIVE}${prefix_nativesdk}/include"
SYSTEMLIBS = "${SDKPATHNATIVE}${base_libdir_nativesdk}/"
SYSTEMLIBS1 = "${SDKPATHNATIVE}${libdir_nativesdk}/"
GCCMULTILIB = "--disable-multilib"
DEPENDS = "virtual/${TARGET_PREFIX}binutils gettext-native ${NATIVEDEPS}"
PROVIDES = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++"
gcc_multilib_setup[vardepsexclude] = "MULTILIB_VARIANTS"

View File

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

View File

@@ -0,0 +1,249 @@
# following code modifies these definitions in the gcc config
# MULTILIB_OPTIONS
# MULTILIB_DIRNAMES
# MULTILIB_OSDIRNAMES
# GLIBC_DYNAMIC_LINKER32
# GLIBC_DYNAMIC_LINKER64
# GLIBC_DYNAMIC_LINKERX32
# GLIBC_DYNAMIC_LINKERN32
# For more information on use of these variables look at these files in the gcc source code
# gcc/config/i386/t-linux64
# gcc/config/mips/t-linux64
# gcc/config/rs6000/t-linux64
# gcc/config/i386/linux64.h
# gcc/config/mips/linux64.h
# gcc/config/rs6000/linux64.h
MULTILIB_OPTION_WHITELIST ??= "-m32 -m64 -mx32 -mabi=n32 -mabi=32 -mabi=64"
python gcc_multilib_setup() {
import re
import shutil
import glob
srcdir = d.getVar('S')
builddir = d.getVar('B')
src_conf_dir = '%s/gcc/config' % srcdir
build_conf_dir = '%s/gcc/config' % builddir
bb.utils.remove(build_conf_dir, True)
ml_globs = ('%s/*/t-linux64' % src_conf_dir,
'%s/*/linux64.h' % src_conf_dir,
'%s/aarch64/t-aarch64' % src_conf_dir,
'%s/aarch64/aarch64.h' % src_conf_dir,
'%s/aarch64/aarch64-linux.h' % src_conf_dir,
'%s/aarch64/aarch64-cores.def' % src_conf_dir,
'%s/arm/linux-eabi.h' % src_conf_dir,
'%s/*/linux.h' % src_conf_dir,
'%s/linux.h' % src_conf_dir)
# copy the target multilib config files to ${B}
for ml_glob in ml_globs:
for fn in glob.glob(ml_glob):
rel_path = os.path.relpath(fn, src_conf_dir)
parent_dir = os.path.dirname(rel_path)
bb.utils.mkdirhier('%s/%s' % (build_conf_dir, parent_dir))
bb.utils.copyfile(fn, '%s/%s' % (build_conf_dir, rel_path))
pn = d.getVar('PN')
multilibs = (d.getVar('MULTILIB_VARIANTS') or '').split()
if not multilibs and pn != "nativesdk-gcc":
return
mlprefix = d.getVar('MLPREFIX')
if ('%sgcc' % mlprefix) != pn and (not pn.startswith('gcc-cross-canadian')) and pn != "nativesdk-gcc":
return
def write_config(root, files, options, dirnames, osdirnames):
for ml_conf_file in files:
with open(root + '/' + ml_conf_file, 'r') as f:
filelines = f.readlines()
# recreate multilib configuration variables
substs = [
(r'^(\s*(MULTILIB_OPTIONS\s*=).*)$', r'\2 %s' % '/'.join(options)),
(r'^(\s*MULTILIB_OPTIONS\s*\+=.*)$', ''),
(r'^(\s*(MULTILIB_DIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(dirnames)),
(r'^(\s*MULTILIB_DIRNAMES\s*\+=.*)$', ''),
(r'^(\s*(MULTILIB_OSDIRNAMES\s*=).*)$', r'\2 %s' % ' '.join(osdirnames)),
(r'^(\s*MULTILIB_OSDIRNAMES\s*\+=.*)$', ''),
]
for (i, line) in enumerate(filelines):
for subst in substs:
line = re.sub(subst[0], subst[1], line)
filelines[i] = line
with open(root + '/' + ml_conf_file, 'w') as f:
f.write(''.join(filelines))
def write_headers(root, files, libdir32, libdir64, libdirx32, libdirn32):
def wrap_libdir(libdir):
if libdir.find('SYSTEMLIBS_DIR') != -1:
return '"%r"'
else:
return '"/%s/"' % libdir
for ml_conf_file in files:
fn = root + '/' + ml_conf_file
if not os.path.exists(fn):
continue
with open(fn, 'r') as f:
filelines = f.readlines()
# replace lines like
# #define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
# by
# #define GLIBC_DYNAMIC_LINKER32 "/lib/" "ld-linux.so.2"
# this is needed to put the correct dynamic loader path in the generated binaries
substs = [
(r'^(#define\s*GLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\"\S+\")$',
r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKER64\s*\"\S+\"\s*)(\S+)(\s*\"\S+\"\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir64) + r'\3' + wrap_libdir(libdir64) + r'\5'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*GLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirn32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKERN32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirn32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*UCLIBC_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER64\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir64) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKERX32\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdirx32) + r'\3'),
(r'^(#define\s*MUSL_DYNAMIC_LINKER\b\s*)(\S+)(\s*\".*\")$',
r'\1' + wrap_libdir(libdir32) + r'\3'),
]
for (i, line) in enumerate(filelines):
for subst in substs:
line = re.sub(subst[0], subst[1], line)
filelines[i] = line
with open(root + '/' + ml_conf_file, 'w') as f:
f.write(''.join(filelines))
gcc_target_config_files = {
'x86_64' : ['gcc/config/i386/t-linux64'],
'i586' : ['gcc/config/i386/t-linux64'],
'i686' : ['gcc/config/i386/t-linux64'],
'mips' : ['gcc/config/mips/t-linux64'],
'mips64' : ['gcc/config/mips/t-linux64'],
'powerpc' : ['gcc/config/rs6000/t-linux64'],
'powerpc64' : ['gcc/config/rs6000/t-linux64'],
'aarch64' : ['gcc/config/aarch64/t-aarch64'],
'arm' : ['gcc/config/aarch64/t-aarch64'],
}
gcc_header_config_files = {
'x86_64' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
'i586' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
'i686' : ['gcc/config/linux.h', 'gcc/config/i386/linux.h', 'gcc/config/i386/linux64.h'],
'mips' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
'mips64' : ['gcc/config/linux.h', 'gcc/config/mips/linux.h', 'gcc/config/mips/linux64.h'],
'powerpc' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
'powerpc64' : ['gcc/config/linux.h', 'gcc/config/rs6000/linux64.h'],
'aarch64' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
'arm' : ['gcc/config/linux.h', 'gcc/config/aarch64/aarch64-linux.h', 'gcc/config/arm/linux-eabi.h'],
}
libdir32 = 'SYSTEMLIBS_DIR'
libdir64 = 'SYSTEMLIBS_DIR'
libdirx32 = 'SYSTEMLIBS_DIR'
libdirn32 = 'SYSTEMLIBS_DIR'
target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix
else d.getVar('TARGET_ARCH'))
if pn == "nativesdk-gcc":
header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH")]
write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
return
if target_arch not in gcc_target_config_files:
bb.warn('gcc multilib setup is not supported for TARGET_ARCH=' + target_arch)
return
target_config_files = gcc_target_config_files[target_arch]
header_config_files = gcc_header_config_files[target_arch]
ml_list = ['DEFAULTTUNE_MULTILIB_ORIGINAL' if mlprefix else 'DEFAULTTUNE']
mltunes = [('DEFAULTTUNE:virtclass-multilib-%s' % ml) for ml in multilibs]
if mlprefix:
mlindex = 0
for ml in multilibs:
if mlprefix == ml + '-':
break
mlindex += 1
ml_list.extend(mltunes[:mlindex] + ['DEFAULTTUNE'] + mltunes[(mlindex + 1):])
else:
ml_list.extend(mltunes)
options = []
dirnames = []
osdirnames = []
optsets = []
for ml in ml_list:
tune = d.getVar(ml)
if not tune:
bb.warn("%s doesn't have a corresponding tune. Skipping..." % ml)
continue
tune_parameters = get_tune_parameters(tune, d)
tune_baselib = tune_parameters['baselib']
if not tune_baselib:
bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
continue
if tune_baselib == 'lib64':
libdir64 = tune_baselib
elif tune_baselib == 'libx32':
libdirx32 = tune_baselib
elif tune_baselib == 'lib32':
libdirn32 = tune_baselib
elif tune_baselib == 'lib':
libdir32 = tune_baselib
else:
bb.error('Unknown libdir (%s) of the tune : %s' % (tune_baselib, tune))
# take out '-' mcpu='s and march='s from parameters
opts = []
whitelist = (d.getVar("MULTILIB_OPTION_WHITELIST") or "").split()
for i in d.expand(tune_parameters['ccargs']).split():
if i in whitelist:
# Need to strip '-' from option
opts.append(i[1:])
options.append(" ".join(opts))
if tune_baselib == 'lib':
dirnames.append('32') # /lib => 32bit lib
else:
dirnames.append(tune_baselib.replace('lib', ''))
osdirnames.append('../' + tune_baselib)
write_config(builddir, target_config_files, options, dirnames, osdirnames)
write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32)
}
gcc_multilib_setup[cleandirs] = "${B}/gcc/config"
gcc_multilib_setup[vardepsexclude] = "SDK_ARCH"
EXTRACONFFUNCS += "gcc_multilib_setup"

View File

@@ -0,0 +1,320 @@
require gcc-configure-common.inc
SUMMARY = "Runtime libraries from GCC"
# Over-ride the LICENSE set by gcc-${PV}.inc to remove "& GPLv3"
# All gcc-runtime packages are now covered by the runtime exception.
LICENSE = "GPL-3.0-with-GCC-exception"
CXXFLAGS:remove = "-fvisibility-inlines-hidden"
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=${includedir}/c++/${BINV} \
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
EXTRA_OECONF:append = " --cache-file=${B}/config.cache"
EXTRA_OECONF:append:libc-newlib = " --with-newlib --with-target-subdir"
EXTRA_OECONF:append:libc-baremetal = " --with-target-subdir"
# Disable ifuncs for libatomic on arm conflicts -march/-mcpu
EXTRA_OECONF:append:arm = " libat_cv_have_ifunc=no "
EXTRA_OECONF:append:armeb = " libat_cv_have_ifunc=no "
DISABLE_STATIC:class-nativesdk ?= ""
# Newlib does not support symbol versioning on libsdtcc++
SYMVERS_CONF:libc-newlib = ""
# Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm"
RUNTIMELIBITM = "libitm"
RUNTIMELIBITM:arc = ""
RUNTIMELIBITM:mipsarch = ""
RUNTIMELIBITM:nios2 = ""
RUNTIMELIBITM:microblaze = ""
RUNTIMELIBITM:riscv32 = ""
RUNTIMELIBITM:riscv64 = ""
RUNTIMELIBITM:loongarch64 = ""
RUNTIMELIBSSP ?= ""
RUNTIMELIBSSP:mingw32 ?= "libssp"
RUNTIMETARGET = "${RUNTIMELIBSSP} libstdc++-v3 libgomp libatomic ${RUNTIMELIBITM} \
${@bb.utils.contains_any('FORTRAN', [',fortran',',f77'], 'libquadmath', '', d)} \
"
# Only build libstdc++ for newlib
RUNTIMETARGET:libc-newlib = "libstdc++-v3"
# libiberty
# libgfortran needs separate recipe due to libquadmath dependency
do_configure () {
export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib"
# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
# tests. Create a dummy empty lib for the purposes of configure.
mkdir -p ${WORKDIR}/dummylib
${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o
${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o
for d in libgcc ${RUNTIMETARGET}; do
echo "Configuring $d"
rm -rf ${B}/${TARGET_SYS}/$d/
mkdir -p ${B}/${TARGET_SYS}/$d/
cd ${B}/${TARGET_SYS}/$d/
chmod a+x ${S}/$d/configure
${S}/$d/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
if [ "$d" = "libgcc" ]; then
(cd ${B}/${TARGET_SYS}/libgcc; oe_runmake enable-execute-stack.c unwind.h md-unwind-support.h sfp-machine.h gthr-default.h)
fi
done
}
EXTRACONFFUNCS += "extract_stashed_builddir"
do_configure[depends] += "${COMPILERDEP}"
do_compile () {
for d in libgcc ${RUNTIMETARGET}; do
cd ${B}/${TARGET_SYS}/$d/
oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/
done
}
do_install () {
for d in ${RUNTIMETARGET}; do
cd ${B}/${TARGET_SYS}/$d/
oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/$d/ install
done
install -d ${D}${datadir}/gdb/auto-load/${libdir}
mv ${D}${libdir}/libstdc++*-gdb.py ${D}${datadir}/gdb/auto-load/${libdir}
if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
fi
rm -rf ${D}${infodir}/libgomp.info* ${D}${infodir}/dir
rm -rf ${D}${infodir}/libitm.info ${D}${infodir}/dir
rm -rf ${D}${infodir}/libquadmath.info ${D}${infodir}/dir
if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
fi
if [ -d ${D}${infodir} ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
fi
if [ -d ${D}${libdir} ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${libdir}
fi
}
do_install:append:class-target () {
if [ "${TARGET_OS}" = "linux-gnuspe" ]; then
ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
fi
if [ "${TARGET_OS}" = "linux-gnun32" ]; then
if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/32
elif [ "${MULTILIB_VARIANTS}" != "" ]; then
mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
else
ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
fi
elif [ "${TARGET_OS}" = "linux-gnux32" ]; then
if [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux
ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-linux/x32
elif [ "${MULTILIB_VARIANTS}" != "" ]; then
mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
ln -s ../${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux/32
else
ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-linux
fi
elif [ "${TARGET_VENDOR_MULTILIB_ORIGINAL}" != "" -a "${TARGET_VENDOR}" != "${TARGET_VENDOR_MULTILIB_ORIGINAL}" ]; then
mkdir ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}
ln -s ../${TARGET_SYS}/bits ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/bits
ln -s ../${TARGET_SYS}/ext ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR_MULTILIB_ORIGINAL}-${TARGET_OS}/ext
fi
if [ "${TARGET_ARCH}" = "x86_64" -a "${MULTILIB_VARIANTS}" != "" ];then
ln -sf ../${X86ARCH32}${TARGET_VENDOR}-${TARGET_OS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}/32
fi
if [ "${TCLIBC}" != "glibc" ]; then
case "${TARGET_OS}" in
"linux-musl" | "linux-*spe") extra_target_os="linux";;
"linux-musleabi") extra_target_os="linux-gnueabi";;
*) extra_target_os="linux";;
esac
ln -s ${TARGET_SYS} ${D}${includedir}/c++/${BINV}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
fi
chown -R root:root ${D}
}
INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ libgcc virtual/${MLPREFIX}libc"
PROVIDES = "virtual/${TARGET_PREFIX}compilerlibs"
BBCLASSEXTEND = "nativesdk"
PACKAGES = "\
${PN}-dbg \
libstdc++ \
libstdc++-precompile-dev \
libstdc++-dev \
libstdc++-staticdev \
libg2c \
libg2c-dev \
libssp \
libssp-dev \
libssp-staticdev \
libquadmath \
libquadmath-dev \
libquadmath-staticdev \
libgomp \
libgomp-dev \
libgomp-staticdev \
libatomic \
libatomic-dev \
libatomic-staticdev \
libitm \
libitm-dev \
libitm-staticdev \
"
# The base package doesn't exist, so we clear the recommends.
RRECOMMENDS:${PN}-dbg = ""
# include python debugging scripts
FILES:${PN}-dbg += "\
${datadir}/gcc-${BINV}/python/libstdcxx \
${datadir}/gdb/auto-load \
"
# Needed by libstdcxx pretty printer, however it is disabled intentionally
# as it adds build time dependency on bash and some cases e.g. no GPL3 cases
# bash is not availbale and builds fails
# So it needs to be added manually to images sadly.
# RDEPENDS:${PN}-dbg += "python3-datetime"
FILES:libg2c = "${target_libdir}/libg2c.so.*"
SUMMARY:libg2c = "Companion runtime library for g77"
FILES:libg2c-dev = "\
${libdir}/libg2c.so \
${libdir}/libg2c.a \
${libdir}/libfrtbegin.a \
"
SUMMARY:libg2c-dev = "Companion runtime library for g77 - development files"
FILES:libstdc++ = "${libdir}/libstdc++.so.*"
SUMMARY:libstdc++ = "GNU standard C++ library"
FILES:libstdc++-dev = "\
${includedir}/c++/ \
${libdir}/libstdc++.so \
${libdir}/libstdc++*.la \
${libdir}/libsupc++.la \
"
SUMMARY:libstdc++-dev = "GNU standard C++ library - development files"
FILES:libstdc++-staticdev = "\
${libdir}/libstdc++*.a \
${libdir}/libsupc++.a \
"
SUMMARY:libstdc++-staticdev = "GNU standard C++ library - static development files"
FILES:libstdc++-precompile-dev = "${includedir}/c++/${TARGET_SYS}/bits/*.gch"
SUMMARY:libstdc++-precompile-dev = "GNU standard C++ library - precompiled header files"
FILES:libssp = "${libdir}/libssp.so.*"
SUMMARY:libssp = "GNU stack smashing protection library"
FILES:libssp-dev = "\
${libdir}/libssp*.so \
${libdir}/libssp*_nonshared.a \
${libdir}/libssp*.la \
${libdir}/${TARGET_SYS}/${BINV}/include/ssp \
"
SUMMARY:libssp-dev = "GNU stack smashing protection library - development files"
FILES:libssp-staticdev = "${libdir}/libssp*.a"
SUMMARY:libssp-staticdev = "GNU stack smashing protection library - static development files"
FILES:libquadmath = "${libdir}/libquadmath*.so.*"
SUMMARY:libquadmath = "GNU quad-precision math library"
FILES:libquadmath-dev = "\
${libdir}/${TARGET_SYS}/${BINV}/include/quadmath* \
${libdir}/libquadmath*.so \
${libdir}/libquadmath.la \
"
SUMMARY:libquadmath-dev = "GNU quad-precision math library - development files"
FILES:libquadmath-staticdev = "${libdir}/libquadmath.a"
SUMMARY:libquadmath-staticdev = "GNU quad-precision math library - static development files"
FILES:libgomp = "${libdir}/libgomp*${SOLIBS}"
SUMMARY:libgomp = "GNU OpenMP parallel programming library"
FILES:libgomp-dev = "\
${libdir}/libgomp*${SOLIBSDEV} \
${libdir}/libgomp*.la \
${libdir}/libgomp.spec \
${libdir}/${TARGET_SYS}/${BINV}/include/acc_prof.h \
${libdir}/${TARGET_SYS}/${BINV}/include/omp.h \
${libdir}/${TARGET_SYS}/${BINV}/include/openacc.h \
"
SUMMARY:libgomp-dev = "GNU OpenMP parallel programming library - development files"
FILES:libgomp-staticdev = "${libdir}/libgomp*.a"
SUMMARY:libgomp-staticdev = "GNU OpenMP parallel programming library - static development files"
FILES:libatomic = "${libdir}/libatomic.so.*"
SUMMARY:libatomic = "GNU C++11 atomics support library"
FILES:libatomic-dev = "\
${libdir}/libatomic.so \
${libdir}/libatomic.la \
"
SUMMARY:libatomic-dev = "GNU C++11 atomics support library - development files"
FILES:libatomic-staticdev = "${libdir}/libatomic.a"
SUMMARY:libatomic-staticdev = "GNU C++11 atomics support library - static development files"
FILES:libitm = "${libdir}/libitm.so.*"
SUMMARY:libitm = "GNU transactional memory support library"
FILES:libitm-dev = "\
${libdir}/libitm.so \
${libdir}/libitm.la \
${libdir}/libitm.spec \
"
SUMMARY:libitm-dev = "GNU transactional memory support library - development files"
FILES:libitm-staticdev = "${libdir}/libitm.a"
SUMMARY:libitm-staticdev = "GNU transactional memory support library - static development files"
require gcc-testsuite.inc
EXTRA_OEMAKE:prepend:task-check = "${PARALLEL_MAKE} "
MAKE_CHECK_TARGETS ??= "check-gcc ${@" ".join("check-target-" + i for i in d.getVar("RUNTIMETARGET").split())}"
# prettyprinters and xmethods require gdb tooling
MAKE_CHECK_IGNORE ??= "prettyprinters.exp xmethods.exp"
MAKE_CHECK_RUNTESTFLAGS ??= "${MAKE_CHECK_BOARDARGS} --ignore '${MAKE_CHECK_IGNORE}'"
# specific host and target dependencies required for test suite running
do_check[depends] += "dejagnu-native:do_populate_sysroot expect-native:do_populate_sysroot"
do_check[depends] += "virtual/libc:do_populate_sysroot"
# only depend on qemu if targeting linux user execution
do_check[depends] += "${@'qemu-native:do_populate_sysroot' if "user" in d.getVar('TOOLCHAIN_TEST_TARGET') else ''}"
# extend the recipe sysroot to include the built libraries (for qemu usermode)
do_check[prefuncs] += "extend_recipe_sysroot"
do_check[prefuncs] += "check_prepare"
do_check[dirs] = "${WORKDIR}/dejagnu ${B}"
do_check[nostamp] = "1"
do_check() {
export DEJAGNU="${WORKDIR}/dejagnu/site.exp"
# HACK: this works around the configure setting CXX with -nostd* args
sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1)
if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then
# qemu user has issues allocating large amounts of memory
export G_SLICE=always-malloc
# no test should need more that 10G of memory, this prevents tests like pthread7-rope from leaking memory
ulimit -m 4194304
ulimit -v 10485760
fi
oe_runmake -i ${MAKE_CHECK_TARGETS} RUNTESTFLAGS="${MAKE_CHECK_RUNTESTFLAGS}"
}
addtask check after do_compile do_populate_sysroot

View File

@@ -0,0 +1,2 @@
require recipes-devtools/gcc/gcc-${PV}.inc
require gcc-runtime.inc

View File

@@ -0,0 +1,121 @@
require gcc-configure-common.inc
LICENSE = "NCSA | MIT"
LIC_FILES_CHKSUM = "\
file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \
"
EXTRA_OECONF_PATHS = "\
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
do_configure () {
rm -rf ${B}/${TARGET_SYS}/libsanitizer/
mkdir -p ${B}/${TARGET_SYS}/libsanitizer/
cd ${B}/${TARGET_SYS}/libsanitizer/
chmod a+x ${S}/libsanitizer/configure
relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")}
$relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
# Easiest way to stop bad RPATHs getting into the library since we have a
# broken libtool here
sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool
# Link to the sysroot's libstdc++ instead of one gcc thinks it just built
sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile
}
EXTRACONFFUNCS += "extract_stashed_builddir"
do_configure[depends] += "${COMPILERDEP}"
do_compile () {
cd ${B}/${TARGET_SYS}/libsanitizer/
oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/
}
do_install () {
cd ${B}/${TARGET_SYS}/libsanitizer/
oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install
if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then
install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include
mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include
rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include
fi
if [ -d ${D}${infodir} ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
fi
chown -R root:root ${D}
}
INHIBIT_DEFAULT_DEPS = "1"
ALLOW_EMPTY:${PN} = "1"
DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc"
# 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]
DEBUG_OPTIMIZATION:append = " -Wno-error"
BBCLASSEXTEND = "nativesdk"
PACKAGES = "${PN} ${PN}-dbg"
PACKAGES += "libasan libubsan liblsan libtsan"
PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
RDEPENDS:libasan += "libstdc++"
RDEPENDS:libubsan += "libstdc++"
RDEPENDS:liblsan += "libstdc++"
RDEPENDS:libtsan += "libstdc++"
RDEPENDS:libasan-dev += "${PN}"
RDEPENDS:libubsan-dev += "${PN}"
RDEPENDS:liblsan-dev += "${PN}"
RDEPENDS:libtsan-dev += "${PN}"
RRECOMMENDS:${PN} += "libasan libubsan"
RRECOMMENDS:${PN}:append:x86 = " liblsan"
RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan"
RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan"
RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan"
do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
# Only x86, powerpc, sparc, s390, arm, aarch64 and loongarch64 are supported
COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64|loongarch64).*-linux'
# musl is currently broken entirely
COMPATIBLE_HOST:libc-musl = 'null'
FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*"
FILES:libasan-dev += "\
${libdir}/libasan_preinit.o \
${libdir}/libhwasan_preinit.o \
${libdir}/libasan.so \
${libdir}/libhwasan.so \
${libdir}/libasan.la \
"
FILES:libasan-staticdev += "${libdir}/libasan.a \
${libdir}/libhwasan.a \
"
FILES:libubsan += "${libdir}/libubsan.so.*"
FILES:libubsan-dev += "\
${libdir}/libubsan.so \
${libdir}/libubsan.la \
"
FILES:libubsan-staticdev += "${libdir}/libubsan.a"
FILES:liblsan += "${libdir}/liblsan.so.*"
FILES:liblsan-dev += "\
${libdir}/liblsan.so \
${libdir}/liblsan.la \
${libdir}/liblsan_preinit.o \
"
FILES:liblsan-staticdev += "${libdir}/liblsan.a"
FILES:libtsan += "${libdir}/libtsan.so.*"
FILES:libtsan-dev += "\
${libdir}/libtsan.so \
${libdir}/libtsan.la \
${libdir}/libtsan_*.o \
"
FILES:libtsan-staticdev += "${libdir}/libtsan.a"
FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"

View File

@@ -0,0 +1,7 @@
require recipes-devtools/gcc/gcc-${PV}.inc
require gcc-sanitizers.inc
# Building with thumb enabled on armv4t armv5t fails with
# sanitizer_linux.s:5749: Error: lo register required -- `ldr ip,[sp],#8'
ARM_INSTRUCTION_SET:armv4 = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"

View File

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

View File

@@ -0,0 +1,45 @@
deltask do_configure
deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
RM_WORK_EXCLUDE += "${PN}"
inherit nopackages
PN = "gcc-source-${PV}"
WORKDIR = "${TMPDIR}/work-shared/gcc-${PV}-${PR}"
SSTATE_SWSPEC = "sstate:gcc::${PV}:${PR}::${SSTATE_VERSION}:"
STAMP = "${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}"
STAMPCLEAN = "${STAMPS_DIR}/work-shared/gcc-${PV}-*"
INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = ""
PACKAGES = ""
TARGET_ARCH = "allarch"
TARGET_AS_ARCH = "none"
TARGET_CC_ARCH = "none"
TARGET_LD_ARCH = "none"
TARGET_OS = "linux"
baselib = "lib"
PACKAGE_ARCH = "all"
B = "${WORKDIR}/build"
# This needs to be Python to avoid lots of shell variables becoming dependencies.
python do_preconfigure () {
import subprocess
cmd = d.expand('cd ${S} && PATH=${PATH} gnu-configize')
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
cmd = d.expand("sed -i 's/BUILD_INFO=info/BUILD_INFO=/' ${S}/gcc/configure")
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
# Easiest way to stop bad RPATHs getting into the library since we have a
# broken libtool here (breaks cross-canadian and target at least)
cmd = d.expand("sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${S}/libcc1/configure")
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
}
addtask do_preconfigure after do_patch
do_preconfigure[depends] += "gnu-config-native:do_populate_sysroot autoconf-native:do_populate_sysroot"

View File

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

View File

@@ -0,0 +1,218 @@
GCCMULTILIB = "--enable-multilib"
require gcc-configure-common.inc
EXTRA_OECONF_PATHS = "\
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
EXTRA_OECONF:append:linuxstdbase = " --enable-clocale=gnu"
# Configure gcc running on the target to default to an architecture which will
# be compatible with that of gcc-runtime (which is cross compiled to be target
# specific). For example, for ARM, ARMv6+ adds atomic instructions that may
# affect the ABI in the gcc-runtime libs. Since we can't rely on gcc on the
# target to always be passed -march etc, its built-in default needs to be safe.
ARMFPARCHEXT ?= ""
EXTRA_OECONF:append:armv6:class-target = " --with-arch=armv6${ARMFPARCHEXT}"
EXTRA_OECONF:append:armv7a:class-target = " --with-arch=armv7-a${ARMFPARCHEXT}"
EXTRA_OECONF:append:armv7ve:class-target = " --with-arch=armv7ve${ARMFPARCHEXT}"
EXTRA_OECONF:append:arc:class-target = " --with-cpu=${TUNE_PKGARCH}"
EXTRA_OECONF:append:x86-64:class-target = " ${@get_gcc_x86_64_arch_setting(bb, d)}"
# libcc1 requres gcc_cv_objdump when cross build, but gcc_cv_objdump is
# set in subdir gcc, so subdir libcc1 can't use it, export it here to
# fix the problem.
export gcc_cv_objdump = "${TARGET_PREFIX}objdump"
EXTRA_OECONF_GCC_FLOAT = "${@get_gcc_float_setting(bb, d)}"
PACKAGES = "\
${PN} ${PN}-plugins ${PN}-symlinks \
g++ g++-symlinks \
cpp cpp-symlinks \
g77 g77-symlinks \
gfortran gfortran-symlinks \
gcov gcov-symlinks \
${PN}-doc \
${PN}-dev \
${PN}-dbg \
"
FILES:${PN} = "\
${bindir}/${TARGET_PREFIX}gcc* \
${bindir}/${TARGET_PREFIX}lto* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/collect2* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/g++-mapper-server \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lto* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto*${SOLIBSDEV} \
${gcclibdir}/${TARGET_SYS}/${BINV}/*.o \
${gcclibdir}/${TARGET_SYS}/${BINV}/specs \
${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBS} \
${gcclibdir}/${TARGET_SYS}/${BINV}/include \
${gcclibdir}/${TARGET_SYS}/${BINV}/include-fixed \
${libdir}/bfd-plugins/*.so \
"
INSANE_SKIP:${PN} += "dev-so"
RRECOMMENDS:${PN} += "\
libssp \
libssp-dev \
"
RDEPENDS:${PN} += "cpp"
FILES:${PN}-dev = "\
${gcclibdir}/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/lib*${SOLIBSDEV} \
${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/include/ \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/plugin/gengtype \
${gcclibdir}/${TARGET_SYS}/${BINV}/plugin/gtype.state \
"
FILES:${PN}-symlinks = "\
${bindir}/cc \
${bindir}/gcc \
${bindir}/gccbug \
"
FILES:${PN}-plugins = "\
${gcclibdir}/${TARGET_SYS}/${BINV}/plugin \
"
ALLOW_EMPTY:${PN}-plugins = "1"
FILES:g77 = "\
${bindir}/${TARGET_PREFIX}g77 \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f771 \
"
FILES:g77-symlinks = "\
${bindir}/g77 \
${bindir}/f77 \
"
RRECOMMENDS:g77 = "\
libg2c \
libg2c-dev \
"
FILES:gfortran = "\
${bindir}/${TARGET_PREFIX}gfortran \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/f951 \
"
RRECOMMENDS:gfortran = "\
libquadmath \
libquadmath-dev \
"
FILES:gfortran-symlinks = "\
${bindir}/gfortran \
${bindir}/f95"
FILES:cpp = "\
${bindir}/${TARGET_PREFIX}cpp* \
${base_libdir}/cpp \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1"
FILES:cpp-symlinks = "${bindir}/cpp"
FILES:gcov = "${bindir}/${TARGET_PREFIX}gcov* \
${bindir}/${TARGET_PREFIX}gcov-tool* \
"
FILES:gcov-symlinks = "${bindir}/gcov \
${bindir}/gcov-tool \
"
FILES:g++ = "\
${bindir}/${TARGET_PREFIX}g++* \
${libexecdir}/gcc/${TARGET_SYS}/${BINV}/cc1plus \
"
FILES:g++-symlinks = "\
${bindir}/c++ \
${bindir}/g++ \
"
RRECOMMENDS:g++ = "\
libstdc++ \
libstdc++-dev \
libatomic \
libatomic-dev \
"
FILES:${PN}-doc = "\
${infodir} \
${mandir} \
${gcclibdir}/${TARGET_SYS}/${BINV}/include/README \
"
do_compile () {
remove_sysroot_paths_from_configargs '/'
remove_sysroot_paths_from_checksum_options '${STAGING_DIR_TARGET}' '/'
oe_runmake all-host
}
do_install () {
oe_runmake 'DESTDIR=${D}' install-host
# Add unwind.h, it comes from libgcc which we don't want to build again
install ${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/gcc/${TARGET_SYS}/${BINV}/include/unwind.h ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
# Cleanup some of the ${libdir}{,exec}/gcc stuff ...
rm -r ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
rm -r ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/install-tools
rm -rf ${D}${libexecdir}/gcc/${TARGET_SYS}/${BINV}/*.la
rmdir ${D}${includedir}
rm -rf ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
# Hack around specs file assumptions
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
# Cleanup manpages..
rm -rf ${D}${mandir}/man7
# Don't package details about the build host
rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/auto-build.h
rm -f ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/plugin/include/bconfig.h
cd ${D}${bindir}
# We care about g++ not c++
rm -f *c++*
# We don't care about the gcc-<version> ones for this
rm -f *gcc-?*.?*
# Not sure why we end up with these but we don't want them...
rm -f ${TARGET_PREFIX}${TARGET_PREFIX}*
# Symlinks so we can use these trivially on the target
if [ -e ${TARGET_PREFIX}g77 ]; then
ln -sf ${TARGET_PREFIX}g77 g77 || true
ln -sf g77 f77 || true
fi
if [ -e ${TARGET_PREFIX}gfortran ]; then
ln -sf ${TARGET_PREFIX}gfortran gfortran || true
ln -sf gfortran f95 || true
fi
ln -sf ${TARGET_PREFIX}g++ g++
ln -sf ${TARGET_PREFIX}gcc gcc
ln -sf ${TARGET_PREFIX}cpp cpp
ln -sf ${TARGET_PREFIX}gcov gcov
ln -sf ${TARGET_PREFIX}gcov-tool gcov-tool
install -d ${D}${base_libdir}
ln -sf ${bindir}/${TARGET_PREFIX}cpp ${D}${base_libdir}/cpp
ln -sf g++ c++
ln -sf gcc cc
install -d ${D}${libdir}/bfd-plugins
ln -sf ${libexecdir}/gcc/${TARGET_SYS}/${BINV}/liblto_plugin.so ${D}${libdir}/bfd-plugins/liblto_plugin.so
chown -R root:root ${D}
cleanup_installed_include_fixed
}
# Installing /usr/lib/gcc/* means we'd have two copies, one from gcc-cross
# and one from here. These can confuse gcc cross where includes use #include_next
# and builds track file dependencies (e.g. perl and its makedepends code).
# For determinism we don't install this ever and rely on the copy from gcc-cross.
# [YOCTO #7287]
SYSROOT_DIRS_IGNORE += "${libdir}/gcc"

View File

@@ -0,0 +1,112 @@
inherit qemu
TOOLCHAIN_TEST_TARGET ??= "user"
TOOLCHAIN_TEST_HOST ??= "localhost"
TOOLCHAIN_TEST_HOST_USER ??= "root"
TOOLCHAIN_TEST_HOST_PORT ??= "2222"
MAKE_CHECK_BOARDFLAGS ??= ""
MAKE_CHECK_BOARDARGS ??= "--target_board=${TOOLCHAIN_TEST_TARGET}${MAKE_CHECK_BOARDFLAGS}"
python () {
# Provide the targets compiler args via targets options. This allows dejagnu to
# correctly mark incompatible tests as UNSUPPORTED (e.g. needs soft-float
# but running on hard-float target).
#
# These options are called "multilib_flags" within the gcc test suite. Most
# architectures handle these options in a sensible way such that tests that
# are incompatible with the provided multilib are marked as UNSUPPORTED.
#
# Note: multilib flags are added to the compile command after the args
# provided by any test (through dg-options), CFLAGS_FOR_TARGET is always
# added to the compile command before any other args but is not interpted
# as options like multilib flags.
#
# i686, x86-64 and aarch64 are special, since most toolchains built for
# these targets don't do multilib the tests do not get correctly marked as
# UNSUPPORTED. More importantly the test suite itself does not handle
# overriding the multilib flags where it could (like other archs do). As
# such do not pass the target compiler args for these targets.
args = d.getVar("TUNE_CCARGS").split()
if d.getVar("TUNE_ARCH") in ["i686", "x86_64", "aarch64"]:
args = []
d.setVar("MAKE_CHECK_BOARDFLAGS", ("/" + "/".join(args)) if len(args) != 0 else "")
}
python check_prepare() {
def generate_qemu_linux_user_config(d):
content = []
content.append('load_generic_config "sim"')
content.append('load_base_board_description "basic-sim"')
content.append('process_multilib_options ""')
# qemu args
qemu_binary = qemu_target_binary(d)
if not qemu_binary:
bb.fatal("Missing target qemu linux-user binary")
args = []
# QEMU_OPTIONS is not always valid due to -cross recipe
args += ["-r", d.getVar("OLDEST_KERNEL")]
# enable all valid instructions, since the test suite itself does not
# limit itself to the target cpu options.
# - valid for x86*, powerpc, arm, arm64
if qemu_binary.endswith(("x86_64", "i386", "arm", "aarch64")):
args += ["-cpu", "max"]
else:
extra = d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('TUNE_PKGARCH'))
if extra:
args += extra.split()
# For mips64 we could set a maximal CPU (e.g. Loongson-3A4000) however they either have MSA
# or Loongson-MMI vector extensions, not both and qemu lacks complete support for MMI
sysroot = d.getVar("RECIPE_SYSROOT")
args += ["-L", sysroot]
# lib paths are static here instead of using $libdir since this is used by a -cross recipe
libpaths = [sysroot + "/usr/lib", sysroot + "/lib"]
args += ["-E", "LD_LIBRARY_PATH={0}".format(":".join(libpaths))]
content.append('set_board_info is_simulator 1')
content.append('set_board_info sim "{0}"'.format(qemu_binary))
content.append('set_board_info sim,options "{0}"'.format(" ".join(args)))
# target build/test config
content.append('set_board_info target_install {%s}' % d.getVar("TARGET_SYS"))
content.append('set_board_info ldscript ""')
#content.append('set_board_info needs_status_wrapper 1') # qemu-linux-user return codes work, and abort works fine
content.append('set_board_info gcc,stack_size 16834')
content.append('set_board_info gdb,nosignals 1')
content.append('set_board_info gcc,timeout 60')
return "\n".join(content)
def generate_remote_ssh_linux_config(d):
content = []
content.append('load_generic_config "unix"')
content.append('process_multilib_options ""')
content.append("set_board_info hostname {0}".format(d.getVar("TOOLCHAIN_TEST_HOST")))
content.append("set_board_info username {0}".format(d.getVar("TOOLCHAIN_TEST_HOST_USER")))
port = d.getVar("TOOLCHAIN_TEST_HOST_PORT")
content.append("set_board_info rsh_prog \"/usr/bin/ssh -p {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
content.append("set_board_info rcp_prog \"/usr/bin/scp -P {0} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no\"".format(port))
return "\n".join(content)
dejagnudir = d.expand("${WORKDIR}/dejagnu")
if not os.path.isdir(dejagnudir):
os.makedirs(dejagnudir)
# write out target qemu board config
with open(os.path.join(dejagnudir, "user.exp"), "w") as f:
f.write(generate_qemu_linux_user_config(d))
# write out target ssh board config
with open(os.path.join(dejagnudir, "ssh.exp"), "w") as f:
f.write(generate_remote_ssh_linux_config(d))
# generate site.exp to provide boards
with open(os.path.join(dejagnudir, "site.exp"), "w") as f:
f.write("lappend boards_dir {0}\n".format(dejagnudir))
f.write("set CFLAGS_FOR_TARGET \"{0}\"\n".format(d.getVar("TOOLCHAIN_OPTIONS")))
}

View File

@@ -0,0 +1,39 @@
From 553564bdcabdcc5d4cc4de73c7eb94c505ef51f5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 08:37:11 +0400
Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Inappropriate [embedded specific]
---
configure | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 117a7ef23f2..535265253fd 100755
--- a/configure
+++ b/configure
@@ -10195,7 +10195,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
-FLAGS_FOR_TARGET=
+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
case " $target_configdirs " in
*" newlib "*)
case " $target_configargs " in
diff --git a/configure.ac b/configure.ac
index b3e9bbd2aa5..5ac8d6490f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3351,7 +3351,7 @@ fi
# for target_alias and gcc doesn't manage it consistently.
target_configargs="--cache-file=./config.cache ${target_configargs}"
-FLAGS_FOR_TARGET=
+FLAGS_FOR_TARGET="$ARCH_FLAGS_FOR_TARGET"
case " $target_configdirs " in
*" newlib "*)
case " $target_configargs " in

View File

@@ -0,0 +1,226 @@
From 52676b5934ba127c3af39fc484c8236c8fa60b96 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 8 Mar 2021 16:04:20 -0800
Subject: [PATCH] gcc: poison-system-directories
Add /sw/include and /opt/include based on the original
zecke-no-host-includes.patch patch. The original patch checked for
/usr/include, /sw/include and /opt/include and then triggered a failure and
aborted.
Instead, we add the two missing items to the current scan. If the user
wants this to be a failure, they can add "-Werror=poison-system-directories".
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/common.opt | 4 ++++
gcc/config.in | 10 ++++++++++
gcc/configure | 19 +++++++++++++++++++
gcc/configure.ac | 16 ++++++++++++++++
gcc/doc/invoke.texi | 9 +++++++++
gcc/gcc.cc | 9 +++++++--
gcc/incpath.cc | 21 +++++++++++++++++++++
7 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index 862c474d3c8..64c4277c991 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -711,6 +711,10 @@ Wreturn-local-addr
Common Var(warn_return_local_addr) Init(1) Warning
Warn about returning a pointer/reference to a local or temporary variable.
+Wpoison-system-directories
+Common Var(flag_poison_system_directories) Init(1) Warning
+Warn for -I and -L options using system directories if cross compiling
+
Wshadow
Common Var(warn_shadow) Warning
Warn when one variable shadows another. Same as -Wshadow=global.
diff --git a/gcc/config.in b/gcc/config.in
index 4cad077bfbe..80e832fdb84 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -236,6 +236,16 @@
#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_POISON_SYSTEM_DIRECTORIES
+#endif
+/* Define to warn for use of native system header directories */
+#ifndef USED_FOR_TARGET
+#undef POISON_BY_DEFAULT
+#endif
+
+
/* Define if you want all operations on RTL (the basic data structure of the
optimizer and back end) to be checked for dynamic type safety at runtime.
This is quite expensive. */
diff --git a/gcc/configure b/gcc/configure
index c7b26d1927d..3508be7b439 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1026,6 +1026,7 @@ enable_maintainer_mode
enable_link_mutex
enable_link_serialization
enable_version_specific_runtime_libs
+enable_poison_system_directories
enable_plugin
enable_host_shared
enable_libquadmath_support
@@ -1788,6 +1789,8 @@ Optional Features:
--enable-version-specific-runtime-libs
specify that runtime libraries should be installed
in a compiler-specific directory
+ --enable-poison-system-directories
+ warn for use of native system header directories
--enable-plugin enable plugin support
--enable-host-shared build host code as shared libraries
--disable-libquadmath-support
@@ -31753,6 +31756,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
fi
+# Check whether --enable-poison-system-directories was given.
+if test "${enable_poison_system_directories+set}" = set; then :
+ enableval=$enable_poison_system_directories;
+else
+ enable_poison_system_directories=no
+fi
+
+if test "x${enable_poison_system_directories}" != "xno"; then
+
+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h
+if test "$enable_poison_system_directories" = "error"; then
+$as_echo "#define POISON_BY_DEFAULT 1" >>confdefs.h
+fi
+
+fi
+
# Substitute configuration variables
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 09082e8ccae..6cd01a8966b 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -7292,6 +7292,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[specify that runtime libraries should be
installed in a compiler-specific directory])])
+AC_ARG_ENABLE([poison-system-directories],
+ AS_HELP_STRING([--enable-poison-system-directories],
+ [warn for use of native system header directories (no/yes/error)]),,
+ [enable_poison_system_directories=no])
+AC_MSG_NOTICE([poisoned directories $enable_poison_system_directories])
+if test "x${enable_poison_system_directories}" != "xno"; then
+ AC_MSG_NOTICE([poisoned directories enabled])
+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES],
+ [1],
+ [Define to warn for use of native system header directories])
+ if test $enable_poison_system_directories = "error"; then
+ AC_MSG_NOTICE([poisoned directories are fatal])
+ AC_DEFINE([POISON_BY_DEFAULT], [1], [Define to make poison warnings errors])
+ fi
+fi
+
# Substitute configuration variables
AC_SUBST(subdirs)
AC_SUBST(srcdir)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index de40f62e219..d6f203c8b71 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -384,6 +384,7 @@ Objective-C and Objective-C++ Dialects}.
-Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
-Wparentheses -Wno-pedantic-ms-format
-Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast
+-Wno-poison-system-directories
-Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls
-Wrestrict -Wno-return-local-addr -Wreturn-type
-Wno-scalar-storage-order -Wsequence-point
@@ -8426,6 +8427,14 @@ made up of data only and thus requires no special treatment. But, for
most targets, it is made up of code and thus requires the stack to be
made executable in order for the program to work properly.
+@opindex Wno-poison-system-directories
+@item -Wno-poison-system-directories
+Do not warn for @option{-I} or @option{-L} options using system
+directories such as @file{/usr/include} when cross compiling. This
+option is intended for use in chroot environments when such
+directories contain the correct headers and libraries for the target
+system rather than the host.
+
@opindex Wfloat-equal
@opindex Wno-float-equal
@item -Wfloat-equal
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 16bb07f2cdc..5feae021545 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1146,6 +1146,8 @@ proper position among the other output files. */
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
+ %{Wno-poison-system-directories:--no-poison-system-directories} \
+ %{Werror=poison-system-directories:--error-poison-system-directories} \
%{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
%{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
@@ -1241,8 +1243,11 @@ static const char *cpp_unique_options =
static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
- %{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{!fno-working-directory:-fworking-directory}}} %{O*}"
+#ifdef POISON_BY_DEFAULT
+ " -Werror=poison-system-directories"
+#endif
+ " %{undef} %{save-temps*:-fpch-preprocess}";
/* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index 4d44321183f..46c0d543205 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -26,6 +26,7 @@
#include "intl.h"
#include "incpath.h"
#include "cppdefault.h"
+#include "diagnostic-core.h"
/* Microsoft Windows does not natively support inodes.
VMS has non-numeric inodes. */
@@ -399,6 +400,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose)
}
fprintf (stderr, _("End of search list.\n"));
}
+
+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES
+ if (flag_poison_system_directories)
+ {
+ struct cpp_dir *p;
+
+ for (p = heads[INC_QUOTE]; p; p = p->next)
+ {
+ if ((!strncmp (p->name, "/usr/include", 12))
+ || (!strncmp (p->name, "/usr/local/include", 18))
+ || (!strncmp (p->name, "/usr/X11R6/include", 18))
+ || (!strncmp (p->name, "/sw/include", 11))
+ || (!strncmp (p->name, "/opt/include", 12)))
+ warning (OPT_Wpoison_system_directories,
+ "include location \"%s\" is unsafe for "
+ "cross-compilation",
+ p->name);
+ }
+ }
+#endif
}
/* Use given -I paths for #include "..." but not #include <...>, and

View File

@@ -0,0 +1,201 @@
From febfac59d0e8a864370d0b4018b4e497ceec156d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:10:06 +0400
Subject: [PATCH] 64-bit multilib hack
GCC has internal multilib handling code but it assumes a very specific rigid directory
layout. The build system implementation of multilib layout is very generic and allows
complete customisation of the library directories.
This patch is a partial solution to allow any custom directories to be passed into gcc
and handled correctly. It forces gcc to use the base_libdir (which is the current
directory, "."). We need to do this for each multilib that is configured as we don't
know which compiler options may be being passed into the compiler. Since we have a compiler
per mulitlib at this point that isn't an issue.
The one problem is the target compiler is only going to work for the default multlilib at
this point. Ideally we'd figure out which multilibs were being enabled with which paths
and be able to patch these entries with a complete set of correct paths but this we
don't have such code at this point. This is something the target gcc recipe should do
and override these platform defaults in its build config.
Do same for riscv64, aarch64 & arc
RP 15/8/11
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Elvis Dowson <elvis.dowson@gmail.com>
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Zang Ruochen <zangruochen@loongson.cn>
---
gcc/config/aarch64/t-aarch64-linux | 8 ++++----
gcc/config/arc/t-multilib-linux | 4 ++--
gcc/config/i386/t-linux64 | 6 ++----
gcc/config/mips/t-linux64 | 28 ++--------------------------
gcc/config/riscv/t-linux | 4 ++--
gcc/config/rs6000/t-linux64 | 5 ++---
gcc/config/loongarch/t-linux | 34 ++++++++++++++++++----------------
7 files changed, 32 insertions(+), 57 deletions(-)
diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux
index 57bf4100fcd..aaef5da8059 100644
--- a/gcc/config/aarch64/t-aarch64-linux
+++ b/gcc/config/aarch64/t-aarch64-linux
@@ -21,8 +21,8 @@
LIB1ASMSRC = aarch64/lib1funcs.asm
LIB1ASMFUNCS = _aarch64_sync_cache_range
-AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
-MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+#AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+#MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+#MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
-MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+#MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
diff --git a/gcc/config/arc/t-multilib-linux b/gcc/config/arc/t-multilib-linux
index a839e4ea67c..f92664573a9 100644
--- a/gcc/config/arc/t-multilib-linux
+++ b/gcc/config/arc/t-multilib-linux
@@ -16,9 +16,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
+#MULTILIB_OPTIONS = mcpu=hs/mcpu=archs/mcpu=hs38/mcpu=hs38_linux/mcpu=arc700/mcpu=nps400
-MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
+#MULTILIB_DIRNAMES = hs archs hs38 hs38_linux arc700 nps400
# Aliases:
MULTILIB_MATCHES += mcpu?arc700=mA7
diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64
index 138956b0962..d6e0cdc4342 100644
--- a/gcc/config/i386/t-linux64
+++ b/gcc/config/i386/t-linux64
@@ -32,7 +32,5 @@
#
comma=,
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
-MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
-MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+MULTILIB_DIRNAMES = . .
+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64
index 176091cabb6..8258ef40559 100644
--- a/gcc/config/mips/t-linux64
+++ b/gcc/config/mips/t-linux64
@@ -17,29 +17,5 @@
# <http://www.gnu.org/licenses/>.
MULTILIB_OPTIONS = mabi=n32/mabi=32/mabi=64
-MULTILIB_DIRNAMES = n32 32 64
-MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
-MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
-ifeq (yes,$(enable_multiarch))
- ifneq (,$(findstring gnuabi64,$(target)))
- MULTILIB_OSDIRNAMES = \
- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
- ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
- ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
- else ifneq (,$(findstring gnuabin32,$(target)))
- MULTILIB_OSDIRNAMES = \
- ../lib$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
- ../libo32$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
- else
- MULTILIB_OSDIRNAMES = \
- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
- endif
-else
- MULTILIB_OSDIRNAMES = \
- ../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
- ../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
- ../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
-endif
+MULTILIB_DIRNAMES = . . .
+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux
index 216d2776a18..e3c520f4bf6 100644
--- a/gcc/config/riscv/t-linux
+++ b/gcc/config/riscv/t-linux
@@ -1,3 +1,3 @@
# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/
-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
+#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES)))
+#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES))
diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64
index 01a94242308..1429eceaebf 100644
--- a/gcc/config/rs6000/t-linux64
+++ b/gcc/config/rs6000/t-linux64
@@ -26,10 +26,9 @@
# MULTILIB_OSDIRNAMES according to what is found on the target.
MULTILIB_OPTIONS := m64/m32
-MULTILIB_DIRNAMES := 64 32
+MULTILIB_DIRNAMES := . .
MULTILIB_EXTRA_OPTS :=
-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
+MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc
$(COMPILE) $<
diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux
index e40da1792..0c7ec9f8a 100644
--- a/gcc/config/loongarch/t-linux
+++ b/gcc/config/loongarch/t-linux
@@ -18,7 +18,9 @@
# Multilib
MULTILIB_OPTIONS = mabi=lp64d/mabi=lp64f/mabi=lp64s
-MULTILIB_DIRNAMES = base/lp64d base/lp64f base/lp64s
+#MULTILIB_DIRNAMES = base/lp64d base/lp64f base/lp64s
+MULTILIB_DIRNAMES = . . .
+MULTILIB_OSDIRNAMES = ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir))
# The GCC driver always gets all abi-related options on the command line.
# (see loongarch-driver.c:driver_get_normalized_m_opts)
@@ -36,18 +38,18 @@ else
endif
# Don't define MULTILIB_OSDIRNAMES if multilib is disabled.
-ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
-
- MULTILIB_OSDIRNAMES = \
- mabi.lp64d=../lib64$\
- $(call if_multiarch,:loongarch64-linux-gnu)
-
- MULTILIB_OSDIRNAMES += \
- mabi.lp64f=../lib64/f32$\
- $(call if_multiarch,:loongarch64-linux-gnuf32)
-
- MULTILIB_OSDIRNAMES += \
- mabi.lp64s=../lib64/sf$\
- $(call if_multiarch,:loongarch64-linux-gnusf)
-
-endif
+#ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),)
+#
+# MULTILIB_OSDIRNAMES = \
+# mabi.lp64d=../lib64$\
+# $(call if_multiarch,:loongarch64-linux-gnu)
+#
+# MULTILIB_OSDIRNAMES += \
+# mabi.lp64f=../lib64/f32$\
+# $(call if_multiarch,:loongarch64-linux-gnuf32)
+#
+# MULTILIB_OSDIRNAMES += \
+# mabi.lp64s=../lib64/sf$\
+# $(call if_multiarch,:loongarch64-linux-gnusf)
+#
+#endif

View File

@@ -0,0 +1,64 @@
From 6fbf920ccde6efc2d0caafde996d9e5738a1ba37 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Thu, 28 Oct 2021 11:33:40 +0100
Subject: [PATCH] Pass CXXFLAGS_FOR_BUILD in a couple of places to avoid these
errors.
If CXXFLAGS contains something unsupported by the build CXX, we see build failures (e.g. using -fmacro-prefix-map for the target).
2021-10-28 Richard Purdie <richard.purdie@linuxfoundation.org>
ChangeLog:
* Makefile.in: Regenerate.
* Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612560.html]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Makefile.in | 2 ++
Makefile.tpl | 2 ++
2 files changed, 4 insertions(+)
diff --git a/Makefile.in b/Makefile.in
index 06a9398e172..4b0069b257c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -178,6 +178,7 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
@@ -210,6 +211,7 @@ HOST_EXPORTS = \
CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
LD="$(LD)"; export LD; \
diff --git a/Makefile.tpl b/Makefile.tpl
index dfbd74b68f8..419b332953b 100644
--- a/Makefile.tpl
+++ b/Makefile.tpl
@@ -181,6 +181,7 @@ BUILD_EXPORTS = \
# built for the build system to override those in BASE_FLAGS_TO_PASS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.
@@ -213,6 +214,7 @@ HOST_EXPORTS = \
CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
+ CXXFLAGS_FOR_BUILD="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS_FOR_BUILD; \
DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
LD="$(LD)"; export LD; \

View File

@@ -0,0 +1,92 @@
From 2cedf13819c0cc929660072d8a972f5e422f9701 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:17:25 +0400
Subject: [PATCH] Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}
Use the defaults.h in ${B} instead of ${S}, and t-oe in ${B}, so that
the source can be shared between gcc-cross-initial,
gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
While compiling gcc-crosssdk-initial-x86_64 on some host, there is
occasionally failure that test the existance of default.h doesn't
work, the reason is tm_include_list='** defaults.h' rather than
tm_include_list='** ./defaults.h'
So we add the test condition for this situation.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
gcc/Makefile.in | 2 +-
gcc/configure | 4 ++--
gcc/configure.ac | 4 ++--
gcc/mkconfig.sh | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 775aaa1b3c4..04f28984b34 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -561,7 +561,7 @@ TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
xmake_file=@xmake_file@
-tmake_file=@tmake_file@
+tmake_file=@tmake_file@ ./t-oe
TM_ENDIAN_CONFIG=@TM_ENDIAN_CONFIG@
TM_MULTILIB_CONFIG=@TM_MULTILIB_CONFIG@
TM_MULTILIB_EXCEPTIONS_CONFIG=@TM_MULTILIB_EXCEPTIONS_CONFIG@
diff --git a/gcc/configure b/gcc/configure
index 3508be7b439..cf773a8b854 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13507,8 +13507,8 @@ for f in $tm_file; do
tm_include_list="${tm_include_list} $f"
;;
defaults.h )
- tm_file_list="${tm_file_list} \$(srcdir)/$f"
- tm_include_list="${tm_include_list} $f"
+ tm_file_list="${tm_file_list} ./$f"
+ tm_include_list="${tm_include_list} ./$f"
;;
* )
tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6cd01a8966b..22591478b72 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2357,8 +2357,8 @@ for f in $tm_file; do
tm_include_list="${tm_include_list} $f"
;;
defaults.h )
- tm_file_list="${tm_file_list} \$(srcdir)/$f"
- tm_include_list="${tm_include_list} $f"
+ tm_file_list="${tm_file_list} ./$f"
+ tm_include_list="${tm_include_list} ./$f"
;;
* )
tm_file_list="${tm_file_list} \$(srcdir)/config/$f"
diff --git a/gcc/mkconfig.sh b/gcc/mkconfig.sh
index 054ede89647..3b2c2b9df37 100644
--- a/gcc/mkconfig.sh
+++ b/gcc/mkconfig.sh
@@ -77,7 +77,7 @@ if [ -n "$HEADERS" ]; then
if [ $# -ge 1 ]; then
echo '#ifdef IN_GCC' >> ${output}T
for file in "$@"; do
- if test x"$file" = x"defaults.h"; then
+ if test x"$file" = x"./defaults.h" -o x"$file" = x"defaults.h"; then
postpone_defaults_h="yes"
else
echo "# include \"$file\"" >> ${output}T
@@ -106,7 +106,7 @@ esac
# If we postponed including defaults.h, add the #include now.
if test x"$postpone_defaults_h" = x"yes"; then
- echo "# include \"defaults.h\"" >> ${output}T
+ echo "# include \"./defaults.h\"" >> ${output}T
fi
# Add multiple inclusion protection guard, part two.

View File

@@ -0,0 +1,53 @@
From f0b4d02a3a3dca1d67fd7add15ed63c2cd572bb9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:22:00 +0400
Subject: [PATCH] cpp: honor sysroot.
Currently, if the gcc toolchain is relocated and installed from sstate, then you try and compile
preprocessed source (.i or .ii files), the compiler will try and access the builtin sysroot location
rather than the --sysroot option specified on the commandline. If access to that directory is
permission denied (unreadable), gcc will error.
This happens when ccache is in use due to the fact it uses preprocessed source files.
The fix below adds %I to the cpp-output spec macro so the default substitutions for -iprefix,
-isystem, -isysroot happen and the correct sysroot is used.
[YOCTO #2074]
RP 2012/04/13
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/cp/lang-specs.h | 2 +-
gcc/gcc.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/cp/lang-specs.h b/gcc/cp/lang-specs.h
index c591d155cc1..61927869fe1 100644
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -116,7 +116,7 @@ along with GCC; see the file COPYING3. If not see
{".ii", "@c++-cpp-output", 0, 0, 0},
{"@c++-cpp-output",
"%{!E:%{!M:%{!MM:"
- " cc1plus -fpreprocessed %i %(cc1_options) %2"
+ " cc1plus -fpreprocessed %i %I %(cc1_options) %2"
" %{!fsyntax-only:"
" %{fmodule-only:%{!S:-o %g.s%V}}"
" %{!fmodule-only:%{!fmodule-header*:%(invoke_as)}}}"
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 5feae021545..8af0c814c33 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -1468,7 +1468,7 @@ static const struct compiler default_compilers[] =
%W{o*:--output-pch %*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0},
{"@cpp-output",
- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %I %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{".s", "@assembler", 0, 0, 0},
{"@assembler",
"%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},

View File

@@ -0,0 +1,408 @@
From 4067ae345f0ff1fbf37c0348f2af09257513b817 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:24:50 +0400
Subject: [PATCH] Define GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
relative to SYSTEMLIBS_DIR
This patch defines GLIBC_DYNAMIC_LINKER and UCLIBC_DYNAMIC_LINKER
relative to SYSTEMLIBS_DIR which can be set in generated headers
This breaks the assumption of hardcoded multilib in gcc
Change is only for the supported architectures in OE including
SH, sparc, alpha for possible future support (if any)
Removes the do_headerfix task in metadata
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/aarch64/aarch64-linux.h | 4 ++--
gcc/config/alpha/linux-elf.h | 4 ++--
gcc/config/arm/linux-eabi.h | 6 +++---
gcc/config/arm/linux-elf.h | 2 +-
gcc/config/i386/linux.h | 4 ++--
gcc/config/i386/linux64.h | 12 ++++++------
gcc/config/linux.h | 8 ++++----
gcc/config/loongarch/gnu-user.h | 4 ++--
gcc/config/microblaze/linux.h | 4 ++--
gcc/config/mips/linux.h | 18 +++++++++---------
gcc/config/nios2/linux.h | 4 ++--
gcc/config/riscv/linux.h | 4 ++--
gcc/config/rs6000/linux64.h | 15 +++++----------
gcc/config/rs6000/sysv4.h | 4 ++--
gcc/config/s390/linux.h | 8 ++++----
gcc/config/sh/linux.h | 4 ++--
gcc/config/sparc/linux.h | 2 +-
gcc/config/sparc/linux64.h | 4 ++--
18 files changed, 53 insertions(+), 58 deletions(-)
diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h
index 4277f03da2a..e4c92c03291 100644
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -21,10 +21,10 @@
#ifndef GCC_AARCH64_LINUX_H
#define GCC_AARCH64_LINUX_H
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
#undef MUSL_DYNAMIC_LINKER
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
#undef ASAN_CC1_SPEC
#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"
diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h
index 03f783f2ad1..4fa02668aa7 100644
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3. If not see
#define EXTRA_SPECS \
{ "elf_dynamic_linker", ELF_DYNAMIC_LINKER },
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
#elif DEFAULT_LIBC == LIBC_GLIBC
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index a119875599d..dce7f59eeea 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -62,8 +62,8 @@
GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
#undef GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
-#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT SYSTEMLIBS_DIR "ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT SYSTEMLIBS_DIR "ld-linux-armhf.so.3"
#define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
#define GLIBC_DYNAMIC_LINKER \
@@ -86,7 +86,7 @@
#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
#endif
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h
index 7b7b7cbbe14..98ef2267117 100644
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -60,7 +60,7 @@
#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
%{static:-Bstatic} \
diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h
index bbb7cc7115e..7d9272040ee 100644
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -20,7 +20,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#define GNU_USER_LINK_EMULATION "elf_i386"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
#undef MUSL_DYNAMIC_LINKER
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-i386.so.1"
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h
index 2bd9f48e271..dbbe7ca5440 100644
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -27,13 +27,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GNU_USER_LINK_EMULATION64 "elf_x86_64"
#define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-linux-x32.so.2"
#undef MUSL_DYNAMIC_LINKER32
-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-i386.so.1"
#undef MUSL_DYNAMIC_LINKER64
-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-x86_64.so.1"
#undef MUSL_DYNAMIC_LINKERX32
-#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+#define MUSL_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ld-musl-x32.so.1"
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index e3aca79cccc..6491c6b84f5 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -86,10 +86,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
GLIBC_DYNAMIC_LINKER must be defined for each target using them, or
GLIBC_DYNAMIC_LINKER32 and GLIBC_DYNAMIC_LINKER64 for targets
supporting both 32-bit and 64-bit compilation. */
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
-#define UCLIBC_DYNAMIC_LINKERX32 "/lib/ldx32-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64-uClibc.so.0"
+#define UCLIBC_DYNAMIC_LINKERX32 SYSTEMLIBS_DIR "ldx32-uClibc.so.0"
#define BIONIC_DYNAMIC_LINKER "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
index aecaa02a199..62f88f7f9a2 100644
--- a/gcc/config/loongarch/gnu-user.h
+++ b/gcc/config/loongarch/gnu-user.h
@@ -31,16 +31,16 @@ along with GCC; see the file COPYING3. If not see
#undef GLIBC_DYNAMIC_LINKER
#define GLIBC_DYNAMIC_LINKER \
- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1"
#define MUSL_ABI_SPEC \
"%{mabi=lp64d:}" \
"%{mabi=lp64f:-sp}" \
"%{mabi=lp64s:-sf}"
#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1"
+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1"
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC \
diff --git a/gcc/config/microblaze/linux.h b/gcc/config/microblaze/linux.h
index 5ed8ee518be..299d1a62c81 100644
--- a/gcc/config/microblaze/linux.h
+++ b/gcc/config/microblaze/linux.h
@@ -28,7 +28,7 @@
#undef TLS_NEEDS_GOT
#define TLS_NEEDS_GOT 1
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */
@@ -38,7 +38,7 @@
#endif
#undef MUSL_DYNAMIC_LINKER
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1"
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index 5add34ea134..34692b433b8 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -22,29 +22,29 @@ along with GCC; see the file COPYING3. If not see
#define GNU_USER_LINK_EMULATIONN32 "elf32%{EB:b}%{EL:l}tsmipn32"
#define GLIBC_DYNAMIC_LINKER32 \
- "%{mnan=2008:/lib/ld-linux-mipsn8.so.1;:/lib/ld.so.1}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
#define GLIBC_DYNAMIC_LINKER64 \
- "%{mnan=2008:/lib64/ld-linux-mipsn8.so.1;:/lib64/ld.so.1}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
#define GLIBC_DYNAMIC_LINKERN32 \
- "%{mnan=2008:/lib32/ld-linux-mipsn8.so.1;:/lib32/ld.so.1}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-linux-mipsn8.so.1;:" SYSTEMLIBS_DIR "ld.so.1}"
#undef UCLIBC_DYNAMIC_LINKER32
#define UCLIBC_DYNAMIC_LINKER32 \
- "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
#undef UCLIBC_DYNAMIC_LINKER64
#define UCLIBC_DYNAMIC_LINKER64 \
- "%{mnan=2008:/lib/ld64-uClibc-mipsn8.so.0;:/lib/ld64-uClibc.so.0}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld64-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld64-uClibc.so.0}"
#define UCLIBC_DYNAMIC_LINKERN32 \
- "%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
+ "%{mnan=2008:" SYSTEMLIBS_DIR "ld-uClibc-mipsn8.so.0;:" SYSTEMLIBS_DIR "ld-uClibc.so.0}"
#undef MUSL_DYNAMIC_LINKER32
#define MUSL_DYNAMIC_LINKER32 \
- "/lib/ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-mips%{mips32r6|mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
#undef MUSL_DYNAMIC_LINKER64
#define MUSL_DYNAMIC_LINKER64 \
- "/lib/ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-mips64%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
#define MUSL_DYNAMIC_LINKERN32 \
- "/lib/ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-mipsn32%{mips64r6:r6}%{EL:el}%{msoft-float:-sf}.so.1"
#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
#define GNU_USER_DYNAMIC_LINKERN32 \
diff --git a/gcc/config/nios2/linux.h b/gcc/config/nios2/linux.h
index 2ce097ebbce..1d45d7b4962 100644
--- a/gcc/config/nios2/linux.h
+++ b/gcc/config/nios2/linux.h
@@ -29,10 +29,10 @@
#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-nios2.so.1"
#undef MUSL_DYNAMIC_LINKER
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1"
+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-nios2.so.1"
#undef LINK_SPEC
#define LINK_SPEC LINK_SPEC_ENDIAN \
diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
index 3e625e0f867..dc3afc97e27 100644
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
} while (0)
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-riscv" XLEN_SPEC "-" ABI_SPEC ".so.1"
#define MUSL_ABI_SUFFIX \
"%{mabi=ilp32:-sf}" \
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
"%{mabi=lp64d:}"
#undef MUSL_DYNAMIC_LINKER
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
+#define MUSL_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-musl-riscv" XLEN_SPEC MUSL_ABI_SUFFIX ".so.1"
#define ICACHE_FLUSH_FUNC "__riscv_flush_icache"
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 9e457033d11..2ddab7c99c1 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -339,24 +339,19 @@ extern int dot_symbols;
#undef LINK_OS_DEFAULT_SPEC
#define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
-#define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
-
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
#ifdef LINUX64_DEFAULT_ABI_ELFv2
-#define GLIBC_DYNAMIC_LINKER64 \
-"%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
-":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:" SYSTEMLIBS_DIR "ld64.so.1;:" SYSTEMLIBS_DIR "ld64.so.2}"
#else
-#define GLIBC_DYNAMIC_LINKER64 \
-"%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
-":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
+#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:" SYSTEMLIBS_DIR "ld64.so.2;:" SYSTEMLIBS_DIR "ld64.so.1}"
#endif
#undef MUSL_DYNAMIC_LINKER32
#define MUSL_DYNAMIC_LINKER32 \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#undef MUSL_DYNAMIC_LINKER64
#define MUSL_DYNAMIC_LINKER64 \
- "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#undef DEFAULT_ASM_ENDIAN
#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index ae932fc22f0..26db003cb3a 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -771,10 +771,10 @@ GNU_USER_TARGET_CC1_SPEC
#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld.so.1"
#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+ SYSTEMLIBS_DIR "ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#ifndef GNU_USER_DYNAMIC_LINKER
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h
index 02aa1edaff8..fab268d61f4 100644
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -72,13 +72,13 @@ along with GCC; see the file COPYING3. If not see
#define MULTILIB_DEFAULTS { "m31" }
#endif
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
-#define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld.so.1"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld64.so.1"
#undef MUSL_DYNAMIC_LINKER32
-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390.so.1"
+#define MUSL_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-musl-s390.so.1"
#undef MUSL_DYNAMIC_LINKER64
-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1"
+#define MUSL_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-musl-s390x.so.1"
#undef LINK_SPEC
#define LINK_SPEC \
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
index 29f5902b98b..83d1e53e6e2 100644
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -61,10 +61,10 @@ along with GCC; see the file COPYING3. If not see
#undef MUSL_DYNAMIC_LINKER
#define MUSL_DYNAMIC_LINKER \
- "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
+ SYSTEMLIBS_DIR "ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP \
"%{mfdpic:-fdpic}.so.1"
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
#undef SUBTARGET_LINK_EMUL_SUFFIX
#define SUBTARGET_LINK_EMUL_SUFFIX "%{mfdpic:_fd;:_linux}"
diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h
index 0e33b3cac2c..84f29adbb35 100644
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -78,7 +78,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
When the -shared link option is used a final link is not being
done. */
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux.so.2"
#undef LINK_SPEC
#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
diff --git a/gcc/config/sparc/linux64.h b/gcc/config/sparc/linux64.h
index f1cc0a19e49..94bc2032803 100644
--- a/gcc/config/sparc/linux64.h
+++ b/gcc/config/sparc/linux64.h
@@ -78,8 +78,8 @@ along with GCC; see the file COPYING3. If not see
When the -shared link option is used a final link is not being
done. */
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER32 SYSTEMLIBS_DIR "ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 SYSTEMLIBS_DIR "ld-linux.so.2"
#ifdef SPARC_BI_ARCH

View File

@@ -0,0 +1,38 @@
From 7608e93ab97e8c33e3b14323d0cabc651926e403 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:29:11 +0400
Subject: [PATCH] libtool
libstdc++ from gcc-runtime gets created with -rpath=/usr/lib/../lib for qemux86-64
when running on am x86_64 build host.
This patch stops this speading to libdir in the libstdc++.la file within libtool.
Arguably, it shouldn't be passing this into libtool in the first place but
for now this resolves the nastiest problems this causes.
func_normal_abspath would resolve an empty path to `pwd` so we need
to filter the zero case.
RP 2012/8/24
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/libtool-patches/2023-04/msg00000.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ltmain.sh b/ltmain.sh
index 70990740b6c..ee938056bef 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -6359,6 +6359,10 @@ func_mode_link ()
func_warning "ignoring multiple \`-rpath's for a libtool library"
install_libdir="$1"
+ if test -n "$install_libdir"; then
+ func_normal_abspath "$install_libdir"
+ install_libdir=$func_normal_abspath_result
+ fi
oldlibs=
if test -z "$rpath"; then

View File

@@ -0,0 +1,39 @@
From 4b0efc18e0d91967a3db11d9ef0595a5a76ad67a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:30:32 +0400
Subject: [PATCH] gcc: armv4: pass fix-v4bx to linker to support EABI.
The LINK_SPEC for linux gets overwritten by linux-eabi.h which
means the value of TARGET_FIX_V4BX_SPEC gets lost and as a result
the option is not passed to linker when chosing march=armv4
This patch redefines this in linux-eabi.h and reinserts it
for eabi defaulting toolchains.
We might want to send it upstream.
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615319.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/arm/linux-eabi.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index dce7f59eeea..27402c629c6 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -88,10 +88,14 @@
#define MUSL_DYNAMIC_LINKER \
SYSTEMLIBS_DIR "ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}%{mfdpic:-fdpic}.so.1"
+/* For armv4 we pass --fix-v4bx to linker to support EABI */
+#undef TARGET_FIX_V4BX_SPEC
+#define TARGET_FIX_V4BX_SPEC "%{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4: --fix-v4bx}"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC
-#define LINK_SPEC EABI_LINK_SPEC \
+#define LINK_SPEC TARGET_FIX_V4BX_SPEC EABI_LINK_SPEC \
LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)

View File

@@ -0,0 +1,99 @@
From b015460586e2ea8a35a11d1a607728707bdf6509 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 29 Mar 2013 09:33:04 +0400
Subject: [PATCH] Use the multilib config files from ${B} instead of using the
ones from ${S}
Use the multilib config files from ${B} instead of using the ones from ${S}
so that the source can be shared between gcc-cross-initial,
gcc-cross-intermediate, gcc-cross, gcc-runtime, and also the sdk build.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Upstream-Status: Inappropriate [configuration]
---
gcc/configure | 22 ++++++++++++++++++----
gcc/configure.ac | 22 ++++++++++++++++++----
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/gcc/configure b/gcc/configure
index cf773a8b854..448a1ec093e 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13487,10 +13487,20 @@ done
tmake_file_=
for f in ${tmake_file}
do
- if test -f ${srcdir}/config/$f
- then
- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
- fi
+ case $f in
+ */t-linux64 )
+ if test -f ./config/$f
+ then
+ tmake_file_="${tmake_file_} ./config/$f"
+ fi
+ ;;
+ * )
+ if test -f ${srcdir}/config/$f
+ then
+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
+ fi
+ ;;
+ esac
done
tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
@@ -13501,6 +13511,10 @@ tm_file_list="options.h"
tm_include_list="options.h insn-constants.h"
for f in $tm_file; do
case $f in
+ */linux64.h )
+ tm_file_list="${tm_file_list} ./config/$f"
+ tm_include_list="${tm_include_list} ./config/$f"
+ ;;
./* )
f=`echo $f | sed 's/^..//'`
tm_file_list="${tm_file_list} $f"
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 22591478b72..b6e7f5149a7 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2337,10 +2337,20 @@ done
tmake_file_=
for f in ${tmake_file}
do
- if test -f ${srcdir}/config/$f
- then
- tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
- fi
+ case $f in
+ */t-linux64 )
+ if test -f ./config/$f
+ then
+ tmake_file_="${tmake_file_} ./config/$f"
+ fi
+ ;;
+ * )
+ if test -f ${srcdir}/config/$f
+ then
+ tmake_file_="${tmake_file_} \$(srcdir)/config/$f"
+ fi
+ ;;
+ esac
done
tmake_file="${tmake_file_}${omp_device_property_tmake_file}"
@@ -2351,6 +2361,10 @@ tm_file_list="options.h"
tm_include_list="options.h insn-constants.h"
for f in $tm_file; do
case $f in
+ */linux64.h )
+ tm_file_list="${tm_file_list} ./config/$f"
+ tm_include_list="${tm_include_list} ./config/$f"
+ ;;
./* )
f=`echo $f | sed 's/^..//'`
tm_file_list="${tm_file_list} $f"

View File

@@ -0,0 +1,55 @@
From b7ce05b2d969b311c6061bda32c3117c76bf7e0c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 31 Jan 2023 22:03:38 -0800
Subject: [PATCH] aarch64: Fix include paths when S != B
aarch64.h gets copied into build directory when built out of tree, in
this case build uses this file but does not find the includes inside it
since they are not found in any of include paths specified in compiler
cmdline.
Fixes build errors like
% 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
In file included from ./tm.h:34,
from ../../../../../../../work-shared/gcc-13.0.1-r0/gcc-b2ec2504af77b35e748067eeb846821d12a6b6b4/gcc/gencheck.cc:23:
./config/aarch64/aarch64.h:164:10: fatal error: aarch64-option-extensions.def: No such file or directory
164 | #include "aarch64-option-extensions.def"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105144
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/aarch64/aarch64.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 73b09e20508..10ea3672f20 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -161,8 +161,8 @@
enum class aarch64_feature : unsigned char {
#define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) IDENT,
#define AARCH64_ARCH(A, B, IDENT, D, E) IDENT,
-#include "aarch64-option-extensions.def"
-#include "aarch64-arches.def"
+#include "config/aarch64/aarch64-option-extensions.def"
+#include "config/aarch64/aarch64-arches.def"
};
/* Define unique flags for each of the above. */
@@ -171,8 +171,8 @@ enum class aarch64_feature : unsigned char {
= aarch64_feature_flags (1) << int (aarch64_feature::IDENT);
#define AARCH64_OPT_EXTENSION(A, IDENT, C, D, E, F) HANDLE (IDENT)
#define AARCH64_ARCH(A, B, IDENT, D, E) HANDLE (IDENT)
-#include "aarch64-option-extensions.def"
-#include "aarch64-arches.def"
+#include "config/aarch64/aarch64-option-extensions.def"
+#include "config/aarch64/aarch64-arches.def"
#undef HANDLE
#endif

View File

@@ -0,0 +1,28 @@
From 39ab6fe76f2788b2c989d29c9016f1fe53cb736e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 09:39:38 +0000
Subject: [PATCH] Avoid using libdir from .la which usually points to a host
path
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ltmain.sh b/ltmain.sh
index ee938056bef..9ebc7e3d1e0 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -5628,6 +5628,9 @@ func_mode_link ()
absdir="$abs_ladir"
libdir="$abs_ladir"
else
+ # Instead of using libdir from .la which usually points to a host path,
+ # use the path the .la is contained in.
+ libdir="$abs_ladir"
dir="$libdir"
absdir="$libdir"
fi

View File

@@ -0,0 +1,113 @@
From 531b9df680c4380797e8e7705a8e7f8ed17ebe68 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 20 Feb 2015 10:25:11 +0000
Subject: [PATCH] Ensure target gcc headers can be included
There are a few headers installed as part of the OpenEmbedded
gcc-runtime target (omp.h, ssp/*.h). Being installed from a recipe
built for the target architecture, these are within the target
sysroot and not cross/nativesdk; thus they weren't able to be
found by gcc with the existing search paths. Add support for
picking up these headers under the sysroot supplied on the gcc
command line in order to resolve this.
Extend target gcc headers search to musl too
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/Makefile.in | 2 ++
gcc/config/linux.h | 8 ++++++++
gcc/config/rs6000/sysv4.h | 8 ++++++++
gcc/cppdefault.cc | 4 ++++
4 files changed, 22 insertions(+)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 04f28984b34..8ef996c0f4d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -640,6 +640,7 @@ libexecdir = @libexecdir@
# Directory in which the compiler finds libraries etc.
libsubdir = $(libdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
+libsubdir_target = $(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(real_target_noncanonical)/$(version)$(accel_dir_suffix)
# Directory in which all plugin resources are installed
@@ -3059,6 +3060,7 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
PREPROCESSOR_DEFINES = \
-DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
+ -DGCC_INCLUDE_SUBDIR_TARGET=\"$(libsubdir_target)/include\" \
-DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
-DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 6491c6b84f5..57496ff1f2f 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -157,6 +157,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
+#endif
+
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
@@ -183,6 +190,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
INCLUDE_DEFAULTS_MUSL_PREFIX \
INCLUDE_DEFAULTS_MUSL_CROSS \
INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 26db003cb3a..3a443abcf6b 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -986,6 +986,13 @@ ncrtn.o%s"
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
+#endif
+
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
@@ -1012,6 +1019,7 @@ ncrtn.o%s"
INCLUDE_DEFAULTS_MUSL_PREFIX \
INCLUDE_DEFAULTS_MUSL_CROSS \
INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
{ GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
index 141bb4d25f6..734590a7059 100644
--- a/gcc/cppdefault.cc
+++ b/gcc/cppdefault.cc
@@ -64,6 +64,10 @@ const struct default_include cpp_include_defaults[]
/* This is the dir for gcc's private headers. */
{ GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
#endif
+#ifdef GCC_INCLUDE_SUBDIR_TARGET
+ /* This is the dir for gcc's private headers under the specified sysroot. */
+ { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
{ LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },

View File

@@ -0,0 +1,35 @@
From 793201cebfeb129f6f263e64310b30a0ffa48895 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 3 Mar 2015 08:21:19 +0000
Subject: [PATCH] Don't search host directory during "relink" if $inst_prefix
is provided
http://lists.gnu.org/archive/html/libtool-patches/2011-01/msg00026.html
Upstream-Status: Submitted
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ltmain.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ltmain.sh b/ltmain.sh
index 9ebc7e3d1e0..7ea79fa8be6 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -6004,12 +6004,13 @@ func_mode_link ()
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
+ # Default if $libdir is not relative to the prefix:
add_dir="-L$libdir"
- # Try looking first in the location we're being installed to.
+
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
+ add_dir="-L$inst_prefix_dir$libdir"
;;
esac
fi

View File

@@ -0,0 +1,51 @@
From 5de63874335c1c673dd132f6aca00dc13f1eac51 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Sun, 5 Jul 2015 20:25:18 -0700
Subject: [PATCH] libcc1: fix libcc1's install path and rpath
* Install libcc1.so and libcc1plugin.so into
$(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version), as what we
had done to lto-plugin.
* Fix bad RPATH iussue:
gcc-5.2.0: package gcc-plugins contains bad RPATH /patht/to/tmp/sysroots/qemux86-64/usr/lib64/../lib64 in file
/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
[rpaths]
Upstream-Status: Inappropriate [OE configuration]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
libcc1/Makefile.am | 4 ++--
libcc1/Makefile.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcc1/Makefile.am b/libcc1/Makefile.am
index 921a33fe236..938e6f964cd 100644
--- a/libcc1/Makefile.am
+++ b/libcc1/Makefile.am
@@ -40,8 +40,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(Wc)$(libiberty_normal)))
libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
-cc1libdir = $(libdir)/$(libsuffix)
+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+plugindir = $(cc1libdir)
if ENABLE_PLUGIN
plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
diff --git a/libcc1/Makefile.in b/libcc1/Makefile.in
index f8f590d71e9..56462492045 100644
--- a/libcc1/Makefile.in
+++ b/libcc1/Makefile.in
@@ -396,8 +396,8 @@ libiberty = $(if $(wildcard $(libiberty_noasan)),$(Wc)$(libiberty_noasan), \
$(Wc)$(libiberty_normal)))
libiberty_dep = $(patsubst $(Wc)%,%,$(libiberty))
-plugindir = $(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/plugin
-cc1libdir = $(libdir)/$(libsuffix)
+cc1libdir = $(libexecdir)/gcc/$(target_noncanonical)/$(gcc_version)
+plugindir = $(cc1libdir)
@ENABLE_PLUGIN_TRUE@plugin_LTLIBRARIES = libcc1plugin.la libcp1plugin.la
@ENABLE_PLUGIN_TRUE@cc1lib_LTLIBRARIES = libcc1.la
shared_source = callbacks.cc callbacks.hh connection.cc connection.hh \

View File

@@ -0,0 +1,514 @@
From bbc75b93bff66891fa7ffb3af5c6ad53df1fff68 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:39:54 +0000
Subject: [PATCH] handle sysroot support for nativesdk-gcc
Being able to build a nativesdk gcc is useful, particularly in cases
where the host compiler may be of an incompatible version (or a 32
bit compiler is needed).
Sadly, building nativesdk-gcc is not straight forward. We install
nativesdk-gcc into a relocatable location and this means that its
library locations can change. "Normal" sysroot support doesn't help
in this case since the values of paths like "libdir" change, not just
base root directory of the system.
In order to handle this we do two things:
a) Add %r into spec file markup which can be used for injected paths
such as SYSTEMLIBS_DIR (see gcc_multilib_setup()).
b) Add other paths which need relocation into a .gccrelocprefix section
which the relocation code will notice and adjust automatically.
Upstream-Status: Inappropriate
RP 2015/7/28
Extend the gccrelocprefix support to musl config too, this ensures
that gcc will get right bits in SDK installations
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Added PREFIXVAR and EXEC_PREFIXVAR to support runtime relocation. Without
these as part of the gccrelocprefix the system can't do runtime relocation
if the executable is moved. (These paths were missed in the original
implementation.)
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
gcc/c-family/c-opts.cc | 4 +--
gcc/config/linux.h | 24 +++++++--------
gcc/config/rs6000/sysv4.h | 24 +++++++--------
gcc/cppdefault.cc | 65 ++++++++++++++++++++++++---------------
gcc/cppdefault.h | 13 +++-----
gcc/gcc.cc | 20 ++++++++----
gcc/incpath.cc | 12 ++++----
gcc/prefix.cc | 6 ++--
8 files changed, 95 insertions(+), 73 deletions(-)
diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc
index c68a2a27469..77e9b5eceaa 100644
--- a/gcc/c-family/c-opts.cc
+++ b/gcc/c-family/c-opts.cc
@@ -1458,8 +1458,8 @@ add_prefixed_path (const char *suffix, incpath_kind chain)
size_t prefix_len, suffix_len;
suffix_len = strlen (suffix);
- prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
- prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
+ prefix = iprefix ? iprefix : GCC_INCLUDE_DIRVAR;
+ prefix_len = iprefix ? strlen (iprefix) : strlen(GCC_INCLUDE_DIRVAR) - 7;
path = (char *) xmalloc (prefix_len + suffix_len + 1);
memcpy (path, prefix, prefix_len);
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index 57496ff1f2f..c921cf6ef63 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -121,53 +121,53 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* Unfortunately, this is mostly duplicated from cppdefault.cc */
#if DEFAULT_LIBC == LIBC_MUSL
#define INCLUDE_DEFAULTS_MUSL_GPP \
- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#ifdef LOCAL_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_LOCAL \
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
#else
#define INCLUDE_DEFAULTS_MUSL_LOCAL
#endif
#ifdef PREFIX_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_PREFIX \
- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_PREFIX
#endif
#ifdef CROSS_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_CROSS \
- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_CROSS
#endif
#ifdef TOOL_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_TOOL \
- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
#ifdef GCC_INCLUDE_SUBDIR_TARGET
#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
#endif
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
#else
#define INCLUDE_DEFAULTS_MUSL_NATIVE
#endif
@@ -192,7 +192,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
INCLUDE_DEFAULTS_MUSL_TOOL \
INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
#endif
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 3a443abcf6b..ef83a5a432e 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -950,53 +950,53 @@ ncrtn.o%s"
/* Include order changes for musl, same as in generic linux.h. */
#if DEFAULT_LIBC == LIBC_MUSL
#define INCLUDE_DEFAULTS_MUSL_GPP \
- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1, \
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#ifdef LOCAL_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_LOCAL \
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
#else
#define INCLUDE_DEFAULTS_MUSL_LOCAL
#endif
#ifdef PREFIX_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_PREFIX \
- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_PREFIX
#endif
#ifdef CROSS_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_CROSS \
- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_CROSS
#endif
#ifdef TOOL_INCLUDE_DIR
#define INCLUDE_DEFAULTS_MUSL_TOOL \
- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_TOOL
#endif
#ifdef GCC_INCLUDE_SUBDIR_TARGET
#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0},
+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0},
#else
#define INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET
#endif
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
- { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIRVAR, 0, 0, 0, 1, 0 },
#else
#define INCLUDE_DEFAULTS_MUSL_NATIVE
#endif
@@ -1021,7 +1021,7 @@ ncrtn.o%s"
INCLUDE_DEFAULTS_MUSL_TOOL \
INCLUDE_DEFAULTS_MUSL_SUBDIR_TARGET \
INCLUDE_DEFAULTS_MUSL_NATIVE \
- { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
#endif
diff --git a/gcc/cppdefault.cc b/gcc/cppdefault.cc
index 734590a7059..b4a8fc29e4a 100644
--- a/gcc/cppdefault.cc
+++ b/gcc/cppdefault.cc
@@ -35,6 +35,30 @@
# undef CROSS_INCLUDE_DIR
#endif
+static char GPLUSPLUS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_INCLUDE_DIR;
+char GCC_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GCC_INCLUDE_DIR;
+static char GPLUSPLUS_TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_TOOL_INCLUDE_DIR;
+static char GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = GPLUSPLUS_BACKWARD_INCLUDE_DIR;
+static char STANDARD_STARTFILE_PREFIX_2VAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET;
+#ifdef LOCAL_INCLUDE_DIR
+static char LOCAL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = LOCAL_INCLUDE_DIR;
+#endif
+#ifdef PREFIX_INCLUDE_DIR
+static char PREFIX_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX_INCLUDE_DIR;
+#endif
+#ifdef FIXED_INCLUDE_DIR
+static char FIXED_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = FIXED_INCLUDE_DIR;
+#endif
+#ifdef CROSS_INCLUDE_DIR
+static char CROSS_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = CROSS_INCLUDE_DIR;
+#endif
+#ifdef TOOL_INCLUDE_DIR
+static char TOOL_INCLUDE_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = TOOL_INCLUDE_DIR;
+#endif
+#ifdef NATIVE_SYSTEM_HEADER_DIR
+static char NATIVE_SYSTEM_HEADER_DIRVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = NATIVE_SYSTEM_HEADER_DIR;
+#endif
+
const struct default_include cpp_include_defaults[]
#ifdef INCLUDE_DEFAULTS
= INCLUDE_DEFAULTS;
@@ -42,17 +66,17 @@ const struct default_include cpp_include_defaults[]
= {
#ifdef GPLUSPLUS_INCLUDE_DIR
/* Pick up GNU C++ generic include files. */
- { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1,
+ { GPLUSPLUS_INCLUDE_DIRVAR, "G++", 1, 1,
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#endif
#ifdef GPLUSPLUS_TOOL_INCLUDE_DIR
/* Pick up GNU C++ target-dependent include files. */
- { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1,
+ { GPLUSPLUS_TOOL_INCLUDE_DIRVAR, "G++", 1, 1,
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 },
#endif
#ifdef GPLUSPLUS_BACKWARD_INCLUDE_DIR
/* Pick up GNU C++ backward and deprecated include files. */
- { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1,
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIRVAR, "G++", 1, 1,
GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
#endif
#ifdef GPLUSPLUS_LIBCXX_INCLUDE_DIR
@@ -62,26 +86,26 @@ const struct default_include cpp_include_defaults[]
#endif
#ifdef GCC_INCLUDE_DIR
/* This is the dir for gcc's private headers. */
- { GCC_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+ { GCC_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
#endif
#ifdef GCC_INCLUDE_SUBDIR_TARGET
/* This is the dir for gcc's private headers under the specified sysroot. */
- { STANDARD_STARTFILE_PREFIX_2 GCC_INCLUDE_SUBDIR_TARGET, "GCC", 0, 0, 1, 0 },
+ { STANDARD_STARTFILE_PREFIX_2VAR, "GCC", 0, 0, 1, 0 },
#endif
#ifdef LOCAL_INCLUDE_DIR
/* /usr/local/include comes before the fixincluded header files. */
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 },
- { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 2 },
+ { LOCAL_INCLUDE_DIRVAR, 0, 0, 1, 1, 0 },
#endif
#ifdef PREFIX_INCLUDE_DIR
- { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0 },
+ { PREFIX_INCLUDE_DIRVAR, 0, 0, 1, 0, 0 },
#endif
#ifdef FIXED_INCLUDE_DIR
/* This is the dir for fixincludes. */
#ifndef SYSROOT_HEADERS_SUFFIX_SPEC
- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0, 2 },
+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 2 },
#endif
- { FIXED_INCLUDE_DIR, "GCC", 0, 0, 0,
+ { FIXED_INCLUDE_DIRVAR, "GCC", 0, 0, 0,
/* A multilib suffix needs adding if different multilibs use
different headers. */
#ifdef SYSROOT_HEADERS_SUFFIX_SPEC
@@ -93,33 +117,24 @@ const struct default_include cpp_include_defaults[]
#endif
#ifdef CROSS_INCLUDE_DIR
/* One place the target system's headers might be. */
- { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0 },
+ { CROSS_INCLUDE_DIRVAR, "GCC", 0, 0, 0, 0 },
#endif
#ifdef TOOL_INCLUDE_DIR
/* Another place the target system's headers might be. */
- { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0 },
+ { TOOL_INCLUDE_DIRVAR, "BINUTILS", 0, 1, 0, 0 },
#endif
#ifdef NATIVE_SYSTEM_HEADER_DIR
/* /usr/include comes dead last. */
- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
- { NATIVE_SYSTEM_HEADER_DIR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 2 },
+ { NATIVE_SYSTEM_HEADER_DIRVAR, NATIVE_SYSTEM_HEADER_COMPONENT, 0, 0, 1, 0 },
#endif
{ 0, 0, 0, 0, 0, 0 }
};
#endif /* no INCLUDE_DEFAULTS */
-#ifdef GCC_INCLUDE_DIR
-const char cpp_GCC_INCLUDE_DIR[] = GCC_INCLUDE_DIR;
-const size_t cpp_GCC_INCLUDE_DIR_len = sizeof GCC_INCLUDE_DIR - 8;
-#else
-const char cpp_GCC_INCLUDE_DIR[] = "";
-const size_t cpp_GCC_INCLUDE_DIR_len = 0;
-#endif
-
/* The configured prefix. */
-const char cpp_PREFIX[] = PREFIX;
-const size_t cpp_PREFIX_len = sizeof PREFIX - 1;
-const char cpp_EXEC_PREFIX[] = STANDARD_EXEC_PREFIX;
+char PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
+char EXEC_PREFIXVAR[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
/* This value is set by cpp_relocated at runtime */
const char *gcc_exec_prefix;
diff --git a/gcc/cppdefault.h b/gcc/cppdefault.h
index e26b424e99c..c9abb090dcd 100644
--- a/gcc/cppdefault.h
+++ b/gcc/cppdefault.h
@@ -33,7 +33,8 @@
struct default_include
{
- const char *const fname; /* The name of the directory. */
+ const char *fname; /* The name of the directory. */
+
const char *const component; /* The component containing the directory
(see update_path in prefix.cc) */
const char cplusplus; /* When this is non-zero, we should only
@@ -55,17 +56,13 @@ struct default_include
};
extern const struct default_include cpp_include_defaults[];
-extern const char cpp_GCC_INCLUDE_DIR[];
-extern const size_t cpp_GCC_INCLUDE_DIR_len;
+extern char GCC_INCLUDE_DIRVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The configure-time prefix, i.e., the value supplied as the argument
to --prefix=. */
-extern const char cpp_PREFIX[];
+extern char PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The length of the configure-time prefix. */
-extern const size_t cpp_PREFIX_len;
-/* The configure-time execution prefix. This is typically the lib/gcc
- subdirectory of cpp_PREFIX. */
-extern const char cpp_EXEC_PREFIX[];
+extern char EXEC_PREFIXVAR[] __attribute__ ((section (".gccrelocprefix")));
/* The run-time execution prefix. This is typically the lib/gcc
subdirectory of the actual installation. */
extern const char *gcc_exec_prefix;
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 8af0c814c33..605fe3b8c0d 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -255,6 +255,8 @@ FILE *report_times_to_file = NULL;
#endif
static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT;
+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR;
+
/* Nonzero means pass the updated target_system_root to the compiler. */
static int target_system_root_changed;
@@ -578,6 +580,7 @@ or with constant text in a single argument.
%G process LIBGCC_SPEC as a spec.
%R Output the concatenation of target_system_root and
target_sysroot_suffix.
+ %r Output the base path target_relocatable_prefix
%S process STARTFILE_SPEC as a spec. A capital S is actually used here.
%E process ENDFILE_SPEC as a spec. A capital E is actually used here.
%C process CPP_SPEC as a spec.
@@ -1619,10 +1622,10 @@ static const char *gcc_libexec_prefix;
gcc_exec_prefix is set because, in that case, we know where the
compiler has been installed, and use paths relative to that
location instead. */
-static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
-static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
-static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
-static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+static char standard_exec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_EXEC_PREFIX;
+static char standard_libexec_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_LIBEXEC_PREFIX;
+static char standard_bindir_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = STANDARD_BINDIR_PREFIX;
+static char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
/* For native compilers, these are well-known paths containing
components that may be provided by the system. For cross
@@ -1630,9 +1633,9 @@ static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
static const char *md_exec_prefix = MD_EXEC_PREFIX;
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
-static const char *const standard_startfile_prefix_1
+static char standard_startfile_prefix_1[4096] __attribute__ ((section (".gccrelocprefix")))
= STANDARD_STARTFILE_PREFIX_1;
-static const char *const standard_startfile_prefix_2
+static char standard_startfile_prefix_2[4096] __attribute__ ((section (".gccrelocprefix")))
= STANDARD_STARTFILE_PREFIX_2;
/* A relative path to be used in finding the location of tools
@@ -6652,6 +6655,11 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
}
break;
+ case 'r':
+ obstack_grow (&obstack, target_relocatable_prefix,
+ strlen (target_relocatable_prefix));
+ break;
+
case 'S':
value = do_spec_1 (startfile_spec, 0, NULL);
if (value != 0)
diff --git a/gcc/incpath.cc b/gcc/incpath.cc
index 46c0d543205..d088dae7b04 100644
--- a/gcc/incpath.cc
+++ b/gcc/incpath.cc
@@ -135,7 +135,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
int relocated = cpp_relocated ();
size_t len;
- if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
+ if (iprefix && (len = strlen(GCC_INCLUDE_DIRVAR) - 7) != 0)
{
/* Look for directories that start with the standard prefix.
"Translate" them, i.e. replace /usr/local/lib/gcc... with
@@ -150,7 +150,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
now. */
if (sysroot && p->add_sysroot)
continue;
- if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
+ if (!filename_ncmp (p->fname, GCC_INCLUDE_DIRVAR, len))
{
char *str = concat (iprefix, p->fname + len, NULL);
if (p->multilib == 1 && imultilib)
@@ -191,7 +191,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
free (sysroot_no_trailing_dir_separator);
}
else if (!p->add_sysroot && relocated
- && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
+ && !filename_ncmp (p->fname, PREFIXVAR, strlen(PREFIXVAR)))
{
static const char *relocated_prefix;
char *ostr;
@@ -208,12 +208,12 @@ add_standard_paths (const char *sysroot, const char *iprefix,
dummy = concat (gcc_exec_prefix, "dummy", NULL);
relocated_prefix
= make_relative_prefix (dummy,
- cpp_EXEC_PREFIX,
- cpp_PREFIX);
+ EXEC_PREFIXVAR,
+ PREFIXVAR);
free (dummy);
}
ostr = concat (relocated_prefix,
- p->fname + cpp_PREFIX_len,
+ p->fname + strlen(PREFIXVAR),
NULL);
str = update_path (ostr, p->component);
free (ostr);
diff --git a/gcc/prefix.cc b/gcc/prefix.cc
index c2a37bde5ea..33944701ced 100644
--- a/gcc/prefix.cc
+++ b/gcc/prefix.cc
@@ -73,7 +73,9 @@ License along with GCC; see the file COPYING3. If not see
#include "prefix.h"
#include "common/common-target.h"
-static const char *std_prefix = PREFIX;
+char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX;
+
+static const char *std_prefix = PREFIXVAR1;
static const char *get_key_value (char *);
static char *translate_name (char *);
@@ -213,7 +215,7 @@ translate_name (char *name)
prefix = getenv (key);
if (prefix == 0)
- prefix = PREFIX;
+ prefix = PREFIXVAR1;
/* We used to strip trailing DIR_SEPARATORs here, but that can
sometimes yield a result with no separator when one was coded

View File

@@ -0,0 +1,100 @@
From 7e095089452b6e895ec40981752e9f902f0ad889 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 7 Dec 2015 23:41:45 +0000
Subject: [PATCH] Search target sysroot gcc version specific dirs with
multilib.
We install the gcc libraries (such as crtbegin.p) into
<sysroot><libdir>/<target-sys>/5.2.0/
which is a default search path for GCC (aka multi_suffix in the
code below). <target-sys> is 'machine' in gcc's terminology. We use
these directories so that multiple gcc versions could in theory
co-exist on target.
We only want to build one gcc-cross-canadian per arch and have this work
for all multilibs. <target-sys> can be handled by mapping the multilib
<target-sys> to the one used by gcc-cross-canadian, e.g.
mips64-polkmllib32-linux
is symlinked to by mips64-poky-linux.
The default gcc search path in the target sysroot for a "lib64" mutlilib
is:
<sysroot>/lib32/mips64-poky-linux/5.2.0/
<sysroot>/lib32/../lib64/
<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
<sysroot>/usr/lib32/../lib64/
<sysroot>/lib32/
<sysroot>/usr/lib32/
which means that the lib32 crtbegin.o will be found and the lib64 ones
will not which leads to compiler failures.
This patch injects a multilib version of that path first so the lib64
binaries can be found first. With this change the search path becomes:
<sysroot>/lib32/../lib64/mips64-poky-linux/5.2.0/
<sysroot>/lib32/mips64-poky-linux/5.2.0/
<sysroot>/lib32/../lib64/
<sysroot>/usr/lib32/../lib64/mips64-poky-linux/5.2.0/
<sysroot>/usr/lib32/mips64-poky-linux/5.2.0/
<sysroot>/usr/lib32/../lib64/
<sysroot>/lib32/
<sysroot>/usr/lib32/
RP 2015/7/31
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615320.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/gcc.cc | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/gcc/gcc.cc b/gcc/gcc.cc
index 605fe3b8c0d..c3a1dab38c4 100644
--- a/gcc/gcc.cc
+++ b/gcc/gcc.cc
@@ -2809,7 +2809,7 @@ for_each_path (const struct path_prefix *paths,
if (path == NULL)
{
len = paths->max_len + extra_space + 1;
- len += MAX (MAX (suffix_len, multi_os_dir_len), multiarch_len);
+ len += MAX ((suffix_len + multi_os_dir_len), multiarch_len);
path = XNEWVEC (char, len);
}
@@ -2821,6 +2821,33 @@ for_each_path (const struct path_prefix *paths,
/* Look first in MACHINE/VERSION subdirectory. */
if (!skip_multi_dir)
{
+ if (!(pl->os_multilib ? skip_multi_os_dir : skip_multi_dir))
+ {
+ const char *this_multi;
+ size_t this_multi_len;
+
+ if (pl->os_multilib)
+ {
+ this_multi = multi_os_dir;
+ this_multi_len = multi_os_dir_len;
+ }
+ else
+ {
+ this_multi = multi_dir;
+ this_multi_len = multi_dir_len;
+ }
+
+ /* Look in multilib MACHINE/VERSION subdirectory first */
+ if (this_multi_len)
+ {
+ memcpy (path + len, this_multi, this_multi_len + 1);
+ memcpy (path + len + this_multi_len, multi_suffix, suffix_len + 1);
+ ret = callback (path, callback_info);
+ if (ret)
+ break;
+ }
+ }
+
memcpy (path + len, multi_suffix, suffix_len + 1);
ret = callback (path, callback_info);
if (ret)

View File

@@ -0,0 +1,84 @@
From bf92b290556b7050df0a001cc7ae43cf79990456 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 27 Jun 2017 18:10:54 -0700
Subject: [PATCH] Add ssp_nonshared to link commandline for musl targets
when -fstack-protector options are enabled we need to
link with ssp_shared on musl since it does not provide
the __stack_chk_fail_local() so essentially it provides
libssp but not libssp_nonshared something like
TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED
where-as for glibc the needed symbols
are already present in libc_nonshared library therefore
we do not need any library helper on glibc based systems
but musl needs the libssp_noshared from gcc
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615317.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/linux.h | 7 +++++++
gcc/config/rs6000/linux.h | 10 ++++++++++
gcc/config/rs6000/linux64.h | 10 ++++++++++
3 files changed, 27 insertions(+)
diff --git a/gcc/config/linux.h b/gcc/config/linux.h
index c921cf6ef63..32e1bc1ae2d 100644
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -195,6 +195,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
{ GCC_INCLUDE_DIRVAR, "GCC", 0, 1, 0, 0 }, \
{ 0, 0, 0, 0, 0, 0 } \
}
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
+#endif
+
#endif
#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h
index 5d21befe8e4..1248a68e4ca 100644
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -99,6 +99,16 @@
" -m elf32ppclinux")
#endif
+/* link libssp_nonshared.a with musl */
+#if DEFAULT_LIBC == LIBC_MUSL
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
+#endif
+#endif
+
#undef LINK_OS_LINUX_SPEC
#define LINK_OS_LINUX_SPEC LINK_OS_LINUX_EMUL " %{!shared: %{!static: \
%{!static-pie: \
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 2ddab7c99c1..9641580fc83 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -372,6 +372,16 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
+/* link libssp_nonshared.a with musl */
+#if DEFAULT_LIBC == LIBC_MUSL
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#undef LINK_SSP_SPEC
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ "|fstack-protector-strong|fstack-protector-explicit" \
+ ":-lssp_nonshared}"
+#endif
+#endif
+
#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
%{!static-pie: \
%{rdynamic:-export-dynamic} \

View File

@@ -0,0 +1,39 @@
From 587ac4a59ea56da18a9989c31a75124e974cb37c Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 6 Jun 2018 12:10:22 -0700
Subject: [PATCH] Re-introduce spe commandline options
This should ensure that we keep accepting
spe options
Upstream-Status: Inappropriate [SPE port is removed from rs600 port]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/rs6000/rs6000.opt | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index bde6d3ff664..5af9640825c 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -344,6 +344,19 @@ mdebug=
Target RejectNegative Joined
-mdebug= Enable debug output.
+; PPC SPE ABI
+mspe
+Target Var(rs6000_spe) Save
+Generate SPE SIMD instructions on E500.
+
+mabi=spe
+Target RejectNegative Var(rs6000_spe_abi) Save
+Use the SPE ABI extensions.
+
+mabi=no-spe
+Target RejectNegative Var(rs6000_spe_abi, 0)
+Do not use the SPE ABI extensions.
+
; Altivec ABI
mabi=altivec
Target RejectNegative Var(rs6000_altivec_abi) Save

View File

@@ -0,0 +1,83 @@
From 8c4c59521720f8c1b1e38e38896b47fcb1bf00ac Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH] libgcc_s: Use alias for __cpu_indicator_init instead of
symver
Adapter from
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00899.html
This fix was debated but hasnt been applied gcc upstream since
they expect musl to support '@' in symbol versioning which is
a sun/gnu versioning extention. This patch however avoids the
need for the '@' symbols at all
libgcc/Changelog:
2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/i386/cpuinfo.c (__cpu_indicator_init_local): Add.
(__cpu_indicator_init@GCC_4.8.0, __cpu_model@GCC_4.8.0): Remove.
* config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Remove -DUSE_ELF_SYMVER.
gcc/Changelog:
2015-05-11 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init
call __cpu_indicator_init_local instead of __cpu_indicator_init.
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612559.html]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/config/i386/i386-expand.cc | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 0d817fc3f3b..8d34d19d3f9 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -12691,10 +12691,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
- /* Make it call __cpu_indicator_init in libgcc. */
+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
tree call_expr, fndecl, type;
type = build_function_type_list (integer_type_node, NULL_TREE);
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
call_expr = build_call_expr (fndecl, 0);
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 50b6d8248a2..724ced402a1 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -63,7 +63,7 @@ __cpu_indicator_init (void)
__cpu_features2);
}
-#if defined SHARED && defined USE_ELF_SYMVER
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
+#ifndef SHARED
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 8506a635790..564296f788e 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,5 +3,5 @@
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER $(CET_FLAGS)
+HOST_LIBGCC2_CFLAGS += -mlong-double-80 $(CET_FLAGS)
CRTSTUFF_T_CFLAGS += $(CET_FLAGS)

View File

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

View File

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

View File

@@ -0,0 +1,31 @@
From 696d696381dd99ec2bddb1170f96f98da36eb418 Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 22 Dec 2021 12:49:25 +0100
Subject: [PATCH] Fix install path of linux64.h
We add linux64.h to tm includes[1] as a relative path to B. This patch
adapts the install path of linux64.h to match the include in tm.h.
[1] 0016-Use-the-multilib-config-files-from-B-instead-of-usin.patch
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Upstream-Status: Inappropriate [configuration]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
gcc/Makefile.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 8ef996c0f4d..21daf380e34 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3731,6 +3731,8 @@ install-plugin: installdirs lang.install-plugin s-header-vars install-gengtype
"$(srcdir)"/config/* | "$(srcdir)"/common/config/* \
| "$(srcdir)"/c-family/* | "$(srcdir)"/*.def ) \
base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
+ */linux64.h ) \
+ base=`dirname $$path`;;\
*) base=`basename $$path` ;; \
esac; \
dest=$(plugin_includedir)/$$base; \

View File

@@ -0,0 +1,28 @@
From 9487b1d6136ea09cce4792d59d0170c712575550 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Sat, 20 Aug 2022 09:04:14 -0700
Subject: [PATCH] Avoid hardcoded build paths into ppc libgcc
Avoid encoding build paths into sources used for floating point on powerpc.
(MACHINE=qemuppc bitbake libgcc).
Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599882.html]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
libgcc/config/rs6000/t-float128 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
index b09b5664af0..513e63748f1 100644
--- a/libgcc/config/rs6000/t-float128
+++ b/libgcc/config/rs6000/t-float128
@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
@src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
echo "Create $@"; \
- (echo "/* file created from $$src */"; \
+ (echo "/* file created from `basename $$src` */"; \
echo; \
sed -f $(fp128_sed) < $$src) > $@

View File

@@ -0,0 +1,233 @@
From f12acc6a383546d48da3bdfb2f25ca2adb7976d7 Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Sun, 13 Aug 2023 10:24:05 +0100
Subject: [PATCH] gcc testsuite tweaks for mips/OE
Disable loongson-mmi runtine, qemu doesn't appear to fully support them even if some
of the instruction decoding is there.
Also disable MSA mips runtime extensions. For some reason qemu appears to accept the test
code when it shouldn't. Our selected MIPS cpu for QEMU doesn't support them.
MIPS is unusual in the gcc testsuite as it uses EFFECTIVE_TARGETS and loops
multiple times through the vector testsuite. In the case of the two above, we can
compile/link them but not run them. Even with the runtime disabled, if the code
marks it as a runtime test, it will elevate itself to that. Setting the default
target to compile therefore isn't enough.
Therefore add code to downgrade runtime tests to link tests if the hardware
support isn't there to run them. This avoids thousands of test failures. To do
this we have to hook downgrade code into the main test runner.
Enable that downgrading for other cases where hardware to run vector extensions is
unavailable to remove test failures on other architectures too.
Also, for gcc.target tests, add checks on wheter loongson or msa code can
be run before trying that, allowing downgrading of tests there to work too.
Upstream-Status: Pending
[Parts of the patch may be able to be split off and acceptable to upstream with
discussion. Need to investigate why qemu-user passes the 'bad' instructions']
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
gcc/testsuite/gcc.target/mips/mips.exp | 16 +++++++++
gcc/testsuite/lib/gcc-dg.exp | 11 +++++++
gcc/testsuite/lib/target-supports.exp | 45 ++++++++------------------
3 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 15d574202d3..2cef9709774 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -709,7 +709,23 @@ proc mips_first_unsupported_option { upstatus } {
global mips_option_tests
upvar $upstatus status
+ if { [mips_have_test_option_p status "-mmsa"] } {
+ verbose -log "Found -mmsa"
+ if { ![check_mips_msa_hw_available] } {
+ verbose -log "No MSA avail"
+ return "-mmsa"
+ }
+ }
+ if { [mips_have_test_option_p status "-mloongson-mmi"] } {
+ verbose -log "Found -mloonson-mmi"
+ if { ![check_mips_loongson_mmi_hw_available] } {
+ verbose -log "No MMI avail"
+ return "-mloonson-mmi"
+ }
+ }
+
foreach { option code } [array get mips_option_tests] {
+
if { [mips_have_test_option_p status $option] } {
regsub -all "\n" $code "\\n\\\n" asm
# Use check_runtime from target-supports.exp, which caches
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 9d79b9402e9..e0e5cbb1af8 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -240,9 +240,20 @@ proc schedule-cleanups { opts } {
proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } {
# Set up the compiler flags, based on what we're going to do.
+ global do-what-limit
set options [list]
+ if [info exists do-what-limit] then {
+ # Demote run tests to $do-what-limit if set
+ switch $do_what {
+ run {
+ set do_what ${do-what-limit}
+ set dg-do-what ${do-what-limit}
+ }
+ }
+ }
+
switch $do_what {
"preprocess" {
set compile_type "preprocess"
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 40f71e9ed8b..10e267fa16d 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2155,14 +2155,7 @@ proc check_mips_loongson_mmi_hw_available { } {
if { !([istarget mips*-*-*]) } {
expr 0
} else {
- check_runtime_nocache mips_loongson_mmi_hw_available {
- #include <loongson-mmiintrin.h>
- int main()
- {
- asm volatile ("paddw $f2,$f4,$f6");
- return 0;
- }
- } "-mloongson-mmi"
+ expr 0
}
}]
}
@@ -2176,29 +2169,7 @@ proc check_mips_msa_hw_available { } {
if { !([istarget mips*-*-*]) } {
expr 0
} else {
- check_runtime_nocache mips_msa_hw_available {
- #if !defined(__mips_msa)
- #error "MSA NOT AVAIL"
- #else
- #if !(((__mips == 64) || (__mips == 32)) && (__mips_isa_rev >= 2))
- #error "MSA NOT AVAIL FOR ISA REV < 2"
- #endif
- #if !defined(__mips_hard_float)
- #error "MSA HARD_FLOAT REQUIRED"
- #endif
- #if __mips_fpr != 64
- #error "MSA 64-bit FPR REQUIRED"
- #endif
- #include <msa.h>
-
- int main()
- {
- v8i16 v = __builtin_msa_ldi_h (0);
- v[0] = 0;
- return v[0];
- }
- #endif
- } "-mmsa"
+ expr 0
}
}]
}
@@ -9187,6 +9158,7 @@ proc is-effective-target-keyword { arg } {
proc et-dg-runtest { runtest testcases flags default-extra-flags } {
global dg-do-what-default
+ global do-what-limit
global EFFECTIVE_TARGETS
global et_index
@@ -9194,6 +9166,7 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } {
foreach target $EFFECTIVE_TARGETS {
set target_flags $flags
set dg-do-what-default compile
+ set do-what-limit link
set et_index [lsearch -exact $EFFECTIVE_TARGETS $target]
if { [info procs add_options_for_${target}] != [list] } {
set target_flags [add_options_for_${target} "$flags"]
@@ -9201,8 +9174,10 @@ proc et-dg-runtest { runtest testcases flags default-extra-flags } {
if { [info procs check_effective_target_${target}_runtime]
!= [list] && [check_effective_target_${target}_runtime] } {
set dg-do-what-default run
+ set do-what-limit run
}
$runtest $testcases $target_flags ${default-extra-flags}
+ unset do-what-limit
}
} else {
set et_index 0
@@ -10789,6 +10764,7 @@ proc check_effective_target_sigsetjmp {} {
proc check_vect_support_and_set_flags { } {
global DEFAULT_VECTCFLAGS
global dg-do-what-default
+ global do-what-limit
global EFFECTIVE_TARGETS
if [istarget powerpc-*paired*] {
@@ -10797,6 +10773,7 @@ proc check_vect_support_and_set_flags { } {
set dg-do-what-default run
} else {
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif [istarget powerpc*-*-*] {
# Skip targets not supporting -maltivec.
@@ -10821,6 +10798,7 @@ proc check_vect_support_and_set_flags { } {
lappend DEFAULT_VECTCFLAGS "-mcpu=970"
}
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
lappend DEFAULT_VECTCFLAGS "-msse2"
@@ -10828,6 +10806,7 @@ proc check_vect_support_and_set_flags { } {
set dg-do-what-default run
} else {
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif { [istarget mips*-*-*]
&& [check_effective_target_nomips16] } {
@@ -10847,6 +10826,7 @@ proc check_vect_support_and_set_flags { } {
set dg-do-what-default run
} else {
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif [istarget alpha*-*-*] {
# Alpha's vectorization capabilities are extremely limited.
@@ -10860,6 +10840,7 @@ proc check_vect_support_and_set_flags { } {
set dg-do-what-default run
} else {
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif [istarget ia64-*-*] {
set dg-do-what-default run
@@ -10873,6 +10854,7 @@ proc check_vect_support_and_set_flags { } {
set dg-do-what-default run
} else {
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif [istarget aarch64*-*-*] {
set dg-do-what-default run
@@ -10897,6 +10879,7 @@ proc check_vect_support_and_set_flags { } {
} else {
lappend DEFAULT_VECTCFLAGS "-march=z14" "-mzarch"
set dg-do-what-default compile
+ set do-what-limit link
}
} elseif [istarget amdgcn-*-*] {
set dg-do-what-default run

View File

@@ -0,0 +1,26 @@
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=948dbc5ee45f9ffd5f41fd6782704081cc7c8c27]
Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
index ed63ff59cc0..009c849b7e7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c
@@ -1,3 +1,5 @@
+/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */
+/* { dg-do run } */
/* { dg-require-effective-target vect_simd_clones } */
/* { dg-additional-options "-fopenmp-simd" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
index c44471e35bc..4699a3f3c80 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
@@ -1,3 +1,5 @@
+/* Since this uses dg-additional-sources, need to specify `dg-do run` instead of the default. */
+/* { dg-do run } */
/* { dg-require-effective-target vect_simd_clones } */
/* { dg-additional-options "-fopenmp-simd" } */
/* { dg-additional-options "-mavx" { target avx_runtime } } */
--
2.43.0

View File

@@ -0,0 +1,14 @@
require recipes-devtools/gcc/gcc-${PV}.inc
require gcc-target.inc
# Building with thumb enabled on armv4t armv5t fails with
# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7438:(.text.unlikely+0x2fa): relocation truncated to fit: R_ARM_THM_CALL against symbol `fancy_abort(char const*, int, char const*)' defined in .glue_7 section in linker stubs
# | gcc-4.8.1-r0/gcc-4.8.1/gcc/cp/decl.c:7442:(.text.unlikely+0x318): additional relocation overflows omitted from the output
ARM_INSTRUCTION_SET:armv4 = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"
ARMFPARCHEXT:armv6 = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
ARMFPARCHEXT:armv7a = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
ARMFPARCHEXT:armv7ve = "${@'+fp' if d.getVar('TARGET_FPU') == 'hard' else ''}"
BBCLASSEXTEND = "nativesdk"

View File

@@ -0,0 +1,163 @@
BPN = "libgcc"
require gcc-configure-common.inc
INHIBIT_DEFAULT_DEPS = "1"
do_configure () {
install -d ${D}${base_libdir} ${D}${libdir}
mkdir -p ${B}/${BPN}
mkdir -p ${B}/${TARGET_SYS}/${BPN}/
cd ${B}/${BPN}
chmod a+x ${S}/${BPN}/configure
${S}/${BPN}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
}
EXTRACONFFUNCS += "extract_stashed_builddir"
do_configure[depends] += "${COMPILERDEP}"
do_compile () {
cd ${B}/${BPN}
oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/
}
do_install () {
cd ${B}/${BPN}
oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/${BPN}/ install
# Move libgcc_s into /lib
mkdir -p ${D}${base_libdir}
if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
mv ${D}${libdir}/nof/libgcc* ${D}${base_libdir}
else
mv ${D}${libdir}/libgcc* ${D}${base_libdir} || true
fi
# install the runtime in /usr/lib/ not in /usr/lib/gcc on target
# so that cross-gcc can find it in the sysroot
mv ${D}${libdir}/gcc/* ${D}${libdir}
rm -rf ${D}${libdir}/gcc/
# unwind.h is installed here which is shipped in gcc-cross
# as well as target gcc and they are identical so we dont
# ship one with libgcc here
rm -rf ${D}${libdir}/${TARGET_SYS}/${BINV}/include
}
do_install:append:libc-baremetal () {
if [ "${base_libdir}" != "${libdir}" ]; then
rmdir ${D}${base_libdir}
fi
}
do_install:append:libc-newlib () {
if [ "${base_libdir}" != "${libdir}" ]; then
rmdir ${D}${base_libdir}
fi
}
# No rpm package is actually created but -dev depends on it, avoid dnf error
DEV_PKG_DEPENDENCY:libc-baremetal = ""
DEV_PKG_DEPENDENCY:libc-newlib = ""
BBCLASSEXTEND = "nativesdk"
addtask multilib_install after do_install before do_package do_populate_sysroot
# this makes multilib gcc files findable for target gcc
# e.g.
# /usr/lib/i586-pokymllib32-linux/4.7/
# by creating this symlink to it
# /usr/lib64/x86_64-poky-linux/4.7/32
fakeroot python do_multilib_install() {
import re
multilibs = d.getVar('MULTILIB_VARIANTS')
if not multilibs or bb.data.inherits_class('nativesdk', d):
return
binv = d.getVar('BINV')
mlprefix = d.getVar('MLPREFIX')
if ('%slibgcc' % mlprefix) != d.getVar('PN'):
return
if mlprefix:
orig_tune = d.getVar('DEFAULTTUNE_MULTILIB_ORIGINAL')
orig_tune_params = get_tune_parameters(orig_tune, d)
orig_tune_baselib = orig_tune_params['baselib']
orig_tune_bitness = orig_tune_baselib.replace('lib', '')
if not orig_tune_bitness:
orig_tune_bitness = '32'
src = '../../../' + orig_tune_baselib + '/' + \
d.getVar('TARGET_SYS_MULTILIB_ORIGINAL') + '/' + binv + '/'
dest = d.getVar('D') + d.getVar('libdir') + '/' + \
d.getVar('TARGET_SYS') + '/' + binv + '/' + orig_tune_bitness
if os.path.lexists(dest):
os.unlink(dest)
os.symlink(src, dest)
return
for ml in multilibs.split():
tune = d.getVar('DEFAULTTUNE:virtclass-multilib-' + ml)
if not tune:
bb.warn('DEFAULTTUNE:virtclass-multilib-%s is not defined. Skipping...' % ml)
continue
tune_parameters = get_tune_parameters(tune, d)
tune_baselib = tune_parameters['baselib']
if not tune_baselib:
bb.warn("Tune %s doesn't have a baselib set. Skipping..." % tune)
continue
tune_arch = tune_parameters['arch']
tune_bitness = tune_baselib.replace('lib', '')
if not tune_bitness:
tune_bitness = '32' # /lib => 32bit lib
tune_abiextension = tune_parameters['abiextension']
if tune_abiextension:
libcextension = '-gnu' + tune_abiextension
else:
libcextension = ''
src = '../../../' + tune_baselib + '/' + \
tune_arch + d.getVar('TARGET_VENDOR') + 'ml' + ml + \
'-' + d.getVar('TARGET_OS') + libcextension + '/' + binv + '/'
dest = d.getVar('D') + d.getVar('libdir') + '/' + \
d.getVar('TARGET_SYS') + '/' + binv + '/' + tune_bitness
if os.path.lexists(dest):
os.unlink(dest)
os.symlink(src, dest)
}
def get_original_os(d):
vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}')
for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]:
if suffix and vendoros.endswith(suffix):
vendoros = vendoros[:-len(suffix)]
# Arm must use linux-gnueabi not linux as only the former is accepted by gcc
if vendoros.startswith("arm-") and not vendoros.endswith("-gnueabi"):
vendoros = vendoros + "-gnueabi"
return vendoros
ORIG_TARGET_VENDOR := "${TARGET_VENDOR}"
BASETARGET_SYS = "${@get_original_os(d)}"
addtask extra_symlinks after do_multilib_install before do_package do_populate_sysroot
fakeroot python do_extra_symlinks() {
if bb.data.inherits_class('nativesdk', d):
return
targetsys = d.getVar('BASETARGET_SYS')
if targetsys != d.getVar('TARGET_SYS'):
dest = d.getVar('D') + d.getVar('libdir') + '/' + targetsys
src = d.getVar('TARGET_SYS')
if not os.path.lexists(dest) and os.path.lexists(d.getVar('D') + d.getVar('libdir')):
os.symlink(src, dest)
}

View File

@@ -0,0 +1,58 @@
#
# Notes on the way the OE cross toolchain now works
#
# We need a libgcc to build glibc. Tranditionally we therefore built
# a non-threaded and non-shared compiler (gcc-cross-initial), then use
# that to build libgcc-initial which is used to build glibc which we can
# then build gcc-cross and libgcc against.
#
# We were able to drop the glibc dependency from gcc-cross, with two tweaks:
# a) specify the minimum glibc version to support in a configure option
# b) create a dummy limits.h file so that later when glibc creates one,
# the headers structure has support for it. We can do this with a simple
# empty file
#
# Once gcc-cross is libc independent, we can use it to build both
# libgcc-initial and then later libgcc.
#
# libgcc-initial is tricky as we need to imitate the non-threaded and
# non-shared case. We can do that by hacking the threading mode back to
# "single" even if gcc reports "posix" and disable libc presence for the
# libgcc-intial build. We have to create the dummy limits.h to avoid
# compiler errors from a missing header.
#
# glibc will fail to link with libgcc-initial due to a missing "exception
# handler" capable libgcc (libgcc_eh.a). Since we know glibc doesn't need
# any exception handler, we can safely symlink to libgcc.a.
#
require libgcc-common.inc
DEPENDS = "virtual/${TARGET_PREFIX}gcc"
LICENSE = "GPL-3.0-with-GCC-exception"
PACKAGES = ""
EXTRA_OECONF += "--disable-shared"
inherit nopackages
# We really only want this built by things that need it, not any recrdeptask
deltask do_build
do_configure:prepend () {
install -d ${STAGING_INCDIR}
touch ${STAGING_INCDIR}/limits.h
sed -i -e 's#INHIBIT_LIBC_CFLAGS =.*#INHIBIT_LIBC_CFLAGS = -Dinhibit_libc#' ${B}/gcc/libgcc.mvars
sed -i -e 's#inhibit_libc = false#inhibit_libc = true#' ${B}/gcc/Makefile
}
do_configure:append () {
sed -i -e 's#thread_header = .*#thread_header = gthr-single.h#' ${B}/${BPN}/Makefile
}
do_install:append () {
ln -s libgcc.a ${D}${libdir}/${TARGET_SYS}/${BINV}/libgcc_eh.a
}

View File

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

View File

@@ -0,0 +1,53 @@
require libgcc-common.inc
DEPENDS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++ virtual/${MLPREFIX}libc"
do_install:append:class-target () {
if [ "${TCLIBC}" != "glibc" ]; then
case "${TARGET_OS}" in
"linux-musl" | "linux-*spe") extra_target_os="linux";;
"linux-musleabi") extra_target_os="linux-gnueabi";;
*) extra_target_os="linux";;
esac
if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
fi
fi
if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
case "${TARGET_OS}" in
"linux-musleabi") extra_target_os="linux-musleabihf";;
"linux-gnueabi") extra_target_os="linux-gnueabihf";;
esac
if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
fi
fi
}
PACKAGES = "\
${PN} \
${PN}-dev \
${PN}-dbg \
"
# All libgcc source is marked with the exception.
#
LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
FILES:${PN}-dev = "\
${base_libdir}/libgcc*.so \
${@oe.utils.conditional('BASETARGET_SYS', '${TARGET_SYS}', '', '${libdir}/${BASETARGET_SYS}', d)} \
${libdir}/${TARGET_SYS}/${BINV}* \
${libdir}/${TARGET_ARCH}${TARGET_VENDOR}* \
"
do_package[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
INSANE_SKIP:${PN}-dev = "staticdev"

View File

@@ -0,0 +1,7 @@
require recipes-devtools/gcc/gcc-${PV}.inc
require libgcc.inc
LDFLAGS += "-fuse-ld=bfd"
# Building with thumb enabled on armv6t fails
ARM_INSTRUCTION_SET:armv6 = "arm"

View File

@@ -0,0 +1,89 @@
require gcc-configure-common.inc
EXTRA_OECONF_PATHS = "\
--with-sysroot=/not/exist \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"
# An arm hard float target like raspberrypi4 won't build
# as CFLAGS don't make it to the fortran compiler otherwise
# (the configure script sets FC to $GFORTRAN unconditionally)
export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
do_configure () {
for target in libbacktrace libgfortran
do
rm -rf ${B}/${TARGET_SYS}/$target/
mkdir -p ${B}/${TARGET_SYS}/$target/
cd ${B}/${TARGET_SYS}/$target/
chmod a+x ${S}/$target/configure
relpath=${@os.path.relpath("${S}", "${B}/${TARGET_SYS}")}
../$relpath/$target/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
# Easiest way to stop bad RPATHs getting into the library since we have a
# broken libtool here
sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/$target/libtool
done
}
EXTRACONFFUNCS += "extract_stashed_builddir"
do_configure[depends] += "${COMPILERDEP}"
do_compile () {
for target in libbacktrace libgfortran
do
cd ${B}/${TARGET_SYS}/$target/
oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/$target/
done
}
do_install () {
cd ${B}/${TARGET_SYS}/libgfortran/
oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libgfortran/ install
if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude
fi
if [ -d ${D}${infodir} ]; then
rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
fi
chown -R root:root ${D}
}
# avoid virtual/libc
INHIBIT_DEFAULT_DEPS = "1"
DEPENDS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs"
BBCLASSEXTEND = "nativesdk"
PACKAGES = "\
${PN}-dbg \
libgfortran \
libgfortran-dev \
libgfortran-staticdev \
"
LICENSE:${PN} = "GPL-3.0-with-GCC-exception"
LICENSE:${PN}-dev = "GPL-3.0-with-GCC-exception"
LICENSE:${PN}-dbg = "GPL-3.0-with-GCC-exception"
FILES:${PN} = "${libdir}/libgfortran.so.*"
FILES:${PN}-dev = "\
${libdir}/libgfortran*.so \
${libdir}/libgfortran.spec \
${libdir}/libgfortran.la \
${libdir}/gcc/${TARGET_SYS}/${BINV}/libgfortranbegin.* \
${libdir}/gcc/${TARGET_SYS}/${BINV}/libcaf_single* \
${libdir}/gcc/${TARGET_SYS}/${BINV}/finclude/ \
${libdir}/gcc/${TARGET_SYS}/${BINV}/include/ \
"
FILES:${PN}-staticdev = "${libdir}/libgfortran.a"
INSANE_SKIP:${MLPREFIX}libgfortran-dev = "staticdev"
do_package_write_ipk[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_deb[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
do_package_write_rpm[depends] += "virtual/${MLPREFIX}libc:do_packagedata"
python __anonymous () {
f = d.getVar("FORTRAN")
if "fortran" not in f:
raise bb.parse.SkipRecipe("libgfortran needs fortran support to be enabled in the compiler")
}

View File

@@ -0,0 +1,3 @@
require recipes-devtools/gcc/gcc-${PV}.inc
require libgfortran.inc