mirror of
https://git.yoctoproject.org/poky
synced 2026-04-27 21:32:13 +02:00
The gcc-runtime recipe builds the gcc libraries including libstdc++ with $TARGET_CC_ARCH flags, which include -march=FOO flags that affect whether atomic instructions are available. This causes an ABI incompatibility when the compiler by default generates code for less capable architectures. For example, gcc-runtime libraries on a Cortex-A8 are built with a different C++11/C++14 mutex implementation than is used code compiled outside OE and without architecture-specific flags. This commit fixes the problem specifically for ABI issues related to atomic instructions available in ARMV6 and subsequent architectures. Other ABI incompatibilities may remain in other architectures. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62100 (From OE-Core rev: 0ba6ab39f187ecd4261f08e768f365f461384a3a) Signed-off-by: Peter A. Bigot <pab@pabigot.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
138 lines
4.8 KiB
PHP
138 lines
4.8 KiB
PHP
require gcc-multilib-config.inc
|
|
#
|
|
# Build the list of lanaguages to build.
|
|
#
|
|
# These can be overridden by the version specific .inc file.
|
|
|
|
# Java (gcj doesn't work on all architectures)
|
|
JAVA ?= ",java"
|
|
JAVA_arm ?= ""
|
|
JAVA_armeb ?= ""
|
|
JAVA_mipsel ?= ""
|
|
JAVA_sh3 ?= ""
|
|
# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
|
|
FORTRAN ?= ",f77"
|
|
LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"
|
|
# disable --enable-target-optspace for powerpc SPE
|
|
# at -Os libgcc.so.1 creates references into
|
|
# hidden symbols in libgcc.a which linker complains
|
|
# when linking shared libraries further in the build like (gnutls)
|
|
|
|
SPECIAL_ARCH_LIST = "powerpc"
|
|
OPTSPACE = '${@bb.utils.contains("SPECIAL_ARCH_LIST", "${TARGET_ARCH}", "", "--enable-target-optspace",d)}'
|
|
|
|
EXTRA_OECONF_BASE ?= ""
|
|
EXTRA_OECONF_PATHS ?= ""
|
|
EXTRA_OECONF_INITIAL ?= ""
|
|
EXTRA_OECONF_INTERMEDIATE ?= ""
|
|
|
|
GCCMULTILIB ?= "--disable-multilib"
|
|
GCCTHREADS ?= "posix"
|
|
|
|
EXTRA_OECONF = "\
|
|
${@['--enable-clocale=generic', ''][d.getVar('USE_NLS', True) != 'no']} \
|
|
--with-gnu-ld \
|
|
--enable-shared \
|
|
--enable-languages=${LANGUAGES} \
|
|
--enable-threads=${GCCTHREADS} \
|
|
${GCCMULTILIB} \
|
|
--enable-c99 \
|
|
--enable-long-long \
|
|
--enable-symvers=gnu \
|
|
--enable-libstdcxx-pch \
|
|
--program-prefix=${TARGET_PREFIX} \
|
|
--without-local-prefix \
|
|
${OPTSPACE} \
|
|
${EXTRA_OECONF_BASE} \
|
|
${EXTRA_OECONF_GCC_FLOAT} \
|
|
${EXTRA_OECONF_PATHS} \
|
|
${@get_gcc_mips_plt_setting(bb, d)} \
|
|
${@get_long_double_setting(bb, d)} \
|
|
${@get_gcc_multiarch_setting(bb, d)} \
|
|
"
|
|
|
|
export ac_cv_path_SED = 'sed'
|
|
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).
|
|
|
|
# Build uclibc compilers without cxa_atexit support
|
|
EXTRA_OECONF_append_linux = " --enable-__cxa_atexit"
|
|
EXTRA_OECONF_append_libc-uclibc = " --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"
|
|
|
|
# ARMv6+ adds atomic instructions that affect the ABI in libraries built
|
|
# with TUNE_CCARGS in gcc-runtime. Make the compiler default to a
|
|
# compatible architecture. armv6 and armv7a cover the minimum tune
|
|
# features used in OE.
|
|
EXTRA_OECONF_append_armv6 = " --with-arch=armv6"
|
|
EXTRA_OECONF_append_armv7a = " --with-arch=armv7-a"
|
|
|
|
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
|
|
}
|
|
|
|
python do_preconfigure () {
|
|
import subprocess
|
|
cmd = d.expand('PATH=${PATH} cd ${S} && gnu-configize')
|
|
subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
|
|
# See 0044-gengtypes.patch, we need to regenerate this file
|
|
bb.utils.remove(d.expand("${S}/gcc/gengtype-lex.c"))
|
|
}
|
|
addtask do_preconfigure after do_patch before do_configure
|
|
do_preconfigure[depends] += "gnu-config-native:do_populate_sysroot autoconf-native:do_populate_sysroot"
|
|
|
|
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
|
|
}
|
|
|