From 239f1e71e467d541072f66fa7f28f08e94061780 Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Tue, 24 Oct 2023 11:47:14 +0800 Subject: [PATCH 1/5] yocto: checkout to openEuler source * some packages checkout to openEuler source: autoconf, automake, cmake, ninja, python3-git, libpciaccess Signed-off-by: lixiaoyong --- .../autoconf/autoconf_%.bbappend | 4 ++++ .../automake/automake_%.bbappend | 4 ++++ .../cmake/cmake-native_%.bbappend | 1 + .../recipes-devtools/cmake/cmake-src.inc | 13 +++++++++++++ .../recipes-devtools/cmake/cmake_%.bbappend | 1 + .../gnu-config/files/gnu-config-20211108.tar.gz | Bin 0 -> 77424 bytes .../gnu-config/gnu-config_%.bbappend | 9 +++++++++ .../recipes-devtools/ninja/ninja_%.bbappend | 6 ++++++ .../python/python3-git_%.bbappend | 9 +++++++++ .../xorg-lib/libpciaccess_%.bbappend | 6 ++++++ 10 files changed, 53 insertions(+) create mode 100644 meta-openeuler/recipes-devtools/autoconf/autoconf_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/automake/automake_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/cmake/cmake-native_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/cmake/cmake-src.inc create mode 100644 meta-openeuler/recipes-devtools/cmake/cmake_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gnu-config/files/gnu-config-20211108.tar.gz create mode 100644 meta-openeuler/recipes-devtools/gnu-config/gnu-config_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/ninja/ninja_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/python/python3-git_%.bbappend create mode 100644 meta-openeuler/recipes-graphics/xorg-lib/libpciaccess_%.bbappend diff --git a/meta-openeuler/recipes-devtools/autoconf/autoconf_%.bbappend b/meta-openeuler/recipes-devtools/autoconf/autoconf_%.bbappend new file mode 100644 index 00000000000..2709c9933c1 --- /dev/null +++ b/meta-openeuler/recipes-devtools/autoconf/autoconf_%.bbappend @@ -0,0 +1,4 @@ +OPENEULER_SRC_URI_REMOVE = "git https http" + +SRC_URI:prepend = "file://${BP}.tar.xz \ +" diff --git a/meta-openeuler/recipes-devtools/automake/automake_%.bbappend b/meta-openeuler/recipes-devtools/automake/automake_%.bbappend new file mode 100644 index 00000000000..2709c9933c1 --- /dev/null +++ b/meta-openeuler/recipes-devtools/automake/automake_%.bbappend @@ -0,0 +1,4 @@ +OPENEULER_SRC_URI_REMOVE = "git https http" + +SRC_URI:prepend = "file://${BP}.tar.xz \ +" diff --git a/meta-openeuler/recipes-devtools/cmake/cmake-native_%.bbappend b/meta-openeuler/recipes-devtools/cmake/cmake-native_%.bbappend new file mode 100644 index 00000000000..05f031f9ae3 --- /dev/null +++ b/meta-openeuler/recipes-devtools/cmake/cmake-native_%.bbappend @@ -0,0 +1 @@ +require cmake-src.inc diff --git a/meta-openeuler/recipes-devtools/cmake/cmake-src.inc b/meta-openeuler/recipes-devtools/cmake/cmake-src.inc new file mode 100644 index 00000000000..5704a5a4111 --- /dev/null +++ b/meta-openeuler/recipes-devtools/cmake/cmake-src.inc @@ -0,0 +1,13 @@ +PV = "3.22.0" + +SRC_URI:remove = " \ +" + +# apply openeuler source package and patches +SRC_URI:prepend = " \ + file://cmake-findruby.patch \ + file://cmake-fedora-flag_release.patch \ + file://cmake-mingw-dl.patch \ +" + +SRC_URI[sha256sum] = "998c7ba34778d2dfdb3df8a695469e24b11e2bfa21fbe41b361a3f45e1c9345e" diff --git a/meta-openeuler/recipes-devtools/cmake/cmake_%.bbappend b/meta-openeuler/recipes-devtools/cmake/cmake_%.bbappend new file mode 100644 index 00000000000..05f031f9ae3 --- /dev/null +++ b/meta-openeuler/recipes-devtools/cmake/cmake_%.bbappend @@ -0,0 +1 @@ +require cmake-src.inc diff --git a/meta-openeuler/recipes-devtools/gnu-config/files/gnu-config-20211108.tar.gz b/meta-openeuler/recipes-devtools/gnu-config/files/gnu-config-20211108.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a2fdf25e5d0e85018173a1920a8f0ade277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S9fm literal 0 HcmV?d00001 diff --git a/meta-openeuler/recipes-devtools/gnu-config/gnu-config_%.bbappend b/meta-openeuler/recipes-devtools/gnu-config/gnu-config_%.bbappend new file mode 100644 index 00000000000..5340c6d67d0 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gnu-config/gnu-config_%.bbappend @@ -0,0 +1,9 @@ +OPENEULER_SRC_URI_REMOVE = "https http git" + +FILESEXTRAPATHS:prepend := "${THISDIR}/files/:" + +PV = "20211108" + +SRC_URI:prepend = "file://${BP}.tar.gz \ +" + diff --git a/meta-openeuler/recipes-devtools/ninja/ninja_%.bbappend b/meta-openeuler/recipes-devtools/ninja/ninja_%.bbappend new file mode 100644 index 00000000000..3acd1d98b9b --- /dev/null +++ b/meta-openeuler/recipes-devtools/ninja/ninja_%.bbappend @@ -0,0 +1,6 @@ +OPENEULER_SRC_URI_REMOVE = "git" + +SRC_URI:prepend = "file://${BP}.tar.gz \ +" + +S = "${WORKDIR}/${BP}" diff --git a/meta-openeuler/recipes-devtools/python/python3-git_%.bbappend b/meta-openeuler/recipes-devtools/python/python3-git_%.bbappend new file mode 100644 index 00000000000..d4ecb7d949e --- /dev/null +++ b/meta-openeuler/recipes-devtools/python/python3-git_%.bbappend @@ -0,0 +1,9 @@ +require pypi-src-openeuler.inc + +PV = "3.1.32" + +SRC_URI:remove = "file://0001-python3-git-CVE-2022-24439-fix-from-PR-1518.patch \ + file://0001-python3-git-CVE-2022-24439-fix-from-PR-1521.patch \ + " + +SRC_URI[sha256sum] = "8d9b8cb1e80b9735e8717c9362079d3ce4c6e5ddeebedd0361b228c3a67a62f6" diff --git a/meta-openeuler/recipes-graphics/xorg-lib/libpciaccess_%.bbappend b/meta-openeuler/recipes-graphics/xorg-lib/libpciaccess_%.bbappend new file mode 100644 index 00000000000..3b3b8e35e55 --- /dev/null +++ b/meta-openeuler/recipes-graphics/xorg-lib/libpciaccess_%.bbappend @@ -0,0 +1,6 @@ +OPENEULER_SRC_URI_REMOVE = "https http git" + +PV = "0.17" + +SRC_URI:prepend = "file://${BP}.tar.gz \ +" -- Gitee From 8ada5942cb2d1790670d9694d8da45266f49b8ef Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Tue, 24 Oct 2023 11:47:57 +0800 Subject: [PATCH 2/5] yocto: checkout gcc to openEuler source * checkout gcc to openEuler source(version: 12.3) Signed-off-by: lixiaoyong --- .../recipes-devtools/gcc/gcc-12.3.inc | 116 + .../recipes-devtools/gcc/gcc-common.inc | 119 + .../gcc/gcc-configure-common.inc | 122 + .../gcc/gcc-cross-canadian.inc | 187 + .../gcc/gcc-cross-canadian_%.bbappend | 1 + .../gcc/gcc-cross-canadian_12.3.bb | 5 + .../recipes-devtools/gcc/gcc-cross.inc | 163 + .../recipes-devtools/gcc/gcc-cross_%.bbappend | 1 + .../recipes-devtools/gcc/gcc-cross_12.3.bb | 3 + .../recipes-devtools/gcc/gcc-crosssdk.inc | 14 + .../gcc/gcc-crosssdk_%.bbappend | 1 + .../recipes-devtools/gcc/gcc-crosssdk_12.3.bb | 2 + .../gcc/gcc-multilib-config.inc | 249 ++ .../recipes-devtools/gcc/gcc-runtime.inc | 310 ++ .../gcc/gcc-runtime_%.bbappend | 1 + .../recipes-devtools/gcc/gcc-runtime_12.3.bb | 2 + .../recipes-devtools/gcc/gcc-sanitizers.inc | 120 + .../gcc/gcc-sanitizers_%.bbappend | 1 + .../gcc/gcc-sanitizers_12.3.bb | 7 + .../gcc/gcc-shared-source.inc | 21 + .../recipes-devtools/gcc/gcc-source.inc | 45 + .../gcc/gcc-source_%.bbappend | 1 + .../recipes-devtools/gcc/gcc-source_12.3.bb | 4 + .../recipes-devtools/gcc/gcc-src.inc | 8 + .../recipes-devtools/gcc/gcc-target.inc | 259 ++ .../recipes-devtools/gcc/gcc-testsuite.inc | 108 + ...0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch | 39 + .../0002-gcc-poison-system-directories.patch | 239 ++ .../gcc/gcc/0003-64-bit-multilib-hack.patch | 134 + ...R_BUILD-in-a-couple-of-places-to-avo.patch | 64 + ...ts.h-in-B-instead-of-S-and-t-oe-in-B.patch | 92 + .../gcc/gcc/0006-cpp-honor-sysroot.patch | 53 + ...AMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch | 403 +++ .../gcc/gcc/0008-libtool.patch | 39 + ...s-fix-v4bx-to-linker-to-support-EABI.patch | 40 + ...-config-files-from-B-instead-of-usin.patch | 99 + ...ir-from-.la-which-usually-points-to-.patch | 28 + ...e-target-gcc-headers-can-be-included.patch | 113 + ...t-directory-during-relink-if-inst_pr.patch | 35 + ...-fix-libcc1-s-install-path-and-rpath.patch | 51 + ...le-sysroot-support-for-nativesdk-gcc.patch | 510 +++ ...sroot-gcc-version-specific-dirs-with.patch | 99 + ...d-to-link-commandline-for-musl-targe.patch | 84 + ...Re-introduce-spe-commandline-options.patch | 39 + ...as-for-__cpu_indicator_init-instead-.patch | 83 + ...s-Do-not-use-__LINE__-for-maintainin.patch | 182 + ...omic-Do-not-enforce-march-on-aarch64.patch | 42 + .../0024-Fix-install-path-of-linux64.h.patch | 31 + ...ch64-Fix-loose-ldpstp-check-PR111411.patch | 117 + .../gcc/gcc/0026-rust-recursion-limit.patch | 92 + .../gcc/gcc/CVE-2023-4039.patch | 3093 +++++++++++++++++ .../gcc/gcc/hardcoded-paths.patch | 19 + .../gcc/gcc/prefix-map-realpath.patch | 63 + .../recipes-devtools/gcc/gcc_%.bbappend | 1 + .../recipes-devtools/gcc/gcc_12.3.bb | 14 + .../recipes-devtools/gcc/libgcc-common.inc | 163 + .../recipes-devtools/gcc/libgcc-initial.inc | 58 + .../gcc/libgcc-initial_%.bbappend | 1 + .../gcc/libgcc-initial_12.3.bb | 5 + .../recipes-devtools/gcc/libgcc.inc | 53 + .../recipes-devtools/gcc/libgcc_%.bbappend | 1 + .../recipes-devtools/gcc/libgcc_12.3.bb | 5 + .../recipes-devtools/gcc/libgfortran.inc | 88 + .../gcc/libgfortran_%.bbappend | 1 + .../recipes-devtools/gcc/libgfortran_12.3.bb | 3 + 65 files changed, 8146 insertions(+) create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-12.3.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-common.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-configure-common.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-cross_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-crosssdk.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-multilib-config.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-runtime.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-runtime_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-runtime_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-sanitizers.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-shared-source.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-source.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-source_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-source_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-src.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-target.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc-testsuite.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0008-libtool.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/CVE-2023-4039.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/hardcoded-paths.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc/prefix-map-realpath.patch create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/gcc_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc-common.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc-initial.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc-initial_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc-initial_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/libgcc_12.3.bb create mode 100644 meta-openeuler/recipes-devtools/gcc/libgfortran.inc create mode 100644 meta-openeuler/recipes-devtools/gcc/libgfortran_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/gcc/libgfortran_12.3.bb diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-12.3.inc b/meta-openeuler/recipes-devtools/gcc/gcc-12.3.inc new file mode 100644 index 00000000000..0518b1db4e0 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-12.3.inc @@ -0,0 +1,116 @@ +require gcc-common.inc + +# Third digit in PV should be incremented after a minor release + +PV = "12.3.0" + +# BINV should be incremented to a revision after a minor gcc release + +BINV = "12.3.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 \ +" +# from git +#RELEASE ?= "7092b7aea122a91824d048aeb23834cf1d19b1a1" +#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 ?= "12.1.0-RC-20220429" +#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-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://0023-libatomic-Do-not-enforce-march-on-aarch64.patch \ + file://0024-Fix-install-path-of-linux64.h.patch \ + file://0026-rust-recursion-limit.patch \ + file://prefix-map-realpath.patch \ + file://hardcoded-paths.patch \ + file://CVE-2023-4039.patch \ + file://0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch \ +" +SRC_URI[sha256sum] = "949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b" + +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} \ +" + +# Is a binutils 2.26 issue, not gcc +CVE_CHECK_IGNORE += "CVE-2021-37322" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-common.inc b/meta-openeuler/recipes-devtools/gcc/gcc-common.inc new file mode 100644 index 00000000000..d3b36937bf4 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-common.inc @@ -0,0 +1,119 @@ +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/${MLPREFIX}${TARGET_PREFIX}gcc:do_gcc_stash_builddir" +COMPILERDEP:class-nativesdk = "virtual/${TARGET_PREFIX}gcc-crosssdk: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" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-configure-common.inc b/meta-openeuler/recipes-devtools/gcc/gcc-configure-common.inc new file mode 100644 index 00000000000..dba25eb7543 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-configure-common.inc @@ -0,0 +1,122 @@ +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 +} + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian.inc b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian.inc new file mode 100644 index 00000000000..c36e4cba810 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian.inc @@ -0,0 +1,187 @@ +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-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk 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 () { + 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- 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 +} + +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}" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_12.3.bb new file mode 100644 index 00000000000..bf53c5cd787 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross-canadian_12.3.bb @@ -0,0 +1,5 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-cross-canadian.inc + + + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross.inc b/meta-openeuler/recipes-devtools/gcc/gcc-cross.inc new file mode 100644 index 00000000000..a540fb2434a --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross.inc @@ -0,0 +1,163 @@ +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}" + + # Prevent native/host sysroot path from being used in configargs.h header, + # as it will be rewritten when used by other sysroots preventing support + # for gcc plugins + oe_runmake configure-gcc + sed -i 's@${STAGING_DIR_TARGET}@/host@g' ${B}/gcc/configargs.h + sed -i 's@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/configargs.h + + # 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@${STAGING_DIR_HOST}@/host@g' ${B}/gcc/checksum-options + + 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/ + + 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 + + # 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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-cross_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-cross_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-cross_12.3.bb new file mode 100644 index 00000000000..b43cca0c526 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-cross_12.3.bb @@ -0,0 +1,3 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-cross.inc + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk.inc b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk.inc new file mode 100644 index 00000000000..74c4537f4f4 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk.inc @@ -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-crosssdk gettext-native ${NATIVEDEPS}" +PROVIDES = "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/${TARGET_PREFIX}g++-crosssdk" + +gcc_multilib_setup[vardepsexclude] = "MULTILIB_VARIANTS" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_12.3.bb new file mode 100644 index 00000000000..40a6c4feff8 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-crosssdk_12.3.bb @@ -0,0 +1,2 @@ +require recipes-devtools/gcc/gcc-cross_${PV}.bb +require gcc-crosssdk.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-multilib-config.inc b/meta-openeuler/recipes-devtools/gcc/gcc-multilib-config.inc new file mode 100644 index 00000000000..2dbbc23c940 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-multilib-config.inc @@ -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" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-runtime.inc b/meta-openeuler/recipes-devtools/gcc/gcc-runtime.inc new file mode 100644 index 00000000000..64b6168ba76 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-runtime.inc @@ -0,0 +1,310 @@ +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 + 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 +} + +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 += "\ + ${libdir}/libstdc++.*-gdb.py \ + ${datadir}/gcc-${BINV}/python/libstdcxx \ +" + +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 + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-runtime_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-runtime_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-runtime_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-runtime_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-runtime_12.3.bb new file mode 100644 index 00000000000..dd430b57ebf --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-runtime_12.3.bb @@ -0,0 +1,2 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require gcc-runtime.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers.inc new file mode 100644 index 00000000000..9881afa8370 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers.inc @@ -0,0 +1,120 @@ +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, and aarch64 are supported +COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-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}/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" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_12.3.bb new file mode 100644 index 00000000000..8bda2ccad67 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-sanitizers_12.3.bb @@ -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" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-shared-source.inc b/meta-openeuler/recipes-devtools/gcc/gcc-shared-source.inc new file mode 100644 index 00000000000..03f520b0933 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-shared-source.inc @@ -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} +} diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-source.inc b/meta-openeuler/recipes-devtools/gcc/gcc-source.inc new file mode 100644 index 00000000000..265bcf4bef5 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-source.inc @@ -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" + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-source_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc-source_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-source_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-source_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc-source_12.3.bb new file mode 100644 index 00000000000..b890fa33ea5 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-source_12.3.bb @@ -0,0 +1,4 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require recipes-devtools/gcc/gcc-source.inc + +EXCLUDE_FROM_WORLD = "1" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-src.inc b/meta-openeuler/recipes-devtools/gcc/gcc-src.inc new file mode 100644 index 00000000000..cafe38286d9 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-src.inc @@ -0,0 +1,8 @@ +OPENEULER_REPO_NAME = "gcc" +OPENEULER_SRC_URI_REMOVE = "http git" + +# use openeuler source +SRC_URI += "file://gcc-${PV}.tar.xz" + +PV = "12.3.0" +BINV = "12.3.0" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-target.inc b/meta-openeuler/recipes-devtools/gcc/gcc-target.inc new file mode 100644 index 00000000000..7dac3ef422c --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-target.inc @@ -0,0 +1,259 @@ +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 () { + # Prevent full target 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}@/@g' ${B}/gcc/configargs.h + sed -i 's@${STAGING_DIR_HOST}@/@g' ${B}/gcc/configargs.h + + # 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@${STAGING_DIR_TARGET}@/@g' ${B}/gcc/checksum-options + + 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- 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} +} + +do_install:append () { + # + # Thefixinc.sh script, run on the gcc's compile phase, looks into sysroot header + # files and places the modified files into + # {D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed folder. This makes the + # build not deterministic. The following code prunes all those headers + # except those under include-fixed/linux, *limits.h and README, yielding + # the same include-fixed folders no matter what sysroot + + include_fixed="${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include-fixed" + for f in $(find ${include_fixed} -type f); do + case $f in + */include-fixed/linux/*) + continue + ;; + */include-fixed/*limits.h) + continue + ;; + */include-fixed/README) + continue + ;; + *) + # remove file and directory if empty + bbdebug 2 "Pruning $f" + rm $f + find $(dirname $f) -maxdepth 0 -empty -exec rmdir {} \; + ;; + esac + done +} + +# 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" diff --git a/meta-openeuler/recipes-devtools/gcc/gcc-testsuite.inc b/meta-openeuler/recipes-devtools/gcc/gcc-testsuite.inc new file mode 100644 index 00000000000..64f60c730fe --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc-testsuite.inc @@ -0,0 +1,108 @@ +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.lstrip("qemu-") in ["x86_64", "i386", "arm", "aarch64"]: + args += ["-cpu", "max"] + elif qemu_binary.lstrip("qemu-") in ["ppc"]: + args += d.getVar("QEMU_EXTRAOPTIONS_%s" % d.getVar('PACKAGE_ARCH')).split() + 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"))) +} + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch new file mode 100644 index 00000000000..66e582ca989 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch @@ -0,0 +1,39 @@ +From 31f94ef5b43a984a98f0eebd2dcf1b53aa1d7bce Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 29 Mar 2013 08:37:11 +0400 +Subject: [PATCH] gcc-4.3.1: ARCH_FLAGS_FOR_TARGET + +Signed-off-by: Khem Raj + +Upstream-Status: Inappropriate [embedded specific] +--- + configure | 2 +- + configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure b/configure +index 5dcaab14ae9..f76310a36bb 100755 +--- a/configure ++++ b/configure +@@ -10165,7 +10165,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 85977482aee..8b9097c7a45 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -3346,7 +3346,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/meta-openeuler/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch new file mode 100644 index 00000000000..5aa635b3d4e --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch @@ -0,0 +1,239 @@ +From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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: Pending +Signed-off-by: Mark Hatle +Signed-off-by: Khem Raj +--- + gcc/common.opt | 4 ++++ + gcc/config.in | 10 ++++++++++ + gcc/configure | 19 +++++++++++++++++++ + gcc/configure.ac | 16 ++++++++++++++++ + gcc/doc/invoke.texi | 9 +++++++++ + gcc/gcc.cc | 15 ++++++++++++--- + gcc/incpath.cc | 21 +++++++++++++++++++++ + 7 files changed, 91 insertions(+), 3 deletions(-) + +diff --git a/gcc/common.opt b/gcc/common.opt +index 8a0dafc52..0357868e2 100644 +--- a/gcc/common.opt ++++ b/gcc/common.opt +@@ -710,6 +710,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 64c27c9cf..a693cb8a8 100644 +--- a/gcc/config.in ++++ b/gcc/config.in +@@ -230,6 +230,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 2b83acfb0..8bb97578c 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -1023,6 +1023,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 +@@ -1785,6 +1786,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 +@@ -31996,6 +31999,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 daf2a708c..6155b83a7 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -7435,6 +7435,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 ff6c338be..a8ebfa59a 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}. + -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol + -Wparentheses -Wno-pedantic-ms-format @gol + -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol ++-Wno-poison-system-directories @gol + -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol + -Wrestrict -Wno-return-local-addr -Wreturn-type @gol + -Wno-scalar-storage-order -Wsequence-point @gol +@@ -8029,6 +8030,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. + ++@item -Wno-poison-system-directories ++@opindex 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. ++ + @item -Wfloat-equal + @opindex Wfloat-equal + @opindex Wno-float-equal +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index beefde7f6..4e6557b3c 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -1162,6 +1162,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):\ +@@ -1257,8 +1259,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 ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}" ++#endif ++ " %{undef} %{save-temps*:-fpch-preprocess}"; + + /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. + +@@ -1287,7 +1292,11 @@ static const char *cc1_options = + %{coverage:-fprofile-arcs -ftest-coverage}\ + %{fprofile-arcs|fprofile-generate*|coverage:\ + %{!fprofile-update=single:\ +- %{pthread:-fprofile-update=prefer-atomic}}}"; ++ %{pthread:-fprofile-update=prefer-atomic}}}" ++#ifdef POISON_BY_DEFAULT ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}" ++#endif ++ ; + + static const char *asm_options = + "%{-target-help:%:print-asm-header()} " +diff --git a/gcc/incpath.cc b/gcc/incpath.cc +index 622204a38..5ac03c086 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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch new file mode 100644 index 00000000000..e83f05b8aa1 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0003-64-bit-multilib-hack.patch @@ -0,0 +1,134 @@ +From 34b861e7a4cfd7b1f0d2c0f8cf9bb0b0b81eb61a Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +Signed-off-by: Elvis Dowson +Signed-off-by: Mark Hatle +Signed-off-by: Khem Raj +--- + 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 | 10 +++------- + gcc/config/riscv/t-linux | 6 ++++-- + gcc/config/rs6000/t-linux64 | 5 ++--- + 6 files changed, 17 insertions(+), 22 deletions(-) + +diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux +index d0cd546002a..f4056d68372 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 ecb9ae6859f..12a164028d4 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 + # . + +-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 5526ad0e6cc..fa51c88912b 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 2fdd8e00407..04f2099250f 100644 +--- a/gcc/config/mips/t-linux64 ++++ b/gcc/config/mips/t-linux64 +@@ -17,10 +17,6 @@ + # . + + 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) +-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)) ++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..e4d817621fc 100644 +--- a/gcc/config/riscv/t-linux ++++ b/gcc/config/riscv/t-linux +@@ -1,3 +1,5 @@ + # Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ +-MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) +-MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) ++#MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) ++MULTILIB_DIRNAMES := . . ++#MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) ++MULTILIB_OSDIRNAMES := ../$(shell basename $(base_libdir)) ../$(shell basename $(base_libdir)) +diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 +index 47e0efd5764..05f5a3f188e 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/meta-openeuler/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch new file mode 100644 index 00000000000..e8f21634769 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0004-Pass-CXXFLAGS_FOR_BUILD-in-a-couple-of-places-to-avo.patch @@ -0,0 +1,64 @@ +From 7f40f8321fb999e9b34d948724517d3fb0d26820 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +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 + +ChangeLog: + + * Makefile.in: Regenerate. + * Makefile.tpl: Add missing CXXFLAGS_FOR_BUILD overrides + +Upstream-Status: Pending [should be submittable] + +Signed-off-by: Richard Purdie +Signed-off-by: Khem Raj +--- + Makefile.in | 2 ++ + Makefile.tpl | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/Makefile.in b/Makefile.in +index 593495e1650..1d9c83cc566 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -176,6 +176,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. +@@ -207,6 +208,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 ef58fac2b9a..bab04f335c2 100644 +--- a/Makefile.tpl ++++ b/Makefile.tpl +@@ -179,6 +179,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/meta-openeuler/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch new file mode 100644 index 00000000000..e34eb2cf3fb --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0005-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch @@ -0,0 +1,92 @@ +From 5455fc1de74897a27c1199dc5611ec02243e24af Mon Sep 17 00:00:00 2001 +From: Khem Raj +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. + +Signed-off-by: Khem Raj + +Upstream-Status: Pending + +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. +Signed-off-by: Hongxu Jia +--- + 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 31ff95500c9..a8277254696 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -553,7 +553,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 dc2d59701ad..3fc0e2f5813 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -13381,8 +13381,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 36ce78924de..46de496b256 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2332,8 +2332,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 91cc43f69ff..8de33713cd8 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. diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch new file mode 100644 index 00000000000..b08aecc736d --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0006-cpp-honor-sysroot.patch @@ -0,0 +1,53 @@ +From abc3b82ab24169277f2090e9df1ceac3573142be Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 + +Signed-off-by: Khem Raj + +Upstream-Status: Pending +--- + 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 f35c9fab76b..19ddc98ce7f 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 ce161d3c853..aa4cf92fb78 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -1476,7 +1476,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}, diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch new file mode 100644 index 00000000000..b59eed57e9e --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0007-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch @@ -0,0 +1,403 @@ +From 4de00af67b57b5440bdf61ab364ad959ad0aeee7 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 + +Signed-off-by: Khem Raj + +Upstream-Status: Inappropriate [OE configuration] +Signed-off-by: Khem Raj +--- + 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 5e4553d79f5..877e8841eb2 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 17f16a55910..0a7be38fa63 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 50cc0bc6d08..17c18b27145 100644 +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -65,8 +65,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 \ +@@ -89,7 +89,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 df3da67c4f0..37456e9d5a4 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 5d99ee56d5b..a76022c9ccc 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 + . */ + + #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 8681e36f10d..ddce49b6b60 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 74f70793d90..4ce173384ef 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -99,10 +99,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 664dc9206ad..082bd7cfc6f 100644 +--- a/gcc/config/loongarch/gnu-user.h ++++ b/gcc/config/loongarch/gnu-user.h +@@ -31,11 +31,11 @@ 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" + + #undef MUSL_DYNAMIC_LINKER + #define MUSL_DYNAMIC_LINKER \ +- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" 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 5b1a365eda4..2e63df1ae9c 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 230b7789bb8..d96d134bfcf 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 f5dd813acad..7a13e1c9799 100644 +--- a/gcc/config/nios2/linux.h ++++ b/gcc/config/nios2/linux.h +@@ -29,8 +29,8 @@ + #undef CPP_SPEC + #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + +-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-nios2.so.1" +-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-nios2.so.1" ++#define GLIBC_DYNAMIC_LINKER SYSTEMLIBS_DIR "ld-linux-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 38803723ba9..d5ef8a96a19 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" + + /* Because RISC-V only has word-sized atomics, it requries libatomic where + others do not. So link libatomic by default, as needed. */ +diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h +index b2a7afabc73..364c1a5b155 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 7e2519de5d4..a73954d9de5 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -779,10 +779,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 d7b7e7a7b02..0139b4d06ca 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 d96d077c99e..7d27f9893ee 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 6a809e9092d..60603765ad6 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 d08a2ef96fe..e6955da0a5b 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 + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0008-libtool.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0008-libtool.patch new file mode 100644 index 00000000000..c9bc38ccf08 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0008-libtool.patch @@ -0,0 +1,39 @@ +From 5117519c1897a49b09fe7fff213b9c2ea15d37f5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 + +Signed-off-by: Khem Raj + +Upstream-Status: Pending +--- + 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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch new file mode 100644 index 00000000000..dd67b115f01 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0009-gcc-armv4-pass-fix-v4bx-to-linker-to-support-EABI.patch @@ -0,0 +1,40 @@ +From 32129f9682d0d27fc67af10f077ad2768935cbe6 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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. + +Signed-off-by: Khem Raj + +Upstream-Status: Pending +--- + 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 17c18b27145..8eacb099317 100644 +--- a/gcc/config/arm/linux-eabi.h ++++ b/gcc/config/arm/linux-eabi.h +@@ -91,10 +91,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) + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch new file mode 100644 index 00000000000..45edc62eb50 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0010-Use-the-multilib-config-files-from-B-instead-of-usin.patch @@ -0,0 +1,99 @@ +From bf85b8bbcb4b77725d4c22c1bb25a29f6ff21038 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +Signed-off-by: Constantin Musca + +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 3fc0e2f5813..2f0f0e057a9 100755 +--- a/gcc/configure ++++ b/gcc/configure +@@ -13361,10 +13361,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}" + +@@ -13375,6 +13385,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 46de496b256..6155b83a732 100644 +--- a/gcc/configure.ac ++++ b/gcc/configure.ac +@@ -2312,10 +2312,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}" + +@@ -2326,6 +2336,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/meta-openeuler/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch new file mode 100644 index 00000000000..352c6eec29b --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0011-Avoid-using-libdir-from-.la-which-usually-points-to-.patch @@ -0,0 +1,28 @@ +From e5463727ff028cee5e452da38f5b4c44d52e412e Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +Signed-off-by: Khem Raj +--- + 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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch new file mode 100644 index 00000000000..61e61ecc6ed --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0013-Ensure-target-gcc-headers-can-be-included.patch @@ -0,0 +1,113 @@ +From 612801d426e75ff997cfabda380dbe52c2cbc532 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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: Pending + +Signed-off-by: Paul Eggleton +Signed-off-by: Khem Raj +--- + 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 a8277254696..07fa63b6640 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -632,6 +632,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 +@@ -3024,6 +3025,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 4ce173384ef..8a3cd4f2d34 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -170,6 +170,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 }, \ +@@ -196,6 +203,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 a73954d9de5..e5dd6538358 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -994,6 +994,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 }, \ +@@ -1020,6 +1027,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 7888300f277..52cf14e92f8 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 }, diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch new file mode 100644 index 00000000000..94308b2aca5 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0014-Don-t-search-host-directory-during-relink-if-inst_pr.patch @@ -0,0 +1,35 @@ +From 9ae49e7b88c208ab79ec9c2fc4a2fa8a3f1e85bb Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- + 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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch new file mode 100644 index 00000000000..ce9635ce4dd --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0015-libcc1-fix-libcc1-s-install-path-and-rpath.patch @@ -0,0 +1,51 @@ +From bf918db7117f41d3c04162095641165ca241707d Mon Sep 17 00:00:00 2001 +From: Robert Yang +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 +--- + 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 6e3a34ff7e2..3f3f6391aba 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 \ diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch new file mode 100644 index 00000000000..3b54719536f --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch @@ -0,0 +1,510 @@ +From 4fbbd40d7db89cdbeaf93df1e1da692b1f80a5bc Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 + +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 +--- + gcc/c-family/c-opts.cc | 4 +-- + gcc/config/linux.h | 24 +++++++-------- + gcc/config/rs6000/sysv4.h | 24 +++++++-------- + gcc/cppdefault.cc | 63 ++++++++++++++++++++++++--------------- + gcc/cppdefault.h | 13 ++++---- + gcc/gcc.cc | 20 +++++++++---- + gcc/incpath.cc | 12 ++++---- + gcc/prefix.cc | 6 ++-- + 8 files changed, 94 insertions(+), 72 deletions(-) + +diff --git a/gcc/c-family/c-opts.cc b/gcc/c-family/c-opts.cc +index a341a061758..83b0bef4dbb 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 8a3cd4f2d34..58143dff731 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -134,53 +134,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 +@@ -205,7 +205,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 e5dd6538358..b496849b792 100644 +--- a/gcc/config/rs6000/sysv4.h ++++ b/gcc/config/rs6000/sysv4.h +@@ -958,53 +958,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 +@@ -1029,7 +1029,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 52cf14e92f8..d8977afc05e 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,23 +86,23 @@ 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. */ +- { 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 +@@ -90,33 +114,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 fb97c0b5814..6267150facc 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 aa4cf92fb78..5569a39a14a 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -252,6 +252,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; +@@ -575,6 +577,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. +@@ -1627,10 +1630,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 +@@ -1638,9 +1641,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 +@@ -6676,6 +6679,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 c80f100f476..5ac03c08693 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 096ed5afa3d..2526f0ecc39 100644 +--- a/gcc/prefix.cc ++++ b/gcc/prefix.cc +@@ -72,7 +72,9 @@ License along with GCC; see the file COPYING3. If not see + #include "prefix.h" + #include "common/common-target.h" + +-static const char *std_prefix = PREFIX; ++char PREFIXVAR1[4096] __attribute__ ((section (".gccrelocprefix"))) = PREFIX; ++ ++static const char *std_prefix = PREFIXVAR1; + + static const char *get_key_value (char *); + static char *translate_name (char *); +@@ -212,7 +214,7 @@ translate_name (char *name) + prefix = getenv (key); + + if (prefix == 0) +- prefix = PREFIX; ++ prefix = PREFIXVAR1; + + /* We used to strip trailing DIR_SEPARATORs here, but that can + sometimes yield a result with no separator when one was coded diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch new file mode 100644 index 00000000000..9b05da64a70 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0017-Search-target-sysroot-gcc-version-specific-dirs-with.patch @@ -0,0 +1,99 @@ +From 33a1f07a4417247dc24819d4e583ca09f56d5a7b Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +//5.2.0/ +which is a default search path for GCC (aka multi_suffix in the +code below). 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. can be handled by mapping the multilib + 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: + +/lib32/mips64-poky-linux/5.2.0/ +/lib32/../lib64/ +/usr/lib32/mips64-poky-linux/5.2.0/ +/usr/lib32/../lib64/ +/lib32/ +/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: + +/lib32/../lib64/mips64-poky-linux/5.2.0/ +/lib32/mips64-poky-linux/5.2.0/ +/lib32/../lib64/ +/usr/lib32/../lib64/mips64-poky-linux/5.2.0/ +/usr/lib32/mips64-poky-linux/5.2.0/ +/usr/lib32/../lib64/ +/lib32/ +/usr/lib32/ + +Upstream-Status: Pending +RP 2015/7/31 + +Signed-off-by: Khem Raj +--- + gcc/gcc.cc | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/gcc/gcc.cc b/gcc/gcc.cc +index 5569a39a14a..4598f6cd7c9 100644 +--- a/gcc/gcc.cc ++++ b/gcc/gcc.cc +@@ -2817,7 +2817,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); + } + +@@ -2829,6 +2829,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) diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch new file mode 100644 index 00000000000..56793e03a3d --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch @@ -0,0 +1,84 @@ +From d7dc2861840e88a4592817a398a054a886c3f3ee Mon Sep 17 00:00:00 2001 +From: Khem Raj +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: Pending + +Signed-off-by: Khem Raj +--- + 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 58143dff731..d2409ccac26 100644 +--- a/gcc/config/linux.h ++++ b/gcc/config/linux.h +@@ -208,6 +208,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 8c9039ac1e5..259cd485973 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 364c1a5b155..e33d9ae98e0 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} \ diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch new file mode 100644 index 00000000000..bb1699be25a --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0019-Re-introduce-spe-commandline-options.patch @@ -0,0 +1,39 @@ +From bf0d7c463e1fab62804556099b56319fe94be1eb Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- + 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 4931d781c4e..3fb87b6f7d5 100644 +--- a/gcc/config/rs6000/rs6000.opt ++++ b/gcc/config/rs6000/rs6000.opt +@@ -348,6 +348,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 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch new file mode 100644 index 00000000000..f37092089f7 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0020-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch @@ -0,0 +1,83 @@ +From a32c75b37209d6836eaaa943dc6b1207acba5d27 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +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 + + * 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 + + * config/i386/i386-expand.c (ix86_expand_builtin): Make __builtin_cpu_init + call __cpu_indicator_init_local instead of __cpu_indicator_init. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + 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 68978ef8dc2..0c71f36b572 100644 +--- a/gcc/config/i386/i386-expand.cc ++++ b/gcc/config/i386/i386-expand.cc +@@ -12321,10 +12321,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 dab1d98060f..cf824b4114a 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) diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch new file mode 100644 index 00000000000..f5f04ae314a --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0021-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch @@ -0,0 +1,182 @@ +From 4efc42b99c96b026f560b0918de7e237ac3dc8d1 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +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 +Signed-off-by: Khem Raj +--- + 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 386ae1b0506..9762e914296 100644 +--- a/gcc/gengtype.cc ++++ b/gcc/gengtype.cc +@@ -1006,7 +1006,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. */ +@@ -1039,7 +1039,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 +@@ -5238,7 +5238,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 59850bb070a..e187f8542a1 100644 +--- a/gcc/genmodes.cc ++++ b/gcc/genmodes.cc +@@ -440,7 +440,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) +@@ -499,7 +499,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, +@@ -552,7 +552,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, +@@ -574,7 +574,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) + +@@ -587,7 +587,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, +@@ -628,16 +628,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. */ +@@ -658,7 +658,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, +@@ -675,7 +675,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, +@@ -690,7 +690,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) +@@ -711,7 +711,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) +@@ -740,7 +740,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, +@@ -767,7 +767,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, +@@ -814,7 +814,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) diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch new file mode 100644 index 00000000000..2f016598470 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0023-libatomic-Do-not-enforce-march-on-aarch64.patch @@ -0,0 +1,42 @@ +From 52931ec7a708b58d68e69ce9eb99001ae9f099dd Mon Sep 17 00:00:00 2001 +From: Khem Raj +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 +--- + libatomic/Makefile.am | 1 - + libatomic/Makefile.in | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am +index d88515e4a03..e0e2f8b442a 100644 +--- a/libatomic/Makefile.am ++++ b/libatomic/Makefile.am +@@ -125,7 +125,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix _$(s)_.lo,$(SIZEOBJS))) + ## On a target-specific basis, include alternates to be selected by IFUNC. + if HAVE_IFUNC + if ARCH_AARCH64_LINUX +-IFUNC_OPTIONS = -march=armv8-a+lse + libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS))) + endif + if ARCH_ARM_LINUX +diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in +index 80d25653dc7..7377689ab34 100644 +--- a/libatomic/Makefile.in ++++ b/libatomic/Makefile.in +@@ -434,7 +434,6 @@ M_SRC = $(firstword $(filter %/$(M_FILE), $(all_c_files))) + libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ + _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) +-@ARCH_AARCH64_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv8-a+lse + @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64 + @ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586 + @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 -mcx16 diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch new file mode 100644 index 00000000000..555be62328e --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0024-Fix-install-path-of-linux64.h.patch @@ -0,0 +1,31 @@ +From 3e67c9c77e46132c252911bf1e5e4222dfd3aa34 Mon Sep 17 00:00:00 2001 +From: Andrei Gherzan +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 + +Upstream-Status: Inappropriate [configuration] +Signed-off-by: Khem Raj +--- + gcc/Makefile.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/gcc/Makefile.in b/gcc/Makefile.in +index 07fa63b6640..0def7394454 100644 +--- a/gcc/Makefile.in ++++ b/gcc/Makefile.in +@@ -3706,6 +3706,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; \ diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch new file mode 100644 index 00000000000..a408a986983 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch @@ -0,0 +1,117 @@ +From adb60dc78e0da4877747f32347cee339364775be Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Fri, 15 Sep 2023 09:19:14 +0100 +Subject: [PATCH] aarch64: Fix loose ldpstp check [PR111411] + +aarch64_operands_ok_for_ldpstp contained the code: + + /* One of the memory accesses must be a mempair operand. + If it is not the first one, they need to be swapped by the + peephole. */ + if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) + && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) + return false; + +But the requirement isn't just that one of the accesses must be a +valid mempair operand. It's that the lower access must be, since +that's the access that will be used for the instruction operand. + +gcc/ + PR target/111411 + * config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require + the lower memory access to a mem-pair operand. + +gcc/testsuite/ + PR target/111411 + * gcc.dg/rtl/aarch64/pr111411.c: New test. + +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d38f45bcca62ca0c7afef4b579f82c5c2a01610] +Signed-off-by: Martin Jansa +--- + gcc/config/aarch64/aarch64.cc | 8 ++- + gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | 57 +++++++++++++++++++++ + 2 files changed, 60 insertions(+), 5 deletions(-) + create mode 100644 gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 6118a3354ac..9b1f791ca8b 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -26154,11 +26154,9 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load, + gcc_assert (known_eq (GET_MODE_SIZE (GET_MODE (mem_1)), + GET_MODE_SIZE (GET_MODE (mem_2)))); + +- /* One of the memory accesses must be a mempair operand. +- If it is not the first one, they need to be swapped by the +- peephole. */ +- if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) +- && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) ++ /* The lower memory access must be a mem-pair operand. */ ++ rtx lower_mem = reversed ? mem_2 : mem_1; ++ if (!aarch64_mem_pair_operand (lower_mem, GET_MODE (lower_mem))) + return false; + + if (REG_P (reg_1) && FP_REGNUM_P (REGNO (reg_1))) +diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c +new file mode 100644 +index 00000000000..ad07e9c6c89 +--- /dev/null ++++ b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c +@@ -0,0 +1,57 @@ ++/* { dg-do compile { target aarch64*-*-* } } */ ++/* { dg-require-effective-target lp64 } */ ++/* { dg-options "-O -fdisable-rtl-postreload -fpeephole2 -fno-schedule-fusion" } */ ++ ++extern int data[]; ++ ++void __RTL (startwith ("ira")) foo (void *ptr) ++{ ++ (function "foo" ++ (param "ptr" ++ (DECL_RTL (reg/v:DI <0> [ ptr ])) ++ (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) ++ ) ;; param "ptr" ++ (insn-chain ++ (block 2 ++ (edge-from entry (flags "FALLTHRU")) ++ (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) ++ (insn 4 (set (reg:DI <0>) (reg:DI x0))) ++ (insn 5 (set (reg:DI <1>) ++ (plus:DI (reg:DI <0>) (const_int 768)))) ++ (insn 6 (set (mem:SI (plus:DI (reg:DI <0>) ++ (const_int 508)) [1 &data+508 S4 A4]) ++ (const_int 0))) ++ (insn 7 (set (mem:SI (plus:DI (reg:DI <1>) ++ (const_int -256)) [1 &data+512 S4 A4]) ++ (const_int 0))) ++ (edge-to exit (flags "FALLTHRU")) ++ ) ;; block 2 ++ ) ;; insn-chain ++ ) ;; function ++} ++ ++void __RTL (startwith ("ira")) bar (void *ptr) ++{ ++ (function "bar" ++ (param "ptr" ++ (DECL_RTL (reg/v:DI <0> [ ptr ])) ++ (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) ++ ) ;; param "ptr" ++ (insn-chain ++ (block 2 ++ (edge-from entry (flags "FALLTHRU")) ++ (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) ++ (insn 4 (set (reg:DI <0>) (reg:DI x0))) ++ (insn 5 (set (reg:DI <1>) ++ (plus:DI (reg:DI <0>) (const_int 768)))) ++ (insn 6 (set (mem:SI (plus:DI (reg:DI <1>) ++ (const_int -256)) [1 &data+512 S4 A4]) ++ (const_int 0))) ++ (insn 7 (set (mem:SI (plus:DI (reg:DI <0>) ++ (const_int 508)) [1 &data+508 S4 A4]) ++ (const_int 0))) ++ (edge-to exit (flags "FALLTHRU")) ++ ) ;; block 2 ++ ) ;; insn-chain ++ ) ;; function ++} diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch b/meta-openeuler/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch new file mode 100644 index 00000000000..bbe2f18f6fc --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/0026-rust-recursion-limit.patch @@ -0,0 +1,92 @@ +From 9234cdca6ee88badfc00297e72f13dac4e540c79 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Fri, 1 Jul 2022 15:58:52 +0100 +Subject: [PATCH] Add a recursion limit to the demangle_const function in the + Rust demangler. + +libiberty/ + PR demangler/105039 + * rust-demangle.c (demangle_const): Add recursion limit. + +Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=9234cdca6ee88badfc00297e72f13dac4e540c79] +--- + libiberty/rust-demangle.c | 29 ++++++++++++++++++++--------- + 1 file changed, 20 insertions(+), 9 deletions(-) + +diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c +index bb58d900e27..36afcfae278 100644 +--- a/libiberty/rust-demangle.c ++++ b/libiberty/rust-demangle.c +@@ -126,7 +126,7 @@ parse_integer_62 (struct rust_demangler *rdm) + return 0; + + x = 0; +- while (!eat (rdm, '_')) ++ while (!eat (rdm, '_') && !rdm->errored) + { + c = next (rdm); + x *= 62; +@@ -1148,6 +1148,15 @@ demangle_const (struct rust_demangler *rdm) + if (rdm->errored) + return; + ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ { ++ ++ rdm->recursion; ++ if (rdm->recursion > RUST_MAX_RECURSION_COUNT) ++ /* FIXME: There ought to be a way to report ++ that the recursion limit has been reached. */ ++ goto fail_return; ++ } ++ + if (eat (rdm, 'B')) + { + backref = parse_integer_62 (rdm); +@@ -1158,7 +1167,7 @@ demangle_const (struct rust_demangler *rdm) + demangle_const (rdm); + rdm->next = old_next; + } +- return; ++ goto pass_return; + } + + ty_tag = next (rdm); +@@ -1167,7 +1176,7 @@ demangle_const (struct rust_demangler *rdm) + /* Placeholder. */ + case 'p': + PRINT ("_"); +- return; ++ goto pass_return; + + /* Unsigned integer types. */ + case 'h': +@@ -1200,18 +1209,20 @@ demangle_const (struct rust_demangler *rdm) + break; + + default: +- rdm->errored = 1; +- return; ++ goto fail_return; + } + +- if (rdm->errored) +- return; +- +- if (rdm->verbose) ++ if (!rdm->errored && rdm->verbose) + { + PRINT (": "); + PRINT (basic_type (ty_tag)); + } ++ ++ fail_return: ++ rdm->errored = 1; ++ pass_return: ++ if (rdm->recursion != RUST_NO_RECURSION_LIMIT) ++ -- rdm->recursion; + } + + static void +-- +2.31.1 + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/CVE-2023-4039.patch b/meta-openeuler/recipes-devtools/gcc/gcc/CVE-2023-4039.patch new file mode 100644 index 00000000000..8cb52849cd3 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/CVE-2023-4039.patch @@ -0,0 +1,3093 @@ +From: Richard Sandiford +Subject: [PATCH 00/19] aarch64: Fix -fstack-protector issue +Date: Tue, 12 Sep 2023 16:25:10 +0100 + +This series of patches fixes deficiencies in GCC's -fstack-protector +implementation for AArch64 when using dynamically allocated stack space. +This is CVE-2023-4039. See: + +https://developer.arm.com/Arm%20Security%20Center/GCC%20Stack%20Protector%20Vulnerability%20AArch64 +https://github.com/metaredteam/external-disclosures/security/advisories/GHSA-x7ch-h5rf-w2mf + +for more details. + +The fix is to put the saved registers above the locals area when +-fstack-protector is used. + +The series also fixes a stack-clash problem that I found while working +on the CVE. In unpatched sources, the stack-clash problem would only +trigger for unrealistic numbers of arguments (8K 64-bit arguments, or an +equivalent). But it would be a more significant issue with the new +-fstack-protector frame layout. It's therefore important that both +problems are fixed together. + +Some reorganisation of the code seemed necessary to fix the problems in a +cleanish way. The series is therefore quite long, but only a handful of +patches should have any effect on code generation. + +See the individual patches for a detailed description. + +Tested on aarch64-linux-gnu. Pushed to trunk and to all active branches. +I've also pushed backports to GCC 7+ to vendors/ARM/heads/CVE-2023-4039. + +CVE: CVE-2023-4039 +Upstream-Status: Backport +Signed-off-by: Ross Burton + + +From 62fbb215cc817e9f2c1ca80282a64f4ee30806bc Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:48 +0100 +Subject: [PATCH 01/19] aarch64: Use local frame vars in shrink-wrapping code + +aarch64_layout_frame uses a shorthand for referring to +cfun->machine->frame: + + aarch64_frame &frame = cfun->machine->frame; + +This patch does the same for some other heavy users of the structure. +No functional change intended. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_save_callee_saves): Use + a local shorthand for cfun->machine->frame. + (aarch64_restore_callee_saves, aarch64_get_separate_components): + (aarch64_process_components): Likewise. + (aarch64_allocate_and_probe_stack_space): Likewise. + (aarch64_expand_prologue, aarch64_expand_epilogue): Likewise. + (aarch64_layout_frame): Use existing shorthand for one more case. +--- + gcc/config/aarch64/aarch64.cc | 123 ++++++++++++++++++---------------- + 1 file changed, 64 insertions(+), 59 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 226dc9dffd4..ae42ffdedbe 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8351,7 +8351,7 @@ aarch64_layout_frame (void) + frame.is_scs_enabled + = (!crtl->calls_eh_return + && sanitize_flags_p (SANITIZE_SHADOW_CALL_STACK) +- && known_ge (cfun->machine->frame.reg_offset[LR_REGNUM], 0)); ++ && known_ge (frame.reg_offset[LR_REGNUM], 0)); + + /* When shadow call stack is enabled, the scs_pop in the epilogue will + restore x30, and we don't need to pop x30 again in the traditional +@@ -8763,6 +8763,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, + unsigned start, unsigned limit, bool skip_wb, + bool hard_fp_valid_p) + { ++ aarch64_frame &frame = cfun->machine->frame; + rtx_insn *insn; + unsigned regno; + unsigned regno2; +@@ -8777,8 +8778,8 @@ aarch64_save_callee_saves (poly_int64 start_offset, + bool frame_related_p = aarch64_emit_cfi_for_reg_p (regno); + + if (skip_wb +- && (regno == cfun->machine->frame.wb_push_candidate1 +- || regno == cfun->machine->frame.wb_push_candidate2)) ++ && (regno == frame.wb_push_candidate1 ++ || regno == frame.wb_push_candidate2)) + continue; + + if (cfun->machine->reg_is_wrapped_separately[regno]) +@@ -8786,7 +8787,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = start_offset + cfun->machine->frame.reg_offset[regno]; ++ offset = start_offset + frame.reg_offset[regno]; + rtx base_rtx = stack_pointer_rtx; + poly_int64 sp_offset = offset; + +@@ -8799,7 +8800,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, + { + gcc_assert (known_eq (start_offset, 0)); + poly_int64 fp_offset +- = cfun->machine->frame.below_hard_fp_saved_regs_size; ++ = frame.below_hard_fp_saved_regs_size; + if (hard_fp_valid_p) + base_rtx = hard_frame_pointer_rtx; + else +@@ -8821,8 +8822,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, + && (regno2 = aarch64_next_callee_save (regno + 1, limit)) <= limit + && !cfun->machine->reg_is_wrapped_separately[regno2] + && known_eq (GET_MODE_SIZE (mode), +- cfun->machine->frame.reg_offset[regno2] +- - cfun->machine->frame.reg_offset[regno])) ++ frame.reg_offset[regno2] - frame.reg_offset[regno])) + { + rtx reg2 = gen_rtx_REG (mode, regno2); + rtx mem2; +@@ -8872,6 +8872,7 @@ static void + aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, + unsigned limit, bool skip_wb, rtx *cfi_ops) + { ++ aarch64_frame &frame = cfun->machine->frame; + unsigned regno; + unsigned regno2; + poly_int64 offset; +@@ -8888,13 +8889,13 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, + rtx reg, mem; + + if (skip_wb +- && (regno == cfun->machine->frame.wb_pop_candidate1 +- || regno == cfun->machine->frame.wb_pop_candidate2)) ++ && (regno == frame.wb_pop_candidate1 ++ || regno == frame.wb_pop_candidate2)) + continue; + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = start_offset + cfun->machine->frame.reg_offset[regno]; ++ offset = start_offset + frame.reg_offset[regno]; + rtx base_rtx = stack_pointer_rtx; + if (mode == VNx2DImode && BYTES_BIG_ENDIAN) + aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, +@@ -8905,8 +8906,7 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, + && (regno2 = aarch64_next_callee_save (regno + 1, limit)) <= limit + && !cfun->machine->reg_is_wrapped_separately[regno2] + && known_eq (GET_MODE_SIZE (mode), +- cfun->machine->frame.reg_offset[regno2] +- - cfun->machine->frame.reg_offset[regno])) ++ frame.reg_offset[regno2] - frame.reg_offset[regno])) + { + rtx reg2 = gen_rtx_REG (mode, regno2); + rtx mem2; +@@ -9011,6 +9011,7 @@ offset_12bit_unsigned_scaled_p (machine_mode mode, poly_int64 offset) + static sbitmap + aarch64_get_separate_components (void) + { ++ aarch64_frame &frame = cfun->machine->frame; + sbitmap components = sbitmap_alloc (LAST_SAVED_REGNUM + 1); + bitmap_clear (components); + +@@ -9027,18 +9028,18 @@ aarch64_get_separate_components (void) + if (mode == VNx2DImode && BYTES_BIG_ENDIAN) + continue; + +- poly_int64 offset = cfun->machine->frame.reg_offset[regno]; ++ poly_int64 offset = frame.reg_offset[regno]; + + /* If the register is saved in the first SVE save slot, we use + it as a stack probe for -fstack-clash-protection. */ + if (flag_stack_clash_protection +- && maybe_ne (cfun->machine->frame.below_hard_fp_saved_regs_size, 0) ++ && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) + && known_eq (offset, 0)) + continue; + + /* Get the offset relative to the register we'll use. */ + if (frame_pointer_needed) +- offset -= cfun->machine->frame.below_hard_fp_saved_regs_size; ++ offset -= frame.below_hard_fp_saved_regs_size; + else + offset += crtl->outgoing_args_size; + +@@ -9057,11 +9058,11 @@ aarch64_get_separate_components (void) + /* If the spare predicate register used by big-endian SVE code + is call-preserved, it must be saved in the main prologue + before any saves that use it. */ +- if (cfun->machine->frame.spare_pred_reg != INVALID_REGNUM) +- bitmap_clear_bit (components, cfun->machine->frame.spare_pred_reg); ++ if (frame.spare_pred_reg != INVALID_REGNUM) ++ bitmap_clear_bit (components, frame.spare_pred_reg); + +- unsigned reg1 = cfun->machine->frame.wb_push_candidate1; +- unsigned reg2 = cfun->machine->frame.wb_push_candidate2; ++ unsigned reg1 = frame.wb_push_candidate1; ++ unsigned reg2 = frame.wb_push_candidate2; + /* If registers have been chosen to be stored/restored with + writeback don't interfere with them to avoid having to output explicit + stack adjustment instructions. */ +@@ -9170,6 +9171,7 @@ aarch64_get_next_set_bit (sbitmap bmp, unsigned int start) + static void + aarch64_process_components (sbitmap components, bool prologue_p) + { ++ aarch64_frame &frame = cfun->machine->frame; + rtx ptr_reg = gen_rtx_REG (Pmode, frame_pointer_needed + ? HARD_FRAME_POINTER_REGNUM + : STACK_POINTER_REGNUM); +@@ -9184,9 +9186,9 @@ aarch64_process_components (sbitmap components, bool prologue_p) + machine_mode mode = aarch64_reg_save_mode (regno); + + rtx reg = gen_rtx_REG (mode, regno); +- poly_int64 offset = cfun->machine->frame.reg_offset[regno]; ++ poly_int64 offset = frame.reg_offset[regno]; + if (frame_pointer_needed) +- offset -= cfun->machine->frame.below_hard_fp_saved_regs_size; ++ offset -= frame.below_hard_fp_saved_regs_size; + else + offset += crtl->outgoing_args_size; + +@@ -9211,14 +9213,14 @@ aarch64_process_components (sbitmap components, bool prologue_p) + break; + } + +- poly_int64 offset2 = cfun->machine->frame.reg_offset[regno2]; ++ poly_int64 offset2 = frame.reg_offset[regno2]; + /* The next register is not of the same class or its offset is not + mergeable with the current one into a pair. */ + if (aarch64_sve_mode_p (mode) + || !satisfies_constraint_Ump (mem) + || GP_REGNUM_P (regno) != GP_REGNUM_P (regno2) + || (crtl->abi->id () == ARM_PCS_SIMD && FP_REGNUM_P (regno)) +- || maybe_ne ((offset2 - cfun->machine->frame.reg_offset[regno]), ++ || maybe_ne ((offset2 - frame.reg_offset[regno]), + GET_MODE_SIZE (mode))) + { + insn = emit_insn (set); +@@ -9240,7 +9242,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) + /* REGNO2 can be saved/restored in a pair with REGNO. */ + rtx reg2 = gen_rtx_REG (mode, regno2); + if (frame_pointer_needed) +- offset2 -= cfun->machine->frame.below_hard_fp_saved_regs_size; ++ offset2 -= frame.below_hard_fp_saved_regs_size; + else + offset2 += crtl->outgoing_args_size; + rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); +@@ -9335,6 +9337,7 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + bool frame_related_p, + bool final_adjustment_p) + { ++ aarch64_frame &frame = cfun->machine->frame; + HOST_WIDE_INT guard_size + = 1 << param_stack_clash_protection_guard_size; + HOST_WIDE_INT guard_used_by_caller = STACK_CLASH_CALLER_GUARD; +@@ -9355,25 +9358,25 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + register as a probe. We can't assume that LR was saved at position 0 + though, so treat any space below it as unprobed. */ + if (final_adjustment_p +- && known_eq (cfun->machine->frame.below_hard_fp_saved_regs_size, 0)) ++ && known_eq (frame.below_hard_fp_saved_regs_size, 0)) + { +- poly_int64 lr_offset = cfun->machine->frame.reg_offset[LR_REGNUM]; ++ poly_int64 lr_offset = frame.reg_offset[LR_REGNUM]; + if (known_ge (lr_offset, 0)) + min_probe_threshold -= lr_offset.to_constant (); + else + gcc_assert (!flag_stack_clash_protection || known_eq (poly_size, 0)); + } + +- poly_int64 frame_size = cfun->machine->frame.frame_size; ++ poly_int64 frame_size = frame.frame_size; + + /* We should always have a positive probe threshold. */ + gcc_assert (min_probe_threshold > 0); + + if (flag_stack_clash_protection && !final_adjustment_p) + { +- poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; +- poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; +- poly_int64 final_adjust = cfun->machine->frame.final_adjust; ++ poly_int64 initial_adjust = frame.initial_adjust; ++ poly_int64 sve_callee_adjust = frame.sve_callee_adjust; ++ poly_int64 final_adjust = frame.final_adjust; + + if (known_eq (frame_size, 0)) + { +@@ -9662,17 +9665,18 @@ aarch64_epilogue_uses (int regno) + void + aarch64_expand_prologue (void) + { +- poly_int64 frame_size = cfun->machine->frame.frame_size; +- poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; +- HOST_WIDE_INT callee_adjust = cfun->machine->frame.callee_adjust; +- poly_int64 final_adjust = cfun->machine->frame.final_adjust; +- poly_int64 callee_offset = cfun->machine->frame.callee_offset; +- poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; ++ aarch64_frame &frame = cfun->machine->frame; ++ poly_int64 frame_size = frame.frame_size; ++ poly_int64 initial_adjust = frame.initial_adjust; ++ HOST_WIDE_INT callee_adjust = frame.callee_adjust; ++ poly_int64 final_adjust = frame.final_adjust; ++ poly_int64 callee_offset = frame.callee_offset; ++ poly_int64 sve_callee_adjust = frame.sve_callee_adjust; + poly_int64 below_hard_fp_saved_regs_size +- = cfun->machine->frame.below_hard_fp_saved_regs_size; +- unsigned reg1 = cfun->machine->frame.wb_push_candidate1; +- unsigned reg2 = cfun->machine->frame.wb_push_candidate2; +- bool emit_frame_chain = cfun->machine->frame.emit_frame_chain; ++ = frame.below_hard_fp_saved_regs_size; ++ unsigned reg1 = frame.wb_push_candidate1; ++ unsigned reg2 = frame.wb_push_candidate2; ++ bool emit_frame_chain = frame.emit_frame_chain; + rtx_insn *insn; + + if (flag_stack_clash_protection && known_eq (callee_adjust, 0)) +@@ -9703,7 +9707,7 @@ aarch64_expand_prologue (void) + } + + /* Push return address to shadow call stack. */ +- if (cfun->machine->frame.is_scs_enabled) ++ if (frame.is_scs_enabled) + emit_insn (gen_scs_push ()); + + if (flag_stack_usage_info) +@@ -9742,7 +9746,7 @@ aarch64_expand_prologue (void) + + /* The offset of the frame chain record (if any) from the current SP. */ + poly_int64 chain_offset = (initial_adjust + callee_adjust +- - cfun->machine->frame.hard_fp_offset); ++ - frame.hard_fp_offset); + gcc_assert (known_ge (chain_offset, 0)); + + /* The offset of the bottom of the save area from the current SP. */ +@@ -9845,16 +9849,17 @@ aarch64_use_return_insn_p (void) + void + aarch64_expand_epilogue (bool for_sibcall) + { +- poly_int64 initial_adjust = cfun->machine->frame.initial_adjust; +- HOST_WIDE_INT callee_adjust = cfun->machine->frame.callee_adjust; +- poly_int64 final_adjust = cfun->machine->frame.final_adjust; +- poly_int64 callee_offset = cfun->machine->frame.callee_offset; +- poly_int64 sve_callee_adjust = cfun->machine->frame.sve_callee_adjust; ++ aarch64_frame &frame = cfun->machine->frame; ++ poly_int64 initial_adjust = frame.initial_adjust; ++ HOST_WIDE_INT callee_adjust = frame.callee_adjust; ++ poly_int64 final_adjust = frame.final_adjust; ++ poly_int64 callee_offset = frame.callee_offset; ++ poly_int64 sve_callee_adjust = frame.sve_callee_adjust; + poly_int64 below_hard_fp_saved_regs_size +- = cfun->machine->frame.below_hard_fp_saved_regs_size; +- unsigned reg1 = cfun->machine->frame.wb_pop_candidate1; +- unsigned reg2 = cfun->machine->frame.wb_pop_candidate2; +- unsigned int last_gpr = (cfun->machine->frame.is_scs_enabled ++ = frame.below_hard_fp_saved_regs_size; ++ unsigned reg1 = frame.wb_pop_candidate1; ++ unsigned reg2 = frame.wb_pop_candidate2; ++ unsigned int last_gpr = (frame.is_scs_enabled + ? R29_REGNUM : R30_REGNUM); + rtx cfi_ops = NULL; + rtx_insn *insn; +@@ -9888,7 +9893,7 @@ aarch64_expand_epilogue (bool for_sibcall) + /* We need to add memory barrier to prevent read from deallocated stack. */ + bool need_barrier_p + = maybe_ne (get_frame_size () +- + cfun->machine->frame.saved_varargs_size, 0); ++ + frame.saved_varargs_size, 0); + + /* Emit a barrier to prevent loads from a deallocated stack. */ + if (maybe_gt (final_adjust, crtl->outgoing_args_size) +@@ -9969,7 +9974,7 @@ aarch64_expand_epilogue (bool for_sibcall) + } + + /* Pop return address from shadow call stack. */ +- if (cfun->machine->frame.is_scs_enabled) ++ if (frame.is_scs_enabled) + { + machine_mode mode = aarch64_reg_save_mode (R30_REGNUM); + rtx reg = gen_rtx_REG (mode, R30_REGNUM); +@@ -12564,24 +12569,24 @@ aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to) + poly_int64 + aarch64_initial_elimination_offset (unsigned from, unsigned to) + { ++ aarch64_frame &frame = cfun->machine->frame; ++ + if (to == HARD_FRAME_POINTER_REGNUM) + { + if (from == ARG_POINTER_REGNUM) +- return cfun->machine->frame.hard_fp_offset; ++ return frame.hard_fp_offset; + + if (from == FRAME_POINTER_REGNUM) +- return cfun->machine->frame.hard_fp_offset +- - cfun->machine->frame.locals_offset; ++ return frame.hard_fp_offset - frame.locals_offset; + } + + if (to == STACK_POINTER_REGNUM) + { + if (from == FRAME_POINTER_REGNUM) +- return cfun->machine->frame.frame_size +- - cfun->machine->frame.locals_offset; ++ return frame.frame_size - frame.locals_offset; + } + +- return cfun->machine->frame.frame_size; ++ return frame.frame_size; + } + + +-- +2.34.1 + + +From 12a8889de169f892d2e927584c00d20b8b7e456f Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:49 +0100 +Subject: [PATCH 02/19] aarch64: Avoid a use of callee_offset + +When we emit the frame chain, i.e. when we reach Here in this statement +of aarch64_expand_prologue: + + if (emit_frame_chain) + { + // Here + ... + } + +the stack is in one of two states: + +- We've allocated up to the frame chain, but no more. + +- We've allocated the whole frame, and the frame chain is within easy + reach of the new SP. + +The offset of the frame chain from the current SP is available +in aarch64_frame as callee_offset. It is also available as the +chain_offset local variable, where the latter is calculated from other +data. (However, chain_offset is not always equal to callee_offset when +!emit_frame_chain, so chain_offset isn't redundant.) + +In c600df9a4060da3c6121ff4d0b93f179eafd69d1 I switched to using +chain_offset for the initialisation of the hard frame pointer: + + aarch64_add_offset (Pmode, hard_frame_pointer_rtx, +- stack_pointer_rtx, callee_offset, ++ stack_pointer_rtx, chain_offset, + tmp1_rtx, tmp0_rtx, frame_pointer_needed); + +But the later REG_CFA_ADJUST_CFA handling still used callee_offset. + +I think the difference is harmless, but it's more logical for the +CFA note to be in sync, and it's more convenient for later patches +if it uses chain_offset. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_expand_prologue): Use + chain_offset rather than callee_offset. +--- + gcc/config/aarch64/aarch64.cc | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index ae42ffdedbe..79253322fd7 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -9670,7 +9670,6 @@ aarch64_expand_prologue (void) + poly_int64 initial_adjust = frame.initial_adjust; + HOST_WIDE_INT callee_adjust = frame.callee_adjust; + poly_int64 final_adjust = frame.final_adjust; +- poly_int64 callee_offset = frame.callee_offset; + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; + poly_int64 below_hard_fp_saved_regs_size + = frame.below_hard_fp_saved_regs_size; +@@ -9783,8 +9782,7 @@ aarch64_expand_prologue (void) + implicit. */ + if (!find_reg_note (insn, REG_CFA_ADJUST_CFA, NULL_RTX)) + { +- rtx src = plus_constant (Pmode, stack_pointer_rtx, +- callee_offset); ++ rtx src = plus_constant (Pmode, stack_pointer_rtx, chain_offset); + add_reg_note (insn, REG_CFA_ADJUST_CFA, + gen_rtx_SET (hard_frame_pointer_rtx, src)); + } +-- +2.34.1 + + +From 03d5e89e7f3be53fd7142556e8e0a2774c653dca Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:49 +0100 +Subject: [PATCH 03/19] aarch64: Explicitly handle frames with no saved + registers + +If a frame has no saved registers, it can be allocated in one go. +There is no need to treat the areas below and above the saved +registers as separate. + +And if we allocate the frame in one go, it should be allocated +as the initial_adjust rather than the final_adjust. This allows the +frame size to grow to guard_size - guard_used_by_caller before a stack +probe is needed. (A frame with no register saves is necessarily a +leaf frame.) + +This is a no-op as thing stand, since a leaf function will have +no outgoing arguments, and so all the frame will be above where +the saved registers normally go. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_layout_frame): Explicitly + allocate the frame in one go if there are no saved registers. +--- + gcc/config/aarch64/aarch64.cc | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 79253322fd7..e1f21230c15 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8378,9 +8378,11 @@ aarch64_layout_frame (void) + + HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset; + HOST_WIDE_INT const_saved_regs_size; +- if (frame.frame_size.is_constant (&const_size) +- && const_size < max_push_offset +- && known_eq (frame.hard_fp_offset, const_size)) ++ if (known_eq (frame.saved_regs_size, 0)) ++ frame.initial_adjust = frame.frame_size; ++ else if (frame.frame_size.is_constant (&const_size) ++ && const_size < max_push_offset ++ && known_eq (frame.hard_fp_offset, const_size)) + { + /* Simple, small frame with no outgoing arguments: + +-- +2.34.1 + + +From 49c2eb7616756c323b7f6b18d8616ec945eb1263 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:49 +0100 +Subject: [PATCH 04/19] aarch64: Add bytes_below_saved_regs to frame info + +The frame layout code currently hard-codes the assumption that +the number of bytes below the saved registers is equal to the +size of the outgoing arguments. This patch abstracts that +value into a new field of aarch64_frame. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::bytes_below_saved_regs): New + field. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize it, + and use it instead of crtl->outgoing_args_size. + (aarch64_get_separate_components): Use bytes_below_saved_regs instead + of outgoing_args_size. + (aarch64_process_components): Likewise. +--- + gcc/config/aarch64/aarch64.cc | 71 ++++++++++++++++++----------------- + gcc/config/aarch64/aarch64.h | 5 +++ + 2 files changed, 41 insertions(+), 35 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index e1f21230c15..94e1b686584 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8217,6 +8217,8 @@ aarch64_layout_frame (void) + gcc_assert (crtl->is_leaf + || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); + ++ frame.bytes_below_saved_regs = crtl->outgoing_args_size; ++ + /* Now assign stack slots for the registers. Start with the predicate + registers, since predicate LDR and STR have a relatively small + offset range. These saves happen below the hard frame pointer. */ +@@ -8321,18 +8323,18 @@ aarch64_layout_frame (void) + + poly_int64 varargs_and_saved_regs_size = offset + frame.saved_varargs_size; + +- poly_int64 above_outgoing_args ++ poly_int64 saved_regs_and_above + = aligned_upper_bound (varargs_and_saved_regs_size + + get_frame_size (), + STACK_BOUNDARY / BITS_PER_UNIT); + + frame.hard_fp_offset +- = above_outgoing_args - frame.below_hard_fp_saved_regs_size; ++ = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; + + /* Both these values are already aligned. */ +- gcc_assert (multiple_p (crtl->outgoing_args_size, ++ gcc_assert (multiple_p (frame.bytes_below_saved_regs, + STACK_BOUNDARY / BITS_PER_UNIT)); +- frame.frame_size = above_outgoing_args + crtl->outgoing_args_size; ++ frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; + + frame.locals_offset = frame.saved_varargs_size; + +@@ -8376,7 +8378,7 @@ aarch64_layout_frame (void) + else if (frame.wb_pop_candidate1 != INVALID_REGNUM) + max_push_offset = 256; + +- HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset; ++ HOST_WIDE_INT const_size, const_below_saved_regs, const_fp_offset; + HOST_WIDE_INT const_saved_regs_size; + if (known_eq (frame.saved_regs_size, 0)) + frame.initial_adjust = frame.frame_size; +@@ -8384,31 +8386,31 @@ aarch64_layout_frame (void) + && const_size < max_push_offset + && known_eq (frame.hard_fp_offset, const_size)) + { +- /* Simple, small frame with no outgoing arguments: ++ /* Simple, small frame with no data below the saved registers. + + stp reg1, reg2, [sp, -frame_size]! + stp reg3, reg4, [sp, 16] */ + frame.callee_adjust = const_size; + } +- else if (crtl->outgoing_args_size.is_constant (&const_outgoing_args_size) ++ else if (frame.bytes_below_saved_regs.is_constant (&const_below_saved_regs) + && frame.saved_regs_size.is_constant (&const_saved_regs_size) +- && const_outgoing_args_size + const_saved_regs_size < 512 +- /* We could handle this case even with outgoing args, provided +- that the number of args left us with valid offsets for all +- predicate and vector save slots. It's such a rare case that +- it hardly seems worth the effort though. */ +- && (!saves_below_hard_fp_p || const_outgoing_args_size == 0) ++ && const_below_saved_regs + const_saved_regs_size < 512 ++ /* We could handle this case even with data below the saved ++ registers, provided that that data left us with valid offsets ++ for all predicate and vector save slots. It's such a rare ++ case that it hardly seems worth the effort though. */ ++ && (!saves_below_hard_fp_p || const_below_saved_regs == 0) + && !(cfun->calls_alloca + && frame.hard_fp_offset.is_constant (&const_fp_offset) + && const_fp_offset < max_push_offset)) + { +- /* Frame with small outgoing arguments: ++ /* Frame with small area below the saved registers: + + sub sp, sp, frame_size +- stp reg1, reg2, [sp, outgoing_args_size] +- stp reg3, reg4, [sp, outgoing_args_size + 16] */ ++ stp reg1, reg2, [sp, bytes_below_saved_regs] ++ stp reg3, reg4, [sp, bytes_below_saved_regs + 16] */ + frame.initial_adjust = frame.frame_size; +- frame.callee_offset = const_outgoing_args_size; ++ frame.callee_offset = const_below_saved_regs; + } + else if (saves_below_hard_fp_p + && known_eq (frame.saved_regs_size, +@@ -8418,30 +8420,29 @@ aarch64_layout_frame (void) + + sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size + save SVE registers relative to SP +- sub sp, sp, outgoing_args_size */ ++ sub sp, sp, bytes_below_saved_regs */ + frame.initial_adjust = (frame.hard_fp_offset + + frame.below_hard_fp_saved_regs_size); +- frame.final_adjust = crtl->outgoing_args_size; ++ frame.final_adjust = frame.bytes_below_saved_regs; + } + else if (frame.hard_fp_offset.is_constant (&const_fp_offset) + && const_fp_offset < max_push_offset) + { +- /* Frame with large outgoing arguments or SVE saves, but with +- a small local area: ++ /* Frame with large area below the saved registers, or with SVE saves, ++ but with a small area above: + + stp reg1, reg2, [sp, -hard_fp_offset]! + stp reg3, reg4, [sp, 16] + [sub sp, sp, below_hard_fp_saved_regs_size] + [save SVE registers relative to SP] +- sub sp, sp, outgoing_args_size */ ++ sub sp, sp, bytes_below_saved_regs */ + frame.callee_adjust = const_fp_offset; + frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; +- frame.final_adjust = crtl->outgoing_args_size; ++ frame.final_adjust = frame.bytes_below_saved_regs; + } + else + { +- /* Frame with large local area and outgoing arguments or SVE saves, +- using frame pointer: ++ /* General case: + + sub sp, sp, hard_fp_offset + stp x29, x30, [sp, 0] +@@ -8449,10 +8450,10 @@ aarch64_layout_frame (void) + stp reg3, reg4, [sp, 16] + [sub sp, sp, below_hard_fp_saved_regs_size] + [save SVE registers relative to SP] +- sub sp, sp, outgoing_args_size */ ++ sub sp, sp, bytes_below_saved_regs */ + frame.initial_adjust = frame.hard_fp_offset; + frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; +- frame.final_adjust = crtl->outgoing_args_size; ++ frame.final_adjust = frame.bytes_below_saved_regs; + } + + /* Make sure the individual adjustments add up to the full frame size. */ +@@ -9043,7 +9044,7 @@ aarch64_get_separate_components (void) + if (frame_pointer_needed) + offset -= frame.below_hard_fp_saved_regs_size; + else +- offset += crtl->outgoing_args_size; ++ offset += frame.bytes_below_saved_regs; + + /* Check that we can access the stack slot of the register with one + direct load with no adjustments needed. */ +@@ -9192,7 +9193,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) + if (frame_pointer_needed) + offset -= frame.below_hard_fp_saved_regs_size; + else +- offset += crtl->outgoing_args_size; ++ offset += frame.bytes_below_saved_regs; + + rtx addr = plus_constant (Pmode, ptr_reg, offset); + rtx mem = gen_frame_mem (mode, addr); +@@ -9246,7 +9247,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) + if (frame_pointer_needed) + offset2 -= frame.below_hard_fp_saved_regs_size; + else +- offset2 += crtl->outgoing_args_size; ++ offset2 += frame.bytes_below_saved_regs; + rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); + rtx mem2 = gen_frame_mem (mode, addr2); + rtx set2 = prologue_p ? gen_rtx_SET (mem2, reg2) +@@ -9320,10 +9321,10 @@ aarch64_stack_clash_protection_alloca_probe_range (void) + registers. If POLY_SIZE is not large enough to require a probe this function + will only adjust the stack. When allocating the stack space + FRAME_RELATED_P is then used to indicate if the allocation is frame related. +- FINAL_ADJUSTMENT_P indicates whether we are allocating the outgoing +- arguments. If we are then we ensure that any allocation larger than the ABI +- defined buffer needs a probe so that the invariant of having a 1KB buffer is +- maintained. ++ FINAL_ADJUSTMENT_P indicates whether we are allocating the area below ++ the saved registers. If we are then we ensure that any allocation ++ larger than the ABI defined buffer needs a probe so that the ++ invariant of having a 1KB buffer is maintained. + + We emit barriers after each stack adjustment to prevent optimizations from + breaking the invariant that we never drop the stack more than a page. This +@@ -9532,7 +9533,7 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + /* Handle any residuals. Residuals of at least MIN_PROBE_THRESHOLD have to + be probed. This maintains the requirement that each page is probed at + least once. For initial probing we probe only if the allocation is +- more than GUARD_SIZE - buffer, and for the outgoing arguments we probe ++ more than GUARD_SIZE - buffer, and below the saved registers we probe + if the amount is larger than buffer. GUARD_SIZE - buffer + buffer == + GUARD_SIZE. This works that for any allocation that is large enough to + trigger a probe here, we'll have at least one, and if they're not large +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 6834c3e9922..1e105e12db8 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -871,6 +871,11 @@ struct GTY (()) aarch64_frame + /* The size of the callee-save registers with a slot in REG_OFFSET. */ + poly_int64 saved_regs_size; + ++ /* The number of bytes between the bottom of the static frame (the bottom ++ of the outgoing arguments) and the bottom of the register save area. ++ This value is always a multiple of STACK_BOUNDARY. */ ++ poly_int64 bytes_below_saved_regs; ++ + /* The size of the callee-save registers with a slot in REG_OFFSET that + are saved below the hard frame pointer. */ + poly_int64 below_hard_fp_saved_regs_size; +-- +2.34.1 + + +From 34081079ea4de0c98331843f574b5f6f94d7b234 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:50 +0100 +Subject: [PATCH 05/19] aarch64: Add bytes_below_hard_fp to frame info + +Following on from the previous bytes_below_saved_regs patch, this one +records the number of bytes that are below the hard frame pointer. +This eventually replaces below_hard_fp_saved_regs_size. + +If a frame pointer is not needed, the epilogue adds final_adjust +to the stack pointer before restoring registers: + + aarch64_add_sp (tmp1_rtx, tmp0_rtx, final_adjust, true); + +Therefore, if the epilogue needs to restore the stack pointer from +the hard frame pointer, the directly corresponding offset is: + + -bytes_below_hard_fp + final_adjust + +i.e. go from the hard frame pointer to the bottom of the frame, +then add the same amount as if we were using the stack pointer +from the outset. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::bytes_below_hard_fp): New + field. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize it. + (aarch64_expand_epilogue): Use it instead of + below_hard_fp_saved_regs_size. +--- + gcc/config/aarch64/aarch64.cc | 6 +++--- + gcc/config/aarch64/aarch64.h | 5 +++++ + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 94e1b686584..c7d84245fbf 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8269,6 +8269,7 @@ aarch64_layout_frame (void) + of the callee save area. */ + bool saves_below_hard_fp_p = maybe_ne (offset, 0); + frame.below_hard_fp_saved_regs_size = offset; ++ frame.bytes_below_hard_fp = offset + frame.bytes_below_saved_regs; + if (frame.emit_frame_chain) + { + /* FP and LR are placed in the linkage record. */ +@@ -9856,8 +9857,7 @@ aarch64_expand_epilogue (bool for_sibcall) + poly_int64 final_adjust = frame.final_adjust; + poly_int64 callee_offset = frame.callee_offset; + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; +- poly_int64 below_hard_fp_saved_regs_size +- = frame.below_hard_fp_saved_regs_size; ++ poly_int64 bytes_below_hard_fp = frame.bytes_below_hard_fp; + unsigned reg1 = frame.wb_pop_candidate1; + unsigned reg2 = frame.wb_pop_candidate2; + unsigned int last_gpr = (frame.is_scs_enabled +@@ -9915,7 +9915,7 @@ aarch64_expand_epilogue (bool for_sibcall) + is restored on the instruction doing the writeback. */ + aarch64_add_offset (Pmode, stack_pointer_rtx, + hard_frame_pointer_rtx, +- -callee_offset - below_hard_fp_saved_regs_size, ++ -bytes_below_hard_fp + final_adjust, + tmp1_rtx, tmp0_rtx, callee_adjust == 0); + else + /* The case where we need to re-use the register here is very rare, so +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 1e105e12db8..de68ff7202f 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -880,6 +880,11 @@ struct GTY (()) aarch64_frame + are saved below the hard frame pointer. */ + poly_int64 below_hard_fp_saved_regs_size; + ++ /* The number of bytes between the bottom of the static frame (the bottom ++ of the outgoing arguments) and the hard frame pointer. This value is ++ always a multiple of STACK_BOUNDARY. */ ++ poly_int64 bytes_below_hard_fp; ++ + /* Offset from the base of the frame (incomming SP) to the + top of the locals area. This value is always a multiple of + STACK_BOUNDARY. */ +-- +2.34.1 + + +From 187861af7c51db9eddc6f954b589c121b210fc74 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:50 +0100 +Subject: [PATCH 06/19] aarch64: Tweak aarch64_save/restore_callee_saves + +aarch64_save_callee_saves and aarch64_restore_callee_saves took +a parameter called start_offset that gives the offset of the +bottom of the saved register area from the current stack pointer. +However, it's more convenient for later patches if we use the +bottom of the entire frame as the reference point, rather than +the bottom of the saved registers. + +Doing that removes the need for the callee_offset field. +Other than that, this is not a win on its own. It only really +makes sense in combination with the follow-on patches. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::callee_offset): Delete. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Remove + callee_offset handling. + (aarch64_save_callee_saves): Replace the start_offset parameter + with a bytes_below_sp parameter. + (aarch64_restore_callee_saves): Likewise. + (aarch64_expand_prologue): Update accordingly. + (aarch64_expand_epilogue): Likewise. +--- + gcc/config/aarch64/aarch64.cc | 56 +++++++++++++++++------------------ + gcc/config/aarch64/aarch64.h | 4 --- + 2 files changed, 28 insertions(+), 32 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index c7d84245fbf..e79551af41d 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8343,7 +8343,6 @@ aarch64_layout_frame (void) + frame.final_adjust = 0; + frame.callee_adjust = 0; + frame.sve_callee_adjust = 0; +- frame.callee_offset = 0; + + frame.wb_pop_candidate1 = frame.wb_push_candidate1; + frame.wb_pop_candidate2 = frame.wb_push_candidate2; +@@ -8411,7 +8410,6 @@ aarch64_layout_frame (void) + stp reg1, reg2, [sp, bytes_below_saved_regs] + stp reg3, reg4, [sp, bytes_below_saved_regs + 16] */ + frame.initial_adjust = frame.frame_size; +- frame.callee_offset = const_below_saved_regs; + } + else if (saves_below_hard_fp_p + && known_eq (frame.saved_regs_size, +@@ -8758,12 +8756,13 @@ aarch64_add_cfa_expression (rtx_insn *insn, rtx reg, + } + + /* Emit code to save the callee-saved registers from register number START +- to LIMIT to the stack at the location starting at offset START_OFFSET, +- skipping any write-back candidates if SKIP_WB is true. HARD_FP_VALID_P +- is true if the hard frame pointer has been set up. */ ++ to LIMIT to the stack. The stack pointer is currently BYTES_BELOW_SP ++ bytes above the bottom of the static frame. Skip any write-back ++ candidates if SKIP_WB is true. HARD_FP_VALID_P is true if the hard ++ frame pointer has been set up. */ + + static void +-aarch64_save_callee_saves (poly_int64 start_offset, ++aarch64_save_callee_saves (poly_int64 bytes_below_sp, + unsigned start, unsigned limit, bool skip_wb, + bool hard_fp_valid_p) + { +@@ -8791,7 +8790,9 @@ aarch64_save_callee_saves (poly_int64 start_offset, + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = start_offset + frame.reg_offset[regno]; ++ offset = (frame.reg_offset[regno] ++ + frame.bytes_below_saved_regs ++ - bytes_below_sp); + rtx base_rtx = stack_pointer_rtx; + poly_int64 sp_offset = offset; + +@@ -8802,9 +8803,7 @@ aarch64_save_callee_saves (poly_int64 start_offset, + else if (GP_REGNUM_P (regno) + && (!offset.is_constant (&const_offset) || const_offset >= 512)) + { +- gcc_assert (known_eq (start_offset, 0)); +- poly_int64 fp_offset +- = frame.below_hard_fp_saved_regs_size; ++ poly_int64 fp_offset = frame.bytes_below_hard_fp - bytes_below_sp; + if (hard_fp_valid_p) + base_rtx = hard_frame_pointer_rtx; + else +@@ -8868,12 +8867,13 @@ aarch64_save_callee_saves (poly_int64 start_offset, + } + + /* Emit code to restore the callee registers from register number START +- up to and including LIMIT. Restore from the stack offset START_OFFSET, +- skipping any write-back candidates if SKIP_WB is true. Write the +- appropriate REG_CFA_RESTORE notes into CFI_OPS. */ ++ up to and including LIMIT. The stack pointer is currently BYTES_BELOW_SP ++ bytes above the bottom of the static frame. Skip any write-back ++ candidates if SKIP_WB is true. Write the appropriate REG_CFA_RESTORE ++ notes into CFI_OPS. */ + + static void +-aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, ++aarch64_restore_callee_saves (poly_int64 bytes_below_sp, unsigned start, + unsigned limit, bool skip_wb, rtx *cfi_ops) + { + aarch64_frame &frame = cfun->machine->frame; +@@ -8899,7 +8899,9 @@ aarch64_restore_callee_saves (poly_int64 start_offset, unsigned start, + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = start_offset + frame.reg_offset[regno]; ++ offset = (frame.reg_offset[regno] ++ + frame.bytes_below_saved_regs ++ - bytes_below_sp); + rtx base_rtx = stack_pointer_rtx; + if (mode == VNx2DImode && BYTES_BIG_ENDIAN) + aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, +@@ -9675,8 +9677,6 @@ aarch64_expand_prologue (void) + HOST_WIDE_INT callee_adjust = frame.callee_adjust; + poly_int64 final_adjust = frame.final_adjust; + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; +- poly_int64 below_hard_fp_saved_regs_size +- = frame.below_hard_fp_saved_regs_size; + unsigned reg1 = frame.wb_push_candidate1; + unsigned reg2 = frame.wb_push_candidate2; + bool emit_frame_chain = frame.emit_frame_chain; +@@ -9752,8 +9752,8 @@ aarch64_expand_prologue (void) + - frame.hard_fp_offset); + gcc_assert (known_ge (chain_offset, 0)); + +- /* The offset of the bottom of the save area from the current SP. */ +- poly_int64 saved_regs_offset = chain_offset - below_hard_fp_saved_regs_size; ++ /* The offset of the current SP from the bottom of the static frame. */ ++ poly_int64 bytes_below_sp = frame_size - initial_adjust - callee_adjust; + + if (emit_frame_chain) + { +@@ -9761,7 +9761,7 @@ aarch64_expand_prologue (void) + { + reg1 = R29_REGNUM; + reg2 = R30_REGNUM; +- aarch64_save_callee_saves (saved_regs_offset, reg1, reg2, ++ aarch64_save_callee_saves (bytes_below_sp, reg1, reg2, + false, false); + } + else +@@ -9801,7 +9801,7 @@ aarch64_expand_prologue (void) + emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx)); + } + +- aarch64_save_callee_saves (saved_regs_offset, R0_REGNUM, R30_REGNUM, ++ aarch64_save_callee_saves (bytes_below_sp, R0_REGNUM, R30_REGNUM, + callee_adjust != 0 || emit_frame_chain, + emit_frame_chain); + if (maybe_ne (sve_callee_adjust, 0)) +@@ -9811,16 +9811,17 @@ aarch64_expand_prologue (void) + aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, + sve_callee_adjust, + !frame_pointer_needed, false); +- saved_regs_offset += sve_callee_adjust; ++ bytes_below_sp -= sve_callee_adjust; + } +- aarch64_save_callee_saves (saved_regs_offset, P0_REGNUM, P15_REGNUM, ++ aarch64_save_callee_saves (bytes_below_sp, P0_REGNUM, P15_REGNUM, + false, emit_frame_chain); +- aarch64_save_callee_saves (saved_regs_offset, V0_REGNUM, V31_REGNUM, ++ aarch64_save_callee_saves (bytes_below_sp, V0_REGNUM, V31_REGNUM, + callee_adjust != 0 || emit_frame_chain, + emit_frame_chain); + + /* We may need to probe the final adjustment if it is larger than the guard + that is assumed by the called. */ ++ gcc_assert (known_eq (bytes_below_sp, final_adjust)); + aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, final_adjust, + !frame_pointer_needed, true); + } +@@ -9855,7 +9856,6 @@ aarch64_expand_epilogue (bool for_sibcall) + poly_int64 initial_adjust = frame.initial_adjust; + HOST_WIDE_INT callee_adjust = frame.callee_adjust; + poly_int64 final_adjust = frame.final_adjust; +- poly_int64 callee_offset = frame.callee_offset; + poly_int64 sve_callee_adjust = frame.sve_callee_adjust; + poly_int64 bytes_below_hard_fp = frame.bytes_below_hard_fp; + unsigned reg1 = frame.wb_pop_candidate1; +@@ -9925,9 +9925,9 @@ aarch64_expand_epilogue (bool for_sibcall) + + /* Restore the vector registers before the predicate registers, + so that we can use P4 as a temporary for big-endian SVE frames. */ +- aarch64_restore_callee_saves (callee_offset, V0_REGNUM, V31_REGNUM, ++ aarch64_restore_callee_saves (final_adjust, V0_REGNUM, V31_REGNUM, + callee_adjust != 0, &cfi_ops); +- aarch64_restore_callee_saves (callee_offset, P0_REGNUM, P15_REGNUM, ++ aarch64_restore_callee_saves (final_adjust, P0_REGNUM, P15_REGNUM, + false, &cfi_ops); + if (maybe_ne (sve_callee_adjust, 0)) + aarch64_add_sp (NULL_RTX, NULL_RTX, sve_callee_adjust, true); +@@ -9935,7 +9935,7 @@ aarch64_expand_epilogue (bool for_sibcall) + /* When shadow call stack is enabled, the scs_pop in the epilogue will + restore x30, we don't need to restore x30 again in the traditional + way. */ +- aarch64_restore_callee_saves (callee_offset - sve_callee_adjust, ++ aarch64_restore_callee_saves (final_adjust + sve_callee_adjust, + R0_REGNUM, last_gpr, + callee_adjust != 0, &cfi_ops); + +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index de68ff7202f..94fca4b9471 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -907,10 +907,6 @@ struct GTY (()) aarch64_frame + It is zero when no push is used. */ + HOST_WIDE_INT callee_adjust; + +- /* The offset from SP to the callee-save registers after initial_adjust. +- It may be non-zero if no push is used (ie. callee_adjust == 0). */ +- poly_int64 callee_offset; +- + /* The size of the stack adjustment before saving or after restoring + SVE registers. */ + poly_int64 sve_callee_adjust; +-- +2.34.1 + + +From 2b983f9064d808daf909bde1d4a13980934a7e6e Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:51 +0100 +Subject: [PATCH 07/19] aarch64: Only calculate chain_offset if there is a + chain + +After previous patches, it is no longer necessary to calculate +a chain_offset in cases where there is no chain record. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_expand_prologue): Move the + calculation of chain_offset into the emit_frame_chain block. +--- + gcc/config/aarch64/aarch64.cc | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index e79551af41d..d71a042d611 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -9747,16 +9747,16 @@ aarch64_expand_prologue (void) + if (callee_adjust != 0) + aarch64_push_regs (reg1, reg2, callee_adjust); + +- /* The offset of the frame chain record (if any) from the current SP. */ +- poly_int64 chain_offset = (initial_adjust + callee_adjust +- - frame.hard_fp_offset); +- gcc_assert (known_ge (chain_offset, 0)); +- + /* The offset of the current SP from the bottom of the static frame. */ + poly_int64 bytes_below_sp = frame_size - initial_adjust - callee_adjust; + + if (emit_frame_chain) + { ++ /* The offset of the frame chain record (if any) from the current SP. */ ++ poly_int64 chain_offset = (initial_adjust + callee_adjust ++ - frame.hard_fp_offset); ++ gcc_assert (known_ge (chain_offset, 0)); ++ + if (callee_adjust == 0) + { + reg1 = R29_REGNUM; +-- +2.34.1 + + +From 0a0a824808d1dec51004fb5805c1a0ae2a35433f Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:51 +0100 +Subject: [PATCH 08/19] aarch64: Rename locals_offset to bytes_above_locals +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +locals_offset was described as: + + /* Offset from the base of the frame (incomming SP) to the + top of the locals area. This value is always a multiple of + STACK_BOUNDARY. */ + +This is implicitly an “upside down” view of the frame: the incoming +SP is at offset 0, and anything N bytes below the incoming SP is at +offset N (rather than -N). + +However, reg_offset instead uses a “right way up” view; that is, +it views offsets in address terms. Something above X is at a +positive offset from X and something below X is at a negative +offset from X. + +Also, even on FRAME_GROWS_DOWNWARD targets like AArch64, +target-independent code views offsets in address terms too: +locals are allocated at negative offsets to virtual_stack_vars. + +It seems confusing to have *_offset fields of the same structure +using different polarities like this. This patch tries to avoid +that by renaming locals_offset to bytes_above_locals. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::locals_offset): Rename to... + (aarch64_frame::bytes_above_locals): ...this. + * config/aarch64/aarch64.cc (aarch64_layout_frame) + (aarch64_initial_elimination_offset): Update accordingly. +--- + gcc/config/aarch64/aarch64.cc | 6 +++--- + gcc/config/aarch64/aarch64.h | 6 +++--- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index d71a042d611..d4ec352ba98 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8337,7 +8337,7 @@ aarch64_layout_frame (void) + STACK_BOUNDARY / BITS_PER_UNIT)); + frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; + +- frame.locals_offset = frame.saved_varargs_size; ++ frame.bytes_above_locals = frame.saved_varargs_size; + + frame.initial_adjust = 0; + frame.final_adjust = 0; +@@ -12578,13 +12578,13 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) + return frame.hard_fp_offset; + + if (from == FRAME_POINTER_REGNUM) +- return frame.hard_fp_offset - frame.locals_offset; ++ return frame.hard_fp_offset - frame.bytes_above_locals; + } + + if (to == STACK_POINTER_REGNUM) + { + if (from == FRAME_POINTER_REGNUM) +- return frame.frame_size - frame.locals_offset; ++ return frame.frame_size - frame.bytes_above_locals; + } + + return frame.frame_size; +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 94fca4b9471..bf46e6124aa 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -885,10 +885,10 @@ struct GTY (()) aarch64_frame + always a multiple of STACK_BOUNDARY. */ + poly_int64 bytes_below_hard_fp; + +- /* Offset from the base of the frame (incomming SP) to the +- top of the locals area. This value is always a multiple of ++ /* The number of bytes between the top of the locals area and the top ++ of the frame (the incomming SP). This value is always a multiple of + STACK_BOUNDARY. */ +- poly_int64 locals_offset; ++ poly_int64 bytes_above_locals; + + /* Offset from the base of the frame (incomming SP) to the + hard_frame_pointer. This value is always a multiple of +-- +2.34.1 + + +From 3fbf0789202b30a67b12e1fb785c7130f098d665 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:52 +0100 +Subject: [PATCH 09/19] aarch64: Rename hard_fp_offset to bytes_above_hard_fp +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Similarly to the previous locals_offset patch, hard_fp_offset +was described as: + + /* Offset from the base of the frame (incomming SP) to the + hard_frame_pointer. This value is always a multiple of + STACK_BOUNDARY. */ + poly_int64 hard_fp_offset; + +which again took an “upside-down” view: higher offsets meant lower +addresses. This patch renames the field to bytes_above_hard_fp instead. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::hard_fp_offset): Rename + to... + (aarch64_frame::bytes_above_hard_fp): ...this. + * config/aarch64/aarch64.cc (aarch64_layout_frame) + (aarch64_expand_prologue): Update accordingly. + (aarch64_initial_elimination_offset): Likewise. +--- + gcc/config/aarch64/aarch64.cc | 26 +++++++++++++------------- + gcc/config/aarch64/aarch64.h | 6 +++--- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index d4ec352ba98..3c4052740e7 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8329,7 +8329,7 @@ aarch64_layout_frame (void) + + get_frame_size (), + STACK_BOUNDARY / BITS_PER_UNIT); + +- frame.hard_fp_offset ++ frame.bytes_above_hard_fp + = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; + + /* Both these values are already aligned. */ +@@ -8378,13 +8378,13 @@ aarch64_layout_frame (void) + else if (frame.wb_pop_candidate1 != INVALID_REGNUM) + max_push_offset = 256; + +- HOST_WIDE_INT const_size, const_below_saved_regs, const_fp_offset; ++ HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; + HOST_WIDE_INT const_saved_regs_size; + if (known_eq (frame.saved_regs_size, 0)) + frame.initial_adjust = frame.frame_size; + else if (frame.frame_size.is_constant (&const_size) + && const_size < max_push_offset +- && known_eq (frame.hard_fp_offset, const_size)) ++ && known_eq (frame.bytes_above_hard_fp, const_size)) + { + /* Simple, small frame with no data below the saved registers. + +@@ -8401,8 +8401,8 @@ aarch64_layout_frame (void) + case that it hardly seems worth the effort though. */ + && (!saves_below_hard_fp_p || const_below_saved_regs == 0) + && !(cfun->calls_alloca +- && frame.hard_fp_offset.is_constant (&const_fp_offset) +- && const_fp_offset < max_push_offset)) ++ && frame.bytes_above_hard_fp.is_constant (&const_above_fp) ++ && const_above_fp < max_push_offset)) + { + /* Frame with small area below the saved registers: + +@@ -8420,12 +8420,12 @@ aarch64_layout_frame (void) + sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size + save SVE registers relative to SP + sub sp, sp, bytes_below_saved_regs */ +- frame.initial_adjust = (frame.hard_fp_offset ++ frame.initial_adjust = (frame.bytes_above_hard_fp + + frame.below_hard_fp_saved_regs_size); + frame.final_adjust = frame.bytes_below_saved_regs; + } +- else if (frame.hard_fp_offset.is_constant (&const_fp_offset) +- && const_fp_offset < max_push_offset) ++ else if (frame.bytes_above_hard_fp.is_constant (&const_above_fp) ++ && const_above_fp < max_push_offset) + { + /* Frame with large area below the saved registers, or with SVE saves, + but with a small area above: +@@ -8435,7 +8435,7 @@ aarch64_layout_frame (void) + [sub sp, sp, below_hard_fp_saved_regs_size] + [save SVE registers relative to SP] + sub sp, sp, bytes_below_saved_regs */ +- frame.callee_adjust = const_fp_offset; ++ frame.callee_adjust = const_above_fp; + frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; + frame.final_adjust = frame.bytes_below_saved_regs; + } +@@ -8450,7 +8450,7 @@ aarch64_layout_frame (void) + [sub sp, sp, below_hard_fp_saved_regs_size] + [save SVE registers relative to SP] + sub sp, sp, bytes_below_saved_regs */ +- frame.initial_adjust = frame.hard_fp_offset; ++ frame.initial_adjust = frame.bytes_above_hard_fp; + frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; + frame.final_adjust = frame.bytes_below_saved_regs; + } +@@ -9754,7 +9754,7 @@ aarch64_expand_prologue (void) + { + /* The offset of the frame chain record (if any) from the current SP. */ + poly_int64 chain_offset = (initial_adjust + callee_adjust +- - frame.hard_fp_offset); ++ - frame.bytes_above_hard_fp); + gcc_assert (known_ge (chain_offset, 0)); + + if (callee_adjust == 0) +@@ -12575,10 +12575,10 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) + if (to == HARD_FRAME_POINTER_REGNUM) + { + if (from == ARG_POINTER_REGNUM) +- return frame.hard_fp_offset; ++ return frame.bytes_above_hard_fp; + + if (from == FRAME_POINTER_REGNUM) +- return frame.hard_fp_offset - frame.bytes_above_locals; ++ return frame.bytes_above_hard_fp - frame.bytes_above_locals; + } + + if (to == STACK_POINTER_REGNUM) +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index bf46e6124aa..dd1f403f939 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -890,10 +890,10 @@ struct GTY (()) aarch64_frame + STACK_BOUNDARY. */ + poly_int64 bytes_above_locals; + +- /* Offset from the base of the frame (incomming SP) to the +- hard_frame_pointer. This value is always a multiple of ++ /* The number of bytes between the hard_frame_pointer and the top of ++ the frame (the incomming SP). This value is always a multiple of + STACK_BOUNDARY. */ +- poly_int64 hard_fp_offset; ++ poly_int64 bytes_above_hard_fp; + + /* The size of the frame. This value is the offset from base of the + frame (incomming SP) to the stack_pointer. This value is always +-- +2.34.1 + + +From aac8b31379ac3bbd14fc6427dce23f56e54e8485 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:52 +0100 +Subject: [PATCH 10/19] aarch64: Tweak frame_size comment +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch fixes another case in which a value was described with +an “upside-down” view. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::frame_size): Tweak comment. +--- + gcc/config/aarch64/aarch64.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index dd1f403f939..700524ae22b 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -895,8 +895,8 @@ struct GTY (()) aarch64_frame + STACK_BOUNDARY. */ + poly_int64 bytes_above_hard_fp; + +- /* The size of the frame. This value is the offset from base of the +- frame (incomming SP) to the stack_pointer. This value is always ++ /* The size of the frame, i.e. the number of bytes between the bottom ++ of the outgoing arguments and the incoming SP. This value is always + a multiple of STACK_BOUNDARY. */ + poly_int64 frame_size; + +-- +2.34.1 + + +From 8d5506a8aeb8dd7e8b209a3663b07688478f76b9 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:53 +0100 +Subject: [PATCH 11/19] aarch64: Measure reg_offset from the bottom of the + frame + +reg_offset was measured from the bottom of the saved register area. +This made perfect sense with the original layout, since the bottom +of the saved register area was also the hard frame pointer address. +It became slightly less obvious with SVE, since we save SVE +registers below the hard frame pointer, but it still made sense. + +However, if we want to allow different frame layouts, it's more +convenient and obvious to measure reg_offset from the bottom of +the frame. After previous patches, it's also a slight simplification +in its own right. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame): Add comment above + reg_offset. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Walk offsets + from the bottom of the frame, rather than the bottom of the saved + register area. Measure reg_offset from the bottom of the frame + rather than the bottom of the saved register area. + (aarch64_save_callee_saves): Update accordingly. + (aarch64_restore_callee_saves): Likewise. + (aarch64_get_separate_components): Likewise. + (aarch64_process_components): Likewise. +--- + gcc/config/aarch64/aarch64.cc | 53 ++++++++++++++++------------------- + gcc/config/aarch64/aarch64.h | 3 ++ + 2 files changed, 27 insertions(+), 29 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 3c4052740e7..97dd077844b 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8139,7 +8139,6 @@ aarch64_needs_frame_chain (void) + static void + aarch64_layout_frame (void) + { +- poly_int64 offset = 0; + int regno, last_fp_reg = INVALID_REGNUM; + machine_mode vector_save_mode = aarch64_reg_save_mode (V8_REGNUM); + poly_int64 vector_save_size = GET_MODE_SIZE (vector_save_mode); +@@ -8217,7 +8216,9 @@ aarch64_layout_frame (void) + gcc_assert (crtl->is_leaf + || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); + +- frame.bytes_below_saved_regs = crtl->outgoing_args_size; ++ poly_int64 offset = crtl->outgoing_args_size; ++ gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); ++ frame.bytes_below_saved_regs = offset; + + /* Now assign stack slots for the registers. Start with the predicate + registers, since predicate LDR and STR have a relatively small +@@ -8229,7 +8230,8 @@ aarch64_layout_frame (void) + offset += BYTES_PER_SVE_PRED; + } + +- if (maybe_ne (offset, 0)) ++ poly_int64 saved_prs_size = offset - frame.bytes_below_saved_regs; ++ if (maybe_ne (saved_prs_size, 0)) + { + /* If we have any vector registers to save above the predicate registers, + the offset of the vector register save slots need to be a multiple +@@ -8247,10 +8249,10 @@ aarch64_layout_frame (void) + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); + else + { +- if (known_le (offset, vector_save_size)) +- offset = vector_save_size; +- else if (known_le (offset, vector_save_size * 2)) +- offset = vector_save_size * 2; ++ if (known_le (saved_prs_size, vector_save_size)) ++ offset = frame.bytes_below_saved_regs + vector_save_size; ++ else if (known_le (saved_prs_size, vector_save_size * 2)) ++ offset = frame.bytes_below_saved_regs + vector_save_size * 2; + else + gcc_unreachable (); + } +@@ -8267,9 +8269,10 @@ aarch64_layout_frame (void) + + /* OFFSET is now the offset of the hard frame pointer from the bottom + of the callee save area. */ +- bool saves_below_hard_fp_p = maybe_ne (offset, 0); +- frame.below_hard_fp_saved_regs_size = offset; +- frame.bytes_below_hard_fp = offset + frame.bytes_below_saved_regs; ++ frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; ++ bool saves_below_hard_fp_p ++ = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); ++ frame.bytes_below_hard_fp = offset; + if (frame.emit_frame_chain) + { + /* FP and LR are placed in the linkage record. */ +@@ -8320,9 +8323,10 @@ aarch64_layout_frame (void) + + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); + +- frame.saved_regs_size = offset; ++ frame.saved_regs_size = offset - frame.bytes_below_saved_regs; + +- poly_int64 varargs_and_saved_regs_size = offset + frame.saved_varargs_size; ++ poly_int64 varargs_and_saved_regs_size ++ = frame.saved_regs_size + frame.saved_varargs_size; + + poly_int64 saved_regs_and_above + = aligned_upper_bound (varargs_and_saved_regs_size +@@ -8790,9 +8794,7 @@ aarch64_save_callee_saves (poly_int64 bytes_below_sp, + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = (frame.reg_offset[regno] +- + frame.bytes_below_saved_regs +- - bytes_below_sp); ++ offset = frame.reg_offset[regno] - bytes_below_sp; + rtx base_rtx = stack_pointer_rtx; + poly_int64 sp_offset = offset; + +@@ -8899,9 +8901,7 @@ aarch64_restore_callee_saves (poly_int64 bytes_below_sp, unsigned start, + + machine_mode mode = aarch64_reg_save_mode (regno); + reg = gen_rtx_REG (mode, regno); +- offset = (frame.reg_offset[regno] +- + frame.bytes_below_saved_regs +- - bytes_below_sp); ++ offset = frame.reg_offset[regno] - bytes_below_sp; + rtx base_rtx = stack_pointer_rtx; + if (mode == VNx2DImode && BYTES_BIG_ENDIAN) + aarch64_adjust_sve_callee_save_base (mode, base_rtx, anchor_reg, +@@ -9040,14 +9040,12 @@ aarch64_get_separate_components (void) + it as a stack probe for -fstack-clash-protection. */ + if (flag_stack_clash_protection + && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) +- && known_eq (offset, 0)) ++ && known_eq (offset, frame.bytes_below_saved_regs)) + continue; + + /* Get the offset relative to the register we'll use. */ + if (frame_pointer_needed) +- offset -= frame.below_hard_fp_saved_regs_size; +- else +- offset += frame.bytes_below_saved_regs; ++ offset -= frame.bytes_below_hard_fp; + + /* Check that we can access the stack slot of the register with one + direct load with no adjustments needed. */ +@@ -9194,9 +9192,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) + rtx reg = gen_rtx_REG (mode, regno); + poly_int64 offset = frame.reg_offset[regno]; + if (frame_pointer_needed) +- offset -= frame.below_hard_fp_saved_regs_size; +- else +- offset += frame.bytes_below_saved_regs; ++ offset -= frame.bytes_below_hard_fp; + + rtx addr = plus_constant (Pmode, ptr_reg, offset); + rtx mem = gen_frame_mem (mode, addr); +@@ -9248,9 +9244,7 @@ aarch64_process_components (sbitmap components, bool prologue_p) + /* REGNO2 can be saved/restored in a pair with REGNO. */ + rtx reg2 = gen_rtx_REG (mode, regno2); + if (frame_pointer_needed) +- offset2 -= frame.below_hard_fp_saved_regs_size; +- else +- offset2 += frame.bytes_below_saved_regs; ++ offset2 -= frame.bytes_below_hard_fp; + rtx addr2 = plus_constant (Pmode, ptr_reg, offset2); + rtx mem2 = gen_frame_mem (mode, addr2); + rtx set2 = prologue_p ? gen_rtx_SET (mem2, reg2) +@@ -9366,7 +9360,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + if (final_adjustment_p + && known_eq (frame.below_hard_fp_saved_regs_size, 0)) + { +- poly_int64 lr_offset = frame.reg_offset[LR_REGNUM]; ++ poly_int64 lr_offset = (frame.reg_offset[LR_REGNUM] ++ - frame.bytes_below_saved_regs); + if (known_ge (lr_offset, 0)) + min_probe_threshold -= lr_offset.to_constant (); + else +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 700524ae22b..b6135837073 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -860,6 +860,9 @@ extern enum aarch64_processor aarch64_tune; + #ifdef HAVE_POLY_INT_H + struct GTY (()) aarch64_frame + { ++ /* The offset from the bottom of the static frame (the bottom of the ++ outgoing arguments) of each register save slot, or -2 if no save is ++ needed. */ + poly_int64 reg_offset[LAST_SAVED_REGNUM + 1]; + + /* The number of extra stack bytes taken up by register varargs. +-- +2.34.1 + + +From b47766614df3b9df878262efb2ad73aaac108363 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:53 +0100 +Subject: [PATCH 12/19] aarch64: Simplify top of frame allocation + +After previous patches, it no longer really makes sense to allocate +the top of the frame in terms of varargs_and_saved_regs_size and +saved_regs_and_above. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_layout_frame): Simplify + the allocation of the top of the frame. +--- + gcc/config/aarch64/aarch64.cc | 23 ++++++++--------------- + 1 file changed, 8 insertions(+), 15 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 97dd077844b..81935852d5b 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8325,23 +8325,16 @@ aarch64_layout_frame (void) + + frame.saved_regs_size = offset - frame.bytes_below_saved_regs; + +- poly_int64 varargs_and_saved_regs_size +- = frame.saved_regs_size + frame.saved_varargs_size; +- +- poly_int64 saved_regs_and_above +- = aligned_upper_bound (varargs_and_saved_regs_size +- + get_frame_size (), +- STACK_BOUNDARY / BITS_PER_UNIT); +- +- frame.bytes_above_hard_fp +- = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; ++ offset += get_frame_size (); ++ offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); ++ auto top_of_locals = offset; + +- /* Both these values are already aligned. */ +- gcc_assert (multiple_p (frame.bytes_below_saved_regs, +- STACK_BOUNDARY / BITS_PER_UNIT)); +- frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; ++ offset += frame.saved_varargs_size; ++ gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); ++ frame.frame_size = offset; + +- frame.bytes_above_locals = frame.saved_varargs_size; ++ frame.bytes_above_hard_fp = frame.frame_size - frame.bytes_below_hard_fp; ++ frame.bytes_above_locals = frame.frame_size - top_of_locals; + + frame.initial_adjust = 0; + frame.final_adjust = 0; +-- +2.34.1 + + +From 08f71b4bb28fb74d20e8d2927a557e8119ce9f4d Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:54 +0100 +Subject: [PATCH 13/19] aarch64: Minor initial adjustment tweak + +This patch just changes a calculation of initial_adjust +to one that makes it slightly more obvious that the total +adjustment is frame.frame_size. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_layout_frame): Tweak + calculation of initial_adjust for frames in which all saves + are SVE saves. +--- + gcc/config/aarch64/aarch64.cc | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 81935852d5b..4d9fcf3d162 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8414,11 +8414,10 @@ aarch64_layout_frame (void) + { + /* Frame in which all saves are SVE saves: + +- sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size ++ sub sp, sp, frame_size - bytes_below_saved_regs + save SVE registers relative to SP + sub sp, sp, bytes_below_saved_regs */ +- frame.initial_adjust = (frame.bytes_above_hard_fp +- + frame.below_hard_fp_saved_regs_size); ++ frame.initial_adjust = frame.frame_size - frame.bytes_below_saved_regs; + frame.final_adjust = frame.bytes_below_saved_regs; + } + else if (frame.bytes_above_hard_fp.is_constant (&const_above_fp) +-- +2.34.1 + + +From f22315d5c19e8310e4dc880fd509678fd291fca8 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:54 +0100 +Subject: [PATCH 14/19] aarch64: Tweak stack clash boundary condition + +The AArch64 ABI says that, when stack clash protection is used, +there can be a maximum of 1KiB of unprobed space at sp on entry +to a function. Therefore, we need to probe when allocating +>= guard_size - 1KiB of data (>= rather than >). This is what +GCC does. + +If an allocation is exactly guard_size bytes, it is enough to allocate +those bytes and probe once at offset 1024. It isn't possible to use a +single probe at any other offset: higher would conmplicate later code, +by leaving more unprobed space than usual, while lower would risk +leaving an entire page unprobed. For simplicity, the code probes all +allocations at offset 1024. + +Some register saves also act as probes. If we need to allocate +more space below the last such register save probe, we need to +probe the allocation if it is > 1KiB. Again, this allocation is +then sometimes (but not always) probed at offset 1024. This sort of +allocation is currently only used for outgoing arguments, which are +rarely this big. + +However, the code also probed if this final outgoing-arguments +allocation was == 1KiB, rather than just > 1KiB. This isn't +necessary, since the register save then probes at offset 1024 +as required. Continuing to probe allocations of exactly 1KiB +would complicate later patches. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): + Don't probe final allocations that are exactly 1KiB in size (after + unprobed space above the final allocation has been deducted). + +gcc/testsuite/ + * gcc.target/aarch64/stack-check-prologue-17.c: New test. +--- + gcc/config/aarch64/aarch64.cc | 4 +- + .../aarch64/stack-check-prologue-17.c | 55 +++++++++++++++++++ + 2 files changed, 58 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 4d9fcf3d162..34c1d8614cd 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -9333,9 +9333,11 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + HOST_WIDE_INT guard_size + = 1 << param_stack_clash_protection_guard_size; + HOST_WIDE_INT guard_used_by_caller = STACK_CLASH_CALLER_GUARD; ++ HOST_WIDE_INT byte_sp_alignment = STACK_BOUNDARY / BITS_PER_UNIT; ++ gcc_assert (multiple_p (poly_size, byte_sp_alignment)); + HOST_WIDE_INT min_probe_threshold + = (final_adjustment_p +- ? guard_used_by_caller ++ ? guard_used_by_caller + byte_sp_alignment + : guard_size - guard_used_by_caller); + /* When doing the final adjustment for the outgoing arguments, take into + account any unprobed space there is above the current SP. There are +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c +new file mode 100644 +index 00000000000..0d8a25d73a2 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c +@@ -0,0 +1,55 @@ ++/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */ ++/* { dg-final { check-function-bodies "**" "" } } */ ++ ++void f(int, ...); ++void g(); ++ ++/* ++** test1: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1024 ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test1(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); ++ } ++ g(); ++ return 1; ++} ++ ++/* ++** test2: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1040 ++** str xzr, \[sp\] ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test2(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x); ++ } ++ g(); ++ return 1; ++} +-- +2.34.1 + + +From 15e18831bf98fd25af098b970ebf0c9a6200a34b Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:55 +0100 +Subject: [PATCH 15/19] aarch64: Put LR save probe in first 16 bytes + +-fstack-clash-protection uses the save of LR as a probe for the next +allocation. The next allocation could be: + +* another part of the static frame, e.g. when allocating SVE save slots + or outgoing arguments + +* an alloca in the same function + +* an allocation made by a callee function + +However, when -fomit-frame-pointer is used, the LR save slot is placed +above the other GPR save slots. It could therefore be up to 80 bytes +above the base of the GPR save area (which is also the hard fp address). + +aarch64_allocate_and_probe_stack_space took this into account when +deciding how much subsequent space could be allocated without needing +a probe. However, it interacted badly with: + + /* If doing a small final adjustment, we always probe at offset 0. + This is done to avoid issues when LR is not at position 0 or when + the final adjustment is smaller than the probing offset. */ + else if (final_adjustment_p && rounded_size == 0) + residual_probe_offset = 0; + +which forces any allocation that is smaller than the guard page size +to be probed at offset 0 rather than the usual offset 1024. It was +therefore possible to construct cases in which we had: + +* a probe using LR at SP + 80 bytes (or some other value >= 16) +* an allocation of the guard page size - 16 bytes +* a probe at SP + 0 + +which allocates guard page size + 64 consecutive unprobed bytes. + +This patch requires the LR probe to be in the first 16 bytes of the +save area when stack clash protection is active. Doing it +unconditionally would cause code-quality regressions. + +Putting LR before other registers prevents push/pop allocation +when shadow call stacks are enabled, since LR is restored +separately from the other callee-saved registers. + +The new comment doesn't say that the probe register is required +to be LR, since a later patch removes that restriction. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_layout_frame): Ensure that + the LR save slot is in the first 16 bytes of the register save area. + Only form STP/LDP push/pop candidates if both registers are valid. + (aarch64_allocate_and_probe_stack_space): Remove workaround for + when LR was not in the first 16 bytes. + +gcc/testsuite/ + * gcc.target/aarch64/stack-check-prologue-18.c: New test. + * gcc.target/aarch64/stack-check-prologue-19.c: Likewise. + * gcc.target/aarch64/stack-check-prologue-20.c: Likewise. +--- + gcc/config/aarch64/aarch64.cc | 72 ++++++------- + .../aarch64/stack-check-prologue-18.c | 100 ++++++++++++++++++ + .../aarch64/stack-check-prologue-19.c | 100 ++++++++++++++++++ + .../aarch64/stack-check-prologue-20.c | 3 + + 4 files changed, 233 insertions(+), 42 deletions(-) + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 34c1d8614cd..16433fb70f4 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8273,26 +8273,34 @@ aarch64_layout_frame (void) + bool saves_below_hard_fp_p + = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); + frame.bytes_below_hard_fp = offset; ++ ++ auto allocate_gpr_slot = [&](unsigned int regno) ++ { ++ frame.reg_offset[regno] = offset; ++ if (frame.wb_push_candidate1 == INVALID_REGNUM) ++ frame.wb_push_candidate1 = regno; ++ else if (frame.wb_push_candidate2 == INVALID_REGNUM) ++ frame.wb_push_candidate2 = regno; ++ offset += UNITS_PER_WORD; ++ }; ++ + if (frame.emit_frame_chain) + { + /* FP and LR are placed in the linkage record. */ +- frame.reg_offset[R29_REGNUM] = offset; +- frame.wb_push_candidate1 = R29_REGNUM; +- frame.reg_offset[R30_REGNUM] = offset + UNITS_PER_WORD; +- frame.wb_push_candidate2 = R30_REGNUM; +- offset += 2 * UNITS_PER_WORD; ++ allocate_gpr_slot (R29_REGNUM); ++ allocate_gpr_slot (R30_REGNUM); + } ++ else if (flag_stack_clash_protection ++ && known_eq (frame.reg_offset[R30_REGNUM], SLOT_REQUIRED)) ++ /* Put the LR save slot first, since it makes a good choice of probe ++ for stack clash purposes. The idea is that the link register usually ++ has to be saved before a call anyway, and so we lose little by ++ stopping it from being individually shrink-wrapped. */ ++ allocate_gpr_slot (R30_REGNUM); + + for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++) + if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) +- { +- frame.reg_offset[regno] = offset; +- if (frame.wb_push_candidate1 == INVALID_REGNUM) +- frame.wb_push_candidate1 = regno; +- else if (frame.wb_push_candidate2 == INVALID_REGNUM) +- frame.wb_push_candidate2 = regno; +- offset += UNITS_PER_WORD; +- } ++ allocate_gpr_slot (regno); + + poly_int64 max_int_offset = offset; + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); +@@ -8370,10 +8378,13 @@ aarch64_layout_frame (void) + max_push_offset to 0, because no registers are popped at this time, + so callee_adjust cannot be adjusted. */ + HOST_WIDE_INT max_push_offset = 0; +- if (frame.wb_pop_candidate2 != INVALID_REGNUM) +- max_push_offset = 512; +- else if (frame.wb_pop_candidate1 != INVALID_REGNUM) +- max_push_offset = 256; ++ if (frame.wb_pop_candidate1 != INVALID_REGNUM) ++ { ++ if (frame.wb_pop_candidate2 != INVALID_REGNUM) ++ max_push_offset = 512; ++ else ++ max_push_offset = 256; ++ } + + HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; + HOST_WIDE_INT const_saved_regs_size; +@@ -9339,29 +9350,6 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + = (final_adjustment_p + ? guard_used_by_caller + byte_sp_alignment + : guard_size - guard_used_by_caller); +- /* When doing the final adjustment for the outgoing arguments, take into +- account any unprobed space there is above the current SP. There are +- two cases: +- +- - When saving SVE registers below the hard frame pointer, we force +- the lowest save to take place in the prologue before doing the final +- adjustment (i.e. we don't allow the save to be shrink-wrapped). +- This acts as a probe at SP, so there is no unprobed space. +- +- - When there are no SVE register saves, we use the store of the link +- register as a probe. We can't assume that LR was saved at position 0 +- though, so treat any space below it as unprobed. */ +- if (final_adjustment_p +- && known_eq (frame.below_hard_fp_saved_regs_size, 0)) +- { +- poly_int64 lr_offset = (frame.reg_offset[LR_REGNUM] +- - frame.bytes_below_saved_regs); +- if (known_ge (lr_offset, 0)) +- min_probe_threshold -= lr_offset.to_constant (); +- else +- gcc_assert (!flag_stack_clash_protection || known_eq (poly_size, 0)); +- } +- + poly_int64 frame_size = frame.frame_size; + + /* We should always have a positive probe threshold. */ +@@ -9541,8 +9529,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + if (final_adjustment_p && rounded_size != 0) + min_probe_threshold = 0; + /* If doing a small final adjustment, we always probe at offset 0. +- This is done to avoid issues when LR is not at position 0 or when +- the final adjustment is smaller than the probing offset. */ ++ This is done to avoid issues when the final adjustment is smaller ++ than the probing offset. */ + else if (final_adjustment_p && rounded_size == 0) + residual_probe_offset = 0; + +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c +new file mode 100644 +index 00000000000..82447d20fff +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c +@@ -0,0 +1,100 @@ ++/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12" } */ ++/* { dg-final { check-function-bodies "**" "" } } */ ++ ++void f(int, ...); ++void g(); ++ ++/* ++** test1: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #4064 ++** str xzr, \[sp\] ++** cbnz w0, .* ++** bl g ++** ... ++** str x26, \[sp, #?4128\] ++** ... ++*/ ++int test1(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x); ++ } ++ g(); ++ return 1; ++} ++ ++/* ++** test2: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1040 ++** str xzr, \[sp\] ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test2(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x); ++ } ++ g(); ++ return 1; ++} ++ ++/* ++** test3: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1024 ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test3(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); ++ } ++ g(); ++ return 1; ++} +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c +new file mode 100644 +index 00000000000..73ac3e4e4eb +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c +@@ -0,0 +1,100 @@ ++/* { dg-options "-O2 -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fsanitize=shadow-call-stack -ffixed-x18" } */ ++/* { dg-final { check-function-bodies "**" "" } } */ ++ ++void f(int, ...); ++void g(); ++ ++/* ++** test1: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #4064 ++** str xzr, \[sp\] ++** cbnz w0, .* ++** bl g ++** ... ++** str x26, \[sp, #?4128\] ++** ... ++*/ ++int test1(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x); ++ } ++ g(); ++ return 1; ++} ++ ++/* ++** test2: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1040 ++** str xzr, \[sp\] ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test2(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x); ++ } ++ g(); ++ return 1; ++} ++ ++/* ++** test3: ++** ... ++** str x30, \[sp\] ++** sub sp, sp, #1024 ++** cbnz w0, .* ++** bl g ++** ... ++*/ ++int test3(int z) { ++ __uint128_t x = 0; ++ int y[0x400]; ++ if (z) ++ { ++ asm volatile ("" ::: ++ "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26"); ++ f(0, 0, 0, 0, 0, 0, 0, &y, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, ++ x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x); ++ } ++ g(); ++ return 1; ++} +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c +new file mode 100644 +index 00000000000..690aae8dfd5 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-20.c +@@ -0,0 +1,3 @@ ++/* { dg-options "-O2 -fstack-protector-all -fstack-clash-protection -fomit-frame-pointer --param stack-clash-protection-guard-size=12 -fsanitize=shadow-call-stack -ffixed-x18" } */ ++ ++#include "stack-check-prologue-19.c" +-- +2.34.1 + + +From c4f0e121faa36342f1d21919e54a05ad841c4f86 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:55 +0100 +Subject: [PATCH 16/19] aarch64: Simplify probe of final frame allocation + +Previous patches ensured that the final frame allocation only needs +a probe when the size is strictly greater than 1KiB. It's therefore +safe to use the normal 1024 probe offset in all cases. + +The main motivation for doing this is to simplify the code and +remove the number of special cases. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_allocate_and_probe_stack_space): + Always probe the residual allocation at offset 1024, asserting + that that is in range. + +gcc/testsuite/ + * gcc.target/aarch64/stack-check-prologue-17.c: Expect the probe + to be at offset 1024 rather than offset 0. + * gcc.target/aarch64/stack-check-prologue-18.c: Likewise. + * gcc.target/aarch64/stack-check-prologue-19.c: Likewise. +--- + gcc/config/aarch64/aarch64.cc | 12 ++++-------- + .../gcc.target/aarch64/stack-check-prologue-17.c | 2 +- + .../gcc.target/aarch64/stack-check-prologue-18.c | 4 ++-- + .../gcc.target/aarch64/stack-check-prologue-19.c | 4 ++-- + 4 files changed, 9 insertions(+), 13 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 16433fb70f4..8abf3d7a1e2 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -9523,16 +9523,12 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + are still safe. */ + if (residual) + { +- HOST_WIDE_INT residual_probe_offset = guard_used_by_caller; ++ gcc_assert (guard_used_by_caller + byte_sp_alignment <= size); ++ + /* If we're doing final adjustments, and we've done any full page + allocations then any residual needs to be probed. */ + if (final_adjustment_p && rounded_size != 0) + min_probe_threshold = 0; +- /* If doing a small final adjustment, we always probe at offset 0. +- This is done to avoid issues when the final adjustment is smaller +- than the probing offset. */ +- else if (final_adjustment_p && rounded_size == 0) +- residual_probe_offset = 0; + + aarch64_sub_sp (temp1, temp2, residual, frame_related_p); + if (residual >= min_probe_threshold) +@@ -9543,8 +9539,8 @@ aarch64_allocate_and_probe_stack_space (rtx temp1, rtx temp2, + HOST_WIDE_INT_PRINT_DEC " bytes, probing will be required." + "\n", residual); + +- emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx, +- residual_probe_offset)); ++ emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx, ++ guard_used_by_caller)); + emit_insn (gen_blockage ()); + } + } +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c +index 0d8a25d73a2..f0ec1389771 100644 +--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-17.c +@@ -33,7 +33,7 @@ int test1(int z) { + ** ... + ** str x30, \[sp\] + ** sub sp, sp, #1040 +-** str xzr, \[sp\] ++** str xzr, \[sp, #?1024\] + ** cbnz w0, .* + ** bl g + ** ... +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c +index 82447d20fff..6383bec5ebc 100644 +--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-18.c +@@ -9,7 +9,7 @@ void g(); + ** ... + ** str x30, \[sp\] + ** sub sp, sp, #4064 +-** str xzr, \[sp\] ++** str xzr, \[sp, #?1024\] + ** cbnz w0, .* + ** bl g + ** ... +@@ -50,7 +50,7 @@ int test1(int z) { + ** ... + ** str x30, \[sp\] + ** sub sp, sp, #1040 +-** str xzr, \[sp\] ++** str xzr, \[sp, #?1024\] + ** cbnz w0, .* + ** bl g + ** ... +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c +index 73ac3e4e4eb..562039b5e9b 100644 +--- a/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c ++++ b/gcc/testsuite/gcc.target/aarch64/stack-check-prologue-19.c +@@ -9,7 +9,7 @@ void g(); + ** ... + ** str x30, \[sp\] + ** sub sp, sp, #4064 +-** str xzr, \[sp\] ++** str xzr, \[sp, #?1024\] + ** cbnz w0, .* + ** bl g + ** ... +@@ -50,7 +50,7 @@ int test1(int z) { + ** ... + ** str x30, \[sp\] + ** sub sp, sp, #1040 +-** str xzr, \[sp\] ++** str xzr, \[sp, #?1024\] + ** cbnz w0, .* + ** bl g + ** ... +-- +2.34.1 + + +From 6f0ab0a9f46a17b68349ff6035aa776bf65f0575 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:56 +0100 +Subject: [PATCH 17/19] aarch64: Explicitly record probe registers in frame + info + +The stack frame is currently divided into three areas: + +A: the area above the hard frame pointer +B: the SVE saves below the hard frame pointer +C: the outgoing arguments + +If the stack frame is allocated in one chunk, the allocation needs a +probe if the frame size is >= guard_size - 1KiB. In addition, if the +function is not a leaf function, it must probe an address no more than +1KiB above the outgoing SP. We ensured the second condition by + +(1) using single-chunk allocations for non-leaf functions only if + the link register save slot is within 512 bytes of the bottom + of the frame; and + +(2) using the link register save as a probe (meaning, for instance, + that it can't be individually shrink wrapped) + +If instead the stack is allocated in multiple chunks, then: + +* an allocation involving only the outgoing arguments (C above) requires + a probe if the allocation size is > 1KiB + +* any other allocation requires a probe if the allocation size + is >= guard_size - 1KiB + +* second and subsequent allocations require the previous allocation + to probe at the bottom of the allocated area, regardless of the size + of that previous allocation + +The final point means that, unlike for single allocations, +it can be necessary to have both a non-SVE register probe and +an SVE register probe. For example: + +* allocate A, probe using a non-SVE register save +* allocate B, probe using an SVE register save +* allocate C + +The non-SVE register used in this case was again the link register. +It was previously used even if the link register save slot was some +bytes above the bottom of the non-SVE register saves, but an earlier +patch avoided that by putting the link register save slot first. + +As a belt-and-braces fix, this patch explicitly records which +probe registers we're using and allows the non-SVE probe to be +whichever register comes first (as for SVE). + +The patch also avoids unnecessary probes in sve/pcs/stack_clash_3.c. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::sve_save_and_probe) + (aarch64_frame::hard_fp_save_and_probe): New fields. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Initialize them. + Rather than asserting that a leaf function saves LR, instead assert + that a leaf function saves something. + (aarch64_get_separate_components): Prevent the chosen probe + registers from being individually shrink-wrapped. + (aarch64_allocate_and_probe_stack_space): Remove workaround for + probe registers that aren't at the bottom of the previous allocation. + +gcc/testsuite/ + * gcc.target/aarch64/sve/pcs/stack_clash_3.c: Avoid redundant probes. +--- + gcc/config/aarch64/aarch64.cc | 68 +++++++++++++++---- + gcc/config/aarch64/aarch64.h | 8 +++ + .../aarch64/sve/pcs/stack_clash_3.c | 6 +- + 3 files changed, 64 insertions(+), 18 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index 8abf3d7a1e2..a8d907df884 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8210,15 +8210,11 @@ aarch64_layout_frame (void) + && !crtl->abi->clobbers_full_reg_p (regno)) + frame.reg_offset[regno] = SLOT_REQUIRED; + +- /* With stack-clash, LR must be saved in non-leaf functions. The saving of +- LR counts as an implicit probe which allows us to maintain the invariant +- described in the comment at expand_prologue. */ +- gcc_assert (crtl->is_leaf +- || maybe_ne (frame.reg_offset[R30_REGNUM], SLOT_NOT_REQUIRED)); + + poly_int64 offset = crtl->outgoing_args_size; + gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); + frame.bytes_below_saved_regs = offset; ++ frame.sve_save_and_probe = INVALID_REGNUM; + + /* Now assign stack slots for the registers. Start with the predicate + registers, since predicate LDR and STR have a relatively small +@@ -8226,6 +8222,8 @@ aarch64_layout_frame (void) + for (regno = P0_REGNUM; regno <= P15_REGNUM; regno++) + if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) + { ++ if (frame.sve_save_and_probe == INVALID_REGNUM) ++ frame.sve_save_and_probe = regno; + frame.reg_offset[regno] = offset; + offset += BYTES_PER_SVE_PRED; + } +@@ -8263,6 +8261,8 @@ aarch64_layout_frame (void) + for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) + if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) + { ++ if (frame.sve_save_and_probe == INVALID_REGNUM) ++ frame.sve_save_and_probe = regno; + frame.reg_offset[regno] = offset; + offset += vector_save_size; + } +@@ -8272,10 +8272,18 @@ aarch64_layout_frame (void) + frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; + bool saves_below_hard_fp_p + = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); ++ gcc_assert (!saves_below_hard_fp_p ++ || (frame.sve_save_and_probe != INVALID_REGNUM ++ && known_eq (frame.reg_offset[frame.sve_save_and_probe], ++ frame.bytes_below_saved_regs))); ++ + frame.bytes_below_hard_fp = offset; ++ frame.hard_fp_save_and_probe = INVALID_REGNUM; + + auto allocate_gpr_slot = [&](unsigned int regno) + { ++ if (frame.hard_fp_save_and_probe == INVALID_REGNUM) ++ frame.hard_fp_save_and_probe = regno; + frame.reg_offset[regno] = offset; + if (frame.wb_push_candidate1 == INVALID_REGNUM) + frame.wb_push_candidate1 = regno; +@@ -8309,6 +8317,8 @@ aarch64_layout_frame (void) + for (regno = V0_REGNUM; regno <= V31_REGNUM; regno++) + if (known_eq (frame.reg_offset[regno], SLOT_REQUIRED)) + { ++ if (frame.hard_fp_save_and_probe == INVALID_REGNUM) ++ frame.hard_fp_save_and_probe = regno; + /* If there is an alignment gap between integer and fp callee-saves, + allocate the last fp register to it if possible. */ + if (regno == last_fp_reg +@@ -8332,6 +8342,17 @@ aarch64_layout_frame (void) + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); + + frame.saved_regs_size = offset - frame.bytes_below_saved_regs; ++ gcc_assert (known_eq (frame.saved_regs_size, ++ frame.below_hard_fp_saved_regs_size) ++ || (frame.hard_fp_save_and_probe != INVALID_REGNUM ++ && known_eq (frame.reg_offset[frame.hard_fp_save_and_probe], ++ frame.bytes_below_hard_fp))); ++ ++ /* With stack-clash, a register must be saved in non-leaf functions. ++ The saving of the bottommost register counts as an implicit probe, ++ which allows us to maintain the invariant described in the comment ++ at expand_prologue. */ ++ gcc_assert (crtl->is_leaf || maybe_ne (frame.saved_regs_size, 0)); + + offset += get_frame_size (); + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); +@@ -8462,6 +8483,25 @@ aarch64_layout_frame (void) + frame.final_adjust = frame.bytes_below_saved_regs; + } + ++ /* The frame is allocated in pieces, with each non-final piece ++ including a register save at offset 0 that acts as a probe for ++ the following piece. In addition, the save of the bottommost register ++ acts as a probe for callees and allocas. Roll back any probes that ++ aren't needed. ++ ++ A probe isn't needed if it is associated with the final allocation ++ (including callees and allocas) that happens before the epilogue is ++ executed. */ ++ if (crtl->is_leaf ++ && !cfun->calls_alloca ++ && known_eq (frame.final_adjust, 0)) ++ { ++ if (maybe_ne (frame.sve_callee_adjust, 0)) ++ frame.sve_save_and_probe = INVALID_REGNUM; ++ else ++ frame.hard_fp_save_and_probe = INVALID_REGNUM; ++ } ++ + /* Make sure the individual adjustments add up to the full frame size. */ + gcc_assert (known_eq (frame.initial_adjust + + frame.callee_adjust +@@ -9039,13 +9079,6 @@ aarch64_get_separate_components (void) + + poly_int64 offset = frame.reg_offset[regno]; + +- /* If the register is saved in the first SVE save slot, we use +- it as a stack probe for -fstack-clash-protection. */ +- if (flag_stack_clash_protection +- && maybe_ne (frame.below_hard_fp_saved_regs_size, 0) +- && known_eq (offset, frame.bytes_below_saved_regs)) +- continue; +- + /* Get the offset relative to the register we'll use. */ + if (frame_pointer_needed) + offset -= frame.bytes_below_hard_fp; +@@ -9080,6 +9113,13 @@ aarch64_get_separate_components (void) + + bitmap_clear_bit (components, LR_REGNUM); + bitmap_clear_bit (components, SP_REGNUM); ++ if (flag_stack_clash_protection) ++ { ++ if (frame.sve_save_and_probe != INVALID_REGNUM) ++ bitmap_clear_bit (components, frame.sve_save_and_probe); ++ if (frame.hard_fp_save_and_probe != INVALID_REGNUM) ++ bitmap_clear_bit (components, frame.hard_fp_save_and_probe); ++ } + + return components; + } +@@ -9616,8 +9656,8 @@ aarch64_epilogue_uses (int regno) + When probing is needed, we emit a probe at the start of the prologue + and every PARAM_STACK_CLASH_PROTECTION_GUARD_SIZE bytes thereafter. + +- We have to track how much space has been allocated and the only stores +- to the stack we track as implicit probes are the FP/LR stores. ++ We can also use register saves as probes. These are stored in ++ sve_save_and_probe and hard_fp_save_and_probe. + + For outgoing arguments we probe if the size is larger than 1KB, such that + the ABI specified buffer is maintained for the next callee. +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index b6135837073..46d4693e206 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -957,6 +957,14 @@ struct GTY (()) aarch64_frame + This is the register they should use. */ + unsigned spare_pred_reg; + ++ /* An SVE register that is saved below the hard frame pointer and that acts ++ as a probe for later allocations, or INVALID_REGNUM if none. */ ++ unsigned sve_save_and_probe; ++ ++ /* A register that is saved at the hard frame pointer and that acts ++ as a probe for later allocations, or INVALID_REGNUM if none. */ ++ unsigned hard_fp_save_and_probe; ++ + bool laid_out; + + /* True if shadow call stack should be enabled for the current function. */ +diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c +index 3e01ec36c3a..3530a0d504b 100644 +--- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c ++++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/stack_clash_3.c +@@ -11,11 +11,10 @@ + ** mov x11, sp + ** ... + ** sub sp, sp, x13 +-** str p4, \[sp\] + ** cbz w0, [^\n]* ++** str p4, \[sp\] + ** ... + ** ptrue p0\.b, all +-** ldr p4, \[sp\] + ** addvl sp, sp, #1 + ** ldr x24, \[sp\], 32 + ** ret +@@ -39,13 +38,12 @@ test_1 (int n) + ** mov x11, sp + ** ... + ** sub sp, sp, x13 +-** str p4, \[sp\] + ** cbz w0, [^\n]* ++** str p4, \[sp\] + ** str p5, \[sp, #1, mul vl\] + ** str p6, \[sp, #2, mul vl\] + ** ... + ** ptrue p0\.b, all +-** ldr p4, \[sp\] + ** addvl sp, sp, #1 + ** ldr x24, \[sp\], 32 + ** ret +-- +2.34.1 + + +From 8254e1b9cd500e0c278465a3657543477e9d1250 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:56 +0100 +Subject: [PATCH 18/19] aarch64: Remove below_hard_fp_saved_regs_size + +After previous patches, it's no longer necessary to store +saved_regs_size and below_hard_fp_saved_regs_size in the frame info. +All measurements instead use the top or bottom of the frame as +reference points. + +gcc/ + * config/aarch64/aarch64.h (aarch64_frame::saved_regs_size) + (aarch64_frame::below_hard_fp_saved_regs_size): Delete. + * config/aarch64/aarch64.cc (aarch64_layout_frame): Update accordingly. +--- + gcc/config/aarch64/aarch64.cc | 45 ++++++++++++++++------------------- + gcc/config/aarch64/aarch64.h | 7 ------ + 2 files changed, 21 insertions(+), 31 deletions(-) + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index a8d907df884..ac3d3b336a3 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8269,9 +8269,8 @@ aarch64_layout_frame (void) + + /* OFFSET is now the offset of the hard frame pointer from the bottom + of the callee save area. */ +- frame.below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; +- bool saves_below_hard_fp_p +- = maybe_ne (frame.below_hard_fp_saved_regs_size, 0); ++ auto below_hard_fp_saved_regs_size = offset - frame.bytes_below_saved_regs; ++ bool saves_below_hard_fp_p = maybe_ne (below_hard_fp_saved_regs_size, 0); + gcc_assert (!saves_below_hard_fp_p + || (frame.sve_save_and_probe != INVALID_REGNUM + && known_eq (frame.reg_offset[frame.sve_save_and_probe], +@@ -8341,9 +8340,8 @@ aarch64_layout_frame (void) + + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); + +- frame.saved_regs_size = offset - frame.bytes_below_saved_regs; +- gcc_assert (known_eq (frame.saved_regs_size, +- frame.below_hard_fp_saved_regs_size) ++ auto saved_regs_size = offset - frame.bytes_below_saved_regs; ++ gcc_assert (known_eq (saved_regs_size, below_hard_fp_saved_regs_size) + || (frame.hard_fp_save_and_probe != INVALID_REGNUM + && known_eq (frame.reg_offset[frame.hard_fp_save_and_probe], + frame.bytes_below_hard_fp))); +@@ -8352,7 +8350,7 @@ aarch64_layout_frame (void) + The saving of the bottommost register counts as an implicit probe, + which allows us to maintain the invariant described in the comment + at expand_prologue. */ +- gcc_assert (crtl->is_leaf || maybe_ne (frame.saved_regs_size, 0)); ++ gcc_assert (crtl->is_leaf || maybe_ne (saved_regs_size, 0)); + + offset += get_frame_size (); + offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); +@@ -8409,7 +8407,7 @@ aarch64_layout_frame (void) + + HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; + HOST_WIDE_INT const_saved_regs_size; +- if (known_eq (frame.saved_regs_size, 0)) ++ if (known_eq (saved_regs_size, 0)) + frame.initial_adjust = frame.frame_size; + else if (frame.frame_size.is_constant (&const_size) + && const_size < max_push_offset +@@ -8422,7 +8420,7 @@ aarch64_layout_frame (void) + frame.callee_adjust = const_size; + } + else if (frame.bytes_below_saved_regs.is_constant (&const_below_saved_regs) +- && frame.saved_regs_size.is_constant (&const_saved_regs_size) ++ && saved_regs_size.is_constant (&const_saved_regs_size) + && const_below_saved_regs + const_saved_regs_size < 512 + /* We could handle this case even with data below the saved + registers, provided that that data left us with valid offsets +@@ -8441,8 +8439,7 @@ aarch64_layout_frame (void) + frame.initial_adjust = frame.frame_size; + } + else if (saves_below_hard_fp_p +- && known_eq (frame.saved_regs_size, +- frame.below_hard_fp_saved_regs_size)) ++ && known_eq (saved_regs_size, below_hard_fp_saved_regs_size)) + { + /* Frame in which all saves are SVE saves: + +@@ -8464,7 +8461,7 @@ aarch64_layout_frame (void) + [save SVE registers relative to SP] + sub sp, sp, bytes_below_saved_regs */ + frame.callee_adjust = const_above_fp; +- frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; ++ frame.sve_callee_adjust = below_hard_fp_saved_regs_size; + frame.final_adjust = frame.bytes_below_saved_regs; + } + else +@@ -8479,7 +8476,7 @@ aarch64_layout_frame (void) + [save SVE registers relative to SP] + sub sp, sp, bytes_below_saved_regs */ + frame.initial_adjust = frame.bytes_above_hard_fp; +- frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; ++ frame.sve_callee_adjust = below_hard_fp_saved_regs_size; + frame.final_adjust = frame.bytes_below_saved_regs; + } + +@@ -9621,17 +9618,17 @@ aarch64_epilogue_uses (int regno) + | local variables | <-- frame_pointer_rtx + | | + +-------------------------------+ +- | padding | \ +- +-------------------------------+ | +- | callee-saved registers | | frame.saved_regs_size +- +-------------------------------+ | +- | LR' | | +- +-------------------------------+ | +- | FP' | | +- +-------------------------------+ |<- hard_frame_pointer_rtx (aligned) +- | SVE vector registers | | \ +- +-------------------------------+ | | below_hard_fp_saved_regs_size +- | SVE predicate registers | / / ++ | padding | ++ +-------------------------------+ ++ | callee-saved registers | ++ +-------------------------------+ ++ | LR' | ++ +-------------------------------+ ++ | FP' | ++ +-------------------------------+ <-- hard_frame_pointer_rtx (aligned) ++ | SVE vector registers | ++ +-------------------------------+ ++ | SVE predicate registers | + +-------------------------------+ + | dynamic allocation | + +-------------------------------+ +diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h +index 46d4693e206..01f7751bc78 100644 +--- a/gcc/config/aarch64/aarch64.h ++++ b/gcc/config/aarch64/aarch64.h +@@ -871,18 +871,11 @@ struct GTY (()) aarch64_frame + STACK_BOUNDARY. */ + HOST_WIDE_INT saved_varargs_size; + +- /* The size of the callee-save registers with a slot in REG_OFFSET. */ +- poly_int64 saved_regs_size; +- + /* The number of bytes between the bottom of the static frame (the bottom + of the outgoing arguments) and the bottom of the register save area. + This value is always a multiple of STACK_BOUNDARY. */ + poly_int64 bytes_below_saved_regs; + +- /* The size of the callee-save registers with a slot in REG_OFFSET that +- are saved below the hard frame pointer. */ +- poly_int64 below_hard_fp_saved_regs_size; +- + /* The number of bytes between the bottom of the static frame (the bottom + of the outgoing arguments) and the hard frame pointer. This value is + always a multiple of STACK_BOUNDARY. */ +-- +2.34.1 + + +From 75c37e031408262263442f5b4cdb83d3777b6422 Mon Sep 17 00:00:00 2001 +From: Richard Sandiford +Date: Tue, 12 Sep 2023 16:08:57 +0100 +Subject: [PATCH 19/19] aarch64: Make stack smash canary protect saved + registers + +AArch64 normally puts the saved registers near the bottom of the frame, +immediately above any dynamic allocations. But this means that a +stack-smash attack on those dynamic allocations could overwrite the +saved registers without needing to reach as far as the stack smash +canary. + +The same thing could also happen for variable-sized arguments that are +passed by value, since those are allocated before a call and popped on +return. + +This patch avoids that by putting the locals (and thus the canary) below +the saved registers when stack smash protection is active. + +The patch fixes CVE-2023-4039. + +gcc/ + * config/aarch64/aarch64.cc (aarch64_save_regs_above_locals_p): + New function. + (aarch64_layout_frame): Use it to decide whether locals should + go above or below the saved registers. + (aarch64_expand_prologue): Update stack layout comment. + Emit a stack tie after the final adjustment. + +gcc/testsuite/ + * gcc.target/aarch64/stack-protector-8.c: New test. + * gcc.target/aarch64/stack-protector-9.c: Likewise. +--- + gcc/config/aarch64/aarch64.cc | 46 +++++++-- + .../gcc.target/aarch64/stack-protector-8.c | 95 +++++++++++++++++++ + .../gcc.target/aarch64/stack-protector-9.c | 33 +++++++ + 3 files changed, 168 insertions(+), 6 deletions(-) + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-8.c + create mode 100644 gcc/testsuite/gcc.target/aarch64/stack-protector-9.c + +diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc +index ac3d3b336a3..96c3f48fdc4 100644 +--- a/gcc/config/aarch64/aarch64.cc ++++ b/gcc/config/aarch64/aarch64.cc +@@ -8133,6 +8133,20 @@ aarch64_needs_frame_chain (void) + return aarch64_use_frame_pointer; + } + ++/* Return true if the current function should save registers above ++ the locals area, rather than below it. */ ++ ++static bool ++aarch64_save_regs_above_locals_p () ++{ ++ /* When using stack smash protection, make sure that the canary slot ++ comes between the locals and the saved registers. Otherwise, ++ it would be possible for a carefully sized smash attack to change ++ the saved registers (particularly LR and FP) without reaching the ++ canary. */ ++ return crtl->stack_protect_guard; ++} ++ + /* Mark the registers that need to be saved by the callee and calculate + the size of the callee-saved registers area and frame record (both FP + and LR may be omitted). */ +@@ -8144,6 +8158,7 @@ aarch64_layout_frame (void) + poly_int64 vector_save_size = GET_MODE_SIZE (vector_save_mode); + bool frame_related_fp_reg_p = false; + aarch64_frame &frame = cfun->machine->frame; ++ poly_int64 top_of_locals = -1; + + frame.emit_frame_chain = aarch64_needs_frame_chain (); + +@@ -8210,9 +8225,16 @@ aarch64_layout_frame (void) + && !crtl->abi->clobbers_full_reg_p (regno)) + frame.reg_offset[regno] = SLOT_REQUIRED; + ++ bool regs_at_top_p = aarch64_save_regs_above_locals_p (); + + poly_int64 offset = crtl->outgoing_args_size; + gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); ++ if (regs_at_top_p) ++ { ++ offset += get_frame_size (); ++ offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); ++ top_of_locals = offset; ++ } + frame.bytes_below_saved_regs = offset; + frame.sve_save_and_probe = INVALID_REGNUM; + +@@ -8352,15 +8374,18 @@ aarch64_layout_frame (void) + at expand_prologue. */ + gcc_assert (crtl->is_leaf || maybe_ne (saved_regs_size, 0)); + +- offset += get_frame_size (); +- offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); +- auto top_of_locals = offset; +- ++ if (!regs_at_top_p) ++ { ++ offset += get_frame_size (); ++ offset = aligned_upper_bound (offset, STACK_BOUNDARY / BITS_PER_UNIT); ++ top_of_locals = offset; ++ } + offset += frame.saved_varargs_size; + gcc_assert (multiple_p (offset, STACK_BOUNDARY / BITS_PER_UNIT)); + frame.frame_size = offset; + + frame.bytes_above_hard_fp = frame.frame_size - frame.bytes_below_hard_fp; ++ gcc_assert (known_ge (top_of_locals, 0)); + frame.bytes_above_locals = frame.frame_size - top_of_locals; + + frame.initial_adjust = 0; +@@ -9615,10 +9640,10 @@ aarch64_epilogue_uses (int regno) + | for register varargs | + | | + +-------------------------------+ +- | local variables | <-- frame_pointer_rtx ++ | local variables (1) | <-- frame_pointer_rtx + | | + +-------------------------------+ +- | padding | ++ | padding (1) | + +-------------------------------+ + | callee-saved registers | + +-------------------------------+ +@@ -9630,6 +9655,10 @@ aarch64_epilogue_uses (int regno) + +-------------------------------+ + | SVE predicate registers | + +-------------------------------+ ++ | local variables (2) | ++ +-------------------------------+ ++ | padding (2) | ++ +-------------------------------+ + | dynamic allocation | + +-------------------------------+ + | padding | +@@ -9639,6 +9668,9 @@ aarch64_epilogue_uses (int regno) + +-------------------------------+ + | | <-- stack_pointer_rtx (aligned) + ++ The regions marked (1) and (2) are mutually exclusive. (2) is used ++ when aarch64_save_regs_above_locals_p is true. ++ + Dynamic stack allocations via alloca() decrease stack_pointer_rtx + but leave frame_pointer_rtx and hard_frame_pointer_rtx + unchanged. +@@ -9834,6 +9866,8 @@ aarch64_expand_prologue (void) + gcc_assert (known_eq (bytes_below_sp, final_adjust)); + aarch64_allocate_and_probe_stack_space (tmp1_rtx, tmp0_rtx, final_adjust, + !frame_pointer_needed, true); ++ if (emit_frame_chain && maybe_ne (final_adjust, 0)) ++ emit_insn (gen_stack_tie (stack_pointer_rtx, hard_frame_pointer_rtx)); + } + + /* Return TRUE if we can use a simple_return insn. +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c +new file mode 100644 +index 00000000000..e71d820e365 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-8.c +@@ -0,0 +1,95 @@ ++/* { dg-options " -O -fstack-protector-strong -mstack-protector-guard=sysreg -mstack-protector-guard-reg=tpidr2_el0 -mstack-protector-guard-offset=16" } */ ++/* { dg-final { check-function-bodies "**" "" } } */ ++ ++void g(void *); ++__SVBool_t *h(void *); ++ ++/* ++** test1: ++** sub sp, sp, #288 ++** stp x29, x30, \[sp, #?272\] ++** add x29, sp, #?272 ++** mrs (x[0-9]+), tpidr2_el0 ++** ldr (x[0-9]+), \[\1, #?16\] ++** str \2, \[sp, #?264\] ++** mov \2, #?0 ++** add x0, sp, #?8 ++** bl g ++** ... ++** mrs .* ++** ... ++** bne .* ++** ... ++** ldp x29, x30, \[sp, #?272\] ++** add sp, sp, #?288 ++** ret ++** bl __stack_chk_fail ++*/ ++int test1() { ++ int y[0x40]; ++ g(y); ++ return 1; ++} ++ ++/* ++** test2: ++** stp x29, x30, \[sp, #?-16\]! ++** mov x29, sp ++** sub sp, sp, #1040 ++** mrs (x[0-9]+), tpidr2_el0 ++** ldr (x[0-9]+), \[\1, #?16\] ++** str \2, \[sp, #?1032\] ++** mov \2, #?0 ++** add x0, sp, #?8 ++** bl g ++** ... ++** mrs .* ++** ... ++** bne .* ++** ... ++** add sp, sp, #?1040 ++** ldp x29, x30, \[sp\], #?16 ++** ret ++** bl __stack_chk_fail ++*/ ++int test2() { ++ int y[0x100]; ++ g(y); ++ return 1; ++} ++ ++#pragma GCC target "+sve" ++ ++/* ++** test3: ++** stp x29, x30, \[sp, #?-16\]! ++** mov x29, sp ++** addvl sp, sp, #-18 ++** ... ++** str p4, \[sp\] ++** ... ++** sub sp, sp, #272 ++** mrs (x[0-9]+), tpidr2_el0 ++** ldr (x[0-9]+), \[\1, #?16\] ++** str \2, \[sp, #?264\] ++** mov \2, #?0 ++** add x0, sp, #?8 ++** bl h ++** ... ++** mrs .* ++** ... ++** bne .* ++** ... ++** add sp, sp, #?272 ++** ... ++** ldr p4, \[sp\] ++** ... ++** addvl sp, sp, #18 ++** ldp x29, x30, \[sp\], #?16 ++** ret ++** bl __stack_chk_fail ++*/ ++__SVBool_t test3() { ++ int y[0x40]; ++ return *h(y); ++} +diff --git a/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c +new file mode 100644 +index 00000000000..58f322aa480 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/aarch64/stack-protector-9.c +@@ -0,0 +1,33 @@ ++/* { dg-options "-O2 -mcpu=neoverse-v1 -fstack-protector-all" } */ ++/* { dg-final { check-function-bodies "**" "" } } */ ++ ++/* ++** main: ++** ... ++** stp x29, x30, \[sp, #?-[0-9]+\]! ++** ... ++** sub sp, sp, #[0-9]+ ++** ... ++** str x[0-9]+, \[x29, #?-8\] ++** ... ++*/ ++int f(const char *); ++void g(void *); ++int main(int argc, char* argv[]) ++{ ++ int a; ++ int b; ++ char c[2+f(argv[1])]; ++ int d[0x100]; ++ char y; ++ ++ y=42; a=4; b=10; ++ c[0] = 'h'; c[1] = '\0'; ++ ++ c[f(argv[2])] = '\0'; ++ ++ __builtin_printf("%d %d\n%s\n", a, b, c); ++ g(d); ++ ++ return 0; ++} +-- +2.34.1 + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/hardcoded-paths.patch b/meta-openeuler/recipes-devtools/gcc/gcc/hardcoded-paths.patch new file mode 100644 index 00000000000..f3485858f48 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/hardcoded-paths.patch @@ -0,0 +1,19 @@ +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 + +Index: gcc-12.1.0/libgcc/config/rs6000/t-float128 +=================================================================== +--- gcc-12.1.0.orig/libgcc/config/rs6000/t-float128 ++++ gcc-12.1.0/libgcc/config/rs6000/t-float128 +@@ -103,7 +103,7 @@ $(ibm128_dec_objs) : INTERNAL_CFLAGS += + $(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) > $@ + diff --git a/meta-openeuler/recipes-devtools/gcc/gcc/prefix-map-realpath.patch b/meta-openeuler/recipes-devtools/gcc/gcc/prefix-map-realpath.patch new file mode 100644 index 00000000000..7f1a2deec7e --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc/prefix-map-realpath.patch @@ -0,0 +1,63 @@ +Relative paths don't work with -fdebug-prefix-map and friends. This +can lead to paths which the user wanted to be remapped being missed. +Setting -fdebug-prefix-map to work with a relative path isn't practical +either. + +Instead, call gcc's realpath function on the incomming path name before +comparing it with the remapping. This means other issues like symlinks +are also accounted for and leads to a more consistent remapping experience. + +Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599885.html] +[Also https://gcc.gnu.org/pipermail/gcc-patches/2022-August/599884.html] +Signed-off-by: Richard Purdie + + +Index: gcc-12.1.0/gcc/file-prefix-map.cc +=================================================================== +--- gcc-12.1.0.orig/gcc/file-prefix-map.cc ++++ gcc-12.1.0/gcc/file-prefix-map.cc +@@ -70,19 +70,28 @@ remap_filename (file_prefix_map *maps, c + file_prefix_map *map; + char *s; + const char *name; ++ char *realname; + size_t name_len; + ++ if (lbasename (filename) == filename) ++ return filename; ++ ++ realname = lrealpath (filename); ++ + for (map = maps; map; map = map->next) +- if (filename_ncmp (filename, map->old_prefix, map->old_len) == 0) ++ if (filename_ncmp (realname, map->old_prefix, map->old_len) == 0) + break; +- if (!map) ++ if (!map) { ++ free (realname); + return filename; +- name = filename + map->old_len; ++ } ++ name = realname + map->old_len; + name_len = strlen (name) + 1; + + s = (char *) ggc_alloc_atomic (name_len + map->new_len); + memcpy (s, map->new_prefix, map->new_len); + memcpy (s + map->new_len, name, name_len); ++ free (realname); + return s; + } + +Index: gcc-12.1.0/libcpp/macro.cc +=================================================================== +--- gcc-12.1.0.orig/libcpp/macro.cc ++++ gcc-12.1.0/libcpp/macro.cc +@@ -563,7 +563,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi + if (!name) + abort (); + } +- if (pfile->cb.remap_filename) ++ if (pfile->cb.remap_filename && !pfile->state.in_directive) + name = pfile->cb.remap_filename (name); + len = strlen (name); + buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); diff --git a/meta-openeuler/recipes-devtools/gcc/gcc_%.bbappend b/meta-openeuler/recipes-devtools/gcc/gcc_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/gcc_12.3.bb b/meta-openeuler/recipes-devtools/gcc/gcc_12.3.bb new file mode 100644 index 00000000000..255fe552bdc --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/gcc_12.3.bb @@ -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" diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc-common.inc b/meta-openeuler/recipes-devtools/gcc/libgcc-common.inc new file mode 100644 index 00000000000..d9084af51ad --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc-common.inc @@ -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) +} diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc-initial.inc b/meta-openeuler/recipes-devtools/gcc/libgcc-initial.inc new file mode 100644 index 00000000000..8251e3c2869 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc-initial.inc @@ -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 +} diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc-initial_%.bbappend b/meta-openeuler/recipes-devtools/gcc/libgcc-initial_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc-initial_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc-initial_12.3.bb b/meta-openeuler/recipes-devtools/gcc/libgcc-initial_12.3.bb new file mode 100644 index 00000000000..a259082b47c --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc-initial_12.3.bb @@ -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" diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc.inc b/meta-openeuler/recipes-devtools/gcc/libgcc.inc new file mode 100644 index 00000000000..84a2d930df2 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc.inc @@ -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" + diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc_%.bbappend b/meta-openeuler/recipes-devtools/gcc/libgcc_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/libgcc_12.3.bb b/meta-openeuler/recipes-devtools/gcc/libgcc_12.3.bb new file mode 100644 index 00000000000..f88963b0a42 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgcc_12.3.bb @@ -0,0 +1,5 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require libgcc.inc + +# Building with thumb enabled on armv6t fails +ARM_INSTRUCTION_SET:armv6 = "arm" diff --git a/meta-openeuler/recipes-devtools/gcc/libgfortran.inc b/meta-openeuler/recipes-devtools/gcc/libgfortran.inc new file mode 100644 index 00000000000..e810146d4d1 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgfortran.inc @@ -0,0 +1,88 @@ +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}" + +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} +} + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "gcc-runtime gcc-cross-${TARGET_ARCH}" + +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") +} diff --git a/meta-openeuler/recipes-devtools/gcc/libgfortran_%.bbappend b/meta-openeuler/recipes-devtools/gcc/libgfortran_%.bbappend new file mode 100644 index 00000000000..a929be0b406 --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgfortran_%.bbappend @@ -0,0 +1 @@ +require gcc-src.inc diff --git a/meta-openeuler/recipes-devtools/gcc/libgfortran_12.3.bb b/meta-openeuler/recipes-devtools/gcc/libgfortran_12.3.bb new file mode 100644 index 00000000000..71dd8b4bdcd --- /dev/null +++ b/meta-openeuler/recipes-devtools/gcc/libgfortran_12.3.bb @@ -0,0 +1,3 @@ +require recipes-devtools/gcc/gcc-${PV}.inc +require libgfortran.inc + -- Gitee From acc74722916907f6db80b96b7b7beab5e293382b Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Tue, 24 Oct 2023 15:03:48 +0800 Subject: [PATCH 3/5] yocto: checkout glibc to openEuler source * checkout glibc to openEuler source(version: 2.38) Signed-off-by: lixiaoyong --- .../recipes-core/glibc/glibc-ld.inc | 20 + .../recipes-core/glibc/glibc-mtrace.inc | 16 + .../recipes-core/glibc/glibc-mtrace_2.38.bb | 1 + .../recipes-core/glibc/glibc-package.inc | 292 +++++ .../recipes-core/glibc/glibc-scripts.inc | 23 + .../recipes-core/glibc/glibc-scripts_2.38.bb | 1 + .../recipes-core/glibc/glibc-src.inc | 9 + .../recipes-core/glibc/glibc-tests.inc | 32 + .../glibc/glibc-testsuite_2.38.bb | 36 + .../recipes-core/glibc/glibc-version.inc | 9 +- .../glibc/glibc-y2038-tests_2.38.bb | 119 ++ meta-openeuler/recipes-core/glibc/glibc.inc | 58 + ...dd-hardlink-resolver-from-util-linux.patch | 1130 +++++++++++++++++ ...-fix-ups-hardlink-to-make-it-compile.patch | 238 ++++ ...Look-for-host-system-ld.so.cache-as-.patch | 65 + ...Fix-buffer-overrun-with-a-relocated-.patch | 46 + ...Raise-the-size-of-arrays-containing-.patch | 152 +++ ...k-glibc-Allow-64-bit-atomics-for-x86.patch | 43 + ...Make-relocatable-install-for-locales.patch | 100 ++ ...Fall-back-to-faccessat-on-faccess2-r.patch | 32 + ...the-path-sets-wrong-config-variables.patch | 260 ++++ ...ss-building-and-testing-instructions.patch | 616 +++++++++ ...glibc-Help-bootstrap-cross-toolchain.patch | 97 ++ ...eglibc-Resolve-__fpscr_values-on-SH4.patch | 53 + ...port-cross-locale-generation-support.patch | 560 ++++++++ ...-archive-uses-a-hard-coded-locale-pa.patch | 80 ++ ...Do-not-ask-compiler-for-finding-arch.patch | 48 + ...y-the-header-between-arm-and-aarch64.patch | 49 + ...h-printf-builtin-in-nscd-init-script.patch | 79 ++ ...igure.ac-Set-libc_cv_rootsbindir-onl.patch | 41 + ...ell-interpreter-overridable-in-tzsel.patch | 47 + ...Use-bin-sh-default-shell-interpreter.patch | 27 + ...d-failed-in-unprivileged-process-BZ-.patch | 86 ++ ...build-time-paths-in-the-output-binar.patch | 32 + ...e-Pass-mcpu-along-with-march-to-dete.patch | 56 + .../glibc/glibc/check-test-wrapper | 80 ++ .../recipes-core/glibc/glibc/etc/ld.so.conf | 1 + .../glibc/glibc/generate-supported.mk | 11 + .../recipes-core/glibc/glibc/makedbs.sh | 177 +++ .../recipes-core/glibc/glibc/run-ptest | 37 + .../recipes-core/glibc/glibc_%.bbappend | 1 + .../recipes-core/glibc/glibc_2.38.bb | 130 ++ 42 files changed, 4988 insertions(+), 2 deletions(-) create mode 100644 meta-openeuler/recipes-core/glibc/glibc-ld.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-mtrace.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-mtrace_2.38.bb create mode 100644 meta-openeuler/recipes-core/glibc/glibc-package.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-scripts.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-scripts_2.38.bb create mode 100644 meta-openeuler/recipes-core/glibc/glibc-src.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-tests.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc-testsuite_2.38.bb create mode 100644 meta-openeuler/recipes-core/glibc/glibc-y2038-tests_2.38.bb create mode 100644 meta-openeuler/recipes-core/glibc/glibc.inc create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch create mode 100644 meta-openeuler/recipes-core/glibc/glibc/check-test-wrapper create mode 100644 meta-openeuler/recipes-core/glibc/glibc/etc/ld.so.conf create mode 100644 meta-openeuler/recipes-core/glibc/glibc/generate-supported.mk create mode 100755 meta-openeuler/recipes-core/glibc/glibc/makedbs.sh create mode 100755 meta-openeuler/recipes-core/glibc/glibc/run-ptest create mode 100644 meta-openeuler/recipes-core/glibc/glibc_%.bbappend create mode 100644 meta-openeuler/recipes-core/glibc/glibc_2.38.bb diff --git a/meta-openeuler/recipes-core/glibc/glibc-ld.inc b/meta-openeuler/recipes-core/glibc/glibc-ld.inc new file mode 100644 index 00000000000..da8fcc430b1 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-ld.inc @@ -0,0 +1,20 @@ +inherit linuxloader + +GLIBC_GETLOADER = "${@get_linuxloader(d)}" + +def glibc_dl_info(d): + infos = {'ldconfig':set(), 'lddrewrite':set()} + + loaders = all_multilib_tune_values(d, "GLIBC_GETLOADER").split() + for loader in loaders: + infos['ldconfig'].add('{"' + loader + '",' + "FLAG_ELF_LIBC6" + ' }') + infos['lddrewrite'].add(loader) + + infos['ldconfig'] = ','.join(sorted(infos['ldconfig'])) + infos['lddrewrite'] = ' '.join(sorted(infos['lddrewrite'])) + return infos + +EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}" +RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}" +RTLDLIST:class-nativesdk = "${base_libdir}/${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}" +glibc_dl_info[vardepsexclude] = "OVERRIDES" diff --git a/meta-openeuler/recipes-core/glibc/glibc-mtrace.inc b/meta-openeuler/recipes-core/glibc/glibc-mtrace.inc new file mode 100644 index 00000000000..734a566562f --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-mtrace.inc @@ -0,0 +1,16 @@ +require glibc-collateral.inc + +SUMMARY = "mtrace utility provided by glibc" +DESCRIPTION = "mtrace utility provided by glibc" +RDEPENDS:${PN} = "perl" +RPROVIDES:${PN} = "libc-mtrace" + +SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts" + +do_install() { + install -d -m 0755 ${D}${bindir} + install -m 0755 ${SRC}/mtrace ${D}${bindir}/ +} + +# Don't scan for CVEs as glibc will be scanned +CVE_PRODUCT = "" diff --git a/meta-openeuler/recipes-core/glibc/glibc-mtrace_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc-mtrace_2.38.bb new file mode 100644 index 00000000000..0b69bad46a3 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-mtrace_2.38.bb @@ -0,0 +1 @@ +require glibc-mtrace.inc diff --git a/meta-openeuler/recipes-core/glibc/glibc-package.inc b/meta-openeuler/recipes-core/glibc/glibc-package.inc new file mode 100644 index 00000000000..1d4e4c52740 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-package.inc @@ -0,0 +1,292 @@ +INHIBIT_SYSROOT_STRIP = "1" + +PACKAGES = "${PN}-dbg sln nscd ldconfig ldd ldso tzcode glibc-thread-db ${PN}-pic libmemusage malloc-debug libnss-db ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}-src" + +# The ld.so in this glibc supports the GNU_HASH +RPROVIDES:${PN} = "eglibc rtld(GNU_HASH)" +RPROVIDES:${PN}-utils = "eglibc-utils" +RPROVIDES:${PN}-mtrace = "eglibc-mtrace libc-mtrace" +RPROVIDES:${PN}-pic = "eglibc-pic" +RPROVIDES:${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev" +RPROVIDES:${PN}-staticdev = "eglibc-staticdev" +RPROVIDES:${PN}-doc = "eglibc-doc" +RPROVIDES:glibc-extra-nss = "eglibc-extra-nss" +RPROVIDES:glibc-thread-db = "eglibc-thread-db" +RPROVIDES:${PN}-pcprofile = "eglibc-pcprofile" +RPROVIDES:${PN}-dbg = "eglibc-dbg" +libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" +ARCH_DYNAMIC_LOADER = "" +# The aarch64 ABI says the dynamic linker -must- be +# /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that +# we need to install it in /usr/lib. +ARCH_DYNAMIC_LOADER:aarch64 = "ld-linux-${TARGET_ARCH}.so.1" +libc_baselibs:append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}" +INSANE_SKIP:${PN}:append:aarch64 = " libdir" +INSANE_SKIP:${PN}-dev += "staticdev" +INSANE_SKIP:${MLPREFIX}ldso:append = " dev-so libdir" + +FILES:${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf" +RRECOMMENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}" +FILES:ldconfig = "${base_sbindir}/ldconfig" +FILES:ldd = "${bindir}/ldd" +FILES:ldso = "${bindir}/${MLPREFIX}ld.so" +FILES:libmemusage = "${base_libdir}/libmemusage.so" +FILES:malloc-debug = "${base_libdir}/libc_malloc_debug.so.0" +FILES:libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh" +RDEPENDS:libnss-db = "${PN}-utils" +FILES:glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" +FILES:sln = "${base_sbindir}/sln" +FILES:${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" +FILES:libsotruss = "${libdir}/audit/sotruss-lib.so" +FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" +FILES:${PN}-dev += "${libdir}/libpthread.a ${libdir}/libdl.a ${libdir}/libutil.a ${libdir}/libanl.a ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal" +RDEPENDS:${PN}-dev = "linux-libc-headers-dev" +FILES:${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" +FILES:nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_system_unitdir}/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \ + ${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd" +FILES:${PN}-mtrace = "${bindir}/mtrace" +FILES:tzcode = "${bindir}/tzselect ${sbindir}/zic ${bindir}/zdump" +FILES:${PN}-utils = "${bindir}/* ${sbindir}/*" +FILES:${PN}-pcprofile = "${base_libdir}/libpcprofile.so" +FILES:glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so" +RPROVIDES:${PN}-dev += "libc-dev" +RPROVIDES:${PN}-staticdev += "libc-staticdev" + +SUMMARY:sln = "The static ln" +DESCRIPTION:sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional." +SUMMARY:nscd = "Name service cache daemon" +DESCRIPTION:nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services." +SUMMARY:glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries" +DESCRIPTION:glibc-extra-nss = "glibc: nis, nisplus and hesiod search services." +SUMMARY:ldd = "print shared library dependencies" +DESCRIPTION:ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line." +SUMMARY:${PN}-utils = "Miscellaneous utilities provided by glibc" +DESCRIPTION:${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, ..." +DESCRIPTION:libsotruss = "Library to support sotruss which traces calls through PLTs" +DESCRIPTION:tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect" + +inherit multilib_header + +do_install() { + oe_runmake install_root=${D} install + install -Dm 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ld.so.conf + install -d ${D}${localedir} + make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED" + # get rid of some broken files... + for i in ${GLIBC_BROKEN_LOCALES}; do + sed -i "/$i/d" ${WORKDIR}/SUPPORTED + done + rm -f ${D}${sysconfdir}/rpc + rm -rf ${D}${datadir}/zoneinfo + rm -rf ${D}${libexecdir}/getconf + + rm -f ${D}${sysconfdir}/localtime + + # remove empty glibc dir + if [ -d ${D}${libexecdir} ]; then + rmdir --ignore-fail-on-non-empty ${D}${libexecdir} + fi + + oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h bits/math-vector.h + + if [ -f ${D}${bindir}/mtrace ]; then + sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace + fi + # 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 + + install -d ${D}${sysconfdir}/init.d + install -d ${D}${localstatedir}/db/nscd + install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd + install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf + install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db + sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd + sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf + + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_system_unitdir}/ + + # The dynamic loader will have been installed into + # ${base_libdir}. However, if that isn't going to end up being + # available in the ABI-mandated location, then a symlink must + # be created. + + if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + install -d ${D}${root_prefix}/lib + ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \ + ${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER} + fi + ln -rs ${D}${base_libdir}/libpthread.so.0 ${D}${libdir}/libpthread.so + ln -rs ${D}${base_libdir}/librt.so.1 ${D}${libdir}/librt.so + if [ -n "${MLPREFIX}" ]; then + mv ${D}${bindir}/ld.so ${D}${bindir}/${MLPREFIX}ld.so + fi +} + +def get_libc_fpu_setting(bb, d): + if d.getVar('TARGET_FPU') in [ 'soft', 'ppc-efd' ]: + return "--without-fp" + return "" + +do_install:append:class-target() { + if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/tmpfiles.d + echo "d /run/nscd 755 root root -" \ + > ${D}${sysconfdir}/tmpfiles.d/nscd.conf + fi + + if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/default/volatiles + echo "d root root 0755 /var/run/nscd none" \ + > ${D}${sysconfdir}/default/volatiles/98_nscd + fi + +} +do_install:append:aarch64 () { + do_install_armmultilib +} + +do_install:append:arm () { + do_install_armmultilib +} + +do_install:append:armeb () { + do_install_armmultilib +} + +do_install_armmultilib () { + oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h + oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/pthreadtypes-arch.h bits/sem.h bits/semaphore.h bits/setjmp.h + oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h + oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h + oe_multilib_header bits/struct_stat.h bits/pthread_stack_min.h + oe_multilib_header bits/dl_find_object.h bits/rseq.h bits/timesize.h + + oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h + + oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h +} + + +LOCALESTASH = "${WORKDIR}/stashed-locale" +bashscripts = "mtrace sotruss xtrace" + +do_stash_locale () { + dest=${LOCALESTASH} + install -d $dest${base_libdir} $dest${bindir} $dest${libdir} $dest${datadir} + # Hide away the locale data from the deployment + if [ -e ${D}${bindir}/localedef ]; then + cp -a ${D}${bindir}/localedef $dest${bindir} + fi + if [ -e ${D}${libdir}/gconv ]; then + cp -a ${D}${libdir}/gconv $dest${libdir} + fi + if [ -e ${D}${datadir}/i18n ]; then + cp -a ${D}${datadir}/i18n $dest${datadir} + fi + + # Make a copy of all the libraries into the locale stash + cp -fpPR ${D}${libdir}/* $dest${libdir} + if [ "${base_libdir}" != "${libdir}" ]; then + cp -fpPR ${D}${base_libdir}/* $dest${base_libdir} + fi + if [ -e ${D}${exec_prefix}/lib ]; then + if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then + cp -fpPR ${D}${exec_prefix}/lib $dest${exec_prefix} + fi + fi + + cp -fpPR ${D}${datadir}/* $dest${datadir} + cp -fpPR ${WORKDIR}/SUPPORTED $dest + + target=$dest/scripts + mkdir -p $target + for i in ${bashscripts}; do + if [ -f ${D}${bindir}/$i ]; then + cp ${D}${bindir}/$i $target/ + fi + done +} + +addtask do_stash_locale after do_install before do_populate_sysroot do_package +do_stash_locale[dirs] = "${B}" +do_stash_locale[cleandirs] = "${LOCALESTASH}" +SSTATETASKS += "do_stash_locale" +do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}" +do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" +do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale" + +python do_stash_locale_setscene () { + sstate_setscene(d) +} +addtask do_stash_locale_setscene + +PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup" +SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup" +stash_locale_cleanup () { + cleanupdir=$1 + # Remove all files which do_stash_locale() copies + for i in ${bashscripts}; do + rm -f $cleanupdir${bindir}/$i + done + rm -f $cleanupdir${bindir}/localedef + rm -rf $cleanupdir${datadir}/i18n + rm -rf $cleanupdir${libdir}/gconv + rm -rf $cleanupdir${localedir} + rm -rf $cleanupdir${datadir}/locale + rmdir --ignore-fail-on-non-empty $cleanupdir${datadir} + + if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then + if [ -d "$cleanupdir${exec_prefix}/lib" ]; then + if [ -z "${ARCH_DYNAMIC_LOADER}" -o \ + ! -e "$cleanupdir${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then + # error out if directory isn't empty + # this dir should only contain locale dir + # which has been deleted in the previous step + rmdir $cleanupdir${exec_prefix}/lib + fi + fi + fi +} + +stash_locale_sysroot_cleanup() { + stash_locale_cleanup ${SYSROOT_DESTDIR} +} +stash_locale_package_cleanup() { + stash_locale_cleanup ${PKGD} +} + +python populate_packages:prepend () { + if d.getVar('DEBIAN_NAMES'): + pkgs = d.getVar('PACKAGES').split() + bpn = d.getVar('BPN') + prefix = d.getVar('MLPREFIX') or "" + # Set the base package... + d.setVar('PKG:' + prefix + bpn, prefix + 'libc6') + libcprefix = prefix + bpn + '-' + for p in pkgs: + # And all the subpackages. + if p.startswith(libcprefix): + renamed = p.replace(bpn, 'libc6', 1) + d.setVar('PKG:' + p, renamed) + # For backward compatibility with old -dbg package + d.appendVar('RPROVIDES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RCONFLICTS:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') + d.appendVar('RREPLACES:' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg') +} + +pkg_postinst:nscd () { + if [ -z "$D" ]; then + if command -v systemd-tmpfiles >/dev/null; then + systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf + elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then + ${sysconfdir}/init.d/populate-volatile.sh update + fi + fi +} +CONFFILES:nscd="${sysconfdir}/nscd.conf" + +SYSTEMD_PACKAGES = "nscd" +SYSTEMD_SERVICE:nscd = "nscd.service" diff --git a/meta-openeuler/recipes-core/glibc/glibc-scripts.inc b/meta-openeuler/recipes-core/glibc/glibc-scripts.inc new file mode 100644 index 00000000000..47216ae7d73 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-scripts.inc @@ -0,0 +1,23 @@ +require glibc-collateral.inc + +SUMMARY = "utility scripts provided by glibc" +DESCRIPTION = "utility scripts provided by glibc" +RDEPENDS:${PN} = "bash glibc-mtrace" + +SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts" + +bashscripts = "sotruss xtrace" + +do_install() { + install -d -m 0755 ${D}${bindir} + for i in ${bashscripts}; do + install -m 0755 ${SRC}/$i ${D}${bindir}/ + done +} + +# sotruss script requires sotruss-lib.so (given by libsotruss package), +# to produce trace of the library calls. +RDEPENDS:${PN} += "libsotruss" + +# Don't scan for CVEs as glibc will be scanned +CVE_PRODUCT = "" diff --git a/meta-openeuler/recipes-core/glibc/glibc-scripts_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc-scripts_2.38.bb new file mode 100644 index 00000000000..5a89bd8022a --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-scripts_2.38.bb @@ -0,0 +1 @@ +require glibc-scripts.inc diff --git a/meta-openeuler/recipes-core/glibc/glibc-src.inc b/meta-openeuler/recipes-core/glibc/glibc-src.inc new file mode 100644 index 00000000000..73e82609d61 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-src.inc @@ -0,0 +1,9 @@ +OPENEULER_REPO_NAME = "glibc" +OPENEULER_SRC_URI_REMOVE = "git https http" + +PV = "2.38" + +SRC_URI:prepend = "file://glibc-${PV}.tar.xz \ +" + +S = "${WORKDIR}/${BP}" diff --git a/meta-openeuler/recipes-core/glibc/glibc-tests.inc b/meta-openeuler/recipes-core/glibc/glibc-tests.inc new file mode 100644 index 00000000000..a8fe160a541 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-tests.inc @@ -0,0 +1,32 @@ +EXCLUDE_FROM_WORLD = "1" + +# handle PN differences +FILESEXTRAPATHS:prepend := "${THISDIR}/glibc:" + +# setup depends +INHIBIT_DEFAULT_DEPS = "" + +python () { + libc = d.getVar("PREFERRED_PROVIDER_virtual/libc") + libclocale = d.getVar("PREFERRED_PROVIDER_virtual/libc-locale") + if libc != "glibc" or libclocale != "glibc-locale": + raise bb.parse.SkipRecipe("glibc-testsuite requires that virtual/libc is glibc") +} + +DEPENDS += "glibc-locale libgcc gcc-runtime" + +# remove the initial depends +DEPENDS:remove = "libgcc-initial" + +do_check[dirs] += "${B}" +do_check () { + # clean out previous test results + oe_runmake tests-clean + # makefiles don't clean entirely (and also sometimes fails due to too many args) + find ${B} -type f -name "*.out" -delete + find ${B} -type f -name "*.test-result" -delete + find ${B}/catgets -name "*.cat" -delete + find ${B}/conform -name "symlist-*" -delete + [ ! -e ${B}/timezone/testdata ] || rm -rf ${B}/timezone/testdata +} +addtask do_check after do_compile diff --git a/meta-openeuler/recipes-core/glibc/glibc-testsuite_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc-testsuite_2.38.bb new file mode 100644 index 00000000000..2e076f4b0f4 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-testsuite_2.38.bb @@ -0,0 +1,36 @@ +require glibc_${PV}.bb +require glibc-tests.inc + +inherit qemu + +SRC_URI += "file://check-test-wrapper" + +# strip provides +PROVIDES = "" + +DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}" + +TOOLCHAIN_TEST_TARGET ??= "user" +TOOLCHAIN_TEST_HOST ??= "localhost" +TOOLCHAIN_TEST_HOST_USER ??= "root" +TOOLCHAIN_TEST_HOST_PORT ??= "2222" + +do_check[nostamp] = "1" +do_check[network] = "1" +do_check:append () { + chmod 0755 ${WORKDIR}/check-test-wrapper + + oe_runmake -i \ + QEMU_SYSROOT="${RECIPE_SYSROOT}" \ + QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \ + SSH_HOST="${TOOLCHAIN_TEST_HOST}" \ + SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \ + SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \ + test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \ + check +} + +inherit nopackages +deltask do_stash_locale +deltask do_install +deltask do_populate_sysroot diff --git a/meta-openeuler/recipes-core/glibc/glibc-version.inc b/meta-openeuler/recipes-core/glibc/glibc-version.inc index f53e59103e2..19b98bc11ad 100644 --- a/meta-openeuler/recipes-core/glibc/glibc-version.inc +++ b/meta-openeuler/recipes-core/glibc/glibc-version.inc @@ -1,8 +1,13 @@ SRCBRANCH ?= "release/2.38/master" -PV = "2.38" -SRCREV_glibc ?= "36f2487f13e3540be9ee0fb51876b1da72176d3f" +PV = "2.38+git" +SRCREV_glibc ?= "750a45a783906a19591fb8ff6b7841470f1f5701" SRCREV_localedef ?= "e0eca29583b9e0f62645c4316ced93cf4e4e26e1" GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git;protocol=https" UPSTREAM_CHECK_GITTAGREGEX = "(?P\d+\.\d+(\.(?!90)\d+)*)" + +CVE_STATUS[CVE-2023-4527] = "fixed-version: Fixed in stable branch updates" +CVE_STATUS[CVE-2023-4911] = "fixed-version: Fixed in stable branch updates" +CVE_STATUS[CVE-2023-4806] = "fixed-version: Fixed in stable branch updates" +CVE_STATUS[CVE-2023-4527] = "fixed-version: Fixed in stable branch updates" diff --git a/meta-openeuler/recipes-core/glibc/glibc-y2038-tests_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc-y2038-tests_2.38.bb new file mode 100644 index 00000000000..be49ca4cb73 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc-y2038-tests_2.38.bb @@ -0,0 +1,119 @@ +require glibc_${PV}.bb +require glibc-tests.inc + +inherit ptest features_check +REQUIRED_DISTRO_FEATURES = "ptest" + +SRC_URI += "\ + file://run-ptest \ +" + +SUMMARY = "glibc tests using time32/time64 interfaces to be run with ptest for the purpose of checking y2038 compatiblity" + +# Erase some variables already set by glibc_${PV} +python __anonymous() { + # Remove packages provided by glibc build, we only need a subset of them + d.setVar("PACKAGES", "${PN} ${PN}-ptest") + + d.setVar("PROVIDES", "${PN} ${PN}-ptest") + + bbclassextend = d.getVar("BBCLASSEXTEND").replace("nativesdk", "").strip() + d.setVar("BBCLASSEXTEND", bbclassextend) + d.setVar("RRECOMMENDS", "") + d.setVar("SYSTEMD_SERVICE:nscd", "") + d.setVar("SYSTEMD_PACKAGES", "") +} + +# Remove any leftovers from original glibc recipe +RPROVIDES:${PN} = "${PN}" +RRECOMMENDS:${PN} = "" +RDEPENDS:${PN} = "glibc libgcc sed bash" +RDEPENDS:${PN}-ptest = "${PN}" +DEPENDS += "sed" + +export oe_srcdir="${exec_prefix}/src/debug/glibc/${PV}/" + +# Just build tests for target - do not run them +do_check:append () { + oe_runmake -i check run-built-tests=no +} +addtask do_check after do_compile before do_install_ptest_base + +glibc_strip_build_directory () { + # Delete all non executable files from build directory + find ${B} ! -executable -type f -delete + + # Remove build dynamic libraries and links to them as + # those are already installed in the target device + find ${B} -type f -name "*.so" -delete + find ${B} -type l -name "*.so*" -delete + + # Remove headers (installed with glibc) + find ${B} -type f -name "*.h" -delete + + find ${B} -type f -name "isomac" -delete + find ${B} -type f -name "annexc" -delete +} + +do_install_ptest_base () { + glibc_strip_build_directory + + ls -r ${B}/*/*-time64 > ${B}/tst_time64 + + # Remove '-time64' suffix - those tests are also time related + sed -e "s/-time64$//" ${B}/tst_time64 > ${B}/tst_time_tmp + tst_time=$(cat ${B}/tst_time_tmp ${B}/tst_time64) + + rm ${B}/tst_time_tmp ${B}/tst_time64 + echo "${tst_time}" + + # Install build test programs to the image + install -d ${D}${PTEST_PATH}/tests/glibc-ptest/ + + for f in "${tst_time}" + do + cp -r ${f} ${D}${PTEST_PATH}/tests/glibc-ptest/ + done + + install -d ${D}${PTEST_PATH} + cp ${WORKDIR}/run-ptest ${D}${PTEST_PATH}/ + +} + +# The datadir directory is required to allow core (and reused) +# glibc cleanup function to finish correctly, as this directory +# is not created for ptests +stash_locale_package_cleanup:prepend () { + mkdir -p ${PKGD}${datadir} +} + +stash_locale_sysroot_cleanup:prepend () { + mkdir -p ${SYSROOT_DESTDIR}${datadir} +} + +# Prevent the do_package() task to set 'libc6' prefix +# for glibc tests related packages +python populate_packages:prepend () { + if d.getVar('DEBIAN_NAMES'): + d.setVar('DEBIAN_NAMES', '') +} + +FILES:${PN} = "${PTEST_PATH}/* /usr/src/debug/${PN}/*" + +EXCLUDE_FROM_SHLIBS = "1" + +# Install debug data in .debug and sources in /usr/src/debug +# It is more handy to have _all_ the sources and symbols in one +# place (package) as this recipe will be used for validation and +# debugging. +PACKAGE_DEBUG_SPLIT_STYLE = ".debug" + +# glibc test cases violate by default some Yocto/OE checks (staticdev, +# textrel) +# 'debug-files' - add everything (including debug) into one package +# (no need to install/build *-src package) +INSANE_SKIP:${PN} += "staticdev textrel debug-files rpaths" + +deltask do_stash_locale +do_install[noexec] = "1" +do_populate_sysroot[noexec] = "1" diff --git a/meta-openeuler/recipes-core/glibc/glibc.inc b/meta-openeuler/recipes-core/glibc/glibc.inc new file mode 100644 index 00000000000..11e8098714d --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc.inc @@ -0,0 +1,58 @@ +require glibc-common.inc +require glibc-ld.inc + +DEPENDS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils${BUSUFFIX} libgcc-initial linux-libc-headers" +BUSUFFIX= "" +BUSUFFIX:class-nativesdk = "-crosssdk" + +PROVIDES = "virtual/libc" +PROVIDES += "virtual/libintl virtual/libiconv" +inherit autotools texinfo systemd + +LEAD_SONAME = "libc.so" + +# msgfmt could come from gettext-native but we don't depend on that and +# disable for reproducibility +CACHED_CONFIGUREVARS += " \ + ac_cv_path_BASH_SHELL=${base_bindir}/bash \ + ac_cv_prog_MSGFMT= \ + libc_cv_slibdir=${base_libdir} \ + libc_cv_rootsbindir=${base_sbindir} \ + libc_cv_localedir=${localedir} \ + libc_cv_ssp_strong=no \ + libc_cv_ssp_all=no \ + libc_cv_ssp=no \ + libc_cv_include_x86_isa_level=no \ +" + +# ifunc doesn't appear to work on mips, casuses libbfd assertion failures +CACHED_CONFIGUREVARS:append:mipsarch = " libc_cv_ld_gnu_indirect_function=no" + +GLIBC_EXTRA_OECONF ?= "" +GLIBC_EXTRA_OECONF:class-nativesdk = "" + +# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer +# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE +EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}"" +EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM" +EXTRA_OEMAKE += "${EGLIBCPARALLELISM}" +PARALLEL_MAKE = "" + +# glibc make-syscalls.sh has a number of issues with /bin/dash and +# it's output which make calls via the SHELL also has issues, so +# ensure make uses /bin/bash +EXTRA_OEMAKE += "SHELL=/bin/bash" + +# We do not need bash to run tzselect script, the default is to use +# bash but it can be configured by setting KSHELL Makefile variable +EXTRA_OEMAKE += "KSHELL=/bin/sh" + +do_configure:prepend() { + sed -e "s#/bin/bash#/bin/sh#" -i ${S}/elf/ldd.bash.in +} + +# Enable backtrace from abort() +do_configure:append:arm () { + echo "CFLAGS-abort.c = -fasynchronous-unwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -fasynchronous-unwind-tables" >> ${B}/configparms +} diff --git a/meta-openeuler/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch b/meta-openeuler/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch new file mode 100644 index 00000000000..eb3da94b8ba --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0001-localedef-Add-hardlink-resolver-from-util-linux.patch @@ -0,0 +1,1130 @@ +From 7c06ca59b47ce06f785b9fce7b9e9d675d5b6e10 Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Sat, 7 Dec 2019 09:59:22 -0800 +Subject: [PATCH] localedef: Add hardlink resolver from util-linux + +The hard link resolver that is built into localedef cannot be run in +parallel. It will search sibling directories (which are be processed +in parallel) and perform a creation of a .tmp file and remove the +original and move the .tmp file in. The problem is that if a probe +occurs a hard link can be requested to the file that is being removed. +This will lead to a stray copy or potentially, on a loaded system +cause race condition which pseudo cannot deal with, where it is left +with a hard link request to a file that no longer exists. In this +situation psuedo will inherit the permissions of what ever the target +inode had to offer. + +In short, there are two problems: + +1) You will be left with stray copies when using the hard link +resolution that is built in while running in parallel with +localedef. + +2) When running under pseudo the possibility exists for uid/gid +leakage when the source file is removed before the hard link can +be completed. + +The solution is to call localedef with --no-hard-links and separately +process the hardlinks at a later point. To do this requires the +inclusion of the hardlink utility found in modern versions of +util-linux. Most host systems do not have this, so it will be +included with the cross-localedef binary. + +[YOCTO #11299] +[YOCTO #12434] + +Upstream-Status: Pending + +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + locale/programs/c.h | 407 ++++++++++++++++ + locale/programs/cross-localedef-hardlink.c | 528 +++++++++++++++++++++ + locale/programs/xalloc.h | 129 +++++ + 3 files changed, 1064 insertions(+) + create mode 100644 locale/programs/c.h + create mode 100644 locale/programs/cross-localedef-hardlink.c + create mode 100644 locale/programs/xalloc.h + +diff --git a/locale/programs/c.h b/locale/programs/c.h +new file mode 100644 +index 0000000000..d0a402e90e +--- /dev/null ++++ b/locale/programs/c.h +@@ -0,0 +1,407 @@ ++/* ++ * Fundamental C definitions. ++ */ ++ ++#ifndef UTIL_LINUX_C_H ++#define UTIL_LINUX_C_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#ifdef HAVE_ERR_H ++# include ++#endif ++ ++#ifdef HAVE_SYS_SYSMACROS_H ++# include /* for major, minor */ ++#endif ++ ++#ifndef LOGIN_NAME_MAX ++# define LOGIN_NAME_MAX 256 ++#endif ++ ++#ifndef NAME_MAX ++# define NAME_MAX PATH_MAX ++#endif ++ ++/* ++ * __GNUC_PREREQ is deprecated in favour of __has_attribute() and ++ * __has_feature(). The __has macros are supported by clang and gcc>=5. ++ */ ++#ifndef __GNUC_PREREQ ++# if defined __GNUC__ && defined __GNUC_MINOR__ ++# define __GNUC_PREREQ(maj, min) \ ++ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) ++# else ++# define __GNUC_PREREQ(maj, min) 0 ++# endif ++#endif ++ ++#ifdef __GNUC__ ++ ++/* &a[0] degrades to a pointer: a different type from an array */ ++# define __must_be_array(a) \ ++ UL_BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) ++ ++# define ignore_result(x) __extension__ ({ \ ++ __typeof__(x) __dummy __attribute__((__unused__)) = (x); (void) __dummy; \ ++}) ++ ++#else /* !__GNUC__ */ ++# define __must_be_array(a) 0 ++# define __attribute__(_arg_) ++# define ignore_result(x) ((void) (x)) ++#endif /* !__GNUC__ */ ++ ++/* ++ * It evaluates to 1 if the attribute/feature is supported by the current ++ * compilation targed. Fallback for old compilers. ++ */ ++#ifndef __has_attribute ++ #define __has_attribute(x) 0 ++#endif ++ ++#ifndef __has_feature ++ #define __has_feature(x) 0 ++#endif ++ ++/* ++ * Function attributes ++ */ ++#ifndef __ul_alloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_alloc_size(s) __attribute__((alloc_size(s), warn_unused_result)) ++# else ++# define __ul_alloc_size(s) ++# endif ++#endif ++ ++#ifndef __ul_calloc_size ++# if (__has_attribute(alloc_size) && __has_attribute(warn_unused_result)) || __GNUC_PREREQ (4, 3) ++# define __ul_calloc_size(n, s) __attribute__((alloc_size(n, s), warn_unused_result)) ++# else ++# define __ul_calloc_size(n, s) ++# endif ++#endif ++ ++#if __has_attribute(returns_nonnull) || __GNUC_PREREQ (4, 9) ++# define __ul_returns_nonnull __attribute__((returns_nonnull)) ++#else ++# define __ul_returns_nonnull ++#endif ++ ++/* ++ * Force a compilation error if condition is true, but also produce a ++ * result (of value 0 and type size_t), so the expression can be used ++ * e.g. in a structure initializer (or wherever else comma expressions ++ * aren't permitted). ++ */ ++#define UL_BUILD_BUG_ON_ZERO(e) __extension__ (sizeof(struct { int:-!!(e); })) ++#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) ++ ++#ifndef ARRAY_SIZE ++# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) ++#endif ++ ++#ifndef PATH_MAX ++# define PATH_MAX 4096 ++#endif ++ ++#ifndef TRUE ++# define TRUE 1 ++#endif ++ ++#ifndef FALSE ++# define FALSE 0 ++#endif ++ ++#ifndef min ++# define min(x, y) __extension__ ({ \ ++ __typeof__(x) _min1 = (x); \ ++ __typeof__(y) _min2 = (y); \ ++ (void) (&_min1 == &_min2); \ ++ _min1 < _min2 ? _min1 : _min2; }) ++#endif ++ ++#ifndef max ++# define max(x, y) __extension__ ({ \ ++ __typeof__(x) _max1 = (x); \ ++ __typeof__(y) _max2 = (y); \ ++ (void) (&_max1 == &_max2); \ ++ _max1 > _max2 ? _max1 : _max2; }) ++#endif ++ ++#ifndef cmp_numbers ++# define cmp_numbers(x, y) __extension__ ({ \ ++ __typeof__(x) _a = (x); \ ++ __typeof__(y) _b = (y); \ ++ (void) (&_a == &_b); \ ++ _a == _b ? 0 : _a > _b ? 1 : -1; }) ++#endif ++ ++#ifndef offsetof ++#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) ++#endif ++ ++/* ++ * container_of - cast a member of a structure out to the containing structure ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ */ ++#ifndef container_of ++#define container_of(ptr, type, member) __extension__ ({ \ ++ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ ++ (type *)( (char *)__mptr - offsetof(type,member) );}) ++#endif ++ ++#ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME ++# ifdef HAVE___PROGNAME ++extern char *__progname; ++# define program_invocation_short_name __progname ++# else ++# ifdef HAVE_GETEXECNAME ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(getexecname(), 0) ++# else ++# define program_invocation_short_name \ ++ prog_inv_sh_nm_from_file(__FILE__, 1) ++# endif ++static char prog_inv_sh_nm_buf[256]; ++static inline char * ++prog_inv_sh_nm_from_file(char *f, char stripext) ++{ ++ char *t; ++ ++ if ((t = strrchr(f, '/')) != NULL) ++ t++; ++ else ++ t = f; ++ ++ strncpy(prog_inv_sh_nm_buf, t, sizeof(prog_inv_sh_nm_buf) - 1); ++ prog_inv_sh_nm_buf[sizeof(prog_inv_sh_nm_buf) - 1] = '\0'; ++ ++ if (stripext && (t = strrchr(prog_inv_sh_nm_buf, '.')) != NULL) ++ *t = '\0'; ++ ++ return prog_inv_sh_nm_buf; ++} ++# endif ++#endif ++ ++ ++#ifndef HAVE_ERR_H ++static inline void ++errmsg(char doexit, int excode, char adderr, const char *fmt, ...) ++{ ++ fprintf(stderr, "%s: ", program_invocation_short_name); ++ if (fmt != NULL) { ++ va_list argp; ++ va_start(argp, fmt); ++ vfprintf(stderr, fmt, argp); ++ va_end(argp); ++ if (adderr) ++ fprintf(stderr, ": "); ++ } ++ if (adderr) ++ fprintf(stderr, "%m"); ++ fprintf(stderr, "\n"); ++ if (doexit) ++ exit(excode); ++} ++ ++#ifndef HAVE_ERR ++# define err(E, FMT...) errmsg(1, E, 1, FMT) ++#endif ++ ++#ifndef HAVE_ERRX ++# define errx(E, FMT...) errmsg(1, E, 0, FMT) ++#endif ++ ++#ifndef HAVE_WARN ++# define warn(FMT...) errmsg(0, 0, 1, FMT) ++#endif ++ ++#ifndef HAVE_WARNX ++# define warnx(FMT...) errmsg(0, 0, 0, FMT) ++#endif ++#endif /* !HAVE_ERR_H */ ++ ++ ++/* Don't use inline function to avoid '#include "nls.h"' in c.h ++ */ ++#define errtryhelp(eval) __extension__ ({ \ ++ fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ program_invocation_short_name); \ ++ exit(eval); \ ++}) ++ ++/* After failed execvp() */ ++#define EX_EXEC_FAILED 126 /* Program located, but not usable. */ ++#define EX_EXEC_ENOENT 127 /* Could not find program to exec. */ ++#define errexec(name) err(errno == ENOENT ? EX_EXEC_ENOENT : EX_EXEC_FAILED, \ ++ _("failed to execute %s"), name) ++ ++ ++static inline __attribute__((const)) int is_power_of_2(unsigned long num) ++{ ++ return (num != 0 && ((num & (num - 1)) == 0)); ++} ++ ++#ifndef HAVE_LOFF_T ++typedef int64_t loff_t; ++#endif ++ ++#if !defined(HAVE_DIRFD) && (!defined(HAVE_DECL_DIRFD) || HAVE_DECL_DIRFD == 0) && defined(HAVE_DIR_DD_FD) ++#include ++#include ++static inline int dirfd(DIR *d) ++{ ++ return d->dd_fd; ++} ++#endif ++ ++/* ++ * Fallback defines for old versions of glibc ++ */ ++#include ++ ++#ifdef O_CLOEXEC ++#define UL_CLOEXECSTR "e" ++#else ++#define UL_CLOEXECSTR "" ++#endif ++ ++#ifndef O_CLOEXEC ++#define O_CLOEXEC 0 ++#endif ++ ++#ifdef __FreeBSD_kernel__ ++#ifndef F_DUPFD_CLOEXEC ++#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ ++#endif ++#endif ++ ++ ++#ifndef AI_ADDRCONFIG ++#define AI_ADDRCONFIG 0x0020 ++#endif ++ ++#ifndef IUTF8 ++#define IUTF8 0040000 ++#endif ++ ++/* ++ * MAXHOSTNAMELEN replacement ++ */ ++static inline size_t get_hostname_max(void) ++{ ++ long len = sysconf(_SC_HOST_NAME_MAX); ++ ++ if (0 < len) ++ return len; ++ ++#ifdef MAXHOSTNAMELEN ++ return MAXHOSTNAMELEN; ++#elif HOST_NAME_MAX ++ return HOST_NAME_MAX; ++#endif ++ return 64; ++} ++ ++ ++/* ++ * Constant strings for usage() functions. For more info see ++ * Documentation/{howto-usage-function.txt,boilerplate.c} ++ */ ++#define USAGE_HEADER ("\nUsage:\n") ++#define USAGE_OPTIONS ("\nOptions:\n") ++#define USAGE_FUNCTIONS ("\nFunctions:\n") ++#define USAGE_COMMANDS ("\nCommands:\n") ++#define USAGE_COLUMNS ("\nAvailable output columns:\n") ++#define USAGE_SEPARATOR "\n" ++ ++#define USAGE_OPTSTR_HELP ("display this help") ++#define USAGE_OPTSTR_VERSION ("display version") ++ ++#define USAGE_HELP_OPTIONS(marg_dsc) \ ++ "%-" #marg_dsc "s%s\n" \ ++ "%-" #marg_dsc "s%s\n" \ ++ , " -h, --help", USAGE_OPTSTR_HELP \ ++ , " -V, --version", USAGE_OPTSTR_VERSION ++ ++#define USAGE_MAN_TAIL(_man) ("\nFor more details see %s.\n"), _man ++ ++#define UTIL_LINUX_VERSION ("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING ++ ++#define print_version(eval) __extension__ ({ \ ++ printf(UTIL_LINUX_VERSION); \ ++ exit(eval); \ ++}) ++ ++/* ++ * scanf modifiers for "strings allocation" ++ */ ++#ifdef HAVE_SCANF_MS_MODIFIER ++#define UL_SCNsA "%ms" ++#elif defined(HAVE_SCANF_AS_MODIFIER) ++#define UL_SCNsA "%as" ++#endif ++ ++/* ++ * seek stuff ++ */ ++#ifndef SEEK_DATA ++# define SEEK_DATA 3 ++#endif ++#ifndef SEEK_HOLE ++# define SEEK_HOLE 4 ++#endif ++ ++ ++/* ++ * Macros to convert #define'itions to strings, for example ++ * #define XYXXY 42 ++ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY)); ++ */ ++#define stringify_value(s) stringify(s) ++#define stringify(s) #s ++ ++/* ++ * UL_ASAN_BLACKLIST is a macro to tell AddressSanitizer (a compile-time ++ * instrumentation shipped with Clang and GCC) to not instrument the ++ * annotated function. Furthermore, it will prevent the compiler from ++ * inlining the function because inlining currently breaks the blacklisting ++ * mechanism of AddressSanitizer. ++ */ ++#if __has_feature(address_sanitizer) && __has_attribute(no_sanitize_memory) && __has_attribute(no_sanitize_address) ++# define UL_ASAN_BLACKLIST __attribute__((noinline)) __attribute__((no_sanitize_memory)) __attribute__((no_sanitize_address)) ++#else ++# define UL_ASAN_BLACKLIST /* nothing */ ++#endif ++ ++/* ++ * Note that sysconf(_SC_GETPW_R_SIZE_MAX) returns *initial* suggested size for ++ * pwd buffer and in some cases it is not large enough. See POSIX and ++ * getpwnam_r man page for more details. ++ */ ++#define UL_GETPW_BUFSIZ (16 * 1024) ++ ++/* ++ * Darwin or other BSDs may only have MAP_ANON. To get it on Darwin we must ++ * define _DARWIN_C_SOURCE before including sys/mman.h. We do this in config.h. ++ */ ++#if !defined MAP_ANONYMOUS && defined MAP_ANON ++# define MAP_ANONYMOUS (MAP_ANON) ++#endif ++ ++#endif /* UTIL_LINUX_C_H */ +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +new file mode 100644 +index 0000000000..63615896b0 +--- /dev/null ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -0,0 +1,528 @@ ++/* ++ * hardlink - consolidate duplicate files via hardlinks ++ * ++ * Copyright (C) 2018 Red Hat, Inc. All rights reserved. ++ * Written by Jakub Jelinek ++ * ++ * Copyright (C) 2019 Karel Zak ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it would be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License along ++ * with this program; if not, write to the Free Software Foundation, Inc., ++ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#ifdef HAVE_PCRE ++# define PCRE2_CODE_UNIT_WIDTH 8 ++# include ++#endif ++ ++#include "c.h" ++#include "xalloc.h" ++#include "nls.h" ++#include "closestream.h" ++ ++#define NHASH (1<<17) /* Must be a power of 2! */ ++#define NBUF 64 ++ ++struct hardlink_file; ++ ++struct hardlink_hash { ++ struct hardlink_hash *next; ++ struct hardlink_file *chain; ++ off_t size; ++ time_t mtime; ++}; ++ ++struct hardlink_dir { ++ struct hardlink_dir *next; ++ char name[]; ++}; ++ ++struct hardlink_file { ++ struct hardlink_file *next; ++ ino_t ino; ++ dev_t dev; ++ unsigned int cksum; ++ char name[]; ++}; ++ ++struct hardlink_dynstr { ++ char *buf; ++ size_t alloc; ++}; ++ ++struct hardlink_ctl { ++ struct hardlink_dir *dirs; ++ struct hardlink_hash *hps[NHASH]; ++ char iobuf1[BUFSIZ]; ++ char iobuf2[BUFSIZ]; ++ /* summary counters */ ++ unsigned long long ndirs; ++ unsigned long long nobjects; ++ unsigned long long nregfiles; ++ unsigned long long ncomp; ++ unsigned long long nlinks; ++ unsigned long long nsaved; ++ /* current device */ ++ dev_t dev; ++ /* flags */ ++ unsigned int verbose; ++ unsigned int ++ no_link:1, ++ content_only:1, ++ force:1; ++}; ++/* ctl is in global scope due use in atexit() */ ++struct hardlink_ctl global_ctl; ++ ++__attribute__ ((always_inline)) ++static inline unsigned int hash(off_t size, time_t mtime) ++{ ++ return (size ^ mtime) & (NHASH - 1); ++} ++ ++__attribute__ ((always_inline)) ++static inline int stcmp(struct stat *st1, struct stat *st2, int content_scope) ++{ ++ if (content_scope) ++ return st1->st_size != st2->st_size; ++ ++ return st1->st_mode != st2->st_mode ++ || st1->st_uid != st2->st_uid ++ || st1->st_gid != st2->st_gid ++ || st1->st_size != st2->st_size ++ || st1->st_mtime != st2->st_mtime; ++} ++ ++static void print_summary(void) ++{ ++ struct hardlink_ctl const *const ctl = &global_ctl; ++ ++ if (!ctl->verbose) ++ return; ++ ++ if (ctl->verbose > 1 && ctl->nlinks) ++ fputc('\n', stdout); ++ ++ printf(_("Directories: %9lld\n"), ctl->ndirs); ++ printf(_("Objects: %9lld\n"), ctl->nobjects); ++ printf(_("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf( "%s%9lld\n", (ctl->no_link ? ++ _("Would link: ") : ++ _("Linked: ")), ctl->nlinks); ++ printf( "%s %9lld\n", (ctl->no_link ? ++ _("Would save: ") : ++ _("Saved: ")), ctl->nsaved); ++} ++ ++static void __attribute__((__noreturn__)) usage(void) ++{ ++ fputs(USAGE_HEADER, stdout); ++ printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ puts(_("Consolidate duplicate files using hardlinks.")); ++ ++ fputs(USAGE_OPTIONS, stdout); ++ puts(_(" -c, --content compare only contents, ignore permission, etc.")); ++ puts(_(" -n, --dry-run don't actually link anything")); ++ puts(_(" -v, --verbose print summary after hardlinking")); ++ puts(_(" -vv print every hardlinked file and summary")); ++ puts(_(" -f, --force force hardlinking across filesystems")); ++ puts(_(" -x, --exclude exclude files matching pattern")); ++ ++ fputs(USAGE_SEPARATOR, stdout); ++ printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ ++ printf(USAGE_MAN_TAIL("hardlink(1)")); ++ exit(EXIT_SUCCESS); ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add2(size_t a, size_t b) ++{ ++ size_t sum = a + b; ++ ++ if (sum < a) ++ errx(EXIT_FAILURE, _("integer overflow")); ++ return sum; ++} ++ ++__attribute__ ((always_inline)) ++static inline size_t add3(size_t a, size_t b, size_t c) ++{ ++ return add2(add2(a, b), c); ++} ++ ++static void growstr(struct hardlink_dynstr *str, size_t newlen) ++{ ++ if (newlen < str->alloc) ++ return; ++ str->buf = xrealloc(str->buf, str->alloc = add2(newlen, 1)); ++} ++ ++static void process_path(struct hardlink_ctl *ctl, const char *name) ++{ ++ struct stat st, st2, st3; ++ const size_t namelen = strlen(name); ++ ++ ctl->nobjects++; ++ if (lstat(name, &st)) ++ return; ++ ++ if (st.st_dev != ctl->dev && !ctl->force) { ++ if (ctl->dev) ++ errx(EXIT_FAILURE, ++ _("%s is on different filesystem than the rest " ++ "(use -f option to override)."), name); ++ ctl->dev = st.st_dev; ++ } ++ if (S_ISDIR(st.st_mode)) { ++ struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1)); ++ memcpy(dp->name, name, namelen + 1); ++ dp->next = ctl->dirs; ++ ctl->dirs = dp; ++ ++ } else if (S_ISREG(st.st_mode)) { ++ int fd, i; ++ struct hardlink_file *fp, *fp2; ++ struct hardlink_hash *hp; ++ const char *n1, *n2; ++ unsigned int buf[NBUF]; ++ int cksumsize = sizeof(buf); ++ unsigned int cksum; ++ time_t mtime = ctl->content_only ? 0 : st.st_mtime; ++ unsigned int hsh = hash(st.st_size, mtime); ++ off_t fsize; ++ ++ ctl->nregfiles++; ++ if (ctl->verbose > 1) ++ printf("%s\n", name); ++ ++ fd = open(name, O_RDONLY); ++ if (fd < 0) ++ return; ++ ++ if ((size_t)st.st_size < sizeof(buf)) { ++ cksumsize = st.st_size; ++ memset(((char *)buf) + cksumsize, 0, ++ (sizeof(buf) - cksumsize) % sizeof(buf[0])); ++ } ++ if (read(fd, buf, cksumsize) != cksumsize) { ++ close(fd); ++ return; ++ } ++ cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]); ++ for (i = 0, cksum = 0; i < cksumsize; i++) { ++ if (cksum + buf[i] < cksum) ++ cksum += buf[i] + 1; ++ else ++ cksum += buf[i]; ++ } ++ for (hp = ctl->hps[hsh]; hp; hp = hp->next) { ++ if (hp->size == st.st_size && hp->mtime == mtime) ++ break; ++ } ++ if (!hp) { ++ hp = xmalloc(sizeof(*hp)); ++ hp->size = st.st_size; ++ hp->mtime = mtime; ++ hp->chain = NULL; ++ hp->next = ctl->hps[hsh]; ++ ctl->hps[hsh] = hp; ++ } ++ for (fp = hp->chain; fp; fp = fp->next) { ++ if (fp->cksum == cksum) ++ break; ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) { ++ close(fd); ++ return; ++ } ++ } ++ for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next) { ++ ++ if (!lstat(fp2->name, &st2) && S_ISREG(st2.st_mode) && ++ !stcmp(&st, &st2, ctl->content_only) && ++ st2.st_ino != st.st_ino && ++ st2.st_dev == st.st_dev) { ++ ++ int fd2 = open(fp2->name, O_RDONLY); ++ if (fd2 < 0) ++ continue; ++ ++ if (fstat(fd2, &st2) || !S_ISREG(st2.st_mode) ++ || st2.st_size == 0) { ++ close(fd2); ++ continue; ++ } ++ ctl->ncomp++; ++ lseek(fd, 0, SEEK_SET); ++ ++ for (fsize = st.st_size; fsize > 0; ++ fsize -= (off_t)sizeof(ctl->iobuf1)) { ++ ssize_t xsz; ++ ssize_t rsize = fsize > (ssize_t) sizeof(ctl->iobuf1) ? ++ (ssize_t) sizeof(ctl->iobuf1) : fsize; ++ ++ if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) ++ warn(_("cannot read %s"), name); ++ else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) ++ warn(_("cannot read %s"), fp2->name); ++ ++ if (xsz != rsize) { ++ close(fd); ++ close(fd2); ++ return; ++ } ++ if (memcmp(ctl->iobuf1, ctl->iobuf2, rsize)) ++ break; ++ } ++ close(fd2); ++ if (fsize > 0) ++ continue; ++ if (lstat(name, &st3)) { ++ warn(_("cannot stat %s"), name); ++ close(fd); ++ return; ++ } ++ st3.st_atime = st.st_atime; ++ if (stcmp(&st, &st3, 0)) { ++ warnx(_("file %s changed underneath us"), name); ++ close(fd); ++ return; ++ } ++ n1 = fp2->name; ++ n2 = name; ++ ++ if (!ctl->no_link) { ++ const char *suffix = ++ ".$$$___cleanit___$$$"; ++ const size_t suffixlen = strlen(suffix); ++ size_t n2len = strlen(n2); ++ struct hardlink_dynstr nam2 = { NULL, 0 }; ++ ++ growstr(&nam2, add2(n2len, suffixlen)); ++ memcpy(nam2.buf, n2, n2len); ++ memcpy(&nam2.buf[n2len], suffix, ++ suffixlen + 1); ++ /* First create a temporary link to n1 under a new name */ ++ if (link(n1, nam2.buf)) { ++ warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ n1, n2, nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ /* Then rename into place over the existing n2 */ ++ if (rename(nam2.buf, n2)) { ++ warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ n1, n2, n2); ++ /* Something went wrong, try to remove the now redundant temporary link */ ++ if (unlink(nam2.buf)) ++ warn(_("failed to remove temporary link %s"), nam2.buf); ++ free(nam2.buf); ++ continue; ++ } ++ free(nam2.buf); ++ } ++ ctl->nlinks++; ++ if (st3.st_nlink > 1) { ++ /* We actually did not save anything this time, since the link second argument ++ had some other links as well. */ ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2); ++ } else { ++ ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; ++ if (ctl->verbose > 1) ++ printf(_(" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? _("Would link") : _("Linked")), ++ n1, n2, ++ (ctl->no_link ? _("would save") : _("saved")), ++ (intmax_t)st.st_size); ++ } ++ close(fd); ++ return; ++ } ++ } ++ fp2 = xmalloc(add3(sizeof(*fp2), namelen, 1)); ++ close(fd); ++ fp2->ino = st.st_ino; ++ fp2->dev = st.st_dev; ++ fp2->cksum = cksum; ++ memcpy(fp2->name, name, namelen + 1); ++ ++ if (fp) { ++ fp2->next = fp->next; ++ fp->next = fp2; ++ } else { ++ fp2->next = hp->chain; ++ hp->chain = fp2; ++ } ++ return; ++ } ++} ++ ++int main(int argc, char **argv) ++{ ++ int ch; ++ int i; ++#ifdef HAVE_PCRE ++ int errornumber; ++ PCRE2_SIZE erroroffset; ++ pcre2_code *re = NULL; ++ PCRE2_SPTR exclude_pattern = NULL; ++ pcre2_match_data *match_data = NULL; ++#endif ++ struct hardlink_dynstr nam1 = { NULL, 0 }; ++ struct hardlink_ctl *ctl = &global_ctl; ++ ++ static const struct option longopts[] = { ++ { "content", no_argument, NULL, 'c' }, ++ { "dry-run", no_argument, NULL, 'n' }, ++ { "exclude", required_argument, NULL, 'x' }, ++ { "force", no_argument, NULL, 'f' }, ++ { "help", no_argument, NULL, 'h' }, ++ { "verbose", no_argument, NULL, 'v' }, ++ { "version", no_argument, NULL, 'V' }, ++ { NULL, 0, NULL, 0 }, ++ }; ++ ++ setlocale(LC_ALL, ""); ++ bindtextdomain(PACKAGE, LOCALEDIR); ++ textdomain(PACKAGE); ++ close_stdout_atexit(); ++ ++ while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { ++ switch (ch) { ++ case 'n': ++ ctl->no_link = 1; ++ break; ++ case 'v': ++ ctl->verbose++; ++ break; ++ case 'c': ++ ctl->content_only = 1; ++ break; ++ case 'f': ++ ctl->force = 1; ++ break; ++ case 'x': ++#ifdef HAVE_PCRE ++ exclude_pattern = (PCRE2_SPTR) optarg; ++#else ++ errx(EXIT_FAILURE, ++ _("option --exclude not supported (built without pcre2)")); ++#endif ++ break; ++ case 'V': ++ print_version(EXIT_SUCCESS); ++ case 'h': ++ usage(); ++ default: ++ errtryhelp(EXIT_FAILURE); ++ } ++ } ++ ++ if (optind == argc) { ++ warnx(_("no directory specified")); ++ errtryhelp(EXIT_FAILURE); ++ } ++ ++#ifdef HAVE_PCRE ++ if (exclude_pattern) { ++ re = pcre2_compile(exclude_pattern, /* the pattern */ ++ PCRE2_ZERO_TERMINATED, /* indicates pattern is zero-terminate */ ++ 0, /* default options */ ++ &errornumber, &erroroffset, NULL); /* use default compile context */ ++ if (!re) { ++ PCRE2_UCHAR buffer[256]; ++ pcre2_get_error_message(errornumber, buffer, ++ sizeof(buffer)); ++ errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ (int)erroroffset, buffer); ++ } ++ match_data = pcre2_match_data_create_from_pattern(re, NULL); ++ } ++#endif ++ atexit(print_summary); ++ ++ for (i = optind; i < argc; i++) ++ process_path(ctl, argv[i]); ++ ++ while (ctl->dirs) { ++ DIR *dh; ++ struct dirent *di; ++ struct hardlink_dir *dp = ctl->dirs; ++ size_t nam1baselen = strlen(dp->name); ++ ++ ctl->dirs = dp->next; ++ growstr(&nam1, add2(nam1baselen, 1)); ++ memcpy(nam1.buf, dp->name, nam1baselen); ++ free(dp); ++ nam1.buf[nam1baselen++] = '/'; ++ nam1.buf[nam1baselen] = 0; ++ dh = opendir(nam1.buf); ++ ++ if (dh == NULL) ++ continue; ++ ctl->ndirs++; ++ ++ while ((di = readdir(dh)) != NULL) { ++ if (!di->d_name[0]) ++ continue; ++ if (di->d_name[0] == '.') { ++ if (!di->d_name[1] || !strcmp(di->d_name, "..")) ++ continue; ++ } ++#ifdef HAVE_PCRE ++ if (re && pcre2_match(re, /* compiled regex */ ++ (PCRE2_SPTR) di->d_name, strlen(di->d_name), 0, /* start at offset 0 */ ++ 0, /* default options */ ++ match_data, /* block for storing the result */ ++ NULL) /* use default match context */ ++ >=0) { ++ if (ctl->verbose) { ++ nam1.buf[nam1baselen] = 0; ++ printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ } ++ continue; ++ } ++#endif ++ { ++ size_t subdirlen; ++ growstr(&nam1, ++ add2(nam1baselen, subdirlen = ++ strlen(di->d_name))); ++ memcpy(&nam1.buf[nam1baselen], di->d_name, ++ add2(subdirlen, 1)); ++ } ++ process_path(ctl, nam1.buf); ++ } ++ closedir(dh); ++ } ++ ++ return 0; ++} +diff --git a/locale/programs/xalloc.h b/locale/programs/xalloc.h +new file mode 100644 +index 0000000000..0129a85e2e +--- /dev/null ++++ b/locale/programs/xalloc.h +@@ -0,0 +1,129 @@ ++/* ++ * Copyright (C) 2010 Davidlohr Bueso ++ * ++ * This file may be redistributed under the terms of the ++ * GNU Lesser General Public License. ++ * ++ * General memory allocation wrappers for malloc, realloc, calloc and strdup ++ */ ++ ++#ifndef UTIL_LINUX_XALLOC_H ++#define UTIL_LINUX_XALLOC_H ++ ++#include ++#include ++ ++#include "c.h" ++ ++#ifndef XALLOC_EXIT_CODE ++# define XALLOC_EXIT_CODE EXIT_FAILURE ++#endif ++ ++static inline void __attribute__((__noreturn__)) ++__err_oom(const char *file, unsigned int line) ++{ ++ err(XALLOC_EXIT_CODE, "%s: %u: cannot allocate memory", file, line); ++} ++ ++#define err_oom() __err_oom(__FILE__, __LINE__) ++ ++static inline __ul_alloc_size(1) __ul_returns_nonnull ++void *xmalloc(const size_t size) ++{ ++ void *ret = malloc(size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_alloc_size(2) __ul_returns_nonnull ++void *xrealloc(void *ptr, const size_t size) ++{ ++ void *ret = realloc(ptr, size); ++ ++ if (!ret && size) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline __ul_calloc_size(1, 2) __ul_returns_nonnull ++void *xcalloc(const size_t nelems, const size_t size) ++{ ++ void *ret = calloc(nelems, size); ++ ++ if (!ret && size && nelems) ++ err(XALLOC_EXIT_CODE, "cannot allocate %zu bytes", size); ++ return ret; ++} ++ ++static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull ++*xstrdup(const char *str) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strdup(str); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++static inline char * __attribute__((warn_unused_result)) __ul_returns_nonnull ++xstrndup(const char *str, size_t size) ++{ ++ char *ret; ++ ++ if (!str) ++ return NULL; ++ ++ ret = strndup(str, size); ++ ++ if (!ret) ++ err(XALLOC_EXIT_CODE, "cannot duplicate string"); ++ return ret; ++} ++ ++ ++static inline int __attribute__ ((__format__(printf, 2, 3))) ++ xasprintf(char **strp, const char *fmt, ...) ++{ ++ int ret; ++ va_list args; ++ va_start(args, fmt); ++ ret = vasprintf(&(*strp), fmt, args); ++ va_end(args); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++static inline int __attribute__ ((__format__(printf, 2, 0))) ++xvasprintf(char **strp, const char *fmt, va_list ap) ++{ ++ int ret = vasprintf(&(*strp), fmt, ap); ++ if (ret < 0) ++ err(XALLOC_EXIT_CODE, "cannot allocate string"); ++ return ret; ++} ++ ++ ++static inline char * __attribute__((warn_unused_result)) xgethostname(void) ++{ ++ char *name; ++ size_t sz = get_hostname_max() + 1; ++ ++ name = xmalloc(sizeof(char) * sz); ++ ++ if (gethostname(name, sz) != 0) { ++ free(name); ++ return NULL; ++ } ++ name[sz - 1] = '\0'; ++ return name; ++} ++ ++#endif diff --git a/meta-openeuler/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch b/meta-openeuler/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch new file mode 100644 index 00000000000..2dc4634dd5c --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0002-localedef-fix-ups-hardlink-to-make-it-compile.patch @@ -0,0 +1,238 @@ +From 9ff5200eb16e9c89ca8da89d7e07975d082a13b0 Mon Sep 17 00:00:00 2001 +From: Jason Wessel +Date: Sat, 7 Dec 2019 10:01:37 -0800 +Subject: [PATCH] localedef: fix-ups hardlink to make it compile + +Upstream-Status: Pending +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + locale/programs/c.h | 2 +- + locale/programs/cross-localedef-hardlink.c | 79 +++++++++++----------- + 2 files changed, 39 insertions(+), 42 deletions(-) + +diff --git a/locale/programs/c.h b/locale/programs/c.h +index d0a402e90e..1804d31c73 100644 +--- a/locale/programs/c.h ++++ b/locale/programs/c.h +@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...) + /* Don't use inline function to avoid '#include "nls.h"' in c.h + */ + #define errtryhelp(eval) __extension__ ({ \ +- fprintf(stderr, _("Try '%s --help' for more information.\n"), \ ++ fprintf(stderr, ("Try '%s --help' for more information.\n"), \ + program_invocation_short_name); \ + exit(eval); \ + }) +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c +index 63615896b0..726e6dd948 100644 +--- a/locale/programs/cross-localedef-hardlink.c ++++ b/locale/programs/cross-localedef-hardlink.c +@@ -20,6 +20,8 @@ + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ ++ ++#undef HAVE_PCRE + #include + #include + #include +@@ -38,8 +40,8 @@ + + #include "c.h" + #include "xalloc.h" +-#include "nls.h" +-#include "closestream.h" ++//#include "nls.h" ++//#include "closestream.h" + + #define NHASH (1<<17) /* Must be a power of 2! */ + #define NBUF 64 +@@ -124,33 +126,33 @@ static void print_summary(void) + if (ctl->verbose > 1 && ctl->nlinks) + fputc('\n', stdout); + +- printf(_("Directories: %9lld\n"), ctl->ndirs); +- printf(_("Objects: %9lld\n"), ctl->nobjects); +- printf(_("Regular files: %9lld\n"), ctl->nregfiles); +- printf(_("Comparisons: %9lld\n"), ctl->ncomp); ++ printf(("Directories: %9lld\n"), ctl->ndirs); ++ printf(("Objects: %9lld\n"), ctl->nobjects); ++ printf(("Regular files: %9lld\n"), ctl->nregfiles); ++ printf(("Comparisons: %9lld\n"), ctl->ncomp); + printf( "%s%9lld\n", (ctl->no_link ? +- _("Would link: ") : +- _("Linked: ")), ctl->nlinks); ++ ("Would link: ") : ++ ("Linked: ")), ctl->nlinks); + printf( "%s %9lld\n", (ctl->no_link ? +- _("Would save: ") : +- _("Saved: ")), ctl->nsaved); ++ ("Would save: ") : ++ ("Saved: ")), ctl->nsaved); + } + + static void __attribute__((__noreturn__)) usage(void) + { + fputs(USAGE_HEADER, stdout); +- printf(_(" %s [options] directory...\n"), program_invocation_short_name); ++ printf((" %s [options] directory...\n"), program_invocation_short_name); + + fputs(USAGE_SEPARATOR, stdout); +- puts(_("Consolidate duplicate files using hardlinks.")); ++ puts(("Consolidate duplicate files using hardlinks.")); + + fputs(USAGE_OPTIONS, stdout); +- puts(_(" -c, --content compare only contents, ignore permission, etc.")); +- puts(_(" -n, --dry-run don't actually link anything")); +- puts(_(" -v, --verbose print summary after hardlinking")); +- puts(_(" -vv print every hardlinked file and summary")); +- puts(_(" -f, --force force hardlinking across filesystems")); +- puts(_(" -x, --exclude exclude files matching pattern")); ++ puts((" -c, --content compare only contents, ignore permission, etc.")); ++ puts((" -n, --dry-run don't actually link anything")); ++ puts((" -v, --verbose print summary after hardlinking")); ++ puts((" -vv print every hardlinked file and summary")); ++ puts((" -f, --force force hardlinking across filesystems")); ++ puts((" -x, --exclude exclude files matching pattern")); + + fputs(USAGE_SEPARATOR, stdout); + printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */ +@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b) + size_t sum = a + b; + + if (sum < a) +- errx(EXIT_FAILURE, _("integer overflow")); ++ errx(EXIT_FAILURE, ("integer overflow")); + return sum; + } + +@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (st.st_dev != ctl->dev && !ctl->force) { + if (ctl->dev) + errx(EXIT_FAILURE, +- _("%s is on different filesystem than the rest " ++ ("%s is on different filesystem than the rest " + "(use -f option to override)."), name); + ctl->dev = st.st_dev; + } +@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + (ssize_t) sizeof(ctl->iobuf1) : fsize; + + if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize) +- warn(_("cannot read %s"), name); ++ warn(("cannot read %s"), name); + else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize) +- warn(_("cannot read %s"), fp2->name); ++ warn(("cannot read %s"), fp2->name); + + if (xsz != rsize) { + close(fd); +@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + if (fsize > 0) + continue; + if (lstat(name, &st3)) { +- warn(_("cannot stat %s"), name); ++ warn(("cannot stat %s"), name); + close(fd); + return; + } + st3.st_atime = st.st_atime; + if (stcmp(&st, &st3, 0)) { +- warnx(_("file %s changed underneath us"), name); ++ warnx(("file %s changed underneath us"), name); + close(fd); + return; + } +@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + suffixlen + 1); + /* First create a temporary link to n1 under a new name */ + if (link(n1, nam2.buf)) { +- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"), ++ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"), + n1, n2, nam2.buf); + free(nam2.buf); + continue; + } + /* Then rename into place over the existing n2 */ + if (rename(nam2.buf, n2)) { +- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"), ++ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"), + n1, n2, n2); + /* Something went wrong, try to remove the now redundant temporary link */ + if (unlink(nam2.buf)) +- warn(_("failed to remove temporary link %s"), nam2.buf); ++ warn(("failed to remove temporary link %s"), nam2.buf); + free(nam2.buf); + continue; + } +@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name) + /* We actually did not save anything this time, since the link second argument + had some other links as well. */ + if (ctl->verbose > 1) +- printf(_(" %s %s to %s\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2); + } else { + ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096; + if (ctl->verbose > 1) +- printf(_(" %s %s to %s, %s %jd\n"), +- (ctl->no_link ? _("Would link") : _("Linked")), ++ printf((" %s %s to %s, %s %jd\n"), ++ (ctl->no_link ? ("Would link") : ("Linked")), + n1, n2, +- (ctl->no_link ? _("would save") : _("saved")), ++ (ctl->no_link ? ("would save") : ("saved")), + (intmax_t)st.st_size); + } + close(fd); +@@ -410,11 +412,6 @@ int main(int argc, char **argv) + { NULL, 0, NULL, 0 }, + }; + +- setlocale(LC_ALL, ""); +- bindtextdomain(PACKAGE, LOCALEDIR); +- textdomain(PACKAGE); +- close_stdout_atexit(); +- + while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) { + switch (ch) { + case 'n': +@@ -434,7 +431,7 @@ int main(int argc, char **argv) + exclude_pattern = (PCRE2_SPTR) optarg; + #else + errx(EXIT_FAILURE, +- _("option --exclude not supported (built without pcre2)")); ++ ("option --exclude not supported (built without pcre2)")); + #endif + break; + case 'V': +@@ -447,7 +444,7 @@ int main(int argc, char **argv) + } + + if (optind == argc) { +- warnx(_("no directory specified")); ++ warnx(("no directory specified")); + errtryhelp(EXIT_FAILURE); + } + +@@ -461,7 +458,7 @@ int main(int argc, char **argv) + PCRE2_UCHAR buffer[256]; + pcre2_get_error_message(errornumber, buffer, + sizeof(buffer)); +- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"), ++ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"), + (int)erroroffset, buffer); + } + match_data = pcre2_match_data_create_from_pattern(re, NULL); +@@ -506,7 +503,7 @@ int main(int argc, char **argv) + >=0) { + if (ctl->verbose) { + nam1.buf[nam1baselen] = 0; +- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name); ++ printf(("Skipping %s%s\n"), nam1.buf, di->d_name); + } + continue; + } diff --git a/meta-openeuler/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch b/meta-openeuler/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch new file mode 100644 index 00000000000..f2602d0e567 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch @@ -0,0 +1,65 @@ +From 0d996c5600603a67f0265e870511cdd18dbaa8a6 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:48:24 +0000 +Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well + +Upstream-Status: Inappropriate [embedded specific] + +The default lib search path order is: + + 1) LD_LIBRARY_PATH + 2) RPATH from the binary + 3) ld.so.cache + 4) default search paths embedded in the linker + +For nativesdk binaries which are being used alongside binaries on a host system, we +need the search paths to firstly search the shipped nativesdk libs but then also +cover the host system. For example we want the host system's libGL and this may be +in a non-standard location like /usr/lib/mesa. The only place the location is know +about is in the ld.so.cache of the host system. + +Since nativesdk has a simple structure and doesn't need to use a cache itself, we +repurpose the cache for use as a last resort in finding host system binaries. This +means we need to switch the order of 3 and 4 above to make this work effectively. + +RP 14/10/2010 + +Signed-off-by: Khem Raj +--- + elf/dl-load.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/elf/dl-load.c b/elf/dl-load.c +index 9a87fda9c9..0a6fa9b8f0 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -2102,6 +2102,14 @@ _dl_map_object (struct link_map *loader, const char *name, + } + } + ++ /* try the default path. */ ++ if (fd == -1 ++ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL ++ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) ++ && __rtld_search_dirs.dirs != (void *) -1) ++ fd = open_path (name, namelen, mode & __RTLD_SECURE, &__rtld_search_dirs, ++ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); ++ /* Finally try ld.so.cache */ + #ifdef USE_LDCONFIG + if (fd == -1 + && (__glibc_likely ((mode & __RTLD_SECURE) == 0) +@@ -2160,14 +2168,6 @@ _dl_map_object (struct link_map *loader, const char *name, + } + #endif + +- /* Finally, try the default path. */ +- if (fd == -1 +- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL +- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB))) +- && __rtld_search_dirs.dirs != (void *) -1) +- fd = open_path (name, namelen, mode, &__rtld_search_dirs, +- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); +- + /* Add another newline when we are tracing the library loading. */ + if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) + _dl_debug_printf ("\n"); diff --git a/meta-openeuler/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch b/meta-openeuler/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch new file mode 100644 index 00000000000..974312367e8 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch @@ -0,0 +1,46 @@ +From c3492719b2deaf3339eefb1ab30f4337e592ed80 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:50:00 +0000 +Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK + +When ld-linux-*.so.2 is relocated to a path that is longer than the +original fixed location, the dynamic loader will crash in open_path +because it implicitly assumes that max_dirnamelen is a fixed size that +never changes. + +The allocated buffer will not be large enough to contain the directory +path string which is larger than the fixed location provided at build +time. + +Upstream-Status: Inappropriate [OE SDK specific] + +Signed-off-by: Jason Wessel +Signed-off-by: Khem Raj +--- + elf/dl-load.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/elf/dl-load.c b/elf/dl-load.c +index 0a6fa9b8f0..3a23dc618c 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -1802,7 +1802,19 @@ open_path (const char *name, size_t namelen, int mode, + given on the command line when rtld is run directly. */ + return -1; + ++ do ++ { ++ struct r_search_path_elem *this_dir = *dirs; ++ if (this_dir->dirnamelen > max_dirnamelen) ++ { ++ max_dirnamelen = this_dir->dirnamelen; ++ } ++ } ++ while (*++dirs != NULL); ++ + buf = alloca (max_dirnamelen + max_capstrlen + namelen); ++ ++ dirs = sps->dirs; + do + { + struct r_search_path_elem *this_dir = *dirs; diff --git a/meta-openeuler/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch b/meta-openeuler/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch new file mode 100644 index 00000000000..086e0c6f143 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch @@ -0,0 +1,152 @@ +From e874dacbfdb06520240887e9077c58006ee33f87 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:51:38 +0000 +Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths + +This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings +and lengths as well as ld.so.cache path in the dynamic loader to specific +sections in memory. The sections that contain paths have been allocated a 4096 +byte section, which is the maximum path length in linux. This will allow the +relocating script to parse the ELF binary, detect the section and easily replace +the strings in a certain path. + +Upstream-Status: Inappropriate [SDK specific] + +Signed-off-by: Laurentiu Palcu +Signed-off-by: Khem Raj +--- + elf/dl-cache.c | 4 ++++ + elf/dl-load.c | 4 ++-- + elf/dl-usage.c | 6 ++++-- + elf/interp.c | 2 +- + elf/ldconfig.c | 2 ++ + elf/rtld.c | 1 + + iconv/gconv_conf.c | 2 +- + sysdeps/generic/dl-cache.h | 4 ---- + 8 files changed, 15 insertions(+), 10 deletions(-) + +diff --git a/elf/dl-cache.c b/elf/dl-cache.c +index 804bf23222..d99501c389 100644 +--- a/elf/dl-cache.c ++++ b/elf/dl-cache.c +@@ -352,6 +352,10 @@ search_cache (const char *string_table, uint32_t string_table_size, + return best; + } + ++const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) = ++ SYSCONFDIR "/ld.so.cache"; ++ ++ + int + _dl_cache_libcmp (const char *p1, const char *p2) + { +diff --git a/elf/dl-load.c b/elf/dl-load.c +index 3a23dc618c..563e703096 100644 +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -117,8 +117,8 @@ enum { ncapstr = 1, max_capstrlen = 0 }; + gen-trusted-dirs.awk. */ + #include "trusted-dirs.h" + +-static const char system_dirs[] = SYSTEM_DIRS; +-static const size_t system_dirs_len[] = ++static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS; ++volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) = + { + SYSTEM_DIRS_LEN + }; +diff --git a/elf/dl-usage.c b/elf/dl-usage.c +index 98f0b0d027..ab4f76e1fe 100644 +--- a/elf/dl-usage.c ++++ b/elf/dl-usage.c +@@ -25,6 +25,8 @@ + #include + #include + ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); ++ + void + _dl_usage (const char *argv0, const char *wrong_option) + { +@@ -184,7 +186,7 @@ setting environment variables (which would be inherited by subprocesses).\n\ + --list list all dependencies and how they are resolved\n\ + --verify verify that given object really is a dynamically linked\n\ + object we can handle\n\ +- --inhibit-cache Do not use " LD_SO_CACHE "\n\ ++ --inhibit-cache Do not use %s\n\ + --library-path PATH use given PATH instead of content of the environment\n\ + variable LD_LIBRARY_PATH\n\ + --glibc-hwcaps-prepend LIST\n\ +@@ -203,7 +205,7 @@ setting environment variables (which would be inherited by subprocesses).\n\ + \n\ + This program interpreter self-identifies as: " RTLD "\n\ + ", +- argv0); ++ argv0, LD_SO_CACHE); + print_search_path_for_help (state); + print_hwcaps_subdirectories (state); + _exit (EXIT_SUCCESS); +diff --git a/elf/interp.c b/elf/interp.c +index ae21ae0cb3..b168e6da66 100644 +--- a/elf/interp.c ++++ b/elf/interp.c +@@ -18,5 +18,5 @@ + + #include + +-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp"))) ++const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) + = RUNTIME_LINKER; +diff --git a/elf/ldconfig.c b/elf/ldconfig.c +index d26eef1fb4..e5af6e5c01 100644 +--- a/elf/ldconfig.c ++++ b/elf/ldconfig.c +@@ -150,6 +150,8 @@ static struct argp argp = + options, parse_opt, NULL, doc, NULL, more_help, NULL + }; + ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); ++ + /* Handle program arguments. */ + static error_t + parse_opt (int key, char *arg, struct argp_state *state) +diff --git a/elf/rtld.c b/elf/rtld.c +index a91e2a4471..56d816d4d9 100644 +--- a/elf/rtld.c ++++ b/elf/rtld.c +@@ -190,6 +190,7 @@ dso_name_valid_for_suid (const char *p) + } + return *p != '\0'; + } ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); + + static void + audit_list_init (struct audit_list *list) +diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c +index ee9e97e1bd..01a99382d0 100644 +--- a/iconv/gconv_conf.c ++++ b/iconv/gconv_conf.c +@@ -35,7 +35,7 @@ + #include + + /* This is the default path where we look for module lists. */ +-static const char default_gconv_path[] = GCONV_PATH; ++static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH; + + /* Type to represent search path. */ + struct path_elem +diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h +index bd39ff7fb7..38f9e2ad57 100644 +--- a/sysdeps/generic/dl-cache.h ++++ b/sysdeps/generic/dl-cache.h +@@ -34,10 +34,6 @@ + ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID) + #endif + +-#ifndef LD_SO_CACHE +-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache" +-#endif +- + #ifndef add_system_dir + # define add_system_dir(dir) add_dir (dir) + #endif diff --git a/meta-openeuler/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch b/meta-openeuler/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch new file mode 100644 index 00000000000..421afdca1ca --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch @@ -0,0 +1,43 @@ +From 76eaf7340a7f9063ab1ad2d7c6c0e205f22f544c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 31 Dec 2015 14:35:35 -0800 +Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86 + +The fix consist of allowing 64bit atomic ops for x86. +This should be safe for i586 and newer CPUs. +It also makes the synchronization more efficient. + +Upstream-Status: Inappropriate [OE-Specific] + +Signed-off-by: Juro Bystricky +Signed-off-by: Richard Purdie +Signed-off-by: Khem Raj +--- + sysdeps/x86/atomic-machine.h | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h +index 95663099e4..4d81efc51a 100644 +--- a/sysdeps/x86/atomic-machine.h ++++ b/sysdeps/x86/atomic-machine.h +@@ -26,19 +26,14 @@ + #define LOCK_PREFIX "lock;" + + #define USE_ATOMIC_COMPILER_BUILTINS 1 ++# define __HAVE_64B_ATOMICS 1 + + #ifdef __x86_64__ +-# define __HAVE_64B_ATOMICS 1 + # define SP_REG "rsp" + # define SEG_REG "fs" + # define BR_CONSTRAINT "q" + # define IBR_CONSTRAINT "iq" + #else +-/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the +- i386 psABI supplement provides only 4-byte alignment for uint64_t +- inside structs, so it is currently not possible to use 64-bit +- atomics on this platform. */ +-# define __HAVE_64B_ATOMICS 0 + # define SP_REG "esp" + # define SEG_REG "gs" + # define BR_CONSTRAINT "r" diff --git a/meta-openeuler/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch b/meta-openeuler/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch new file mode 100644 index 00000000000..64243b10981 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch @@ -0,0 +1,100 @@ +From ef8bb46455d602cb00caf59b2044a9a23b240cc2 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:55:12 -0700 +Subject: [PATCH] nativesdk-glibc: Make relocatable install for locales + +The glibc locale path is hard-coded to the install prefix, but in SDKs we need +to be able to relocate the binaries. Expand the strings to 4K and put them in a +magic segment that we can relocate at install time. + +Upstream-Status: Inappropriate (OE-specific) + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + locale/findlocale.c | 4 ++-- + locale/loadarchive.c | 2 +- + locale/localeinfo.h | 2 +- + locale/programs/locale.c | 7 ++++--- + 4 files changed, 8 insertions(+), 7 deletions(-) + +diff --git a/locale/findlocale.c b/locale/findlocale.c +index 1b7034348b..939d4fd613 100644 +--- a/locale/findlocale.c ++++ b/locale/findlocale.c +@@ -55,7 +55,7 @@ struct __locale_data *const _nl_C[] attribute_hidden = + which are somehow addressed. */ + struct loaded_l10nfile *_nl_locale_file_list[__LC_LAST]; + +-const char _nl_default_locale_path[] attribute_hidden = COMPLOCALEDIR; ++char _nl_default_locale_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR; + + /* Checks if the name is actually present, that is, not NULL and not + empty. */ +@@ -165,7 +165,7 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, + + /* Nothing in the archive. Set the default path to search below. */ + locale_path = _nl_default_locale_path; +- locale_path_len = sizeof _nl_default_locale_path; ++ locale_path_len = strlen(locale_path) + 1; + } + else + /* We really have to load some data. First see whether the name is +diff --git a/locale/loadarchive.c b/locale/loadarchive.c +index 5b857d5d24..e642912e2a 100644 +--- a/locale/loadarchive.c ++++ b/locale/loadarchive.c +@@ -42,7 +42,7 @@ + + + /* Name of the locale archive file. */ +-static const char archfname[] = COMPLOCALEDIR "/locale-archive"; ++static const char archfname[4096] __attribute__ ((section (".gccrelocprefix"))) = COMPLOCALEDIR "/locale-archive"; + + /* Size of initial mapping window, optimal if large enough to + cover the header plus the initial locale. */ +diff --git a/locale/localeinfo.h b/locale/localeinfo.h +index 8bbf281427..7a930079a5 100644 +--- a/locale/localeinfo.h ++++ b/locale/localeinfo.h +@@ -347,7 +347,7 @@ _nl_lookup_word (locale_t l, int category, int item) + } + + /* Default search path if no LOCPATH environment variable. */ +-extern const char _nl_default_locale_path[] attribute_hidden; ++extern char _nl_default_locale_path[4096] attribute_hidden; + + /* Load the locale data for CATEGORY from the file specified by *NAME. + If *NAME is "", use environment variables as specified by POSIX, and +diff --git a/locale/programs/locale.c b/locale/programs/locale.c +index 1d1a9b2f00..d9ed395b39 100644 +--- a/locale/programs/locale.c ++++ b/locale/programs/locale.c +@@ -631,6 +631,7 @@ nameentcmp (const void *a, const void *b) + ((const struct nameent *) b)->name); + } + ++static char _write_archive_locales_path[4096] attribute_hidden __attribute__ ((section (".gccrelocprefix"))) = ARCHIVE_NAME; + + static int + write_archive_locales (void **all_datap, char *linebuf) +@@ -644,7 +645,7 @@ write_archive_locales (void **all_datap, char *linebuf) + int fd, ret = 0; + uint32_t cnt; + +- fd = open64 (ARCHIVE_NAME, O_RDONLY); ++ fd = open64 (_write_archive_locales_path, O_RDONLY); + if (fd < 0) + return 0; + +@@ -699,8 +700,8 @@ write_archive_locales (void **all_datap, char *linebuf) + if (cnt) + putchar_unlocked ('\n'); + +- printf ("locale: %-15.15s archive: " ARCHIVE_NAME "\n%s\n", +- names[cnt].name, linebuf); ++ printf ("locale: %-15.15s archive: %s\n%s\n", ++ names[cnt].name, _write_archive_locales_path, linebuf); + + locrec = (struct locrecent *) (addr + names[cnt].locrec_offset); + diff --git a/meta-openeuler/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch b/meta-openeuler/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch new file mode 100644 index 00000000000..38dca83b1b4 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch @@ -0,0 +1,32 @@ +From 7f05e35c675a6d1af2144b4cfbabab250de43f38 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 6 Mar 2021 14:48:56 -0800 +Subject: [PATCH] nativesdk-glibc: Fall back to faccessat on faccess2 returns + EPERM + +Fedora-specific workaround for systemd-nspawn + +Upstream-Status: Inappropriate [Distro Specific] + +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/faccessat.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/faccessat.c b/sysdeps/unix/sysv/linux/faccessat.c +index 0ccbd778b5..9df1a0fe12 100644 +--- a/sysdeps/unix/sysv/linux/faccessat.c ++++ b/sysdeps/unix/sysv/linux/faccessat.c +@@ -30,7 +30,11 @@ __faccessat (int fd, const char *file, int mode, int flag) + #if __ASSUME_FACCESSAT2 + return ret; + #else +- if (ret == 0 || errno != ENOSYS) ++ /* Fedora-specific workaround: ++ As a workround for a broken systemd-nspawn that returns ++ EPERM when a syscall is not allowed instead of ENOSYS ++ we must check for EPERM here and fall back to faccessat. */ ++ if (ret == 0 || !(errno == ENOSYS || errno == EPERM)) + return ret; + + if (flag & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS)) diff --git a/meta-openeuler/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch b/meta-openeuler/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch new file mode 100644 index 00000000000..61fdcb08167 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0009-yes-within-the-path-sets-wrong-config-variables.patch @@ -0,0 +1,260 @@ +From 70e721856c3ebf6ae0ea84b828396bd2af090acf Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:31:06 +0000 +Subject: [PATCH] 'yes' within the path sets wrong config variables + +It seems that the 'AC_EGREP_CPP(yes...' example is quite popular +but being such a short word to grep it is likely to produce +false-positive matches with the path it is configured into. + +The change is to use a more elaborated string to grep for. + +Upstream-Status: Submitted [libc-alpha@sourceware.org] + +Signed-off-by: Benjamin Esquivel +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/configure | 4 ++-- + sysdeps/aarch64/configure.ac | 4 ++-- + sysdeps/arm/configure | 4 ++-- + sysdeps/arm/configure.ac | 4 ++-- + sysdeps/mips/configure | 4 ++-- + sysdeps/mips/configure.ac | 4 ++-- + sysdeps/nios2/configure | 4 ++-- + sysdeps/nios2/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure | 4 ++-- + sysdeps/unix/sysv/linux/mips/configure.ac | 4 ++-- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure | 8 ++++---- + sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac | 8 ++++---- + 12 files changed, 28 insertions(+), 28 deletions(-) + +diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure +index ca57edce47..5e91fab023 100644 +--- a/sysdeps/aarch64/configure ++++ b/sysdeps/aarch64/configure +@@ -165,12 +165,12 @@ else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __AARCH64EB__ +- yes ++ is_aarch64_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "is_aarch64_be" >/dev/null 2>&1 + then : + libc_cv_aarch64_be=yes + else $as_nop +diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac +index 27874eceb4..8a708f2ef4 100644 +--- a/sysdeps/aarch64/configure.ac ++++ b/sysdeps/aarch64/configure.ac +@@ -13,8 +13,8 @@ AC_DEFINE(SUPPORT_STATIC_PIE) + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([for big endian], + [libc_cv_aarch64_be], +- [AC_EGREP_CPP(yes,[#ifdef __AARCH64EB__ +- yes ++ [AC_EGREP_CPP(is_aarch64_be,[#ifdef __AARCH64EB__ ++ is_aarch64_be + #endif + ], libc_cv_aarch64_be=yes, libc_cv_aarch64_be=no)]) + if test $libc_cv_aarch64_be = yes; then +diff --git a/sysdeps/arm/configure b/sysdeps/arm/configure +index 35e2918922..94d7fbe8bb 100644 +--- a/sysdeps/arm/configure ++++ b/sysdeps/arm/configure +@@ -161,12 +161,12 @@ else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __ARM_PCS_VFP +- yes ++ use_arm_pcs_vfp + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "use_arm_pcs_vfp" >/dev/null 2>&1 + then : + libc_cv_arm_pcs_vfp=yes + else $as_nop +diff --git a/sysdeps/arm/configure.ac b/sysdeps/arm/configure.ac +index 5172e30bbe..f06dedd7c5 100644 +--- a/sysdeps/arm/configure.ac ++++ b/sysdeps/arm/configure.ac +@@ -10,8 +10,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. + # the dynamic linker via %ifdef. + AC_CACHE_CHECK([whether the compiler is using the ARM hard-float ABI], + [libc_cv_arm_pcs_vfp], +- [AC_EGREP_CPP(yes,[#ifdef __ARM_PCS_VFP +- yes ++ [AC_EGREP_CPP(use_arm_pcs_vfp,[#ifdef __ARM_PCS_VFP ++ use_arm_pcs_vfp + #endif + ], libc_cv_arm_pcs_vfp=yes, libc_cv_arm_pcs_vfp=no)]) + if test $libc_cv_arm_pcs_vfp = yes; then +diff --git a/sysdeps/mips/configure b/sysdeps/mips/configure +index 1e8c6711e6..ae52ccd929 100644 +--- a/sysdeps/mips/configure ++++ b/sysdeps/mips/configure +@@ -158,11 +158,11 @@ else $as_nop + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1 + then : + libc_cv_mips_nan2008=yes + else $as_nop +diff --git a/sysdeps/mips/configure.ac b/sysdeps/mips/configure.ac +index d3cd780d78..250223d206 100644 +--- a/sysdeps/mips/configure.ac ++++ b/sysdeps/mips/configure.ac +@@ -6,9 +6,9 @@ dnl position independent way. + AC_DEFINE(HIDDEN_VAR_NEEDS_DYNAMIC_RELOC) + + AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding], +- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl ++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + if test x$libc_cv_mips_nan2008 = xyes; then + AC_DEFINE(HAVE_MIPS_NAN2008) +diff --git a/sysdeps/nios2/configure b/sysdeps/nios2/configure +index 2fb230cbaa..1959d0a444 100644 +--- a/sysdeps/nios2/configure ++++ b/sysdeps/nios2/configure +@@ -155,12 +155,12 @@ else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef __nios2_big_endian__ +- yes ++ is_nios2_be + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "is_nios2_be" >/dev/null 2>&1 + then : + libc_cv_nios2_be=yes + else $as_nop +diff --git a/sysdeps/nios2/configure.ac b/sysdeps/nios2/configure.ac +index f738e9a7ed..4085851cbc 100644 +--- a/sysdeps/nios2/configure.ac ++++ b/sysdeps/nios2/configure.ac +@@ -4,8 +4,8 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. + # Nios II big endian is not yet supported. + AC_CACHE_CHECK([for big endian], + [libc_cv_nios2_be], +- [AC_EGREP_CPP(yes,[#ifdef __nios2_big_endian__ +- yes ++ [AC_EGREP_CPP(is_nios2_be,[#ifdef __nios2_big_endian__ ++ is_nios2_be + #endif + ], libc_cv_nios2_be=yes, libc_cv_nios2_be=no)]) + if test $libc_cv_nios2_be = yes; then +diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure +index a060901de4..0ac7019438 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure ++++ b/sysdeps/unix/sysv/linux/mips/configure +@@ -441,11 +441,11 @@ else $as_nop + /* end confdefs.h. */ + dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "use_mips_nan2008" >/dev/null 2>&1 + then : + libc_cv_mips_nan2008=yes + else $as_nop +diff --git a/sysdeps/unix/sysv/linux/mips/configure.ac b/sysdeps/unix/sysv/linux/mips/configure.ac +index 049a0f4bdf..005526d4e8 100644 +--- a/sysdeps/unix/sysv/linux/mips/configure.ac ++++ b/sysdeps/unix/sysv/linux/mips/configure.ac +@@ -105,9 +105,9 @@ AC_COMPILE_IFELSE( + LIBC_CONFIG_VAR([mips-mode-switch],[${libc_mips_mode_switch}]) + + AC_CACHE_CHECK([whether the compiler is using the 2008 NaN encoding], +- libc_cv_mips_nan2008, [AC_EGREP_CPP(yes, [dnl ++ libc_cv_mips_nan2008, [AC_EGREP_CPP(use_mips_nan2008, [dnl + #ifdef __mips_nan2008 +-yes ++use_mips_nan2008 + #endif], libc_cv_mips_nan2008=yes, libc_cv_mips_nan2008=no)]) + + libc_mips_nan= +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +index cf1b70c745..0dccf6cd76 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure +@@ -168,12 +168,12 @@ else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #if _CALL_ELF == 2 +- yes ++ use_ppc_elfv2_abi + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "use_ppc_elfv2_abi" >/dev/null 2>&1 + then : + libc_cv_ppc64_elfv2_abi=yes + else $as_nop +@@ -203,12 +203,12 @@ else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + #ifdef _CALL_ELF +- yes ++ is_def_call_elf + #endif + + _ACEOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | +- $EGREP "yes" >/dev/null 2>&1 ++ $EGREP "is_def_call_elf" >/dev/null 2>&1 + then : + libc_cv_ppc64_def_call_elf=yes + else $as_nop +diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +index f9cba6e15d..b21f72f1e4 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac ++++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac +@@ -6,8 +6,8 @@ LIBC_SLIBDIR_RTLDDIR([lib64], [lib64]) + # Define default-abi according to compiler flags. + AC_CACHE_CHECK([whether the compiler is using the PowerPC64 ELFv2 ABI], + [libc_cv_ppc64_elfv2_abi], +- [AC_EGREP_CPP(yes,[#if _CALL_ELF == 2 +- yes ++ [AC_EGREP_CPP(use_ppc_elfv2_abi,[#if _CALL_ELF == 2 ++ use_ppc_elfv2_abi + #endif + ], libc_cv_ppc64_elfv2_abi=yes, libc_cv_ppc64_elfv2_abi=no)]) + if test $libc_cv_ppc64_elfv2_abi = yes; then +@@ -19,8 +19,8 @@ else + # Compiler that do not support ELFv2 ABI does not define _CALL_ELF + AC_CACHE_CHECK([whether the compiler defines _CALL_ELF], + [libc_cv_ppc64_def_call_elf], +- [AC_EGREP_CPP(yes,[#ifdef _CALL_ELF +- yes ++ [AC_EGREP_CPP(is_def_call_elf,[#ifdef _CALL_ELF ++ is_def_call_elf + #endif + ], libc_cv_ppc64_def_call_elf=yes, libc_cv_ppc64_def_call_elf=no)]) + if test $libc_cv_ppc64_def_call_elf = no; then diff --git a/meta-openeuler/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch b/meta-openeuler/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch new file mode 100644 index 00000000000..ffbe138ff1c --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0010-eglibc-Cross-building-and-testing-instructions.patch @@ -0,0 +1,616 @@ +From 9625e90bdf35774c71f1e566e73d435e38c04171 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:42:58 +0000 +Subject: [PATCH] eglibc: Cross building and testing instructions + +Ported from eglibc +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + GLIBC.cross-building | 383 +++++++++++++++++++++++++++++++++++++++++++ + GLIBC.cross-testing | 205 +++++++++++++++++++++++ + 2 files changed, 588 insertions(+) + create mode 100644 GLIBC.cross-building + create mode 100644 GLIBC.cross-testing + +diff --git a/GLIBC.cross-building b/GLIBC.cross-building +new file mode 100644 +index 0000000000..e6e0da1aaf +--- /dev/null ++++ b/GLIBC.cross-building +@@ -0,0 +1,383 @@ ++ -*- mode: text -*- ++ ++ Cross-Compiling GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Most GNU tools have a simple build procedure: you run their ++'configure' script, and then you run 'make'. Unfortunately, the ++process of cross-compiling the GNU C library is quite a bit more ++involved: ++ ++1) Build a cross-compiler, with certain facilities disabled. ++ ++2) Configure the C library using the compiler you built in step 1). ++ Build a few of the C run-time object files, but not the rest of the ++ library. Install the library's header files and the run-time ++ object files, and create a dummy libc.so. ++ ++3) Build a second cross-compiler, using the header files and object ++ files you installed in step 2. ++ ++4) Configure, build, and install a fresh C library, using the compiler ++ built in step 3. ++ ++5) Build a third cross-compiler, based on the C library built in step 4. ++ ++The reason for this complexity is that, although GCC and the GNU C ++library are distributed separately, they are not actually independent ++of each other: GCC requires the C library's headers and some object ++files to compile its own libraries, while the C library depends on ++GCC's libraries. GLIBC includes features and bug fixes to the stock ++GNU C library that simplify this process, but the fundamental ++interdependency stands. ++ ++In this document, we explain how to cross-compile an GLIBC/GCC pair ++from source. Our intended audience is developers who are already ++familiar with the GNU toolchain and comfortable working with ++cross-development tools. While we do present a worked example to ++accompany the explanation, for clarity's sake we do not cover many of ++the options available to cross-toolchain users. ++ ++ ++Preparation ++ ++GLIBC requires recent versions of the GNU binutils, GCC, and the ++Linux kernel. The web page ++documents the current requirements, and lists patches needed for ++certain target architectures. As of this writing, these build ++instructions have been tested with binutils 2.22.51, GCC 4.6.2, ++and Linux 3.1. ++ ++First, let's set some variables, to simplify later commands. We'll ++build GLIBC and GCC for an ARM target, known to the Linux kernel ++as 'arm', and we'll do the build on an Intel x86_64 Linux box: ++ ++ $ build=x86_64-pc-linux-gnu ++ $ host=$build ++ $ target=arm-none-linux-gnueabi ++ $ linux_arch=arm ++ ++We're using the aforementioned versions of Binutils, GCC, and Linux: ++ ++ $ binutilsv=binutils-2.22.51 ++ $ gccv=gcc-4.6.2 ++ $ linuxv=linux-3.1 ++ ++We're carrying out the entire process under '~/cross-build', which ++contains unpacked source trees for binutils, gcc, and linux kernel, ++along with GLIBC svn trunk (which can be checked-out with ++'svn co http://www.eglibc.org/svn/trunk eglibc'): ++ ++ $ top=$HOME/cross-build/$target ++ $ src=$HOME/cross-build/src ++ $ ls $src ++ binutils-2.22.51 glibc gcc-4.6.2 linux-3.1 ++ ++We're going to place our build directories in a subdirectory 'obj', ++we'll install the cross-development toolchain in 'tools', and we'll ++place our sysroot (containing files to be installed on the target ++system) in 'sysroot': ++ ++ $ obj=$top/obj ++ $ tools=$top/tools ++ $ sysroot=$top/sysroot ++ ++ ++Binutils ++ ++Configuring and building binutils for the target is straightforward: ++ ++ $ mkdir -p $obj/binutils ++ $ cd $obj/binutils ++ $ $src/$binutilsv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot ++ $ make ++ $ make install ++ ++ ++The First GCC ++ ++For our work, we need a cross-compiler targeting an ARM Linux ++system. However, that configuration includes the shared library ++'libgcc_s.so', which is compiled against the GLIBC headers (which we ++haven't installed yet) and linked against 'libc.so' (which we haven't ++built yet). ++ ++Fortunately, there are configuration options for GCC which tell it not ++to build 'libgcc_s.so'. The '--without-headers' option is supposed to ++take care of this, but its implementation is incomplete, so you must ++also configure with the '--with-newlib' option. While '--with-newlib' ++appears to mean "Use the Newlib C library", its effect is to tell the ++GCC build machinery, "Don't assume there is a C library available." ++ ++We also need to disable some of the libraries that would normally be ++built along with GCC, and specify that only the compiler for the C ++language is needed. ++ ++So, we create a build directory, configure, make, and install. ++ ++ $ mkdir -p $obj/gcc1 ++ $ cd $obj/gcc1 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --without-headers --with-newlib \ ++ > --disable-shared --disable-threads --disable-libssp \ ++ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ ++ > --disable-decimal-float --disable-libffi \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++Linux Kernel Headers ++ ++To configure GLIBC, we also need Linux kernel headers in place. ++Fortunately, the Linux makefiles have a target that installs them for ++us. Since the process does modify the source tree a bit, we make a ++copy first: ++ ++ $ cp -r $src/$linuxv $obj/linux ++ $ cd $obj/linux ++ ++Now we're ready to install the headers into the sysroot: ++ ++ $ PATH=$tools/bin:$PATH \ ++ > make headers_install \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ > INSTALL_HDR_PATH=$sysroot/usr ++ ++ ++GLIBC Headers and Preliminary Objects ++ ++Using the cross-compiler we've just built, we can now configure GLIBC ++well enough to install the headers and build the object files that the ++full cross-compiler will need: ++ ++ $ mkdir -p $obj/glibc-headers ++ $ cd $obj/glibc-headers ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++The option '--prefix=/usr' may look strange, but you should never ++configure GLIBC with a prefix other than '/usr': in various places, ++GLIBC's build system checks whether the prefix is '/usr', and does ++special handling only if that is the case. Unless you use this ++prefix, you will get a sysroot that does not use the standard Linux ++directory layouts and cannot be used as a basis for the root ++filesystem on your target system compatibly with normal GLIBC ++installations. ++ ++The '--with-headers' option tells GLIBC where the Linux headers have ++been installed. ++ ++The '--enable-add-ons=nptl,libidn,../ports' option tells GLIBC to look ++for the listed glibc add-ons. Most notably the ports add-on (located ++just above the libc sources in the GLIBC svn tree) is required to ++support ARM targets. ++ ++We can now use the 'install-headers' makefile target to install the ++headers: ++ ++ $ make install-headers install_root=$sysroot \ ++ > install-bootstrap-headers=yes ++ ++The 'install_root' variable indicates where the files should actually ++be installed; its value is treated as the parent of the '--prefix' ++directory we passed to the configure script, so the headers will go in ++'$sysroot/usr/include'. The 'install-bootstrap-headers' variable ++requests special handling for certain tricky header files. ++ ++Next, there are a few object files needed to link shared libraries, ++which we build and install by hand: ++ ++ $ mkdir -p $sysroot/usr/lib ++ $ make csu/subdir_lib ++ $ cp csu/crt1.o csu/crti.o csu/crtn.o $sysroot/usr/lib ++ ++Finally, 'libgcc_s.so' requires a 'libc.so' to link against. However, ++since we will never actually execute its code, it doesn't matter what ++it contains. So, treating '/dev/null' as a C source file, we produce ++a dummy 'libc.so' in one step: ++ ++ $ $tools/bin/$target-gcc -nostdlib -nostartfiles -shared -x c /dev/null \ ++ > -o $sysroot/usr/lib/libc.so ++ ++ ++The Second GCC ++ ++With the GLIBC headers and selected object files installed, we can ++now build a GCC that is capable of compiling GLIBC. We configure, ++build, and install the second GCC, again building only the C compiler, ++and avoiding libraries we won't use: ++ ++ $ mkdir -p $obj/gcc2 ++ $ cd $obj/gcc2 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --disable-libffi --disable-libquadmath \ ++ > --enable-languages=c ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++ ++GLIBC, Complete ++ ++With the second compiler built and installed, we're now ready for the ++full GLIBC build: ++ ++ $ mkdir -p $obj/glibc ++ $ cd $obj/glibc ++ $ BUILD_CC=gcc \ ++ > CC=$tools/bin/$target-gcc \ ++ > CXX=$tools/bin/$target-g++ \ ++ > AR=$tools/bin/$target-ar \ ++ > RANLIB=$tools/bin/$target-ranlib \ ++ > $src/glibc/libc/configure \ ++ > --prefix=/usr \ ++ > --with-headers=$sysroot/usr/include \ ++ > --with-kconfig=$obj/linux/scripts/kconfig \ ++ > --build=$build \ ++ > --host=$target \ ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports ++ ++Note the additional '--with-kconfig' option. This tells GLIBC where to ++find the host config tools used by the kernel 'make config' and 'make ++menuconfig'. These tools can be re-used by GLIBC for its own 'make ++*config' support, which will create 'option-groups.config' for you. ++But first make sure those tools have been built by running some ++dummy 'make *config' calls in the kernel directory: ++ ++ $ cd $obj/linux ++ $ PATH=$tools/bin:$PATH make config \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ $ PATH=$tools/bin:$PATH make menuconfig \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ ++Now we can configure and build the full GLIBC: ++ ++ $ cd $obj/glibc ++ $ PATH=$tools/bin:$PATH make defconfig ++ $ PATH=$tools/bin:$PATH make menuconfig ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install install_root=$sysroot ++ ++At this point, we have a complete GLIBC installation in '$sysroot', ++with header files, library files, and most of the C runtime startup ++files in place. ++ ++ ++The Third GCC ++ ++Finally, we recompile GCC against this full installation, enabling ++whatever languages and libraries we would like to use: ++ ++ $ mkdir -p $obj/gcc3 ++ $ cd $obj/gcc3 ++ $ $src/$gccv/configure \ ++ > --target=$target \ ++ > --prefix=$tools \ ++ > --with-sysroot=$sysroot \ ++ > --enable-__cxa_atexit \ ++ > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --enable-languages=c,c++ ++ $ PATH=$tools/bin:$PATH make ++ $ PATH=$tools/bin:$PATH make install ++ ++The '--enable-__cxa_atexit' option tells GCC what sort of C++ ++destructor support to expect from the C library; it's required with ++GLIBC. ++ ++And since GCC's installation process isn't designed to help construct ++sysroot trees, we must manually copy certain libraries into place in ++the sysroot. ++ ++ $ cp -d $tools/$target/lib/libgcc_s.so* $sysroot/lib ++ $ cp -d $tools/$target/lib/libstdc++.so* $sysroot/usr/lib ++ ++ ++Trying Things Out ++ ++At this point, '$tools' contains a cross toolchain ready to use ++the GLIBC installation in '$sysroot': ++ ++ $ cat > hello.c < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > puts ("Hello, world!"); ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-gcc -Wall hello.c -o hello ++ $ cat > c++-hello.cc < #include ++ > int ++ > main (int argc, char **argv) ++ > { ++ > std::cout << "Hello, C++ world!" << std::endl; ++ > return 0; ++ > } ++ > EOF ++ $ $tools/bin/$target-g++ -Wall c++-hello.cc -o c++-hello ++ ++ ++We can use 'readelf' to verify that these are indeed executables for ++our target, using our dynamic linker: ++ ++ $ $tools/bin/$target-readelf -hl hello ++ ELF Header: ++ ... ++ Type: EXEC (Executable file) ++ Machine: ARM ++ ++ ... ++ Program Headers: ++ Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align ++ PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 ++ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 ++ [Requesting program interpreter: /lib/ld-linux.so.3] ++ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 ++ ... ++ ++Looking at the dynamic section of the installed 'libgcc_s.so', we see ++that the 'NEEDED' entry for the C library does include the '.6' ++suffix, indicating that was linked against our fully build GLIBC, and ++not our dummy 'libc.so': ++ ++ $ $tools/bin/$target-readelf -d $sysroot/lib/libgcc_s.so.1 ++ Dynamic section at offset 0x1083c contains 24 entries: ++ Tag Type Name/Value ++ 0x00000001 (NEEDED) Shared library: [libc.so.6] ++ 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] ++ ... ++ ++ ++And on the target machine, we can run our programs: ++ ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./hello ++ Hello, world! ++ $ $sysroot/lib/ld.so.1 --library-path $sysroot/lib:$sysroot/usr/lib \ ++ > ./c++-hello ++ Hello, C++ world! +diff --git a/GLIBC.cross-testing b/GLIBC.cross-testing +new file mode 100644 +index 0000000000..b67b468466 +--- /dev/null ++++ b/GLIBC.cross-testing +@@ -0,0 +1,205 @@ ++ -*- mode: text -*- ++ ++ Cross-Testing With GLIBC ++ Jim Blandy ++ ++ ++Introduction ++ ++Developers writing software for embedded systems often use a desktop ++or other similarly capable computer for development, but need to run ++tests on the embedded system, or perhaps on a simulator. When ++configured for cross-compilation, the stock GNU C library simply ++disables running tests altogether: the command 'make tests' builds ++test programs, but does not run them. GLIBC, however, provides ++facilities for compiling tests and generating data files on the build ++system, but running the test programs themselves on a remote system or ++simulator. ++ ++ ++Test environment requirements ++ ++The test environment must meet certain conditions for GLIBC's ++cross-testing facilities to work: ++ ++- Shared filesystems. The 'build' system, on which you configure and ++ compile GLIBC, and the 'host' system, on which you intend to run ++ GLIBC, must share a filesystem containing the GLIBC build and ++ source trees. Files must appear at the same paths on both systems. ++ ++- Remote-shell like invocation. There must be a way to run a program ++ on the host system from the build system, passing it properly quoted ++ command-line arguments, setting environment variables, and ++ inheriting the caller's standard input and output. ++ ++ ++Usage ++ ++To use GLIBC's cross-testing support, provide values for the ++following Make variables when you invoke 'make': ++ ++- cross-test-wrapper ++ ++ This should be the name of the cross-testing wrapper command, along ++ with any arguments. ++ ++- cross-localedef ++ ++ This should be the name of a cross-capable localedef program, like ++ that included in the GLIBC 'localedef' module, along with any ++ arguments needed. ++ ++These are each explained in detail below. ++ ++ ++The Cross-Testing Wrapper ++ ++To run test programs reliably, the stock GNU C library takes care to ++ensure that test programs use the newly compiled dynamic linker and ++shared libraries, and never the host system's installed libraries. To ++accomplish this, it runs the tests by explicitly invoking the dynamic ++linker from the build tree, passing it a list of build tree ++directories to search for shared libraries, followed by the name of ++the executable to run and its arguments. ++ ++For example, where one might normally run a test program like this: ++ ++ $ ./tst-foo arg1 arg2 ++ ++the GNU C library might run that program like this: ++ ++ $ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++(where $objdir is the path to the top of the build tree, and the ++trailing backslash indicates a continuation of the command). In other ++words, each test program invocation is 'wrapped up' inside an explicit ++invocation of the dynamic linker, which must itself execute the test ++program, having loaded shared libraries from the appropriate ++directories. ++ ++To support cross-testing, GLIBC allows the developer to optionally ++set the 'cross-test-wrapper' Make variable to another wrapper command, ++to which it passes the entire dynamic linker invocation shown above as ++arguments. For example, if the developer supplies a wrapper of ++'my-wrapper hostname', then GLIBC would run the test above as ++follows: ++ ++ $ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++The 'my-wrapper' command is responsible for executing the command ++given on the host system. ++ ++Since tests are run in varying directories, the wrapper should either ++be in your command search path, or 'cross-test-wrapper' should give an ++absolute path for the wrapper. ++ ++The wrapper must meet several requirements: ++ ++- It must preserve the current directory. As explained above, the ++ build directory tree must be visible on both the build and host ++ systems, at the same path. The test wrapper must ensure that the ++ current directory it inherits is also inherited by the dynamic ++ linker (and thus the test program itself). ++ ++- It must preserve environment variables' values. Many GLIBC tests ++ set environment variables for test runs; in native testing, it ++ invokes programs like this: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ With the cross-testing wrapper, that invocation becomes: ++ ++ $ GCONV_PATH=$objdir/iconvdata \ ++ my-wrapper hostname \ ++ $objdir/elf/ld-linux.so.3 --library-path $objdir \ ++ ./tst-foo arg1 arg2 ++ ++ Here, 'my-wrapper' must ensure that the value it sees for ++ 'GCONV_PATH' will be seen by the dynamic linker, and thus 'tst-foo' ++ itself. (The wrapper supplied with GLIBC simply preserves the ++ values of *all* enviroment variables, with a fixed set of ++ exceptions.) ++ ++ If your wrapper is a shell script, take care to correctly propagate ++ environment variables whose values contain spaces and shell ++ metacharacters. ++ ++- It must pass the command's arguments, unmodified. The arguments ++ seen by the test program should be exactly those seen by the wrapper ++ (after whatever arguments are given to the wrapper itself). The ++ GLIBC test framework performs all needed shell word splitting and ++ expansion (wildcard expansion, parameter substitution, and so on) ++ before invoking the wrapper; further expansion may break the tests. ++ ++ ++The 'cross-test-ssh.sh' script ++ ++If you want to use 'ssh' (or something sufficiently similar) to run ++test programs on your host system, GLIBC includes a shell script, ++'scripts/cross-test-ssh.sh', which you can use as your wrapper ++command. This script takes care of setting the test command's current ++directory, propagating environment variable values, and carrying ++command-line arguments, all across an 'ssh' connection. You may even ++supply an alternative to 'ssh' on the command line, if needed. ++ ++For more details, pass 'cross-test-ssh.sh' the '--help' option. ++ ++ ++The Cross-Compiling Locale Definition Command ++ ++Some GLIBC tests rely on locales generated especially for the test ++process. In a native configuration, these tests simply run the ++'localedef' command built by the normal GLIBC build process, ++'locale/localedef', to process and install their locales. However, in ++a cross-compiling configuration, this 'localedef' is built for the ++host system, not the build system, and since it requires quite a bit ++of memory to run (we have seen it fail on systems with 64MiB of ++memory), it may not be practical to run it on the host system. ++ ++If set, GLIBC uses the 'cross-localedef' Make variable as the command ++to run on the build system to process and install locales. The ++localedef program built from the GLIBC 'localedef' module is ++suitable. ++ ++The value of 'cross-localedef' may also include command-line arguments ++to be passed to the program; if you are using GLIBC's 'localedef', ++you may include endianness and 'uint32_t' alignment arguments here. ++ ++ ++Example ++ ++In developing GLIBC's cross-testing facility, we invoked 'make' with ++the following script: ++ ++ #!/bin/sh ++ ++ srcdir=... ++ test_hostname=... ++ localedefdir=... ++ cross_gxx=...-g++ ++ ++ wrapper="$srcdir/scripts/cross-test-ssh.sh $test_hostname" ++ localedef="$localedefdir/localedef --little-endian --uint32-align=4" ++ ++ make cross-test-wrapper="$wrapper" \ ++ cross-localedef="$localedef" \ ++ CXX="$cross_gxx" \ ++ "$@" ++ ++ ++Other Cross-Testing Concerns ++ ++Here are notes on some other issues which you may encounter in running ++the GLIBC tests in a cross-compiling environment: ++ ++- Some tests require a C++ cross-compiler; you should set the 'CXX' ++ Make variable to the name of an appropriate cross-compiler. ++ ++- Some tests require access to libstdc++.so.6 and libgcc_s.so.1; we ++ simply place copies of these libraries in the top GLIBC build ++ directory. diff --git a/meta-openeuler/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch b/meta-openeuler/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch new file mode 100644 index 00000000000..88017bd29b0 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0011-eglibc-Help-bootstrap-cross-toolchain.patch @@ -0,0 +1,97 @@ +From cf2126b2d6e073137a3a7d9bcc261e0a760a82da Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:49:28 +0000 +Subject: [PATCH] eglibc: Help bootstrap cross toolchain + +Taken from EGLIBC, r1484 + r1525 + + 2007-02-20 Jim Blandy + + * Makefile (install-headers): Preserve old behavior: depend on + $(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers + is set; otherwise, place gnu/stubs.h on the 'install-others' list. + + 2007-02-16 Jim Blandy + + * Makefile: Amend make install-headers to install everything + necessary for building a cross-compiler. Install gnu/stubs.h as + part of 'install-headers', not 'install-others'. + If install-bootstrap-headers is 'yes', install a dummy copy of + gnu/stubs.h, instead of computing the real thing. + * include/stubs-bootstrap.h: New file. + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + Makefile | 22 +++++++++++++++++++++- + include/stubs-bootstrap.h | 12 ++++++++++++ + 2 files changed, 33 insertions(+), 1 deletion(-) + create mode 100644 include/stubs-bootstrap.h + +diff --git a/Makefile b/Makefile +index c6d4817a9e..b4b0e23560 100644 +--- a/Makefile ++++ b/Makefile +@@ -79,9 +79,18 @@ subdir-dirs = include + vpath %.h $(subdir-dirs) + + # What to install. +-install-others = $(inst_includedir)/gnu/stubs.h + install-bin-script = + ++# If we're bootstrapping, install a dummy gnu/stubs.h along with the ++# other headers, so 'make install-headers' produces a useable include ++# tree. Otherwise, install gnu/stubs.h later, after the rest of the ++# build is done. ++ifeq ($(install-bootstrap-headers),yes) ++install-headers: $(inst_includedir)/gnu/stubs.h ++else ++install-others = $(inst_includedir)/gnu/stubs.h ++endif ++ + ifeq (yes,$(build-shared)) + headers += gnu/lib-names.h + endif +@@ -421,6 +430,16 @@ others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh + + subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs) + ++# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o ++# files in EGLIBC. For bootstrapping a GCC/EGLIBC pair, an empty ++# gnu/stubs.h is good enough. ++ifeq ($(install-bootstrap-headers),yes) ++$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force) ++ $(make-target-directory) ++ $(INSTALL_DATA) $< $@ ++ ++installed-stubs = ++else + ifndef abi-variants + installed-stubs = $(inst_includedir)/gnu/stubs.h + else +@@ -447,6 +466,7 @@ $(inst_includedir)/gnu/stubs.h: $(+force) + + install-others-nosubdir: $(installed-stubs) + endif ++endif + + + # Since stubs.h is never needed when building the library, we simplify the +diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h +new file mode 100644 +index 0000000000..1d2b669aff +--- /dev/null ++++ b/include/stubs-bootstrap.h +@@ -0,0 +1,12 @@ ++/* Placeholder stubs.h file for bootstrapping. ++ ++ When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC ++ headers be installed, but we can't fully build EGLIBC without that ++ GCC. So we run the command: ++ ++ make install-headers install-bootstrap-headers=yes ++ ++ to install the headers GCC needs, but avoid building certain ++ difficult headers. The header depends, via the ++ EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but ++ an empty stubs.h like this will do fine for GCC. */ diff --git a/meta-openeuler/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch b/meta-openeuler/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch new file mode 100644 index 00000000000..fee020cc4cc --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0012-eglibc-Resolve-__fpscr_values-on-SH4.patch @@ -0,0 +1,53 @@ +From 61948c02226acea68d34313cc6286ee1ab44a98c Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:55:53 +0000 +Subject: [PATCH] eglibc: Resolve __fpscr_values on SH4 + +2010-09-29 Nobuhiro Iwamatsu + Andrew Stubbs + + Resolve SH's __fpscr_values to symbol in libc.so. + + * sysdeps/sh/sh4/fpu/fpu_control.h: Add C++ __set_fpscr prototype. + * sysdeps/unix/sysv/linux/sh/Versions (GLIBC_2.2): Add __fpscr_values. + * sysdeps/unix/sysv/linux/sh/sysdep.S (___fpscr_values): New constant. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/sh/Versions | 1 + + sysdeps/unix/sysv/linux/sh/sysdep.S | 11 +++++++++++ + 2 files changed, 12 insertions(+) + +diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions +index 3ad702e165..931985b5d6 100644 +--- a/sysdeps/unix/sysv/linux/sh/Versions ++++ b/sysdeps/unix/sysv/linux/sh/Versions +@@ -3,6 +3,7 @@ libc { + GLIBC_2.2 { + # functions used in other libraries + __xstat64; __fxstat64; __lxstat64; ++ __fpscr_values; + + # a* + alphasort64; +diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S +index 9d85ff99a0..6bda921ca3 100644 +--- a/sysdeps/unix/sysv/linux/sh/sysdep.S ++++ b/sysdeps/unix/sysv/linux/sh/sysdep.S +@@ -30,3 +30,14 @@ ENTRY (__syscall_error) + + #define __syscall_error __syscall_error_1 + #include ++ ++ .data ++ .align 3 ++ .globl ___fpscr_values ++ .type ___fpscr_values, @object ++ .size ___fpscr_values, 8 ++___fpscr_values: ++ .long 0 ++ .long 0x80000 ++weak_alias (___fpscr_values, __fpscr_values) ++ diff --git a/meta-openeuler/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch b/meta-openeuler/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch new file mode 100644 index 00000000000..60bcab0fecd --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0013-eglibc-Forward-port-cross-locale-generation-support.patch @@ -0,0 +1,560 @@ +From befa58c48a8ba664e7bbdfcf22e2a15efa2e0d17 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 01:33:49 +0000 +Subject: [PATCH] eglibc: Forward port cross locale generation support + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + locale/Makefile | 3 +- + locale/catnames.c | 46 +++++++++++++++++++++++++++ + locale/localeinfo.h | 2 +- + locale/programs/charmap-dir.c | 6 ++++ + locale/programs/ld-collate.c | 17 +++++----- + locale/programs/ld-ctype.c | 27 ++++++++-------- + locale/programs/ld-time.c | 31 ++++++++++++------ + locale/programs/linereader.c | 2 +- + locale/programs/localedef.c | 8 +++++ + locale/programs/locfile.c | 5 ++- + locale/programs/locfile.h | 59 +++++++++++++++++++++++++++++++++-- + locale/setlocale.c | 29 ----------------- + 12 files changed, 167 insertions(+), 68 deletions(-) + create mode 100644 locale/catnames.c + +diff --git a/locale/Makefile b/locale/Makefile +index d7036b0855..ed795e2710 100644 +--- a/locale/Makefile ++++ b/locale/Makefile +@@ -26,7 +26,8 @@ headers = langinfo.h locale.h bits/locale.h \ + bits/types/locale_t.h bits/types/__locale_t.h + routines = setlocale findlocale loadlocale loadarchive \ + localeconv nl_langinfo nl_langinfo_l mb_cur_max \ +- newlocale duplocale freelocale uselocale ++ newlocale duplocale freelocale uselocale \ ++ catnames + tests = tst-C-locale tst-locname tst-duplocale + tests-container = tst-localedef-path-norm + categories = ctype messages monetary numeric time paper name \ +diff --git a/locale/catnames.c b/locale/catnames.c +new file mode 100644 +index 0000000000..538f3f5edb +--- /dev/null ++++ b/locale/catnames.c +@@ -0,0 +1,46 @@ ++/* Copyright (C) 2006 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include "localeinfo.h" ++ ++/* Define an array of category names (also the environment variable names). */ ++const struct catnamestr_t _nl_category_names attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ category_name, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ }; ++ ++/* An array of their lengths, for convenience. */ ++const uint8_t _nl_category_name_sizes[] attribute_hidden = ++ { ++#define DEFINE_CATEGORY(category, category_name, items, a) \ ++ [category] = sizeof (category_name) - 1, ++#include "categories.def" ++#undef DEFINE_CATEGORY ++ [LC_ALL] = sizeof ("LC_ALL") - 1 ++ }; +diff --git a/locale/localeinfo.h b/locale/localeinfo.h +index 7a930079a5..05d7848d29 100644 +--- a/locale/localeinfo.h ++++ b/locale/localeinfo.h +@@ -246,7 +246,7 @@ __libc_tsd_define (extern, locale_t, LOCALE) + unused. We can manage this playing some tricks with weak references. + But with thread-local locale settings, it becomes quite ungainly unless + we can use __thread variables. So only in that case do we attempt this. */ +-#ifndef SHARED ++#if !defined SHARED && !defined IN_GLIBC_LOCALEDEF + # include + # define NL_CURRENT_INDIRECT 1 + #endif +diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c +index 9582f2d167..8f9f3f582c 100644 +--- a/locale/programs/charmap-dir.c ++++ b/locale/programs/charmap-dir.c +@@ -18,7 +18,9 @@ + #include + #include + #include ++#ifndef NO_UNCOMPRESS + #include ++#endif + #include + #include + #include +@@ -154,6 +156,7 @@ charmap_closedir (CHARMAP_DIR *cdir) + return closedir (dir); + } + ++#ifndef NO_UNCOMPRESS + /* Creates a subprocess decompressing the given pathname, and returns + a stream reading its output (the decompressed data). */ + static +@@ -202,6 +205,7 @@ fopen_uncompressed (const char *pathname, const char *compressor) + } + return NULL; + } ++#endif + + /* Opens a charmap for reading, given its name (not an alias name). */ + FILE * +@@ -224,6 +228,7 @@ charmap_open (const char *directory, const char *name) + if (stream != NULL) + return stream; + ++#ifndef NO_UNCOMPRESS + memcpy (p, ".gz", 4); + stream = fopen_uncompressed (pathname, "gzip"); + if (stream != NULL) +@@ -233,6 +238,7 @@ charmap_open (const char *directory, const char *name) + stream = fopen_uncompressed (pathname, "bzip2"); + if (stream != NULL) + return stream; ++#endif + + return NULL; + } +diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c +index 2c9f540bf1..c937cfd2ab 100644 +--- a/locale/programs/ld-collate.c ++++ b/locale/programs/ld-collate.c +@@ -352,7 +352,7 @@ new_element (struct locale_collate_t *collate, const char *mbs, size_t mbslen, + } + if (wcs != NULL) + { +- size_t nwcs = wcslen ((wchar_t *) wcs); ++ size_t nwcs = wcslen_uint32 (wcs); + uint32_t zero = 0; + /* Handle as a single character. */ + if (nwcs == 0) +@@ -1776,8 +1776,7 @@ symbol `%s' has the same encoding as"), (*eptr)->name); + + if ((*eptr)->nwcs == runp->nwcs) + { +- int c = wmemcmp ((wchar_t *) (*eptr)->wcs, +- (wchar_t *) runp->wcs, runp->nwcs); ++ int c = wmemcmp_uint32 ((*eptr)->wcs, runp->wcs, runp->nwcs); + + if (c == 0) + { +@@ -2004,9 +2003,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + one consecutive entry. */ + if (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)) + { +@@ -2030,9 +2029,9 @@ add_to_tablewc (uint32_t ch, struct element_t *runp) + runp = runp->wcnext; + while (runp->wcnext != NULL + && runp->nwcs == runp->wcnext->nwcs +- && wmemcmp ((wchar_t *) runp->wcs, +- (wchar_t *)runp->wcnext->wcs, +- runp->nwcs - 1) == 0 ++ && wmemcmp_uint32 (runp->wcs, ++ runp->wcnext->wcs, ++ runp->nwcs - 1) == 0 + && (runp->wcs[runp->nwcs - 1] + == runp->wcnext->wcs[runp->nwcs - 1] + 1)); + +diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c +index d285b72611..4bf01fa3db 100644 +--- a/locale/programs/ld-ctype.c ++++ b/locale/programs/ld-ctype.c +@@ -914,7 +914,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, + allocate_arrays (ctype, charmap, ctype->repertoire); + + default_missing_len = (ctype->default_missing +- ? wcslen ((wchar_t *) ctype->default_missing) ++ ? wcslen_uint32 (ctype->default_missing) + : 0); + + init_locale_data (&file, nelems); +@@ -1926,7 +1926,7 @@ read_translit_entry (struct linereader *ldfile, struct locale_ctype_t *ctype, + ignore = 1; + else + /* This value is usable. */ +- obstack_grow (ob, to_wstr, wcslen ((wchar_t *) to_wstr) * 4); ++ obstack_grow (ob, to_wstr, wcslen_uint32 (to_wstr) * 4); + + first = 0; + } +@@ -2460,8 +2460,8 @@ with character code range values one must use the absolute ellipsis `...'")); + } + + handle_tok_digit: +- class_bit = _ISwdigit; +- class256_bit = _ISdigit; ++ class_bit = BITw (tok_digit); ++ class256_bit = BIT (tok_digit); + handle_digits = 1; + goto read_charclass; + +@@ -3876,8 +3876,7 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + + while (idx < number) + { +- int res = wcscmp ((const wchar_t *) sorted[idx]->from, +- (const wchar_t *) runp->from); ++ int res = wcscmp_uint32 (sorted[idx]->from, runp->from); + if (res == 0) + { + replace = 1; +@@ -3914,11 +3913,11 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + for (size_t cnt = 0; cnt < number; ++cnt) + { + struct translit_to_t *srunp; +- from_len += wcslen ((const wchar_t *) sorted[cnt]->from) + 1; ++ from_len += wcslen_uint32 (sorted[cnt]->from) + 1; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- to_len += wcslen ((const wchar_t *) srunp->str) + 1; ++ to_len += wcslen_uint32 (srunp->str) + 1; + srunp = srunp->next; + } + /* Plus one for the extra NUL character marking the end of +@@ -3942,18 +3941,18 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, + ctype->translit_from_idx[cnt] = from_len; + ctype->translit_to_idx[cnt] = to_len; + +- len = wcslen ((const wchar_t *) sorted[cnt]->from) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_from_tbl[from_len], +- (const wchar_t *) sorted[cnt]->from, len); ++ len = wcslen_uint32 (sorted[cnt]->from) + 1; ++ wmemcpy_uint32 (&ctype->translit_from_tbl[from_len], ++ sorted[cnt]->from, len); + from_len += len; + + ctype->translit_to_idx[cnt] = to_len; + srunp = sorted[cnt]->to; + while (srunp != NULL) + { +- len = wcslen ((const wchar_t *) srunp->str) + 1; +- wmemcpy ((wchar_t *) &ctype->translit_to_tbl[to_len], +- (const wchar_t *) srunp->str, len); ++ len = wcslen_uint32 (srunp->str) + 1; ++ wmemcpy_uint32 (&ctype->translit_to_tbl[to_len], ++ srunp->str, len); + to_len += len; + srunp = srunp->next; + } +diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c +index a590b013b3..5ed4fa0f59 100644 +--- a/locale/programs/ld-time.c ++++ b/locale/programs/ld-time.c +@@ -219,8 +219,10 @@ No definition for %s category found"), "LC_TIME"); + } + else + { ++ static const uint32_t wt_fmt_ampm[] ++ = { '%','I',':','%','M',':','%','S',' ','%','p',0 }; + time->t_fmt_ampm = "%I:%M:%S %p"; +- time->wt_fmt_ampm = (const uint32_t *) L"%I:%M:%S %p"; ++ time->wt_fmt_ampm = wt_fmt_ampm; + } + } + +@@ -230,7 +232,7 @@ No definition for %s category found"), "LC_TIME"); + const int days_per_month[12] = { 31, 29, 31, 30, 31, 30, + 31, 31, 30, 31 ,30, 31 }; + size_t idx; +- wchar_t *wstr; ++ uint32_t *wstr; + + time->era_entries = + (struct era_data *) xmalloc (time->num_era +@@ -456,18 +458,18 @@ No definition for %s category found"), "LC_TIME"); + } + + /* Now generate the wide character name and format. */ +- wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ +- wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ ++ wstr = wcschr_uint32 (time->wera[idx], L':'); /* end direction */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end offset */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end start */ ++ wstr = wstr ? wcschr_uint32 (wstr + 1, L':') : NULL; /* end end */ + if (wstr != NULL) + { +- time->era_entries[idx].wname = (uint32_t *) wstr + 1; +- wstr = wcschr (wstr + 1, L':'); /* end name */ ++ time->era_entries[idx].wname = wstr + 1; ++ wstr = wcschr_uint32 (wstr + 1, L':'); /* end name */ + if (wstr != NULL) + { + *wstr = L'\0'; +- time->era_entries[idx].wformat = (uint32_t *) wstr + 1; ++ time->era_entries[idx].wformat = wstr + 1; + } + else + time->era_entries[idx].wname = +@@ -526,7 +528,16 @@ No definition for %s category found"), "LC_TIME"); + if (time->date_fmt == NULL) + time->date_fmt = "%a %b %e %H:%M:%S %Z %Y"; + if (time->wdate_fmt == NULL) +- time->wdate_fmt = (const uint32_t *) L"%a %b %e %H:%M:%S %Z %Y"; ++ { ++ static const uint32_t wdate_fmt[] = ++ { '%','a',' ', ++ '%','b',' ', ++ '%','e',' ', ++ '%','H',':','%','M',':','%','S',' ', ++ '%','Z',' ', ++ '%','Y',0 }; ++ time->wdate_fmt = wdate_fmt; ++ } + } + + +diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c +index f8c49ac06f..ddda006037 100644 +--- a/locale/programs/linereader.c ++++ b/locale/programs/linereader.c +@@ -776,7 +776,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, + { + int return_widestr = lr->return_widestr; + struct lr_buffer lrb; +- wchar_t *buf2 = NULL; ++ uint32_t *buf2 = NULL; + + lr_buffer_init (&lrb); + +diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c +index 1b751bb7be..c255e2b436 100644 +--- a/locale/programs/localedef.c ++++ b/locale/programs/localedef.c +@@ -108,6 +108,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version; + #define OPT_NO_WARN 402 + #define OPT_WARN 403 + #define OPT_NO_HARD_LINKS 404 ++#define OPT_UINT32_ALIGN 405 + + /* Definitions of arguments for argp functions. */ + static const struct argp_option options[] = +@@ -152,6 +153,8 @@ static const struct argp_option options[] = + N_("Generate little-endian output") }, + { "big-endian", OPT_BIG_ENDIAN, NULL, 0, + N_("Generate big-endian output") }, ++ { "uint32-align", OPT_UINT32_ALIGN, "ALIGNMENT", 0, ++ N_("Set the target's uint32_t alignment in bytes (default 4)") }, + { NULL, 0, NULL, 0, NULL } + }; + +@@ -242,12 +245,14 @@ main (int argc, char *argv[]) + ctype locale. (P1003.2 4.35.5.2) */ + setlocale (LC_CTYPE, "POSIX"); + ++#ifndef NO_SYSCONF + /* Look whether the system really allows locale definitions. POSIX + defines error code 3 for this situation so I think it must be + a fatal error (see P1003.2 4.35.8). */ + if (sysconf (_SC_2_LOCALEDEF) < 0) + record_error (3, 0, _("\ + FATAL: system does not define `_POSIX2_LOCALEDEF'")); ++#endif + + /* Process charmap file. */ + charmap = charmap_read (charmap_file, verbose, 1, be_quiet, 1); +@@ -399,6 +404,9 @@ parse_opt (int key, char *arg, struct argp_state *state) + /* Do not hard link to other locales. */ + hard_links = false; + break; ++ case OPT_UINT32_ALIGN: ++ uint32_align_mask = strtol (arg, NULL, 0) - 1; ++ break; + case 'c': + force_output = 1; + break; +diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c +index e3eef59295..711d6fbea0 100644 +--- a/locale/programs/locfile.c ++++ b/locale/programs/locfile.c +@@ -543,6 +543,9 @@ compare_files (const char *filename1, const char *filename2, size_t size, + machine running localedef. */ + bool swap_endianness_p; + ++/* The target's value of __align__(uint32_t) - 1. */ ++unsigned int uint32_align_mask = 3; ++ + /* When called outside a start_locale_structure/end_locale_structure + or start_locale_prelude/end_locale_prelude block, record that the + next byte in FILE's obstack will be the first byte of a new element. +@@ -620,7 +623,7 @@ add_locale_string (struct locale_file *file, const char *string) + void + add_locale_wstring (struct locale_file *file, const uint32_t *string) + { +- add_locale_uint32_array (file, string, wcslen ((const wchar_t *) string) + 1); ++ add_locale_uint32_array (file, string, wcslen_uint32 (string) + 1); + } + + /* Record that FILE's next element is the 32-bit integer VALUE. */ +diff --git a/locale/programs/locfile.h b/locale/programs/locfile.h +index 5caf5c348f..76856a32c2 100644 +--- a/locale/programs/locfile.h ++++ b/locale/programs/locfile.h +@@ -70,6 +70,8 @@ extern void write_all_categories (struct localedef_t *definitions, + + extern bool swap_endianness_p; + ++extern unsigned int uint32_align_mask; ++ + /* Change the output to be big-endian if BIG_ENDIAN is true and + little-endian otherwise. */ + static inline void +@@ -88,7 +90,8 @@ maybe_swap_uint32 (uint32_t value) + } + + /* Likewise, but munge an array of N uint32_ts starting at ARRAY. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_array (uint32_t *array, size_t n) + { + if (swap_endianness_p) +@@ -98,7 +101,8 @@ maybe_swap_uint32_array (uint32_t *array, size_t n) + + /* Like maybe_swap_uint32_array, but the array of N elements is at + the end of OBSTACK's current object. */ +-static inline void ++static void ++__attribute__ ((unused)) + maybe_swap_uint32_obstack (struct obstack *obstack, size_t n) + { + maybe_swap_uint32_array ((uint32_t *) obstack_next_free (obstack) - n, n); +@@ -275,4 +279,55 @@ extern void identification_output (struct localedef_t *locale, + const struct charmap_t *charmap, + const char *output_path); + ++static size_t wcslen_uint32 (const uint32_t *str) __attribute__ ((unused)); ++static uint32_t * wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++static uint32_t * wcschr_uint32 (const uint32_t *s, uint32_t ch) __attribute__ ((unused)); ++static int wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) __attribute__ ((unused)); ++static int wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) __attribute__ ((unused)); ++ ++static size_t ++wcslen_uint32 (const uint32_t *str) ++{ ++ size_t len = 0; ++ while (str[len] != 0) ++ len++; ++ return len; ++} ++ ++static int ++wmemcmp_uint32 (const uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ while (n-- != 0) ++ { ++ int diff = *s1++ - *s2++; ++ if (diff != 0) ++ return diff; ++ } ++ return 0; ++} ++ ++static int ++wcscmp_uint32 (const uint32_t *s1, const uint32_t *s2) ++{ ++ while (*s1 != 0 && *s1 == *s2) ++ s1++, s2++; ++ return *s1 - *s2; ++} ++ ++static uint32_t * ++wmemcpy_uint32 (uint32_t *s1, const uint32_t *s2, size_t n) ++{ ++ return memcpy (s1, s2, n * sizeof (uint32_t)); ++} ++ ++static uint32_t * ++wcschr_uint32 (const uint32_t *s, uint32_t ch) ++{ ++ do ++ if (*s == ch) ++ return (uint32_t *) s; ++ while (*s++ != 0); ++ return 0; ++} ++ + #endif /* locfile.h */ +diff --git a/locale/setlocale.c b/locale/setlocale.c +index 6a902faa50..17413f0a9c 100644 +--- a/locale/setlocale.c ++++ b/locale/setlocale.c +@@ -63,35 +63,6 @@ static char *const _nl_current_used[] = + + #endif + +- +-/* Define an array of category names (also the environment variable names). */ +-const struct catnamestr_t _nl_category_names attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- category_name, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = offsetof (struct catnamestr_t, CATNAMEMF (__LINE__)), +-#include "categories.def" +-#undef DEFINE_CATEGORY +- }; +- +-/* An array of their lengths, for convenience. */ +-const uint8_t _nl_category_name_sizes[] attribute_hidden = +- { +-#define DEFINE_CATEGORY(category, category_name, items, a) \ +- [category] = sizeof (category_name) - 1, +-#include "categories.def" +-#undef DEFINE_CATEGORY +- [LC_ALL] = sizeof ("LC_ALL") - 1 +- }; +- +- + #ifdef NL_CURRENT_INDIRECT + # define WEAK_POSTLOAD(postload) weak_extern (postload) + #else diff --git a/meta-openeuler/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch b/meta-openeuler/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch new file mode 100644 index 00000000000..3e7d5b74c1b --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch @@ -0,0 +1,80 @@ +From 653b0631f80f17abe01957c06ef8a8d5d189b789 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 3 Aug 2018 09:42:06 -0700 +Subject: [PATCH] localedef --add-to-archive uses a hard-coded locale path + +it doesn't exist in normal use, and there's no way to pass an +alternative filename. + +Add a fallback of $LOCALEARCHIVE from the environment, and allow +creation of new locale archives that are not the system archive. + +Upstream-Status: Inappropriate (OE-specific) + +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + locale/programs/locarchive.c | 35 +++++++++++++++++++++++++---------- + 1 file changed, 25 insertions(+), 10 deletions(-) + +diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c +index 71fd9f34fa..cd3eb90ad5 100644 +--- a/locale/programs/locarchive.c ++++ b/locale/programs/locarchive.c +@@ -339,12 +339,24 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) + struct namehashent *oldnamehashtab; + struct locarhandle new_ah; + size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; +- char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; +- char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; ++ char *archivefname; ++ char *fname; ++ char *envarchive = getenv("LOCALEARCHIVE"); + +- if (output_prefix) +- memcpy (archivefname, output_prefix, prefix_len); +- strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ if (envarchive != NULL) ++ { ++ archivefname = xmalloc(strlen(envarchive) + 1); ++ fname = xmalloc(strlen(envarchive) + sizeof (".XXXXXX")); ++ strcpy (archivefname, envarchive); ++ } ++ else ++ { ++ archivefname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME)); ++ fname = xmalloc(prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1); ++ if (output_prefix) ++ memcpy (archivefname, output_prefix, prefix_len); ++ strcpy (archivefname + prefix_len, ARCHIVE_NAME); ++ } + strcpy (stpcpy (fname, archivefname), ".XXXXXX"); + + /* Not all of the old file has to be mapped. Change this now this +@@ -568,10 +580,13 @@ open_archive (struct locarhandle *ah, bool readonly) + /* If ah has a non-NULL fname open that otherwise open the default. */ + if (archivefname == NULL) + { +- archivefname = default_fname; +- if (output_prefix) +- memcpy (default_fname, output_prefix, prefix_len); +- strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ archivefname = getenv("LOCALEARCHIVE"); ++ if (archivefname == NULL) { ++ archivefname = default_fname; ++ if (output_prefix) ++ memcpy (default_fname, output_prefix, prefix_len); ++ strcpy (default_fname + prefix_len, ARCHIVE_NAME); ++ } + } + + while (1) +@@ -584,7 +599,7 @@ open_archive (struct locarhandle *ah, bool readonly) + the default locale archive we ignore the failure and + list an empty archive, otherwise we print an error + and exit. */ +- if (errno == ENOENT && archivefname == default_fname) ++ if (errno == ENOENT) + { + if (readonly) + { diff --git a/meta-openeuler/recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch b/meta-openeuler/recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch new file mode 100644 index 00000000000..ff49a71bb21 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch @@ -0,0 +1,48 @@ +From fae5ee7d7b9dca2f25684a99f7046042d870235f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 7 Aug 2020 14:31:16 -0700 +Subject: [PATCH] powerpc: Do not ask compiler for finding arch + +This does not work well in cross compiling environments like OE +and moreover it uses its own -mcpu/-march options via cflags + +Upstream-Status: Inappropriate [ OE-Specific] + +Signed-off-by: Khem Raj +--- + sysdeps/powerpc/preconfigure | 5 +---- + sysdeps/powerpc/preconfigure.ac | 5 +---- + 2 files changed, 2 insertions(+), 8 deletions(-) + +diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure +index 4de94089a3..428ad7b162 100644 +--- a/sysdeps/powerpc/preconfigure ++++ b/sysdeps/powerpc/preconfigure +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|.machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. +diff --git a/sysdeps/powerpc/preconfigure.ac b/sysdeps/powerpc/preconfigure.ac +index 6c63bd8257..3e925f1d48 100644 +--- a/sysdeps/powerpc/preconfigure.ac ++++ b/sysdeps/powerpc/preconfigure.ac +@@ -29,10 +29,7 @@ esac + # directive which shows up, and try using it. + case "${machine}:${submachine}" in + *powerpc*:) +- archcpu=`echo "int foo () { return 0; }" \ +- | $CC $CFLAGS $CPPFLAGS -S -frecord-gcc-switches -xc -o - - \ +- | grep -E "mcpu=|[.]machine" -m 1 \ +- | sed -e "s/.*machine //" -e "s/.*mcpu=\(.*\)\"/\1/"` ++ archcpu='' + # Note if you add patterns here you must ensure that an appropriate + # directory exists in sysdeps/powerpc. Likewise, if we find a + # cpu, don't let the generic configure append extra compiler options. diff --git a/meta-openeuler/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch b/meta-openeuler/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch new file mode 100644 index 00000000000..b7b4046efc3 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch @@ -0,0 +1,49 @@ +From 91a7848698ce6c96c646f3a170714ee71eab6884 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 15 May 2020 17:05:45 -0700 +Subject: [PATCH] wordsize.h: Unify the header between arm and aarch64 + +This helps OE multilibs to not sythesize this header which causes all +kind of recursions and other issues since wordsize is fundamental header +and ends up including itself in many case e.g. clang tidy, bpf etc. + +Upstream-Status: Inappropriate [ OE-Specific ] + +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/bits/wordsize.h | 8 ++++++-- + sysdeps/arm/bits/wordsize.h | 1 + + 2 files changed, 7 insertions(+), 2 deletions(-) + create mode 120000 sysdeps/arm/bits/wordsize.h + +diff --git a/sysdeps/aarch64/bits/wordsize.h b/sysdeps/aarch64/bits/wordsize.h +index 04d4be9519..63876a7830 100644 +--- a/sysdeps/aarch64/bits/wordsize.h ++++ b/sysdeps/aarch64/bits/wordsize.h +@@ -17,12 +17,16 @@ + License along with the GNU C Library; if not, see + . */ + +-#ifdef __LP64__ ++#if defined (__aarch64__) && defined (__LP64__) + # define __WORDSIZE 64 +-#else ++#elif defined (__aarch64__) + # define __WORDSIZE 32 + # define __WORDSIZE32_SIZE_ULONG 1 + # define __WORDSIZE32_PTRDIFF_LONG 1 ++#else ++# define __WORDSIZE 32 ++# define __WORDSIZE32_SIZE_ULONG 0 ++# define __WORDSIZE32_PTRDIFF_LONG 0 + #endif + + #define __WORDSIZE_TIME64_COMPAT32 0 +diff --git a/sysdeps/arm/bits/wordsize.h b/sysdeps/arm/bits/wordsize.h +new file mode 120000 +index 0000000000..4c4a788ec2 +--- /dev/null ++++ b/sysdeps/arm/bits/wordsize.h +@@ -0,0 +1 @@ ++../../aarch64/bits/wordsize.h +\ No newline at end of file diff --git a/meta-openeuler/recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch b/meta-openeuler/recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch new file mode 100644 index 00000000000..f2ed8210815 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch @@ -0,0 +1,79 @@ +From 63611cfd3b25f3656db168aee41a5850ac769dfc Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 31 Dec 2015 14:33:02 -0800 +Subject: [PATCH] Replace echo with printf builtin in nscd init script + +The nscd init script calls for #! /bin/bash interpreter +since it uses bash specific extentions namely (translated strings) +and echo -n command, replace echo with printf and +switch the shell interpreter to #!/bin/sh. + +Upstream-Status: Pending +Signed-off-by: Ross Burton +Signed-off-by: Khem Raj +--- + nscd/nscd.init | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/nscd/nscd.init b/nscd/nscd.init +index a882da7d8b..857b541381 100644 +--- a/nscd/nscd.init ++++ b/nscd/nscd.init +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # nscd: Starts the Name Switch Cache Daemon + # +@@ -49,16 +49,16 @@ prog=nscd + start () { + [ -d /var/run/nscd ] || mkdir /var/run/nscd + [ -d /var/db/nscd ] || mkdir /var/db/nscd +- echo -n $"Starting $prog: " ++ printf "Starting $prog: " + daemon /usr/sbin/nscd + RETVAL=$? +- echo ++ printf "\n" + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nscd + return $RETVAL + } + + stop () { +- echo -n $"Stopping $prog: " ++ printf "Stopping $prog: " + /usr/sbin/nscd -K + RETVAL=$? + if [ $RETVAL -eq 0 ]; then +@@ -67,11 +67,11 @@ stop () { + # a non-privileged user + rm -f /var/run/nscd/nscd.pid + rm -f /var/run/nscd/socket +- success $"$prog shutdown" ++ success "$prog shutdown" + else +- failure $"$prog shutdown" ++ failure "$prog shutdown" + fi +- echo ++ printf "\n" + return $RETVAL + } + +@@ -103,13 +103,13 @@ case "$1" in + RETVAL=$? + ;; + force-reload | reload) +- echo -n $"Reloading $prog: " ++ printf "Reloading $prog: " + killproc /usr/sbin/nscd -HUP + RETVAL=$? +- echo ++ printf "\n" + ;; + *) +- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" ++ printf "Usage: $0 {start|stop|status|restart|reload|condrestart}\n" + RETVAL=1 + ;; + esac diff --git a/meta-openeuler/recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch b/meta-openeuler/recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch new file mode 100644 index 00000000000..12a460664f0 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch @@ -0,0 +1,41 @@ +From 912ccb5001ffa5355caff09354558e89e9aa937b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 18 Mar 2015 00:27:10 +0000 +Subject: [PATCH] sysdeps/gnu/configure.ac: Set libc_cv_rootsbindir only if its + empty + +This ensures that it can be set in build environment + +Upstream-Status: Pending +Signed-off-by: Matthieu Crapet +Signed-off-by: Khem Raj +--- + sysdeps/gnu/configure | 2 +- + sysdeps/gnu/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sysdeps/gnu/configure b/sysdeps/gnu/configure +index 18c9d7945a..ef22cc845d 100644 +--- a/sysdeps/gnu/configure ++++ b/sysdeps/gnu/configure +@@ -32,7 +32,7 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin} + ;; + esac + +diff --git a/sysdeps/gnu/configure.ac b/sysdeps/gnu/configure.ac +index 634fe4de2a..492112e0fd 100644 +--- a/sysdeps/gnu/configure.ac ++++ b/sysdeps/gnu/configure.ac +@@ -21,6 +21,6 @@ case "$prefix" in + else + libc_cv_localstatedir=$localstatedir + fi +- libc_cv_rootsbindir=/sbin ++ libc_cv_rootsbindir=${libc_cv_rootsbindir:=/sbin} + ;; + esac diff --git a/meta-openeuler/recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch b/meta-openeuler/recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch new file mode 100644 index 00000000000..359b1c37e5e --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch @@ -0,0 +1,47 @@ +From 1d518ac57b00a3335f80f10f899c1bc24a0ddbf5 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Thu, 9 Dec 2021 15:14:42 -0800 +Subject: [PATCH] timezone: Make shell interpreter overridable in tzselect.ksh + +define new macro called KSHELL which can be used to define default shell +use Bash by default + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + Makeconfig | 9 +++++++++ + timezone/Makefile | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/Makeconfig b/Makeconfig +index 77d7fd14df..e253046861 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -309,6 +309,15 @@ ifndef sysincludedir + sysincludedir = /usr/include + endif + ++# The full path name of a Posix-compliant shell, preferably one that supports ++# the Korn shell's 'select' statement as an extension. ++# These days, Bash is the most popular. ++# It should be OK to set this to /bin/sh, on platforms where /bin/sh ++# lacks 'select' or doesn't completely conform to Posix, but /bin/bash ++# is typically nicer if it works. ++ifndef KSHELL ++KSHELL = /bin/bash ++endif + + # Commands to install files. + ifndef INSTALL_DATA +diff --git a/timezone/Makefile b/timezone/Makefile +index 0306c0bca9..4dfdcebdb7 100644 +--- a/timezone/Makefile ++++ b/timezone/Makefile +@@ -136,6 +136,7 @@ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make + -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ + -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ + -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \ ++ -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + < $< > $@.new + chmod 555 $@.new + mv -f $@.new $@ diff --git a/meta-openeuler/recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch b/meta-openeuler/recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch new file mode 100644 index 00000000000..9a1bfdd6af3 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch @@ -0,0 +1,27 @@ +From 7274541782927394852712ba0c8dfd67bd9b8b5b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 15 Dec 2021 21:47:53 -0800 +Subject: [PATCH] tzselect.ksh: Use /bin/sh default shell interpreter + +checkbashism reports no issues with tzselect.ksh, therefore using +/bin/sh instead of /bin/bash should be safe and portable across systems +which don't ship bash ( embedded systems ) + +Upstream-Status: Pending +Signed-off-by: Khem Raj +Cc: Adhemerval Zanella +Cc: Paul Eggert +--- + timezone/tzselect.ksh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh +index 18fce27e24..cc08efb0fb 100755 +--- a/timezone/tzselect.ksh ++++ b/timezone/tzselect.ksh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # Ask the user about the time zone, and output the resulting TZ value to stdout. + # Interact with the user via stderr and stdin. + diff --git a/meta-openeuler/recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch b/meta-openeuler/recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch new file mode 100644 index 00000000000..3b567cc9ab1 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch @@ -0,0 +1,86 @@ +From 4a1bff4c1e34ad9b596a7ba44ab61f4c9d00097b Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Sun, 29 Aug 2021 20:49:16 +0800 +Subject: [PATCH] fix create thread failed in unprivileged process [BZ #28287] + +Since commit [d8ea0d0168 Add an internal wrapper for clone, clone2 and clone3] +applied, start a unprivileged container (docker run without --privileged), +it creates a thread failed in container. + +In commit d8ea0d0168, it calls __clone3 if HAVE_CLONE3_WAPPER is defined. If +__clone3 returns -1 with ENOSYS, fall back to clone or clone2. + +As known from [1], cloneXXX fails with EPERM if CLONE_NEWCGROUP, +CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, or CLONE_NEWUTS +was specified by an unprivileged process (process without CAP_SYS_ADMIN) + +[1] https://man7.org/linux/man-pages/man2/clone3.2.html + +So if __clone3 returns -1 with EPERM, fall back to clone or clone2 could +fix the issue. Here are the test steps: + +1) Prepare test code +cat > conftest.c < + #include + +int check_me = 0; +void* func(void* data) {check_me = 42; printf("start thread: check_me %d\n", check_me); return &check_me;} +int main() +{ + pthread_t t; + void *ret; + pthread_create (&t, 0, func, 0); + pthread_join (t, &ret); + printf("check_me %d, p %p\n", check_me, &ret); + return (check_me != 42 || ret != &check_me); +} + +ENDOF + +2) Compile +gcc -o conftest -pthread conftest.c + +3) Start a container with glibc 2.34 installed +[skip details] +docker run -it bash + +4) Run conftest without this patch +$ ./conftest +check_me 0, p 0x7ffd91ccd400 + +5) Run conftest with this patch +$ ./conftest +start thread: check_me 42 +check_me 42, p 0x7ffe253c6f20 + +Upstream-Status: Inappropriate [Rejected by upstream] + +Upstream glibc rejected it because the latest docker has resolved the issue [1], +and upstream glibc does not backward compatibility with old docker[2] + +In order to build Yocto with uninative in old docker, we need this local +patch + +[1] https://github.com/moby/moby/commit/9f6b562dd12ef7b1f9e2f8e6f2ab6477790a6594 +[2] https://sourceware.org/pipermail/libc-alpha/2021-August/130590.html + +Signed-off-by: Hongxu Jia +Signed-off-by: Khem Raj +--- + sysdeps/unix/sysv/linux/clone-internal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysdeps/unix/sysv/linux/clone-internal.c b/sysdeps/unix/sysv/linux/clone-internal.c +index 790739cfce..8d24d04917 100644 +--- a/sysdeps/unix/sysv/linux/clone-internal.c ++++ b/sysdeps/unix/sysv/linux/clone-internal.c +@@ -106,7 +106,7 @@ __clone_internal (struct clone_args *cl_args, + #ifdef HAVE_CLONE3_WRAPPER + int saved_errno = errno; + int ret = __clone3_internal (cl_args, func, arg); +- if (ret != -1 || errno != ENOSYS) ++ if (ret != -1 || (errno != ENOSYS && errno != EPERM)) + return ret; + + /* NB: Restore errno since errno may be checked against non-zero diff --git a/meta-openeuler/recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch b/meta-openeuler/recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch new file mode 100644 index 00000000000..55c81f38aa3 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch @@ -0,0 +1,32 @@ +From e61792fc978f9b8a9c790be468fbf97828ac8ae9 Mon Sep 17 00:00:00 2001 +From: Richard Purdie +Date: Sun, 24 Jul 2022 07:07:29 -0700 +Subject: [PATCH] Avoid hardcoded build time paths in the output binaries + +replace the compile definitions with the output locations. + +Upstream-Status: Inappropriate [would need reworking somehow to be acceptable upstream] + +Signed-off-by: Richard Purdie +Signed-off-by: Khem Raj +--- + support/Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/support/Makefile b/support/Makefile +index 917a858bd1..17a747c8c7 100644 +--- a/support/Makefile ++++ b/support/Makefile +@@ -227,9 +227,9 @@ libsupport-inhibit-o += .o + endif + + CFLAGS-support_paths.c = \ +- -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ +- -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ +- -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ ++ -DSRCDIR_PATH=\"$(oe_srcdir)\" \ ++ -DOBJDIR_PATH=\"$(libdir)/glibc-tests/ptest/tests/glibc-ptest\" \ ++ -DOBJDIR_ELF_LDSO_PATH=\"$(slibdir)/$(rtld-installed-name)\" \ + -DINSTDIR_PATH=\"$(prefix)\" \ + -DLIBDIR_PATH=\"$(libdir)\" \ + -DBINDIR_PATH=\"$(bindir)\" \ diff --git a/meta-openeuler/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch b/meta-openeuler/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch new file mode 100644 index 00000000000..7be9fc981d6 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch @@ -0,0 +1,56 @@ +From d836f008a96aa9b2e88c7b394bfc110542e57176 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 4 Aug 2023 09:34:50 -0700 +Subject: [PATCH] aarch64/configure: Pass -mcpu along with -march to detect sve + support + +SVE support logic in configure is rightly passing -march=+sve to +compiler to override whatever user might have passed via environment, +however GCC does not do as intended when -mcpu is part of environment +compiler flags, then it overrides the -march computed from -mcpu and +igonores other -march values so this test fails for lot of aarch64 +machines which pass -mcpu that does not support sve. This is seemingly a +bug in GCC [1], until that is fixed we preempt -mcpu along with -march +in the configure test itself. It does not change functionality and yet +lets us through the GCC inconsistency. + +[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110901 + +Upstream-Status: Inappropriate [Workaround for a GCC issue] +Signed-off-by: Khem Raj + +Signed-off-by: Khem Raj +--- + sysdeps/aarch64/configure | 2 +- + sysdeps/aarch64/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure +index 5e91fab023..39dddc66d4 100644 +--- a/sysdeps/aarch64/configure ++++ b/sysdeps/aarch64/configure +@@ -327,7 +327,7 @@ else $as_nop + cat > conftest.s <<\EOF + ptrue p0.b + EOF +-if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5' ++if { ac_try='${CC-cc} -c -mcpu=generic+sve -march=armv8.2-a+sve conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? +diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac +index 8a708f2ef4..b6a146d2be 100644 +--- a/sysdeps/aarch64/configure.ac ++++ b/sysdeps/aarch64/configure.ac +@@ -92,7 +92,7 @@ AC_CACHE_CHECK([for SVE support in assembler], [libc_cv_aarch64_sve_asm], [dnl + cat > conftest.s <<\EOF + ptrue p0.b + EOF +-if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then ++if AC_TRY_COMMAND(${CC-cc} -c -mcpu=generic+sve -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then + libc_cv_aarch64_sve_asm=yes + else + libc_cv_aarch64_sve_asm=no +-- +2.41.0 + diff --git a/meta-openeuler/recipes-core/glibc/glibc/check-test-wrapper b/meta-openeuler/recipes-core/glibc/glibc/check-test-wrapper new file mode 100644 index 00000000000..5cc993f718a --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/check-test-wrapper @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +import sys +import os +import subprocess +import resource + +env = os.environ.copy() +args = sys.argv[1:] +targettype = args.pop(0) + +if targettype == "user": + qemuargs = os.environ.get("QEMU_OPTIONS", "").split() + if not os.path.exists(qemuargs[0]): + # ensure qemu args has a valid absolute path + for i in os.environ.get("PATH", "").split(":"): + if os.path.exists(os.path.join(i, qemuargs[0])): + qemuargs[0] = os.path.join(i, qemuargs[0]) + break + sysroot = os.environ.get("QEMU_SYSROOT", None) + if not sysroot: + sys.exit(-1) + libpaths = [sysroot + "/usr/lib", sysroot + "/lib"] + + if args[0] == "env": + args.pop(0) + if len(args) == 0: + args = ["env"] + else: + # process options + while args[0].startswith("-"): + opt = args.pop(0).lstrip("-") + if "i" in opt: + env.clear() + # process environment vars + while "=" in args[0]: + key, val = args.pop(0).split("=", 1) + if key == "LD_LIBRARY_PATH": + libpaths += val.split(":") + else: + env[key] = val + if args[0] == "cp": + # ignore copies, the filesystem is the same + sys.exit(0) + + qemuargs += ["-L", sysroot] + qemuargs += ["-E", "LD_LIBRARY_PATH={}".format(":".join(libpaths))] + command = qemuargs + args + + # We've seen qemu-arm using up all system memory for some glibc + # tests e.g. nptl/tst-pthread-timedlock-lockloop + # Cap at 8GB since no test should need more than that + # (5GB adds 7 failures for qemuarm glibc test run) + limit = 8*1024*1024*1024 + resource.setrlimit(resource.RLIMIT_AS, (limit, limit)) + +elif targettype == "ssh": + host = os.environ.get("SSH_HOST", None) + user = os.environ.get("SSH_HOST_USER", None) + port = os.environ.get("SSH_HOST_PORT", None) + + command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-o", "LogLevel=quiet"] + if port: + command += ["-p", str(port)] + if not host: + sys.exit(-1) + command += ["{}@{}".format(user, host) if user else host] + + # wrap and replace quotes for correct transformation on ssh + wrapped = " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in ["cd", os.getcwd()]]) + "; " + wrapped += " ".join(["'{0}'".format(i.replace("'", r"'\''")) for i in args]) + command += ["sh", "-c", "\"{}\"".format(wrapped)] +else: + sys.exit(-1) + +try: + r = subprocess.run(command, timeout = 1800, env = env) + sys.exit(r.returncode) +except subprocess.TimeoutExpired: + sys.exit(-1) + diff --git a/meta-openeuler/recipes-core/glibc/glibc/etc/ld.so.conf b/meta-openeuler/recipes-core/glibc/glibc/etc/ld.so.conf new file mode 100644 index 00000000000..83327c01bf5 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/etc/ld.so.conf @@ -0,0 +1 @@ +include /etc/ld.so.conf.d/*.conf diff --git a/meta-openeuler/recipes-core/glibc/glibc/generate-supported.mk b/meta-openeuler/recipes-core/glibc/glibc/generate-supported.mk new file mode 100644 index 00000000000..d2a28c2dc63 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/generate-supported.mk @@ -0,0 +1,11 @@ +#!/usr/bin/make + +include $(IN) + +all: + rm -f $(OUT) + touch $(OUT) + for locale in $(SUPPORTED-LOCALES); do \ + [ $$locale = true ] && continue; \ + echo $$locale | sed 's,/, ,' >> $(OUT); \ + done diff --git a/meta-openeuler/recipes-core/glibc/glibc/makedbs.sh b/meta-openeuler/recipes-core/glibc/glibc/makedbs.sh new file mode 100755 index 00000000000..7d51a673521 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/makedbs.sh @@ -0,0 +1,177 @@ +#!/bin/sh + +# +# Make passwd.db, group.db, etc. +# + +VAR_DB=/var/db + +# Use make if available +if [ -x /usr/bin/make -o -x /bin/make ]; then + make -C $VAR_DB + exit 0 +fi + +# No make available, do it in hard way + +# passwd.db +if [ -e /etc/passwd ]; then +target=$VAR_DB/passwd.db +echo -n "passwd... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print }' /etc/passwd | \ +makedb --quiet -o $target - +echo "done." +fi + +# group.db +if [ -e /etc/group ]; then +target=$VAR_DB/group.db +echo -n "group... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$3; print; \ + if ($$4 != "") { \ + split($$4, grmems, ","); \ + for (memidx in grmems) { \ + mem=grmems[memidx]; \ + if (members[mem] == "") \ + members[mem]=$$3; \ + else \ + members[mem]=members[mem] "," $$3; \ + } \ + delete grmems; } } \ + END { for (mem in members) \ + printf ":%s %s %s\n", mem, mem, members[mem]; }' /etc/group | \ +makedb --quiet -o $target - +echo "done." +fi + +# ethers.db +if [ -e /etc/ethers ]; then +target=$VAR_DB/ethers.db +echo -n "ethers... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print }' /etc/ethers | \ +makedb --quiet -o $target - +echo "done." +fi + +# protocols.db +if [ -e /etc/protocols ]; then +target=$VAR_DB/protocols.db +echo -n "protocols... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/protocols | \ +makedb --quiet -o $target - +echo "done." +fi + +# rpc.db +if [ -e /etc/rpc ]; then +target=$VAR_DB/rpc.db +echo -n "rpc... " +awk '/^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print; \ + printf "=%s ", $$2; print; \ + for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ".%s ", $$i; print } }' /etc/rpc | \ +makedb --quiet -o $target - +echo "done." +fi + +# services.db +if [ -e /etc/services ]; then +target=$VAR_DB/services.db +echo -n "services... " +awk 'BEGIN { FS="[ \t/]+" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { sub(/[ \t]*#.*$$/, "");\ + printf ":%s/%s ", $$1, $$3; print; \ + printf ":%s/ ", $$1; print; \ + printf "=%s/%s ", $$2, $$3; print; \ + printf "=%s/ ", $$2; print; \ + for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \ + { printf ":%s/%s ", $$i, $$3; print; \ + printf ":%s/ ", $$i; print } }' /etc/services | \ +makedb --quiet -o $target - +echo "done." +fi + +# shadow.db +if [ -e /etc/shadow ]; then +target=$VAR_DB/shadow.db +echo -n "shadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/shadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target; + echo + echo "Warning: The shadow password database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the \`shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# gshadow.db +if [ -e /etc/gshadow ]; then +target=$VAR_DB/gshadow.db +echo -n "gshadow... " +awk 'BEGIN { FS=":"; OFS=":" } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { printf ".%s ", $$1; print }' /etc/gshadow | \ +(umask 077 && makedb --quiet -o $target -) +echo "done." +if chgrp shadow $target 2>/dev/null; then + chmod g+r $target +else + chown 0 $target; chgrp 0 $target; chmod 600 $target + echo + echo "Warning: The shadow group database $target" + echo "has been set to be readable only by root. You may want" + echo "to make it readable by the \`shadow' group depending" + echo "on your configuration." + echo +fi +fi + +# netgroup.db +if [ -e /etc/netgroup ]; then +target=$VAR_DB/netgroup.db +echo -n "netgroup... " +awk 'BEGIN { ini=1 } \ + /^[ \t]*$$/ { next } \ + /^[ \t]*#/ { next } \ + /^[^#]/ { if (sub(/[ \t]*\\$$/, " ") == 0) end="\n"; \ + else end=""; \ + gsub(/[ \t]+/, " "); \ + sub(/^[ \t]*/, ""); \ + if (ini == 0) printf "%s%s", $$0, end; \ + else printf ".%s %s%s", $$1, $$0, end; \ + ini=end == "" ? 0 : 1; } \ + END { if (ini==0) printf "\n" }' /etc/netgroup | \ +makedb --quiet -o $target +echo "done." +fi diff --git a/meta-openeuler/recipes-core/glibc/glibc/run-ptest b/meta-openeuler/recipes-core/glibc/glibc/run-ptest new file mode 100755 index 00000000000..c394b498660 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc/run-ptest @@ -0,0 +1,37 @@ +#!/bin/bash +# ptest script for glibc - to run time related tests to +# facilitate Y2038 validation +# Run with 'ptest-runner glibc-tests' + +output() { + retcode=$? + if [ $retcode -eq 0 ] + then echo "PASS: $i" + elif [ $retcode -eq 77 ] + then echo "SKIP: $i" + else echo "FAIL: $i" + fi +} + +# Allow altering time on the target +export GLIBC_TEST_ALLOW_TIME_SETTING="1" + +tst_time64=$(ls -r ${PWD}/tests/glibc-ptest/*-time64) + +# Remove '-time64' suffix - those tests are also time +# related +tst_time_tmp=$(sed -e "s/-time64$//" <<< ${tst_time64}) + +# Run tests supporting only 32 bit time +for i in ${tst_time_tmp} +do + $i >/dev/null 2>&1 + output +done + +# Run tests supporting only 64 bit time +for i in ${tst_time64} +do + $i >/dev/null 2>&1 + output +done diff --git a/meta-openeuler/recipes-core/glibc/glibc_%.bbappend b/meta-openeuler/recipes-core/glibc/glibc_%.bbappend new file mode 100644 index 00000000000..9f56f84ff82 --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc_%.bbappend @@ -0,0 +1 @@ +require glibc-src.inc diff --git a/meta-openeuler/recipes-core/glibc/glibc_2.38.bb b/meta-openeuler/recipes-core/glibc/glibc_2.38.bb new file mode 100644 index 00000000000..32ccb888f0f --- /dev/null +++ b/meta-openeuler/recipes-core/glibc/glibc_2.38.bb @@ -0,0 +1,130 @@ +require glibc.inc +require glibc-version.inc + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023 +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024 +CVE_STATUS_GROUPS = "CVE_STATUS_RECIPE" +CVE_STATUS_RECIPE = "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024" +CVE_STATUS_RECIPE[status] = "disputed: \ +Upstream glibc maintainers dispute there is any issue and have no plans to address it further. \ +this is being treated as a non-security bug and no real threat." + +# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025 +# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853 +CVE_STATUS[CVE-2019-1010025] = "disputed: \ +Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow \ +easier access for another. 'ASLR bypass itself is not a vulnerability.'" + +CVE_STATUS[CVE-2023-25139] = "cpe-stable-backport: This is integrated into the 2.37 branch as of 07b9521fc6" + +DEPENDS += "gperf-native bison-native" + +NATIVESDKFIXES ?= "" +NATIVESDKFIXES:class-nativesdk = "\ + file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \ + file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \ + file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \ + file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \ + file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \ + file://0008-nativesdk-glibc-Fall-back-to-faccessat-on-faccess2-r.patch \ +" + +SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ + file://etc/ld.so.conf \ + file://generate-supported.mk \ + file://makedbs.sh \ + \ + ${NATIVESDKFIXES} \ + file://0009-yes-within-the-path-sets-wrong-config-variables.patch \ + file://0010-eglibc-Cross-building-and-testing-instructions.patch \ + file://0011-eglibc-Help-bootstrap-cross-toolchain.patch \ + file://0012-eglibc-Resolve-__fpscr_values-on-SH4.patch \ + file://0013-eglibc-Forward-port-cross-locale-generation-support.patch \ + file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \ + file://0015-powerpc-Do-not-ask-compiler-for-finding-arch.patch \ + file://0016-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \ + file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \ + file://0018-sysdeps-gnu-configure.ac-Set-libc_cv_rootsbindir-onl.patch \ + file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \ + file://0020-tzselect.ksh-Use-bin-sh-default-shell-interpreter.patch \ + file://0021-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ + file://0022-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ + file://0023-aarch64-configure-Pass-mcpu-along-with-march-to-dete.patch \ +" +S = "${WORKDIR}/git" +B = "${WORKDIR}/build-${TARGET_SYS}" + +PACKAGES_DYNAMIC = "" + +# the -isystem in bitbake.conf screws up glibc do_stage +BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" +TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}" + +GLIBC_BROKEN_LOCALES = "" + +GLIBCPIE ??= "" + +EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ + --disable-profile \ + --disable-debug --without-gd \ + --enable-clocale=gnu \ + --with-headers=${STAGING_INCDIR} \ + --without-selinux \ + --enable-bind-now \ + --enable-stack-protector=strong \ + --disable-crypt \ + --with-default-link \ + --disable-werror \ + --enable-fortify-source \ + ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \ + ${GLIBCPIE} \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +EXTRA_OECONF:append:x86 = " ${@bb.utils.contains_any('TUNE_FEATURES', 'i586 c3', '--disable-cet', '--enable-cet', d)}" +EXTRA_OECONF:append:x86-64 = " --enable-cet" + +PACKAGECONFIG ??= "nscd memory-tagging" + +PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd" +PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging" + +do_patch:append() { + bb.build.exec_func('do_fix_readlib_c', d) +} + +do_fix_readlib_c () { + sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c +} + +do_configure () { +# override this function to avoid the autoconf/automake/aclocal/autoheader +# calls for now +# don't pass CPPFLAGS into configure, since it upsets the kernel-headers +# version check and doesn't really help with anything + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + find ${S} -name "configure" | xargs touch + CPPFLAGS="" LD="${HOST_PREFIX}ld.bfd ${TOOLCHAIN_OPTIONS}" oe_runconf +} + +LDFLAGS += "-fuse-ld=bfd" +CC += "-fuse-ld=bfd" + +do_compile () { + base_do_compile + echo "Adjust ldd script" + if [ -n "${RTLDLIST}" ] + then + prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` + # remove duplicate entries + newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)` + echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\"" + sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#" + fi +} + +require glibc-package.inc + +BBCLASSEXTEND = "nativesdk" -- Gitee From 92574ac6fe00631701e39ca34e69633ac6b2056c Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Sat, 28 Oct 2023 17:33:56 +0800 Subject: [PATCH 4/5] yocto: checkout binutils to openEuler source * checkout binutils to openEuler source(version: 2.40) Signed-off-by: lixiaoyong --- .../binutils/binutils-2.40.inc | 40 ++++ .../binutils/binutils-cross-canadian.inc | 32 +++ .../binutils/binutils-cross-canadian_2.40.bb | 3 + .../binutils/binutils-cross-testsuite_2.40.bb | 81 +++++++ .../binutils/binutils-cross.inc | 39 ++++ .../binutils/binutils-cross_%.bbappend | 1 + .../binutils/binutils-cross_2.40.bb | 3 + .../binutils/binutils-crosssdk_%.bbappend | 1 + .../binutils/binutils-crosssdk_2.40.bb | 11 + .../{binutils_src.inc => binutils-src.inc} | 22 +- .../recipes-devtools/binutils/binutils.inc | 207 ++++++++++++++++++ .../binutils/binutils_%.bbappend | 2 +- .../binutils/binutils_2.40.bb | 75 +++++++ 13 files changed, 503 insertions(+), 14 deletions(-) create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-2.40.inc create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian.inc create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian_2.40.bb create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross-testsuite_2.40.bb create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross.inc create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-cross_2.40.bb create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_%.bbappend create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_2.40.bb rename meta-openeuler/recipes-devtools/binutils/{binutils_src.inc => binutils-src.inc} (82%) create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils.inc create mode 100644 meta-openeuler/recipes-devtools/binutils/binutils_2.40.bb diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-2.40.inc b/meta-openeuler/recipes-devtools/binutils/binutils-2.40.inc new file mode 100644 index 00000000000..dea68ee6fc2 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-2.40.inc @@ -0,0 +1,40 @@ +LIC_FILES_CHKSUM="\ + file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\ + file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\ + file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\ + file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\ + file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\ + file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\ + file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\ + file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\ + file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\ + " + +# When upgrading to 2.41, please make sure there is no trailing .0, so +# that upstream version check can work correctly. +PV = "2.40" +CVE_VERSION = "2.40" +SRCBRANCH ?= "binutils-2_40-branch" + +UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P\d+_(\d_?)*)" + +SRCREV ?= "4671be001eb5a899ecac3e2686a92934000f8262" +BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${SRCBRANCH};protocol=https" +SRC_URI = "\ + ${BINUTILS_GIT_URI} \ + file://0004-Point-scripts-location-to-libdir.patch \ + file://0005-don-t-let-the-distro-compiler-point-to-the-wrong-ins.patch \ + file://0006-warn-for-uses-of-system-directories-when-cross-linki.patch \ + file://0007-fix-the-incorrect-assembling-for-ppc-wait-mnemonic.patch \ + file://0008-Use-libtool-2.4.patch \ + file://0009-Fix-rpath-in-libtool-when-sysroot-is-enabled.patch \ + file://0010-sync-with-OE-libtool-changes.patch \ + file://0011-Check-for-clang-before-checking-gcc-version.patch \ + file://0012-Only-generate-an-RPATH-entry-if-LD_RUN_PATH-is-not-e.patch \ + file://0013-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \ + file://0015-Remove-duplicate-pe-dll.o-entry-deom-targ_extra_ofil.patch \ + file://0016-CVE-2023-25586.patch \ + file://fix-time64.patch \ + file://0001-Fix-an-illegal-memory-access-when-an-accessing-a-zer.patch \ +" +S = "${WORKDIR}/git" diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian.inc b/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian.inc new file mode 100644 index 00000000000..62ebb3f5bc4 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian.inc @@ -0,0 +1,32 @@ +inherit cross-canadian + +SUMMARY = "GNU binary utilities (cross-canadian for ${TARGET_ARCH} target)" +PN = "binutils-cross-canadian-${TRANSLATED_TARGET_ARCH}" +BPN = "binutils" + +DEPENDS = "flex-native bison-native virtual/${HOST_PREFIX}gcc virtual/nativesdk-libc nativesdk-zlib nativesdk-gettext nativesdk-flex" +EXTRA_OECONF += "--with-sysroot=${SDKPATH}/sysroots/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS} \ + --enable-poison-system-directories \ + " + +# We have to point binutils 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[vardepsexclude] = "TUNE_PKGARCH" + +do_install () { + autotools_do_install + + # We're not interested in the libs or headers, these would come from the + # nativesdk or target version of the binutils recipe + rm -rf ${D}${prefix}/${TARGET_SYS} + rm -f ${D}${libdir}/libbfd* + rm -f ${D}${libdir}/libiberty* + rm -f ${D}${libdir}/libopcodes* + rm -f ${D}${includedir}/*.h + rm -f ${D}${sysconfdir}/gprofng.rc + rmdir ${D}${sysconfdir} || : + + cross_canadian_bindirlinks +} + +BBCLASSEXTEND = "" diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian_2.40.bb b/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian_2.40.bb new file mode 100644 index 00000000000..5dbaa030178 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross-canadian_2.40.bb @@ -0,0 +1,3 @@ +require binutils.inc +require binutils-${PV}.inc +require binutils-cross-canadian.inc diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross-testsuite_2.40.bb b/meta-openeuler/recipes-devtools/binutils/binutils-cross-testsuite_2.40.bb new file mode 100644 index 00000000000..14480785b4d --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross-testsuite_2.40.bb @@ -0,0 +1,81 @@ +require binutils.inc +require binutils-${PV}.inc + +BPN = "binutils" + +DEPENDS += "dejagnu-native expect-native" +DEPENDS += "binutils-native" + +deltask do_compile +deltask do_install + +inherit nopackages + +do_configure[dirs] += "${B}/ld ${B}/bfd" +do_configure() { + # create config.h, oe enables initfini-array by default + echo "#define HAVE_INITFINI_ARRAY" > ${B}/ld/config.h +} + +# target depends +DEPENDS += "virtual/${TARGET_PREFIX}binutils" +DEPENDS += "virtual/${TARGET_PREFIX}gcc" +DEPENDS += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs" +DEPENDS += "virtual/${MLPREFIX}libc" + +python check_prepare() { + def suffix_sys(sys): + if sys.endswith("-linux"): + return sys + "-gnu" + return sys + + def generate_site_exp(d, suite): + content = [] + content.append('set srcdir "{0}/{1}"'.format(d.getVar("S"), suite)) + content.append('set objdir "{0}/{1}"'.format(d.getVar("B"), suite)) + content.append('set build_alias "{0}"'.format(d.getVar("BUILD_SYS"))) + content.append('set build_triplet {0}'.format(d.getVar("BUILD_SYS"))) + # use BUILD here since HOST=TARGET + content.append('set host_alias "{0}"'.format(d.getVar("BUILD_SYS"))) + content.append('set host_triplet {0}'.format(d.getVar("BUILD_SYS"))) + content.append('set target_alias "{0}"'.format(d.getVar("TARGET_SYS"))) + content.append('set target_triplet {0}'.format(suffix_sys(d.getVar("TARGET_SYS")))) + content.append("set development true") + content.append("set experimental false") + + content.append(d.expand('set CXXFILT "${TARGET_PREFIX}c++filt"')) + content.append(d.expand('set CC "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) + content.append(d.expand('set CXX "${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) + content.append(d.expand('set CFLAGS_FOR_TARGET "--sysroot=${STAGING_DIR_TARGET} ${TUNE_CCARGS}"')) + + if suite == "ld" and d.getVar("TUNE_ARCH") == "mips64": + # oe patches binutils to have the default mips64 abi as 64bit, but + # skips gas causing issues with the ld test suite (which uses gas) + content.append('set ASFLAGS "-64"') + + return "\n".join(content) + + for i in ["binutils", "gas", "ld"]: + builddir = os.path.join(d.getVar("B"), i) + if not os.path.isdir(builddir): + os.makedirs(builddir) + with open(os.path.join(builddir, "site.exp"), "w") as f: + f.write(generate_site_exp(d, i)) +} + +CHECK_TARGETS ??= "binutils gas ld" + +do_check[dirs] = "${B} ${B}/binutils ${B}/gas ${B}/ld" +do_check[prefuncs] += "check_prepare" +do_check[nostamp] = "1" +do_check() { + export LC_ALL=C + for i in ${CHECK_TARGETS}; do + (cd ${B}/$i; runtest \ + --tool $i \ + --srcdir ${S}/$i/testsuite \ + --ignore 'plugin.exp' \ + || true) + done +} +addtask check after do_configure diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross.inc b/meta-openeuler/recipes-devtools/binutils/binutils-cross.inc new file mode 100644 index 00000000000..835d4fa69b7 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross.inc @@ -0,0 +1,39 @@ +inherit cross +PROVIDES = "virtual/${TARGET_PREFIX}binutils" + +PN = "binutils-cross-${TARGET_ARCH}" +BPN = "binutils" + +# Ignore how TARGET_ARCH is computed. +TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" + +INHIBIT_DEFAULT_DEPS = "1" +INHIBIT_AUTOTOOLS_DEPS = "1" + +SRC_URI += "file://0002-binutils-cross-Do-not-generate-linker-script-directo.patch" + +# Specify lib-path else we use a load of search dirs which we don't use +# and mean the linker scripts have to be relocated. +EXTRA_OECONF += "--with-sysroot=${STAGING_DIR_TARGET} \ + --disable-install-libbfd \ + --disable-gprofng \ + --enable-poison-system-directories \ + --with-lib-path==${target_base_libdir}:=${target_libdir} \ + " +do_install () { + oe_runmake 'DESTDIR=${D}' install + + # We don't really need these, so we'll remove them... + rm -rf ${D}${STAGING_DIR_NATIVE}${libdir_native}/libiberty.a + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/${TARGET_SYS} + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/lib/ldscripts + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/info + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/locale + rm -rf ${D}${STAGING_DIR_NATIVE}${prefix_native}/share/man + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/share || : + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}/gcc-lib || : + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64/gcc-lib || : + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir} || : + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${libdir}64 || : + rmdir ${D}${STAGING_DIR_NATIVE}${prefix_native}/${prefix} || : +} diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross_%.bbappend b/meta-openeuler/recipes-devtools/binutils/binutils-cross_%.bbappend new file mode 100644 index 00000000000..938773963a2 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross_%.bbappend @@ -0,0 +1 @@ +require binutils-src.inc diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-cross_2.40.bb b/meta-openeuler/recipes-devtools/binutils/binutils-cross_2.40.bb new file mode 100644 index 00000000000..fbd1f7d25a5 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-cross_2.40.bb @@ -0,0 +1,3 @@ +require binutils.inc +require binutils-${PV}.inc +require binutils-cross.inc diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_%.bbappend b/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_%.bbappend new file mode 100644 index 00000000000..938773963a2 --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_%.bbappend @@ -0,0 +1 @@ +require binutils-src.inc diff --git a/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_2.40.bb b/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_2.40.bb new file mode 100644 index 00000000000..6752659304e --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils-crosssdk_2.40.bb @@ -0,0 +1,11 @@ +require binutils-cross_${PV}.bb + +inherit crosssdk + +PN = "binutils-crosssdk-${SDK_SYS}" + +SRC_URI += "file://0001-binutils-crosssdk-Generate-relocatable-SDKs.patch" + +do_configure:prepend () { + sed -i 's#/usr/local/lib /lib /usr/lib#${SDKPATHNATIVE}/lib ${SDKPATHNATIVE}/usr/lib /usr/local/lib /lib /usr/lib#' ${S}/ld/configure.tgt +} diff --git a/meta-openeuler/recipes-devtools/binutils/binutils_src.inc b/meta-openeuler/recipes-devtools/binutils/binutils-src.inc similarity index 82% rename from meta-openeuler/recipes-devtools/binutils/binutils_src.inc rename to meta-openeuler/recipes-devtools/binutils/binutils-src.inc index 1283abeda34..cdfa852d8ad 100644 --- a/meta-openeuler/recipes-devtools/binutils/binutils_src.inc +++ b/meta-openeuler/recipes-devtools/binutils/binutils-src.inc @@ -1,7 +1,12 @@ +OPENEULER_SRC_URI_REMOVE = "git http" + PV = "2.40" S = "${WORKDIR}/${BPN}-${PV}" + FILESEXTRAPATHS:prepend := "${THISDIR}/files/:" +SRC_URI:remove:class-nativesdk = " file://0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch " + # apply package source and patches from openeuler SRC_URI = " \ file://${BPN}-${PV}.tar.xz \ @@ -24,13 +29,15 @@ SRC_URI += " \ file://0005-Point-scripts-location-to-libdir.patch \ " +SRC_URI[sha256sum] = "820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c" + +# openeuler configuration + # We do not need gprofng EXTRA_OECONF:append = " \ --enable-gprofng=no \ " -SRC_URI[sha256sum] = "820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c" - do_configure:prepend:class-target () { # fix Can't locate Autom4te/ChannelDefs.pm in @INC (you may need to install the Autom4te::ChannelDefs module) (@INC contains: /build/tmp/work/*/binutils/2.37-r0/recipe-sysroot-native/usr/share/autoconf ... # autoconf is installed at buildtool-bar, not build autoconf-native, so need to set autom4te_perllibdir or modify default value in gnu-config @@ -39,14 +46,3 @@ do_configure:prepend:class-target () { fi } -# bfd_stdint.h has been removed in favor of using stdint.h in new version -# delete the two function below after upgrade to new poky -do_install:prepend () { - mkdir -p ${D}${includedir} - touch ${D}${includedir}/bfd_stdint.h -} - -do_install:append () { - rm -f ${D}${includedir}/bfd_stdint.h - rm -f ${D}${libdir}/libsframe* -} diff --git a/meta-openeuler/recipes-devtools/binutils/binutils.inc b/meta-openeuler/recipes-devtools/binutils/binutils.inc new file mode 100644 index 00000000000..e176b5cff1a --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils.inc @@ -0,0 +1,207 @@ +SUMMARY = "GNU binary utilities" +DESCRIPTION = "The GNU Binutils are a collection of binary tools. \ +The main ones are ld (GNU Linker), and as (GNU Assembler). This \ +package also includes addition tools such as addr2line (Converts \ +addresses into filenames and line numbers), ar (utility for creating, \ +modifying and extracting archives), nm (list symbols in object \ +files), objcopy (copy and translate object files), objdump (Display \ +object information), and other tools and related libraries." +HOMEPAGE = "http://www.gnu.org/software/binutils/" +BUGTRACKER = "http://sourceware.org/bugzilla/" +SECTION = "devel" +LICENSE = "GPL-3.0-only" + +DEPENDS = "flex-native bison-native zlib-native gnu-config-native autoconf-native" + +inherit autotools gettext multilib_header pkgconfig texinfo + +FILES:${PN} = " \ + ${bindir}/${TARGET_PREFIX}* \ + ${libdir}/lib*.so.* \ + ${libdir}/bfd-plugins/lib*.so \ + ${libdir}/lib*-${PV}*.so \ + ${prefix}/${TARGET_SYS}/bin/* \ + ${bindir}/embedspu" + +RPROVIDES:${PN} += "${PN}-symlinks" + +FILES:${PN}-dev = " \ + ${includedir} \ + ${libdir}/*.la \ + ${libdir}/libbfd.so \ + ${libdir}/libctf.so \ + ${libdir}/libctf-nobfd.so \ + ${libdir}/libopcodes.so" + +FILES:${PN}-staticdev += "${libdir}/gprofng/*.a" + +# Rather than duplicating multiple entries for these, make one +# list and reuse it. + +GPROFNGS = " \ + gp-archive \ + gp-collect-app \ + gp-display-html \ + gp-display-src \ + gp-display-text \ + gprofng \ +" + +# it disables gprofng for clang and musl in the bb file +GPROFNGS:toolchain-clang = "" +GPROFNGS:libc-musl = "" + +GPROFNG_ALTS ?= "" +GPROFNG_ALTS:x86 = "${GPROFNGS}" +GPROFNG_ALTS:x86-64 = "${GPROFNGS}" +GPROFNG_ALTS:aarch64 = "${GPROFNGS}" + +LDGOLD_ALTS ?= "ld.gold dwp" +LDGOLD_ALTS:riscv64 = "" +LDGOLD_ALTS:riscv32 = "" +LDGOLD_ALTS:loongarch64 = "" +LDGOLD_ALTS:libc-glibc:mipsarch = "" + +USE_ALTERNATIVES_FOR = " \ + addr2line \ + ar \ + as \ + c++filt \ + elfedit \ + gprof \ + ${GPROFNG_ALTS} \ + ld \ + ld.bfd \ + ${LDGOLD_ALTS} \ + nm \ + objcopy \ + objdump \ + ranlib \ + readelf \ + size \ + strings \ + strip \ +" + +python do_package:prepend() { + make_alts = d.getVar("USE_ALTERNATIVES_FOR") or "" + prefix = d.getVar("TARGET_PREFIX") + bindir = d.getVar("bindir") + for alt in make_alts.split(): + d.setVarFlag('ALTERNATIVE_TARGET', alt, bindir + "/" + prefix + alt) + d.setVarFlag('ALTERNATIVE_LINK_NAME', alt, bindir + "/" + alt) +} + +B = "${S}/build.${HOST_SYS}.${TARGET_SYS}" + +EXTRA_OECONF = "--program-prefix=${TARGET_PREFIX} \ + --disable-werror \ + --enable-deterministic-archives \ + --enable-plugins \ + --enable-new-dtags \ + --disable-gdb \ + --disable-gdbserver \ + --disable-libdecnumber \ + --disable-readline \ + --disable-sim \ + ${LDGOLD} \ + ${EXTRA_TARGETS} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)}" + +EXTRA_TARGETS = "" +EXTRA_TARGETS:x86-64 = " --enable-targets=x86_64-pe,x86_64-pep " +EXTRA_TARGETS:class-native = "" + +LDGOLD:class-native = "" +LDGOLD:class-crosssdk = "" +LDGOLD:libc-glibc:mipsarch = "" +LDGOLD ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '--enable-gold=default --enable-threads', '--enable-gold --enable-ld=default --enable-threads', d)}" + + +# This is necessary due to a bug in the binutils Makefiles +# EXTRA_OEMAKE = "configure-build-libiberty all" + +export AR = "${HOST_PREFIX}ar" +export AS = "${HOST_PREFIX}as" +export LD = "${HOST_PREFIX}ld" +export NM = "${HOST_PREFIX}nm" +export RANLIB = "${HOST_PREFIX}ranlib" +export OBJCOPY = "${HOST_PREFIX}objcopy" +export OBJDUMP = "${HOST_PREFIX}objdump" + +export AR_FOR_TARGET = "${TARGET_PREFIX}ar" +export AS_FOR_TARGET = "${TARGET_PREFIX}as" +export LD_FOR_TARGET = "${TARGET_PREFIX}ld" +export NM_FOR_TARGET = "${TARGET_PREFIX}nm" +export RANLIB_FOR_TARGET = "${TARGET_PREFIX}ranlib" + +export CC_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" +export CXX_FOR_HOST = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_ARCH}" + +# autotools.bbclass sets the _FOR_BUILD variables, but for some reason we need +# to unset LD_LIBRARY_PATH. +export CC_FOR_BUILD = "LD_LIBRARY_PATH= ${BUILD_CC}" + +MULTIARCH := "${@bb.utils.contains("DISTRO_FEATURES", "multiarch", "yes", "no", d)}" +do_configure[vardeps] += "MULTIARCH" +do_configure () { + (cd ${S} && gnu-configize) + + oe_runconf +# +# must prime config.cache to ensure the build of libiberty +# + mkdir -p ${B}/build-${BUILD_SYS} + for i in ${CONFIG_SITE}; do + cat $i >> ${B}/build-${BUILD_SYS}/config.cache || true + done +} + +do_install () { + autotools_do_install + + # We don't really need these, so we'll remove them... + rm -rf ${D}${libdir}/ldscripts + + bindir_rel=${@os.path.relpath('${bindir}', '${prefix}/${TARGET_SYS}/bin')} + + # Fix the /usr/${TARGET_SYS}/bin/* links + for l in ${D}${prefix}/${TARGET_SYS}/bin/*; do + rm -f $l + ln -sf $bindir_rel/${TARGET_PREFIX}`basename $l` $l + done + + # Install the libiberty header + install -d ${D}${includedir} + install -m 644 ${S}/include/ansidecl.h ${D}${includedir} + install -m 644 ${S}/include/libiberty.h ${D}${includedir} + + # insall pic version of libiberty if available + if [ -e ${B}/libiberty/pic/libiberty.a ]; then + install -Dm 0644 ${B}/libiberty/pic/libiberty.a ${D}${libdir}/libiberty.a + fi + + cd ${D}${bindir} + + # Symlinks for ease of running these on the native target + for p in ${TARGET_PREFIX}* ; do + ln -sf $p `echo $p | sed -e s,${TARGET_PREFIX},,` + done + + for alt in ${USE_ALTERNATIVES_FOR}; do + rm -f ${D}${bindir}/$alt + done + + oe_multilib_header bfd.h +} + +inherit update-alternatives + +ALTERNATIVE_PRIORITY = "100" + +ALTERNATIVE:${PN}:class-target = "${USE_ALTERNATIVES_FOR}" + +python () { + if bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', True, False, d) and bb.utils.contains_any('TARGET_ARCH', 'riscv32 riscv64 loongarch64', True, False, d): + bb.fatal("Gold linker does not _yet_ support RISC-V and LoongArch architecture please remove ld-is-gold from DISTRO_FEATURES") +} diff --git a/meta-openeuler/recipes-devtools/binutils/binutils_%.bbappend b/meta-openeuler/recipes-devtools/binutils/binutils_%.bbappend index 42dd3e6f17b..938773963a2 100644 --- a/meta-openeuler/recipes-devtools/binutils/binutils_%.bbappend +++ b/meta-openeuler/recipes-devtools/binutils/binutils_%.bbappend @@ -1 +1 @@ -require binutils_src.inc +require binutils-src.inc diff --git a/meta-openeuler/recipes-devtools/binutils/binutils_2.40.bb b/meta-openeuler/recipes-devtools/binutils/binutils_2.40.bb new file mode 100644 index 00000000000..4ce1b4bec2f --- /dev/null +++ b/meta-openeuler/recipes-devtools/binutils/binutils_2.40.bb @@ -0,0 +1,75 @@ +require binutils.inc +require binutils-${PV}.inc + +DEPENDS += "zlib" + +EXTRA_OECONF += "--with-sysroot=/ \ + --enable-install-libbfd \ + --enable-install-libiberty \ + --enable-shared \ + --with-system-zlib \ + " + +EXTRA_OEMAKE:append:libc-musl = "\ + gt_cv_func_gnugettext1_libc=yes \ + gt_cv_func_gnugettext2_libc=yes \ + " +# libcollector/collector.c:547:15: error: no member named '__fprintf_chk' in 'struct CollectorUtilFuncs' +EXTRA_OECONF:append:toolchain-clang = " --disable-gprofng" +# | ../../../gprofng/libcollector/../src/collector_module.h:78:13: error: duplicate member 'pwrite' +# | ../../../gprofng/libcollector/dispatcher.c:578:8: error: 'struct sigevent' has no member named '_sigev_un' +EXTRA_OECONF:append:libc-musl = " --disable-gprofng" + +EXTRA_OECONF:class-native = "--enable-targets=all \ + --enable-64-bit-bfd \ + --enable-install-libiberty \ + --enable-install-libbfd \ + --disable-gdb \ + --disable-gdbserver \ + --disable-libdecnumber \ + --disable-readline \ + --disable-sim \ + --disable-werror" + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}" +PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils" + +do_install:class-native () { + autotools_do_install + + # Install the libiberty header + install -d ${D}${includedir} + install -m 644 ${S}/include/ansidecl.h ${D}${includedir} + install -m 644 ${S}/include/libiberty.h ${D}${includedir} + + # We only want libiberty, libbfd and libopcodes + rm -rf ${D}${bindir} + rm -rf ${D}${prefix}/${TARGET_SYS} + rm -rf ${D}${prefix}/lib/ldscripts + rm -rf ${D}${prefix}/share/info + rm -rf ${D}${prefix}/share/locale + rm -rf ${D}${prefix}/share/man + rmdir ${D}${prefix}/share || : + rmdir ${D}/${libdir}/gcc-lib || : + rmdir ${D}/${libdir}64/gcc-lib || : + rmdir ${D}/${libdir} || : + rmdir ${D}/${libdir}64 || : +} + +# libctf races with libbfd +PARALLEL_MAKEINST:class-target = "" +PARALLEL_MAKEINST:class-nativesdk = "" + +# Split out libbfd-*.so and libopcodes-*.so so including perf doesn't include +# extra stuff +PACKAGE_BEFORE_PN += "libbfd libopcodes gprofng" +FILES:libbfd = "${libdir}/libbfd-*.so.* ${libdir}/libbfd-*.so" +FILES:libopcodes = "${libdir}/libopcodes-*.so.* ${libdir}/libopcodes-*.so" +FILES:gprofng = "${sysconfdir}/gprofng.rc ${libdir}/gprofng/libgp-*.so ${libdir}/gprofng/libgprofng.so.* ${bindir}/gp-* ${bindir}/gprofng" +FILES:${PN}-dev += "${libdir}/libgprofng.so ${libdir}/libsframe.so" +SRC_URI:append:class-nativesdk = " file://0003-binutils-nativesdk-Search-for-alternative-ld.so.conf.patch " + +USE_ALTERNATIVES_FOR:class-nativesdk = "" +FILES:${PN}:append:class-nativesdk = " ${bindir}" + +BBCLASSEXTEND = "native nativesdk" -- Gitee From 90f1b15f57061b75443c32dbf9ac22c24dbfe313 Mon Sep 17 00:00:00 2001 From: lixiaoyong Date: Sat, 21 Oct 2023 14:29:59 +0800 Subject: [PATCH 5/5] yocto: update manifest file * update manifest file, add some packages Signed-off-by: lixiaoyong --- .oebuild/manifest.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.oebuild/manifest.yaml b/.oebuild/manifest.yaml index cb96b8c7aab..03db539f2ef 100644 --- a/.oebuild/manifest.yaml +++ b/.oebuild/manifest.yaml @@ -1428,3 +1428,27 @@ manifest_list: libmodulemd: remote_url: https://gitee.com/src-openeuler/libmodulemd.git version: 12d250eb89accacc62bd609170bbd356e78c2ecd + gcc: + remote_url: https://gitee.com/src-openeuler/gcc.git + version: 5f6931e0f1feade0704df1d8ae7e7b78776233be + ninja: + remote_url: https://gitee.com/src-openeuler/ninja-build.git + version: 66e8d14ae38ef546c2f0685571befb856d655bb3 + quilt: + remote_url: https://gitee.com/src-openeuler/quilt.git + version: e7982134da4045463d63a3f94ccc685abc5028a3 + python-pip: + remote_url: https://gitee.com/src-openeuler/python-pip.git + version: c70dbd6adc9e9a0d66febb4fad648c0bebe86713 + itstool: + remote_url: https://gitee.com/src-openeuler/itstool.git + version: 1d89c268ee08d705174a56f7b6b8111469404c34 + libpciaccess: + remote_url: https://gitee.com/src-openeuler/libpciaccess.git + version: a3c7f279cde8f65e808e0fc3b2fb05b96e318557 + python-GitPython: + remote_url: https://gitee.com/src-openeuler/python-GitPython.git + version: 4e662f085ebd74393ce27e4a33278dfeee6a64bb + libdnf: + remote_url: https://gitee.com/src-openeuler/libdnf.git + version: 5b0676fed93b04cec4fbba6086b6fce6c9658121 -- Gitee