diff options
3 files changed, 209 insertions, 114 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-10.2.inc b/meta/recipes-devtools/gcc/gcc-10.2.inc index 1e69c91311..c0cd8b31d5 100644 --- a/meta/recipes-devtools/gcc/gcc-10.2.inc +++ b/meta/recipes-devtools/gcc/gcc-10.2.inc | |||
| @@ -69,7 +69,7 @@ SRC_URI = "\ | |||
| 69 | file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ | 69 | file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ |
| 70 | file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ | 70 | file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ |
| 71 | file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ | 71 | file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ |
| 72 | file://0001-lib-Remove-i-86-march-overrides.patch \ | 72 | file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \ |
| 73 | " | 73 | " |
| 74 | SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" | 74 | SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" |
| 75 | 75 | ||
diff --git a/meta/recipes-devtools/gcc/gcc/0001-lib-Remove-i-86-march-overrides.patch b/meta/recipes-devtools/gcc/gcc/0001-lib-Remove-i-86-march-overrides.patch deleted file mode 100644 index 3f04e121ba..0000000000 --- a/meta/recipes-devtools/gcc/gcc/0001-lib-Remove-i-86-march-overrides.patch +++ /dev/null | |||
| @@ -1,113 +0,0 @@ | |||
| 1 | From 3776789cde95916f95deef48acf9532b0ebf91ae Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Nathan Rossi <nathan@nathanrossi.com> | ||
| 3 | Date: Tue, 15 Dec 2020 11:43:36 +1000 | ||
| 4 | Subject: [PATCH] lib*: Remove i*86 march overrides | ||
| 5 | |||
| 6 | OE does not pass the '--with-arch' option to gccs configure, as such | ||
| 7 | some gcc-runtime libraries try to override the value of '-march' and | ||
| 8 | '-mtune' which OE already provides. This causes conflicts with other | ||
| 9 | i*86 instruction/architecture flags (e.g. -msse* and -mfpmath=*). | ||
| 10 | Additionally this caused the following libraries to be built with less | ||
| 11 | optimized tune configurations. | ||
| 12 | |||
| 13 | Upstream suggests that this should be detecting or otherwise checking if | ||
| 14 | the target supports the desired functionality before overriding. | ||
| 15 | |||
| 16 | https://gcc.gnu.org/legacy-ml/gcc-patches/2016-04/msg01344.html | ||
| 17 | |||
| 18 | libatomic also overrides the '-march' specifically for IFUNC objects. | ||
| 19 | OE already supplies the correct march flag, so remove setting. | ||
| 20 | |||
| 21 | Upstream-Status: Inappropriate [OE Specific] | ||
| 22 | Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> | ||
| 23 | --- | ||
| 24 | libatomic/Makefile.am | 1 - | ||
| 25 | libatomic/Makefile.in | 1 - | ||
| 26 | libatomic/configure.tgt | 9 --------- | ||
| 27 | libgomp/configure.tgt | 8 -------- | ||
| 28 | libitm/configure.tgt | 9 --------- | ||
| 29 | 5 files changed, 28 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/libatomic/Makefile.am b/libatomic/Makefile.am | ||
| 32 | index ac1ca64587..5aa16e0699 100644 | ||
| 33 | --- a/libatomic/Makefile.am | ||
| 34 | +++ b/libatomic/Makefile.am | ||
| 35 | @@ -133,7 +133,6 @@ libatomic_la_LIBADD += $(foreach s,$(SIZES),$(addsuffix _$(s)_1_.lo,$(SIZEOBJS)) | ||
| 36 | libatomic_la_LIBADD += $(addsuffix _8_2_.lo,$(SIZEOBJS)) | ||
| 37 | endif | ||
| 38 | if ARCH_I386 | ||
| 39 | -IFUNC_OPTIONS = -march=i586 | ||
| 40 | libatomic_la_LIBADD += $(addsuffix _8_1_.lo,$(SIZEOBJS)) | ||
| 41 | endif | ||
| 42 | if ARCH_X86_64 | ||
| 43 | diff --git a/libatomic/Makefile.in b/libatomic/Makefile.in | ||
| 44 | index 97df2d7ff0..82c511d420 100644 | ||
| 45 | --- a/libatomic/Makefile.in | ||
| 46 | +++ b/libatomic/Makefile.in | ||
| 47 | @@ -432,7 +432,6 @@ libatomic_la_LIBADD = $(foreach s,$(SIZES),$(addsuffix \ | ||
| 48 | _$(s)_.lo,$(SIZEOBJS))) $(am__append_1) $(am__append_2) \ | ||
| 49 | $(am__append_3) $(am__append_4) | ||
| 50 | @ARCH_ARM_LINUX_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=armv7-a+fp -DHAVE_KERNEL64 | ||
| 51 | -@ARCH_I386_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -march=i586 | ||
| 52 | @ARCH_X86_64_TRUE@@HAVE_IFUNC_TRUE@IFUNC_OPTIONS = -mcx16 | ||
| 53 | libatomic_convenience_la_SOURCES = $(libatomic_la_SOURCES) | ||
| 54 | libatomic_convenience_la_LIBADD = $(libatomic_la_LIBADD) | ||
| 55 | diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt | ||
| 56 | index 5dd0926d20..3cc41773c3 100644 | ||
| 57 | --- a/libatomic/configure.tgt | ||
| 58 | +++ b/libatomic/configure.tgt | ||
| 59 | @@ -82,15 +82,6 @@ case "${target_cpu}" in | ||
| 60 | ;; | ||
| 61 | |||
| 62 | i[3456]86) | ||
| 63 | - case " ${CC} ${CFLAGS} " in | ||
| 64 | - *" -m64 "*|*" -mx32 "*) | ||
| 65 | - ;; | ||
| 66 | - *) | ||
| 67 | - if test -z "$with_arch"; then | ||
| 68 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 69 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 70 | - fi | ||
| 71 | - esac | ||
| 72 | ARCH=x86 | ||
| 73 | # ??? Detect when -march=i686 is already enabled. | ||
| 74 | try_ifunc=yes | ||
| 75 | diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt | ||
| 76 | index 4790a31e39..46c4c958e6 100644 | ||
| 77 | --- a/libgomp/configure.tgt | ||
| 78 | +++ b/libgomp/configure.tgt | ||
| 79 | @@ -72,14 +72,6 @@ if test x$enable_linux_futex = xyes; then | ||
| 80 | # Note that bare i386 is not included here. We need cmpxchg. | ||
| 81 | i[456]86-*-linux*) | ||
| 82 | config_path="linux/x86 linux posix" | ||
| 83 | - case " ${CC} ${CFLAGS} " in | ||
| 84 | - *" -m64 "*|*" -mx32 "*) | ||
| 85 | - ;; | ||
| 86 | - *) | ||
| 87 | - if test -z "$with_arch"; then | ||
| 88 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 89 | - fi | ||
| 90 | - esac | ||
| 91 | ;; | ||
| 92 | |||
| 93 | # Similar jiggery-pokery for x86_64 multilibs, except here we | ||
| 94 | diff --git a/libitm/configure.tgt b/libitm/configure.tgt | ||
| 95 | index 04109160e9..3d78ea609d 100644 | ||
| 96 | --- a/libitm/configure.tgt | ||
| 97 | +++ b/libitm/configure.tgt | ||
| 98 | @@ -59,15 +59,6 @@ case "${target_cpu}" in | ||
| 99 | arm*) ARCH=arm ;; | ||
| 100 | |||
| 101 | i[3456]86) | ||
| 102 | - case " ${CC} ${CFLAGS} " in | ||
| 103 | - *" -m64 "*|*" -mx32 "*) | ||
| 104 | - ;; | ||
| 105 | - *) | ||
| 106 | - if test -z "$with_arch"; then | ||
| 107 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 108 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 109 | - fi | ||
| 110 | - esac | ||
| 111 | XCFLAGS="${XCFLAGS} -mrtm" | ||
| 112 | ARCH=x86 | ||
| 113 | ;; | ||
diff --git a/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch new file mode 100644 index 0000000000..addecb4bd8 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jakub Jelinek <jakub@redhat.com> | ||
| 3 | Date: Fri, 15 Jan 2021 13:12:59 +0100 | ||
| 4 | Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454] | ||
| 5 | |||
| 6 | The recent changes to error on mixing -march=i386 and -fcf-protection broke | ||
| 7 | bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it | ||
| 8 | only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't | ||
| 9 | on by default already). Similarly, it will not use ifuncs if -mcx16 | ||
| 10 | (or -march=i686 for 32-bit) is on by default. | ||
| 11 | |||
| 12 | 2021-01-15 Jakub Jelinek <jakub@redhat.com> | ||
| 13 | |||
| 14 | PR target/70454 | ||
| 15 | libatomic/ | ||
| 16 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
| 17 | be added through preprocessor check on | ||
| 18 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed | ||
| 19 | based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 | ||
| 20 | or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8. | ||
| 21 | libgomp/ | ||
| 22 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
| 23 | be added through preprocessor check on | ||
| 24 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. | ||
| 25 | libitm/ | ||
| 26 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
| 27 | be added through preprocessor check on | ||
| 28 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. | ||
| 29 | |||
| 30 | Upstream-Status: Backport [master post 10.x release] | ||
| 31 | --- | ||
| 32 | libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------ | ||
| 33 | libgomp/configure.tgt | 35 +++++++++++--------------- | ||
| 34 | libitm/configure.tgt | 37 +++++++++++++-------------- | ||
| 35 | 3 files changed, 64 insertions(+), 64 deletions(-) | ||
| 36 | |||
| 37 | diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt | ||
| 38 | index 5dd0926d20..6ea082a29b 100644 | ||
| 39 | --- a/libatomic/configure.tgt | ||
| 40 | +++ b/libatomic/configure.tgt | ||
| 41 | @@ -81,32 +81,40 @@ case "${target_cpu}" in | ||
| 42 | ARCH=sparc | ||
| 43 | ;; | ||
| 44 | |||
| 45 | - i[3456]86) | ||
| 46 | - case " ${CC} ${CFLAGS} " in | ||
| 47 | - *" -m64 "*|*" -mx32 "*) | ||
| 48 | - ;; | ||
| 49 | - *) | ||
| 50 | - if test -z "$with_arch"; then | ||
| 51 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 52 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 53 | - fi | ||
| 54 | - esac | ||
| 55 | - ARCH=x86 | ||
| 56 | - # ??? Detect when -march=i686 is already enabled. | ||
| 57 | - try_ifunc=yes | ||
| 58 | - ;; | ||
| 59 | - x86_64) | ||
| 60 | - case " ${CC} ${CFLAGS} " in | ||
| 61 | - *" -m32 "*) | ||
| 62 | + i[3456]86 | x86_64) | ||
| 63 | + cat > conftestx.c <<EOF | ||
| 64 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
| 65 | +#error need -march=i486 | ||
| 66 | +#endif | ||
| 67 | +EOF | ||
| 68 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
| 69 | + : | ||
| 70 | + else | ||
| 71 | + if test "${target_cpu}" = x86_64; then | ||
| 72 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
| 73 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 74 | - ;; | ||
| 75 | - *) | ||
| 76 | - ;; | ||
| 77 | - esac | ||
| 78 | + else | ||
| 79 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 80 | + fi | ||
| 81 | + XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 82 | + fi | ||
| 83 | + cat > conftestx.c <<EOF | ||
| 84 | +#ifdef __x86_64__ | ||
| 85 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 | ||
| 86 | +#error need -mcx16 | ||
| 87 | +#endif | ||
| 88 | +#else | ||
| 89 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 | ||
| 90 | +#error need -march=i686 | ||
| 91 | +#endif | ||
| 92 | +#endif | ||
| 93 | +EOF | ||
| 94 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
| 95 | + try_ifunc=no | ||
| 96 | + else | ||
| 97 | + try_ifunc=yes | ||
| 98 | + fi | ||
| 99 | + rm -f conftestx.c | ||
| 100 | ARCH=x86 | ||
| 101 | - # ??? Detect when -mcx16 is already enabled. | ||
| 102 | - try_ifunc=yes | ||
| 103 | ;; | ||
| 104 | |||
| 105 | *) ARCH="${target_cpu}" ;; | ||
| 106 | diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt | ||
| 107 | index 4790a31e39..761ef2a7db 100644 | ||
| 108 | --- a/libgomp/configure.tgt | ||
| 109 | +++ b/libgomp/configure.tgt | ||
| 110 | @@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then | ||
| 111 | ;; | ||
| 112 | |||
| 113 | # Note that bare i386 is not included here. We need cmpxchg. | ||
| 114 | - i[456]86-*-linux*) | ||
| 115 | + i[456]86-*-linux* | x86_64-*-linux*) | ||
| 116 | config_path="linux/x86 linux posix" | ||
| 117 | - case " ${CC} ${CFLAGS} " in | ||
| 118 | - *" -m64 "*|*" -mx32 "*) | ||
| 119 | - ;; | ||
| 120 | - *) | ||
| 121 | - if test -z "$with_arch"; then | ||
| 122 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 123 | - fi | ||
| 124 | - esac | ||
| 125 | - ;; | ||
| 126 | - | ||
| 127 | - # Similar jiggery-pokery for x86_64 multilibs, except here we | ||
| 128 | - # can't rely on the --with-arch configure option, since that | ||
| 129 | - # applies to the 64-bit side. | ||
| 130 | - x86_64-*-linux*) | ||
| 131 | - config_path="linux/x86 linux posix" | ||
| 132 | - case " ${CC} ${CFLAGS} " in | ||
| 133 | - *" -m32 "*) | ||
| 134 | + cat > conftestx.c <<EOF | ||
| 135 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
| 136 | +#error need -march=i486 | ||
| 137 | +#endif | ||
| 138 | +EOF | ||
| 139 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
| 140 | + : | ||
| 141 | + else | ||
| 142 | + if test "${target_cpu}" = x86_64; then | ||
| 143 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
| 144 | - ;; | ||
| 145 | - esac | ||
| 146 | + else | ||
| 147 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 148 | + fi | ||
| 149 | + fi | ||
| 150 | + rm -f conftestx.c | ||
| 151 | ;; | ||
| 152 | |||
| 153 | # Note that sparcv7 and sparcv8 is not included here. We need cas. | ||
| 154 | diff --git a/libitm/configure.tgt b/libitm/configure.tgt | ||
| 155 | index 04109160e9..ca62bac627 100644 | ||
| 156 | --- a/libitm/configure.tgt | ||
| 157 | +++ b/libitm/configure.tgt | ||
| 158 | @@ -58,16 +58,23 @@ case "${target_cpu}" in | ||
| 159 | |||
| 160 | arm*) ARCH=arm ;; | ||
| 161 | |||
| 162 | - i[3456]86) | ||
| 163 | - case " ${CC} ${CFLAGS} " in | ||
| 164 | - *" -m64 "*|*" -mx32 "*) | ||
| 165 | - ;; | ||
| 166 | - *) | ||
| 167 | - if test -z "$with_arch"; then | ||
| 168 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 169 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 170 | - fi | ||
| 171 | - esac | ||
| 172 | + i[3456]86 | x86_64) | ||
| 173 | + cat > conftestx.c <<EOF | ||
| 174 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
| 175 | +#error need -march=i486 | ||
| 176 | +#endif | ||
| 177 | +EOF | ||
| 178 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
| 179 | + : | ||
| 180 | + else | ||
| 181 | + if test "${target_cpu}" = x86_64; then | ||
| 182 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
| 183 | + else | ||
| 184 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
| 185 | + fi | ||
| 186 | + XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 187 | + fi | ||
| 188 | + rm -f conftestx.c | ||
| 189 | XCFLAGS="${XCFLAGS} -mrtm" | ||
| 190 | ARCH=x86 | ||
| 191 | ;; | ||
| 192 | @@ -102,16 +109,6 @@ case "${target_cpu}" in | ||
| 193 | ARCH=sparc | ||
| 194 | ;; | ||
| 195 | |||
| 196 | - x86_64) | ||
| 197 | - case " ${CC} ${CFLAGS} " in | ||
| 198 | - *" -m32 "*) | ||
| 199 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
| 200 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
| 201 | - ;; | ||
| 202 | - esac | ||
| 203 | - XCFLAGS="${XCFLAGS} -mrtm" | ||
| 204 | - ARCH=x86 | ||
| 205 | - ;; | ||
| 206 | s390|s390x) | ||
| 207 | XCFLAGS="${XCFLAGS} -mzarch -mhtm" | ||
| 208 | ARCH=s390 | ||
