From 0067fbb6093ae0acfac8a95e5a7699248a1d834f Mon Sep 17 00:00:00 2001 From: Ferass El Hafidi Date: Mon, 22 Jun 2026 19:39:56 +0000 Subject: [PATCH] cross/*-armhf: drop We are dropping armhf from postmarketOS. Remove all cross-compilers for it. See also: #4615 Signed-off-by: Ferass El Hafidi Part-of: --- ...llow-valid-binary-op-when-optimize-c.patch | 130 - cross/gcc-armhf/0001-posix_memalign.patch | 42 - ....cc-Fix-assert-constant-offset-in-ch.patch | 77 - .../0002-gcc-poison-system-directories.patch | 258 -- ...03-specs-turn-on-Wl-z-now-by-default.patch | 44 - ...Y_SOURCE-2-by-default-for-C-C-ObjC-O.patch | 46 - ...-pass-as-needed-by-default-to-the-li.patch | 286 --- ...rmat-and-Wformat-security-by-default.patch | 34 - .../0007-Enable-Wtrampolines-by-default.patch | 25 - ...on-ffreestanding-nostdlib-and-nodefa.patch | 39 - ...ams-set-default-ssp-buffer-size-to-4.patch | 25 - ...mt-doesn-t-encounter-problems-during.patch | 54 - ...clare-asprintf-if-defined-as-a-macro.patch | 28 - ...opy-PIC-objects-during-build-process.patch | 24 - cross/gcc-armhf/0013-libgcc_s.patch | 57 - cross/gcc-armhf/0014-nopie.patch | 85 - .../0015-ada-fix-shared-linking.patch | 42 - ...build-fix-CXXFLAGS_FOR_BUILD-passing.patch | 24 - .../0017-add-fortify-headers-paths.patch | 25 - ...age-provides-libssp_nonshared.a.-We-.patch | 31 - ...e-pop-state-for-gold-as-well-when-li.patch | 69 - ...020-aarch64-disable-multilib-support.patch | 26 - .../0021-s390x-disable-multilib-support.patch | 25 - ...22-ppc64-le-disable-multilib-support.patch | 81 - ...0023-x86_64-disable-multilib-support.patch | 26 - .../0024-riscv-disable-multilib-support.patch | 78 - .../0025-always-build-libgcc_eh.a.patch | 51 - ...ove-use-of-glibc-specific-pthread_rw.patch | 59 - ...-posix_openpt-instead-of-glibc-speci.patch | 50 - ...daint-fix-sched.h-inclusion-for-musl.patch | 54 - ...able-autolink-libatomic-use-in-LINK_.patch | 256 -- ...tection-of-atomic-builtins-in-libato.patch | 57 - ...hrow-exceptions-for-non-C-locales-on.patch | 27 - ...lly-link-libgphobos-against-libucont.patch | 26 - ...against-libucontext-on-all-platforms.patch | 54 - ...time_t-is-always-64-bit-on-musl-libc.patch | 25 - ...5-libphobos-do-not-use-LFS64-symbols.patch | 30 - .../gcc-armhf/0036-libgo-fix-lfs64-use.patch | 195 -- ...7-loongarch-disable-multilib-support.patch | 32 - ...PIE-ensure-static-reaches-the-linker.patch | 113 - ...-the-cached-value-of-the-gcc_except_.patch | 77 - ...-stub-symbolic-module-name-functions.patch | 164 -- ...gnize-linux-musleabi-and-linux-muslg.patch | 26 - ...42-libsanitizer-struct_sock_fprog_sz.patch | 31 - cross/gcc-armhf/APKBUILD | 830 ------- cross/gcc4-armhf/01_all_gcc49_configure.patch | 156 -- cross/gcc4-armhf/02_all_gcc48_config.in.patch | 32 - .../gcc4-armhf/03_all_gcc49_Makefile.in.patch | 96 - cross/gcc4-armhf/05_all_gcc48_gcc.c.patch | 25 - .../1001-fix-reload1-compile-error.patch | 17 - .../12_all_default-warn-trampolines.patch | 24 - .../15_all_libgfortran-Werror.patch | 17 - .../16_all_gcc47_nopie_option.patch | 16 - cross/gcc4-armhf/16_all_libgomp-Werror.patch | 17 - .../20_all_gcc49_config_crtbeginp.patch | 40 - .../gcc4-armhf/24_all_gcc49_invoke.texi.patch | 44 - .../gcc4-armhf/34_all_gcc48_config_i386.patch | 56 - .../gcc4-armhf/35_all_gcc48_config_arm.patch | 35 - .../gcc4-armhf/40_all_gcc49_config_esp.patch | 135 -- .../41_all_gcc49_config_esp_alpine.patch | 67 - .../48_all_x86_pr53113_libitm-avx.patch | 28 - .../50_all_libiberty-asprintf.patch | 18 - cross/gcc4-armhf/51_all_libiberty-pic.patch | 10 - ...67_all_gcc-poison-system-directories.patch | 190 -- cross/gcc4-armhf/APKBUILD | 534 ---- cross/gcc4-armhf/ada-fixes.patch | 44 - cross/gcc4-armhf/ada-musl.patch | 136 -- cross/gcc4-armhf/ada-no-pie.patch | 66 - cross/gcc4-armhf/ada-shared.patch | 30 - cross/gcc4-armhf/boehm-gc-musl.patch | 62 - cross/gcc4-armhf/boehm-gc-uclibc.patch | 11 - .../gcc4-armhf/fix-cxxflags-for-target.patch | 5 - cross/gcc4-armhf/fix-cxxflags-passing.patch | 10 - cross/gcc4-armhf/fix-gcj-iconv-musl.patch | 120 - cross/gcc4-armhf/fix-gcj-musl.patch | 49 - cross/gcc4-armhf/gcc-4.6-pr32219.patch | 25 - cross/gcc4-armhf/gcc-4.8-build-args.patch | 41 - .../gcc-4.8-musl-fix-iteratephdr.patch | 22 - cross/gcc4-armhf/gcc-4.8-musl-libssp.patch | 21 - cross/gcc4-armhf/gcc-4.9-musl.patch | 703 ------ cross/gcc4-armhf/gcc-ice-hack.patch | 304 --- cross/gcc4-armhf/gcc-pure64.patch | 11 - cross/gcc4-armhf/gcc-spec-env.patch | 42 - cross/gcc4-armhf/gcc49-cloog-dl.patch | 478 ---- cross/gcc4-armhf/hardenednopie.specs | 12 - cross/gcc4-armhf/hardenednopiessp.specs | 4 - cross/gcc4-armhf/hardenednossp.specs | 6 - .../libgcc-always-build-gcceh.a.patch | 39 - .../gcc4-armhf/musl-posix_memalign-c++.patch | 27 - cross/gcc4-armhf/pr63740.patch | 17 - cross/gcc4-armhf/vanilla.specs | 11 - ...truct-ix86_frame-to-machine_function.patch | 241 -- ...ce-of-struct-ix86_frame-to-avoid-cop.patch | 69 - ...eference-of-struct-ix86_frame-to-avo.patch | 126 - .../0004-x86-Add-mindirect-branch.patch | 2149 ----------------- .../0005-x86-Add-mfunction-return.patch | 1565 ------------ ...06-x86-Add-mindirect-branch-register.patch | 941 -------- ...-x86-Add-V-register-operand-modifier.patch | 134 - ...direct-branch-mfunction-return-with-.patch | 299 --- ..._REGNUM-in-indirect-thunk-processing.patch | 121 - ...ID_REGNUM-as-invalid-register-number.patch | 41 - ...mfunction-return-for-return-with-pop.patch | 456 ---- ...-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch | 1003 -------- ...rate-alias-for-function-return-thunk.patch | 225 -- .../0014-fix-missing-includes-isl-0.20.patch | 54 - .../0015-fix-error_p-null-error.patch | 30 - .../001_all_default-ssp-strong.patch | 215 -- cross/gcc6-armhf/002_all_default-relro.patch | 33 - .../005_all_default-as-needed.patch | 241 -- ...011_all_default-warn-format-security.patch | 43 - .../012_all_default-warn-trampolines.patch | 25 - .../020_all_msgfmt-libstdc++-link.patch | 39 - .../050_all_libiberty-asprintf.patch | 18 - cross/gcc6-armhf/051_all_libiberty-pic.patch | 10 - .../053_all_libitm-no-fortify-source.patch | 27 - ...67_all_gcc-poison-system-directories.patch | 194 -- .../090_all_pr55930-dependency-tracking.patch | 18 - cross/gcc6-armhf/201-cilkrts.patch | 59 - cross/gcc6-armhf/203-libgcc_s.patch | 56 - .../204-linux_libc_has_function.patch | 25 - cross/gcc6-armhf/205-nopie.patch | 75 - cross/gcc6-armhf/207-static-pie.patch | 40 - ...in-gcc-add-musl-s390x-dynamic-linker.patch | 32 - cross/gcc6-armhf/310-build-gcj-s390x.patch | 28 - cross/gcc6-armhf/320-libffi-gnulinux.patch | 13 - cross/gcc6-armhf/APKBUILD | 552 ----- cross/gcc6-armhf/ada-aarch64-multiarch.patch | 16 - cross/gcc6-armhf/ada-fixes.patch | 35 - cross/gcc6-armhf/ada-mips64.patch | 224 -- cross/gcc6-armhf/ada-musl.patch | 137 -- cross/gcc6-armhf/ada-shared.patch | 30 - cross/gcc6-armhf/boehm-gc-musl.patch | 62 - cross/gcc6-armhf/fix-cxxflags-passing.patch | 10 - cross/gcc6-armhf/fix-gcj-iconv-musl.patch | 120 - cross/gcc6-armhf/fix-gcj-musl.patch | 49 - cross/gcc6-armhf/fix-gcj-stdgnu14-link.patch | 35 - .../fix-linux-header-use-in-libgcc.patch | 44 - cross/gcc6-armhf/fix-rs6000-pie.patch | 59 - cross/gcc6-armhf/gcc-4.8-build-args.patch | 41 - cross/gcc6-armhf/gcc-6.1-musl-libssp.patch | 20 - cross/gcc6-armhf/gcc-6.4-isl.patch | 251 -- cross/gcc6-armhf/gcc-pure64-mips.patch | 47 - cross/gcc6-armhf/gcc-pure64.patch | 89 - .../libgcc-always-build-gcceh.a.patch | 39 - cross/musl-armhf/APKBUILD | 63 - 145 files changed, 18259 deletions(-) delete mode 100644 cross/gcc-armhf/0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch delete mode 100644 cross/gcc-armhf/0001-posix_memalign.patch delete mode 100644 cross/gcc-armhf/0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch delete mode 100644 cross/gcc-armhf/0002-gcc-poison-system-directories.patch delete mode 100644 cross/gcc-armhf/0003-specs-turn-on-Wl-z-now-by-default.patch delete mode 100644 cross/gcc-armhf/0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch delete mode 100644 cross/gcc-armhf/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch delete mode 100644 cross/gcc-armhf/0006-Enable-Wformat-and-Wformat-security-by-default.patch delete mode 100644 cross/gcc-armhf/0007-Enable-Wtrampolines-by-default.patch delete mode 100644 cross/gcc-armhf/0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch delete mode 100644 cross/gcc-armhf/0009-gcc-params-set-default-ssp-buffer-size-to-4.patch delete mode 100644 cross/gcc-armhf/0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch delete mode 100644 cross/gcc-armhf/0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch delete mode 100644 cross/gcc-armhf/0012-libiberty-copy-PIC-objects-during-build-process.patch delete mode 100644 cross/gcc-armhf/0013-libgcc_s.patch delete mode 100644 cross/gcc-armhf/0014-nopie.patch delete mode 100644 cross/gcc-armhf/0015-ada-fix-shared-linking.patch delete mode 100644 cross/gcc-armhf/0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch delete mode 100644 cross/gcc-armhf/0017-add-fortify-headers-paths.patch delete mode 100644 cross/gcc-armhf/0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch delete mode 100644 cross/gcc-armhf/0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch delete mode 100644 cross/gcc-armhf/0020-aarch64-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0021-s390x-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0022-ppc64-le-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0023-x86_64-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0024-riscv-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0025-always-build-libgcc_eh.a.patch delete mode 100644 cross/gcc-armhf/0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch delete mode 100644 cross/gcc-armhf/0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch delete mode 100644 cross/gcc-armhf/0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch delete mode 100644 cross/gcc-armhf/0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch delete mode 100644 cross/gcc-armhf/0030-configure-fix-detection-of-atomic-builtins-in-libato.patch delete mode 100644 cross/gcc-armhf/0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch delete mode 100644 cross/gcc-armhf/0032-gdc-unconditionally-link-libgphobos-against-libucont.patch delete mode 100644 cross/gcc-armhf/0033-druntime-link-against-libucontext-on-all-platforms.patch delete mode 100644 cross/gcc-armhf/0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch delete mode 100644 cross/gcc-armhf/0035-libphobos-do-not-use-LFS64-symbols.patch delete mode 100644 cross/gcc-armhf/0036-libgo-fix-lfs64-use.patch delete mode 100644 cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch delete mode 100644 cross/gcc-armhf/0038-static-PIE-ensure-static-reaches-the-linker.patch delete mode 100644 cross/gcc-armhf/0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch delete mode 100644 cross/gcc-armhf/0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch delete mode 100644 cross/gcc-armhf/0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch delete mode 100644 cross/gcc-armhf/0042-libsanitizer-struct_sock_fprog_sz.patch delete mode 100644 cross/gcc-armhf/APKBUILD delete mode 100644 cross/gcc4-armhf/01_all_gcc49_configure.patch delete mode 100644 cross/gcc4-armhf/02_all_gcc48_config.in.patch delete mode 100644 cross/gcc4-armhf/03_all_gcc49_Makefile.in.patch delete mode 100644 cross/gcc4-armhf/05_all_gcc48_gcc.c.patch delete mode 100644 cross/gcc4-armhf/1001-fix-reload1-compile-error.patch delete mode 100644 cross/gcc4-armhf/12_all_default-warn-trampolines.patch delete mode 100644 cross/gcc4-armhf/15_all_libgfortran-Werror.patch delete mode 100644 cross/gcc4-armhf/16_all_gcc47_nopie_option.patch delete mode 100644 cross/gcc4-armhf/16_all_libgomp-Werror.patch delete mode 100644 cross/gcc4-armhf/20_all_gcc49_config_crtbeginp.patch delete mode 100644 cross/gcc4-armhf/24_all_gcc49_invoke.texi.patch delete mode 100644 cross/gcc4-armhf/34_all_gcc48_config_i386.patch delete mode 100644 cross/gcc4-armhf/35_all_gcc48_config_arm.patch delete mode 100644 cross/gcc4-armhf/40_all_gcc49_config_esp.patch delete mode 100644 cross/gcc4-armhf/41_all_gcc49_config_esp_alpine.patch delete mode 100644 cross/gcc4-armhf/48_all_x86_pr53113_libitm-avx.patch delete mode 100644 cross/gcc4-armhf/50_all_libiberty-asprintf.patch delete mode 100644 cross/gcc4-armhf/51_all_libiberty-pic.patch delete mode 100644 cross/gcc4-armhf/67_all_gcc-poison-system-directories.patch delete mode 100644 cross/gcc4-armhf/APKBUILD delete mode 100644 cross/gcc4-armhf/ada-fixes.patch delete mode 100644 cross/gcc4-armhf/ada-musl.patch delete mode 100644 cross/gcc4-armhf/ada-no-pie.patch delete mode 100644 cross/gcc4-armhf/ada-shared.patch delete mode 100644 cross/gcc4-armhf/boehm-gc-musl.patch delete mode 100644 cross/gcc4-armhf/boehm-gc-uclibc.patch delete mode 100644 cross/gcc4-armhf/fix-cxxflags-for-target.patch delete mode 100644 cross/gcc4-armhf/fix-cxxflags-passing.patch delete mode 100644 cross/gcc4-armhf/fix-gcj-iconv-musl.patch delete mode 100644 cross/gcc4-armhf/fix-gcj-musl.patch delete mode 100644 cross/gcc4-armhf/gcc-4.6-pr32219.patch delete mode 100644 cross/gcc4-armhf/gcc-4.8-build-args.patch delete mode 100644 cross/gcc4-armhf/gcc-4.8-musl-fix-iteratephdr.patch delete mode 100644 cross/gcc4-armhf/gcc-4.8-musl-libssp.patch delete mode 100644 cross/gcc4-armhf/gcc-4.9-musl.patch delete mode 100644 cross/gcc4-armhf/gcc-ice-hack.patch delete mode 100644 cross/gcc4-armhf/gcc-pure64.patch delete mode 100644 cross/gcc4-armhf/gcc-spec-env.patch delete mode 100644 cross/gcc4-armhf/gcc49-cloog-dl.patch delete mode 100644 cross/gcc4-armhf/hardenednopie.specs delete mode 100644 cross/gcc4-armhf/hardenednopiessp.specs delete mode 100644 cross/gcc4-armhf/hardenednossp.specs delete mode 100644 cross/gcc4-armhf/libgcc-always-build-gcceh.a.patch delete mode 100644 cross/gcc4-armhf/musl-posix_memalign-c++.patch delete mode 100644 cross/gcc4-armhf/pr63740.patch delete mode 100644 cross/gcc4-armhf/vanilla.specs delete mode 100644 cross/gcc6-armhf/0001-i386-Move-struct-ix86_frame-to-machine_function.patch delete mode 100644 cross/gcc6-armhf/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch delete mode 100644 cross/gcc6-armhf/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch delete mode 100644 cross/gcc6-armhf/0004-x86-Add-mindirect-branch.patch delete mode 100644 cross/gcc6-armhf/0005-x86-Add-mfunction-return.patch delete mode 100644 cross/gcc6-armhf/0006-x86-Add-mindirect-branch-register.patch delete mode 100644 cross/gcc6-armhf/0007-x86-Add-V-register-operand-modifier.patch delete mode 100644 cross/gcc6-armhf/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch delete mode 100644 cross/gcc6-armhf/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch delete mode 100644 cross/gcc6-armhf/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch delete mode 100644 cross/gcc6-armhf/0011-i386-Update-mfunction-return-for-return-with-pop.patch delete mode 100644 cross/gcc6-armhf/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch delete mode 100644 cross/gcc6-armhf/0013-i386-Don-t-generate-alias-for-function-return-thunk.patch delete mode 100644 cross/gcc6-armhf/0014-fix-missing-includes-isl-0.20.patch delete mode 100644 cross/gcc6-armhf/0015-fix-error_p-null-error.patch delete mode 100644 cross/gcc6-armhf/001_all_default-ssp-strong.patch delete mode 100644 cross/gcc6-armhf/002_all_default-relro.patch delete mode 100644 cross/gcc6-armhf/005_all_default-as-needed.patch delete mode 100644 cross/gcc6-armhf/011_all_default-warn-format-security.patch delete mode 100644 cross/gcc6-armhf/012_all_default-warn-trampolines.patch delete mode 100644 cross/gcc6-armhf/020_all_msgfmt-libstdc++-link.patch delete mode 100644 cross/gcc6-armhf/050_all_libiberty-asprintf.patch delete mode 100644 cross/gcc6-armhf/051_all_libiberty-pic.patch delete mode 100644 cross/gcc6-armhf/053_all_libitm-no-fortify-source.patch delete mode 100644 cross/gcc6-armhf/067_all_gcc-poison-system-directories.patch delete mode 100644 cross/gcc6-armhf/090_all_pr55930-dependency-tracking.patch delete mode 100644 cross/gcc6-armhf/201-cilkrts.patch delete mode 100644 cross/gcc6-armhf/203-libgcc_s.patch delete mode 100644 cross/gcc6-armhf/204-linux_libc_has_function.patch delete mode 100644 cross/gcc6-armhf/205-nopie.patch delete mode 100644 cross/gcc6-armhf/207-static-pie.patch delete mode 100644 cross/gcc6-armhf/300-main-gcc-add-musl-s390x-dynamic-linker.patch delete mode 100644 cross/gcc6-armhf/310-build-gcj-s390x.patch delete mode 100644 cross/gcc6-armhf/320-libffi-gnulinux.patch delete mode 100644 cross/gcc6-armhf/APKBUILD delete mode 100644 cross/gcc6-armhf/ada-aarch64-multiarch.patch delete mode 100644 cross/gcc6-armhf/ada-fixes.patch delete mode 100644 cross/gcc6-armhf/ada-mips64.patch delete mode 100644 cross/gcc6-armhf/ada-musl.patch delete mode 100644 cross/gcc6-armhf/ada-shared.patch delete mode 100644 cross/gcc6-armhf/boehm-gc-musl.patch delete mode 100644 cross/gcc6-armhf/fix-cxxflags-passing.patch delete mode 100644 cross/gcc6-armhf/fix-gcj-iconv-musl.patch delete mode 100644 cross/gcc6-armhf/fix-gcj-musl.patch delete mode 100644 cross/gcc6-armhf/fix-gcj-stdgnu14-link.patch delete mode 100644 cross/gcc6-armhf/fix-linux-header-use-in-libgcc.patch delete mode 100644 cross/gcc6-armhf/fix-rs6000-pie.patch delete mode 100644 cross/gcc6-armhf/gcc-4.8-build-args.patch delete mode 100644 cross/gcc6-armhf/gcc-6.1-musl-libssp.patch delete mode 100644 cross/gcc6-armhf/gcc-6.4-isl.patch delete mode 100644 cross/gcc6-armhf/gcc-pure64-mips.patch delete mode 100644 cross/gcc6-armhf/gcc-pure64.patch delete mode 100644 cross/gcc6-armhf/libgcc-always-build-gcceh.a.patch delete mode 100644 cross/musl-armhf/APKBUILD diff --git a/cross/gcc-armhf/0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch b/cross/gcc-armhf/0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch deleted file mode 100644 index d10f4e51e..000000000 --- a/cross/gcc-armhf/0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 824eae920f0f64dd7687c969a2436b129161fdc9 Mon Sep 17 00:00:00 2001 -From: Jinyang He -Date: Wed, 29 Oct 2025 16:07:35 +0800 -Subject: [PATCH] LoongArch: Only allow valid binary op when optimize - conditional move - -It is wrong that optimize from `if (cond) dest op= 1 << shift` to -`dest op= (cond ? 1 : 0) << shift` when `dest op 0 != dest`. -Like `and`, `mul` or `div`. -And in this optimization `mul` and `div` is optimized to shift. - -gcc/ChangeLog: - - * config/loongarch/loongarch.cc - (loongarch_expand_conditional_move): Only allow valid binary - op when optimize conditional move. - -gcc/testsuite/ChangeLog: - - * gcc.target/loongarch/conditional-move-opt-1.c: Remove mul. - * gcc.target/loongarch/conditional-move-opt-2.c: Remove and. - * gcc.target/loongarch/conditional-move-opt-3.c: New test. - -Co-Authored-By: Peng Fan ---- - gcc/config/loongarch/loongarch.cc | 26 ++++++++++++++++--- - .../loongarch/conditional-move-opt-1.c | 4 +-- - .../loongarch/conditional-move-opt-2.c | 2 +- - .../loongarch/conditional-move-opt-3.c | 14 ++++++++++ - 4 files changed, 40 insertions(+), 6 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c - -diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc -index bdf290654..740c8611a 100644 ---- a/gcc/config/loongarch/loongarch.cc -+++ b/gcc/config/loongarch/loongarch.cc -@@ -5533,12 +5533,32 @@ loongarch_expand_conditional_move (rtx *operands) - } - } - -+ auto is_binary_op_0_keep_orig = [](enum rtx_code code) -+ { -+ switch (code) -+ { -+ case PLUS: -+ case MINUS: -+ case IOR: -+ case XOR: -+ case ROTATE: -+ case ROTATERT: -+ case ASHIFT: -+ case ASHIFTRT: -+ case LSHIFTRT: -+ return true; -+ default: -+ return false; -+ } -+ }; -+ - /* Check if the optimization conditions are met. */ - if (value_if_true_insn - && value_if_false_insn -- /* Make sure that value_if_false and var are the same. */ -- && BINARY_P (value_if_true_insn_src -- = SET_SRC (single_set (value_if_true_insn))) -+ /* Make sure that the orig value OP 0 keep orig. */ -+ && (value_if_true_insn_src -+ = SET_SRC (single_set (value_if_true_insn))) -+ && is_binary_op_0_keep_orig ( GET_CODE (value_if_true_insn_src)) - /* Make sure that both value_if_true and value_if_false - has the same var. */ - && rtx_equal_p (XEXP (value_if_true_insn_src, 0), -diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c -index ed13471aa..47802aa96 100644 ---- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c -+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-1.c -@@ -27,7 +27,7 @@ void - test_lt () - { - if (lm < ln) -- lr *= (1 << 16); -+ lr += (1 << 16); - lr += lm; - } - -@@ -35,7 +35,7 @@ void - test_le () - { - if (lm <= ln) -- lr = lm * ((long)1 << 32); -+ lr = lm + ((long)1 << 32); - else - lr = lm; - lr += lm; -diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c -index ac72d4d93..743fd5e67 100644 ---- a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c -+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-2.c -@@ -29,7 +29,7 @@ void - test_lez () - { - if (lm <= 0) -- lr &= (1 << 16); -+ lr |= (1 << 16); - lr += lm; - } - -diff --git a/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c -new file mode 100644 -index 000000000..95887980c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/loongarch/conditional-move-opt-3.c -@@ -0,0 +1,14 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2" } */ -+/* { dg-final { scan-assembler "maskeqz" } } */ -+/* { dg-final { scan-assembler "masknez" } } */ -+ -+extern long lm, ln, lr; -+ -+void -+test_and () -+{ -+ if (lm < 0) -+ lr &= (1 << 16); -+ lr += lm; -+} --- -2.51.1 - diff --git a/cross/gcc-armhf/0001-posix_memalign.patch b/cross/gcc-armhf/0001-posix_memalign.patch deleted file mode 100644 index bbc2db9ca..000000000 --- a/cross/gcc-armhf/0001-posix_memalign.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 94cf7d2b3514ed3a4401861a519ead450e022afc Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Fri, 26 Jan 2018 20:32:50 +0000 -Subject: [PATCH] posix_memalign - ---- - gcc/config/i386/pmm_malloc.h | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/gcc/config/i386/pmm_malloc.h b/gcc/config/i386/pmm_malloc.h -index d1d79a32fc9..069c3bb8324 100644 ---- a/gcc/config/i386/pmm_malloc.h -+++ b/gcc/config/i386/pmm_malloc.h -@@ -27,12 +27,13 @@ - #include - - /* We can't depend on since the prototype of posix_memalign -- may not be visible. */ -+ may not be visible and we can't pollute the namespace either. */ - #ifndef __cplusplus --extern int posix_memalign (void **, size_t, size_t); -+extern int _mm_posix_memalign (void **, size_t, size_t) - #else --extern "C" int posix_memalign (void **, size_t, size_t) throw (); -+extern "C" int _mm_posix_memalign (void **, size_t, size_t) throw () - #endif -+__asm__("posix_memalign"); - - static __inline void * - _mm_malloc (size_t __size, size_t __alignment) -@@ -42,7 +43,7 @@ _mm_malloc (size_t __size, size_t __alignment) - return malloc (__size); - if (__alignment == 2 || (sizeof (void *) == 8 && __alignment == 4)) - __alignment = sizeof (void *); -- if (posix_memalign (&__ptr, __alignment, __size) == 0) -+ if (_mm_posix_memalign (&__ptr, __alignment, __size) == 0) - return __ptr; - else - return NULL; --- -2.50.1 - diff --git a/cross/gcc-armhf/0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch b/cross/gcc-armhf/0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch deleted file mode 100644 index cc814d0d4..000000000 --- a/cross/gcc-armhf/0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 21b7d08714c4964403848db4144003835ff5245a Mon Sep 17 00:00:00 2001 -From: Linsen Zhou -Date: Fri, 17 Oct 2025 11:05:04 +0800 -Subject: [PATCH] tree-object-size.cc: Fix assert constant offset in - check_for_plus_in_loops [PR122012] - -After commit 51b85dfeb19652bf3e0aaec08828ba7cee1e641c, when the -pointer offset is a variable in the loop, the object size of the -pointer may also need to be reexamined. -Which make gcc_assert in the check_for_plus_in_loops failed. - -gcc/ChangeLog: - - PR tree-optimization/122012 - * tree-object-size.cc (check_for_plus_in_loops): Skip check - for the variable offset - -gcc/testsuite/ChangeLog: - - PR tree-optimization/122012 - * gcc.dg/torture/pr122012.c: New test. - -Signed-off-by: Linsen Zhou -(cherry picked from commit 82cefc4898d4ccabe76e28d6626b91ca9e998923) ---- - gcc/testsuite/gcc.dg/torture/pr122012.c | 18 ++++++++++++++++++ - gcc/tree-object-size.cc | 7 +++---- - 2 files changed, 21 insertions(+), 4 deletions(-) - create mode 100644 gcc/testsuite/gcc.dg/torture/pr122012.c - -diff --git a/gcc/testsuite/gcc.dg/torture/pr122012.c b/gcc/testsuite/gcc.dg/torture/pr122012.c -new file mode 100644 -index 00000000000..055915a1e98 ---- /dev/null -+++ b/gcc/testsuite/gcc.dg/torture/pr122012.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile } */ -+#include -+ -+void foo(); -+ -+void test(size_t step) { -+ char *buf = malloc(64); -+ char *p = buf; -+ size_t i; -+ -+ for(i = 0; i < 64; ++i) { -+ p += 4; -+ if (__builtin_object_size (p, 2) != 0) -+ foo(); -+ p += step; -+ } -+ free(buf); -+} -diff --git a/gcc/tree-object-size.cc b/gcc/tree-object-size.cc -index 2d13ab79a84..76dc2446059 100644 ---- a/gcc/tree-object-size.cc -+++ b/gcc/tree-object-size.cc -@@ -2153,12 +2153,11 @@ check_for_plus_in_loops (struct object_size_info *osi, tree var) - && gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) - { - tree basevar = gimple_assign_rhs1 (stmt); -- tree cst = gimple_assign_rhs2 (stmt); -- -- gcc_assert (TREE_CODE (cst) == INTEGER_CST); -+ tree offset = gimple_assign_rhs2 (stmt); - - /* Skip non-positive offsets. */ -- if (integer_zerop (cst) || compare_tree_int (cst, offset_limit) > 0) -+ if (TREE_CODE (offset) != INTEGER_CST -+ || integer_zerop (offset) || compare_tree_int (offset, offset_limit) > 0) - return; - - osi->depths[SSA_NAME_VERSION (basevar)] = 1; --- -2.51.0 - diff --git a/cross/gcc-armhf/0002-gcc-poison-system-directories.patch b/cross/gcc-armhf/0002-gcc-poison-system-directories.patch deleted file mode 100644 index de66b72d0..000000000 --- a/cross/gcc-armhf/0002-gcc-poison-system-directories.patch +++ /dev/null @@ -1,258 +0,0 @@ -From 0d5e04099a3d2609105719f7396a4ff941b873b6 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Thu, 23 Jan 2025 17:12:51 -0800 -Subject: [PATCH] gcc: poison-system-directories - -Add /sw/include and /opt/include based on the original -zecke-no-host-includes.patch patch. The original patch checked for -/usr/include, /sw/include and /opt/include and then triggered a failure and -aborted. - -Instead, we add the two missing items to the current scan. If the user -wants this to be a failure, they can add "-Werror=poison-system-directories". - -Upstream-Status: Inappropriate [OE configuration] -Signed-off-by: Mark Hatle -Signed-off-by: sunil dora -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 | 12 ++++++++++-- - gcc/incpath.cc | 25 +++++++++++++++++++++++++ - 7 files changed, 93 insertions(+), 2 deletions(-) - -diff --git a/gcc/common.opt b/gcc/common.opt -index e3fa0dacec4..bea1adc0940 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -729,6 +729,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 a79c51adb2b..8a531ed591c 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -249,6 +249,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 16965953f05..0f4a5d52c30 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -1051,6 +1051,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_host_pie -@@ -1828,6 +1829,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 - --enable-host-pie build host code as PIE -@@ -34027,6 +34030,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 9f67e62950a..b0e3615e5aa 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -7502,6 +7502,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 72009c33cd0..29aea724731 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -405,6 +405,7 @@ Objective-C and Objective-C++ Dialects}. - -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded - -Wparentheses -Wno-pedantic-ms-format - -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast -+-Wno-poison-system-directories - -Wno-pragmas -Wno-pragma-once-outside-header -Wno-prio-ctor-dtor - -Wno-psabi - -Wredundant-decls -Wrestrict -@@ -10727,6 +10728,14 @@ an error. @option{Wint-to-pointer-cast} is enabled by default. - Suppress warnings from casts from a pointer to an integer type of a - different size. - -+@opindex Wno-poison-system-directories -+@item -Wno-poison-system-directories -+Do not warn for @option{-I} or @option{-L} options using system -+directories such as @file{/usr/include} when cross compiling. This -+option is intended for use in chroot environments when such -+directories contain the correct headers and libraries for the target -+system rather than the host. -+ - @opindex Winvalid-pch - @opindex Wno-invalid-pch - @item -Winvalid-pch -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 4fd87f2c4a1..79d4920a047 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -909,6 +909,12 @@ proper position among the other output files. */ - #define ASM_MAP "" - #endif - -+#ifdef POISON_BY_DEFAULT -+#define POISON_IS_ERROR " -Werror=poison-system-directories" -+#else -+#define POISON_IS_ERROR -+#endif -+ - /* Assembler options for compressed debug sections. */ - #if HAVE_LD_COMPRESS_DEBUG == 0 - /* Reject if the linker cannot write compressed debug sections. */ -@@ -1166,6 +1172,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*} %(link_libgcc) " \ - VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \ - %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ -@@ -1268,7 +1276,7 @@ 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}"; -+ %{undef} %{save-temps*:-fpch-preprocess}" POISON_IS_ERROR; - - /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al. - -@@ -1297,7 +1305,7 @@ static const char *cc1_options = - %{coverage:-fprofile-arcs -ftest-coverage}\ - %{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\ - %{!fprofile-update=single:\ -- %{pthread:-fprofile-update=prefer-atomic}}}"; -+ %{pthread:-fprofile-update=prefer-atomic}}}" POISON_IS_ERROR; - - static const char *asm_options = - "%{-target-help:%:print-asm-header()} " -diff --git a/gcc/incpath.cc b/gcc/incpath.cc -index c1bbfd3872a..2cdbebc4c50 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. */ -@@ -273,6 +274,10 @@ remove_duplicates (cpp_reader *pfile, struct cpp_dir *head, - cur->name, xstrerror (errno)); - reason = REASON_NOENT; - } -+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES -+ pcur = &cur->next; -+ continue; -+#endif - } - else if (!S_ISDIR (st.st_mode)) - cpp_error_with_line (pfile, CPP_DL_WARNING, 0, 0, -@@ -411,6 +416,26 @@ merge_include_chains (const char *sysroot, cpp_reader *pfile, int verbose) - fprintf (stderr, _("End of #embed 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 --- -2.50.1 - diff --git a/cross/gcc-armhf/0003-specs-turn-on-Wl-z-now-by-default.patch b/cross/gcc-armhf/0003-specs-turn-on-Wl-z-now-by-default.patch deleted file mode 100644 index be6a3dc60..000000000 --- a/cross/gcc-armhf/0003-specs-turn-on-Wl-z-now-by-default.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 90e8697dd88fd99ce2cf8739e95494853005377e Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:45:49 +0000 -Subject: [PATCH] specs: turn on -Wl,-z,now by default - -Previously, we also used to turn on -z relro here, but we now build -binutils with --enable-relro, which is functionally equivalent. - -Binutils does not appear to have a similar option for enabling -z -now by default. ---- - gcc/doc/invoke.texi | 3 +++ - gcc/gcc.cc | 1 + - 2 files changed, 4 insertions(+) - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 29aea724731..6fb3ab70cc7 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -19477,6 +19477,9 @@ For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the - linker. When using the GNU linker, you can also get the same effect with - @option{-Wl,-Map=output.map}. - -+NOTE: In Alpine Linux, for LDFLAGS, the option -+@option{-Wl,-z,now} is used. To disable, use @option{-Wl,-z,nonow}. -+ - @opindex u - @item -u @var{symbol} - Pretend the symbol @var{symbol} is undefined, to force linking of -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 79d4920a047..74a356fdf5e 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1170,6 +1170,7 @@ proper position among the other output files. */ - "%{flto|flto=*:% -Date: Fri, 21 Aug 2020 06:46:22 +0000 -Subject: [PATCH] Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, - ObjC++, if the optimization level is > 0 - ---- - gcc/c-family/c-cppbuiltin.cc | 4 ++++ - gcc/doc/invoke.texi | 6 ++++++ - 2 files changed, 10 insertions(+) - -diff --git a/gcc/c-family/c-cppbuiltin.cc b/gcc/c-family/c-cppbuiltin.cc -index 4589ee4a3a6..9edf095384c 100644 ---- a/gcc/c-family/c-cppbuiltin.cc -+++ b/gcc/c-family/c-cppbuiltin.cc -@@ -1581,6 +1581,10 @@ c_cpp_builtins (cpp_reader *pfile) - builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0); - builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0); - -+ /* Fortify Source enabled by default for optimization levels > 0 */ -+ if (optimize) -+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2); -+ - /* Misc. */ - if (flag_gnu89_inline) - cpp_define (pfile, "__GNUC_GNU_INLINE__"); -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 6fb3ab70cc7..799ce073dbf 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -12840,6 +12840,12 @@ also turns on the following optimization flags: - Please note the warning under @option{-fgcse} about - invoking @option{-O2} on programs that use computed gotos. - -+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is -+set by default, and is activated when @option{-O} is set to 2 or higher. -+This enables additional compile-time and run-time checks for several libc -+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or -+@option{-D_FORTIFY_SOURCE=0}. -+ - @opindex O3 - @item -O3 - Optimize yet more. @option{-O3} turns on all optimizations specified --- -2.50.1 - diff --git a/cross/gcc-armhf/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch b/cross/gcc-armhf/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch deleted file mode 100644 index 630e5f8ad..000000000 --- a/cross/gcc-armhf/0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch +++ /dev/null @@ -1,286 +0,0 @@ -From 95d8fac6247b2cba1142261cc95c21063539112a Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:46:56 +0000 -Subject: [PATCH] On linux targets pass --as-needed by default to the linker, - but always link the sanitizer libraries with --no-as-needed. - ---- - gcc/config/aarch64/aarch64-linux.h | 1 + - gcc/config/alpha/linux-elf.h | 2 +- - gcc/config/arm/linux-elf.h | 1 + - gcc/config/gnu-user.h | 6 +++--- - gcc/config/i386/gnu-user.h | 2 +- - gcc/config/i386/gnu-user64.h | 1 + - gcc/config/ia64/linux.h | 2 +- - gcc/config/loongarch/gnu-user.h | 2 +- - gcc/config/mips/gnu-user.h | 1 + - gcc/config/riscv/linux.h | 1 + - gcc/config/rs6000/linux64.h | 4 ++-- - gcc/config/rs6000/sysv4.h | 2 +- - gcc/config/s390/linux.h | 2 +- - gcc/config/sparc/linux.h | 2 +- - gcc/gcc.cc | 28 ++++++++++++++++++++-------- - 15 files changed, 37 insertions(+), 20 deletions(-) - -diff --git a/gcc/config/aarch64/aarch64-linux.h b/gcc/config/aarch64/aarch64-linux.h -index 116bb4e69f3..daf99f8dce9 100644 ---- a/gcc/config/aarch64/aarch64-linux.h -+++ b/gcc/config/aarch64/aarch64-linux.h -@@ -39,6 +39,7 @@ - #define CPP_SPEC "%{pthread:-D_REENTRANT}" - - #define LINUX_TARGET_LINK_SPEC "%{h*} \ -+ --as-needed \ - %{static:-Bstatic} \ - %{shared:-shared} \ - %{symbolic:-Bsymbolic} \ -diff --git a/gcc/config/alpha/linux-elf.h b/gcc/config/alpha/linux-elf.h -index 3fd3b831166..0b4c2dccebe 100644 ---- a/gcc/config/alpha/linux-elf.h -+++ b/gcc/config/alpha/linux-elf.h -@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3. If not see - - #define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER - --#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \ -+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \ - %{O*:-O3} %{!O*:-O1} \ - %{shared:-shared} \ - %{!shared: \ -diff --git a/gcc/config/arm/linux-elf.h b/gcc/config/arm/linux-elf.h -index d4d389e2aa8..adccc0b11c2 100644 ---- a/gcc/config/arm/linux-elf.h -+++ b/gcc/config/arm/linux-elf.h -@@ -70,6 +70,7 @@ - %{rdynamic:-export-dynamic} \ - %{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ - -X \ -+ --as-needed \ - %{mbig-endian:-EB} %{mlittle-endian:-EL}" \ - SUBTARGET_EXTRA_LINK_SPEC - -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index 4c4e31efa39..3c17ac6eade 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -136,7 +136,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ - "%{static-libasan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" -+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #undef LIBHWASAN_EARLY_SPEC - #define LIBHWASAN_EARLY_SPEC "%{!shared:libhwasan_preinit%O%s} " \ - "%{static-libhwasan:%{!shared:" \ -@@ -146,12 +146,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LIBTSAN_EARLY_SPEC "%{!shared:libtsan_preinit%O%s} " \ - "%{static-libtsan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" -+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #undef LIBLSAN_EARLY_SPEC - #define LIBLSAN_EARLY_SPEC "%{!shared:liblsan_preinit%O%s} " \ - "%{static-liblsan:%{!shared:" \ - LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \ -- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}" -+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}" - #endif - - #undef TARGET_F951_OPTIONS -diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h -index 7abfda53049..ceb8f855b7d 100644 ---- a/gcc/config/i386/gnu-user.h -+++ b/gcc/config/i386/gnu-user.h -@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see - { "link_emulation", GNU_USER_LINK_EMULATION },\ - { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } - --#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ -+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \ - %{!shared: \ - %{!static: \ - %{!static-pie: \ -diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h -index abe714711bf..3ca128a79f5 100644 ---- a/gcc/config/i386/gnu-user64.h -+++ b/gcc/config/i386/gnu-user64.h -@@ -56,6 +56,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - "%{" SPEC_64 ":-m " GNU_USER_LINK_EMULATION64 "} \ - %{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \ - %{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \ -+ --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/config/ia64/linux.h b/gcc/config/ia64/linux.h -index a2494c214c4..e1a5d530cdf 100644 ---- a/gcc/config/ia64/linux.h -+++ b/gcc/config/ia64/linux.h -@@ -58,7 +58,7 @@ do { \ - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2" - - #undef LINK_SPEC --#define LINK_SPEC "\ -+#define LINK_SPEC " --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h -index fbc75a90ad5..adbc4b7733f 100644 ---- a/gcc/config/loongarch/gnu-user.h -+++ b/gcc/config/loongarch/gnu-user.h -@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see - - #undef GNU_USER_TARGET_LINK_SPEC - #define GNU_USER_TARGET_LINK_SPEC \ -- "%{G*} %{shared} -m " GNU_USER_LINK_EMULATION \ -+ "%{G*} %{shared} --as-needed -m " GNU_USER_LINK_EMULATION \ - "%{!shared: %{static} " \ - "%{!static: %{!static-pie: %{rdynamic:-export-dynamic} " \ - "-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} " \ -diff --git a/gcc/config/mips/gnu-user.h b/gcc/config/mips/gnu-user.h -index 5a82508c113..6eee7cdc603 100644 ---- a/gcc/config/mips/gnu-user.h -+++ b/gcc/config/mips/gnu-user.h -@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see - #undef GNU_USER_TARGET_LINK_SPEC - #define GNU_USER_TARGET_LINK_SPEC "\ - %{G*} %{EB} %{EL} %{mips*} %{shared} \ -+ -as-needed \ - %{!shared: \ - %{!static: \ - %{rdynamic:-export-dynamic} \ -diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h -index 9060c940a44..282c77b6a7b 100644 ---- a/gcc/config/riscv/linux.h -+++ b/gcc/config/riscv/linux.h -@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see - "%{mabi=ilp32:_ilp32}" - - #define LINK_SPEC "\ -+-as-needed \ - -melf" XLEN_SPEC DEFAULT_ENDIAN_SPEC "riscv" LD_EMUL_SUFFIX " \ - %{mno-relax:--no-relax} \ - -X \ -diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h -index 0316d8cb65d..139e1b6796c 100644 ---- a/gcc/config/rs6000/linux64.h -+++ b/gcc/config/rs6000/linux64.h -@@ -378,13 +378,13 @@ extern int dot_symbols; - " -m elf64ppc") - #endif - --#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \ - %{!static-pie: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \ - %(link_os_extra_spec32)" - --#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \ - %{!static-pie: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \ -diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h -index afb5c6ad867..b64638fb25b 100644 ---- a/gcc/config/rs6000/sysv4.h -+++ b/gcc/config/rs6000/sysv4.h -@@ -781,7 +781,7 @@ GNU_USER_TARGET_CC1_SPEC - #define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER - #endif - --#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ -+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \ - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}" - -diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h -index 2c3bca5dfcb..b90661247a4 100644 ---- a/gcc/config/s390/linux.h -+++ b/gcc/config/s390/linux.h -@@ -82,7 +82,7 @@ along with GCC; see the file COPYING3. If not see - - #undef LINK_SPEC - #define LINK_SPEC \ -- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \ -+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \ - %{shared:-shared} \ - %{!shared: \ - %{static:-static} \ -diff --git a/gcc/config/sparc/linux.h b/gcc/config/sparc/linux.h -index 6d928846895..3cc05bb7240 100644 ---- a/gcc/config/sparc/linux.h -+++ b/gcc/config/sparc/linux.h -@@ -81,7 +81,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" - - #undef LINK_SPEC --#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \ -+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \ - %{!mno-relax:%{!r:-relax}} \ - %{!shared: \ - %{!static: \ -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 74a356fdf5e..fc9c7d15b04 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -774,8 +774,11 @@ proper position among the other output files. */ - #ifdef LIBASAN_EARLY_SPEC - #define LIBASAN_SPEC STATIC_LIBASAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \ -- "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -lasan " \ -+ " %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBASAN_LIBS - #else - #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS -@@ -810,8 +813,11 @@ proper position among the other output files. */ - #ifdef LIBTSAN_EARLY_SPEC - #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \ -- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -ltsan " \ -+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBTSAN_LIBS - #else - #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS -@@ -828,8 +834,11 @@ proper position among the other output files. */ - #ifdef LIBLSAN_EARLY_SPEC - #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) --#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION \ -- "} -llsan %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -llsan " \ -+ " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBLSAN_LIBS - #else - #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS -@@ -844,8 +853,11 @@ proper position among the other output files. */ - #define STATIC_LIBUBSAN_LIBS \ - " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}" - #ifdef HAVE_LD_STATIC_DYNAMIC --#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION \ -- "} -lubsan %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -+#define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \ -+ " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " -lubsan " \ -+ " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -+ " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ - STATIC_LIBUBSAN_LIBS - #else - #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS --- -2.50.1 - diff --git a/cross/gcc-armhf/0006-Enable-Wformat-and-Wformat-security-by-default.patch b/cross/gcc-armhf/0006-Enable-Wformat-and-Wformat-security-by-default.patch deleted file mode 100644 index 501b8de24..000000000 --- a/cross/gcc-armhf/0006-Enable-Wformat-and-Wformat-security-by-default.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 58a94690d4dd7b34543d9d154abc96d2d90d3b32 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:47:43 +0000 -Subject: [PATCH] Enable -Wformat and -Wformat-security by default. - ---- - gcc/c-family/c.opt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt -index 75b6531860e..78830ce4b42 100644 ---- a/gcc/c-family/c.opt -+++ b/gcc/c-family/c.opt -@@ -805,7 +805,7 @@ Warn about function calls with format strings that write past the end - of the destination region. - - Wformat-security --C ObjC C++ ObjC++ Var(warn_format_security) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) -+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) - Warn about possible security problems with format functions. - - Wformat-signedness -@@ -830,7 +830,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++ - Warn about zero-length formats. - - Wformat= --C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) -+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) IntegerRange(0, 2) - Warn about printf/scanf/strftime/strfmon format string anomalies. - - Wframe-address --- -2.50.1 - diff --git a/cross/gcc-armhf/0007-Enable-Wtrampolines-by-default.patch b/cross/gcc-armhf/0007-Enable-Wtrampolines-by-default.patch deleted file mode 100644 index 2179ff434..000000000 --- a/cross/gcc-armhf/0007-Enable-Wtrampolines-by-default.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b2a755b671d88c34402290d7d769232e01aed350 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 01:44:20 -0700 -Subject: [PATCH] Enable -Wtrampolines by default. - ---- - gcc/common.opt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/common.opt b/gcc/common.opt -index bea1adc0940..e65a575d9f8 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -829,7 +829,7 @@ Common Var(warn_tautological_compare) Warning LangEnabledBy(C ObjC C++ ObjC++,Wa - Warn if a comparison always evaluates to true or false. - - Wtrampolines --Common Var(warn_trampolines) Warning -+Common Var(warn_trampolines) Init(1) Warning - Warn whenever a trampoline is generated. - - Wtrivial-auto-var-init --- -2.50.1 - diff --git a/cross/gcc-armhf/0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch b/cross/gcc-armhf/0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch deleted file mode 100644 index d947fcc86..000000000 --- a/cross/gcc-armhf/0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c355364231395090e7223ec00d8a16065903c2c5 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 01:49:03 -0700 -Subject: [PATCH] gcc: disable SSP on -ffreestanding, -nostdlib and - -nodefaultlibs - ---- - gcc/gcc.cc | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index fc9c7d15b04..7b0d3d2743b 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1009,6 +1009,12 @@ proper position among the other output files. */ - #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" - #endif - -+#ifdef ENABLE_DEFAULT_SSP -+#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} " -+#else -+#define NO_SSP_SPEC "" -+#endif -+ - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -@@ -1314,7 +1320,7 @@ static const char *cc1_options = - %{-version:--version}\ - %{-help=*:--help=%*}\ - %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\ -- %{fsyntax-only:-o %j} %{-param*}\ -+ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\ - %{coverage:-fprofile-arcs -ftest-coverage}\ - %{fprofile-arcs|fcondition-coverage|fpath-coverage|fprofile-generate*|coverage:\ - %{!fprofile-update=single:\ --- -2.50.1 - diff --git a/cross/gcc-armhf/0009-gcc-params-set-default-ssp-buffer-size-to-4.patch b/cross/gcc-armhf/0009-gcc-params-set-default-ssp-buffer-size-to-4.patch deleted file mode 100644 index d0c159df8..000000000 --- a/cross/gcc-armhf/0009-gcc-params-set-default-ssp-buffer-size-to-4.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 5f09842c19d6db976724cd117190a8a6951acf9b Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 01:50:42 -0700 -Subject: [PATCH] gcc: params: set default ssp-buffer-size to 4 - ---- - gcc/params.opt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/params.opt b/gcc/params.opt -index 64e453d29b7..bba3fd574f2 100644 ---- a/gcc/params.opt -+++ b/gcc/params.opt -@@ -1064,7 +1064,7 @@ Common Joined UInteger Var(param_ssa_name_def_chain_limit) Init(512) Param Optim - The maximum number of SSA_NAME assignments to follow in determining a value. - - -param=ssp-buffer-size= --Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization -+Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization - The lower bound for a buffer to be considered for stack smashing protection. - - -param=stack-clash-protection-guard-size= --- -2.50.1 - diff --git a/cross/gcc-armhf/0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch b/cross/gcc-armhf/0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch deleted file mode 100644 index 3ee3ad168..000000000 --- a/cross/gcc-armhf/0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch +++ /dev/null @@ -1,54 +0,0 @@ -From ee0615536ae0d255f59070b904aa35d6de8fce49 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:50:33 +0000 -Subject: [PATCH] Ensure that msgfmt doesn't encounter problems during gcc - bootstrapping. - -Solves error messages like the following: - -msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6) - -The libgcc_s.so used during build doesn't satisfy the needs of the -libstdc++.so that msgfmt is linked against. On the other hand, msgfmt -is used as a stand-alone application here, and what library it uses -behind the scenes is of no concern to the gcc build process. -Therefore, simply invoking it "as usual", i.e. without any special -library path, will make it work as expected here. - -2011-09-19 Martin von Gagern - -References: -https://bugs.gentoo.org/372377 -https://bugs.gentoo.org/295480 ---- - libstdc++-v3/po/Makefile.am | 1 + - libstdc++-v3/po/Makefile.in | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/libstdc++-v3/po/Makefile.am b/libstdc++-v3/po/Makefile.am -index 7f84a99533e..a4c6284f788 100644 ---- a/libstdc++-v3/po/Makefile.am -+++ b/libstdc++-v3/po/Makefile.am -@@ -38,6 +38,7 @@ MSGFMT = msgfmt - EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN) - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) -diff --git a/libstdc++-v3/po/Makefile.in b/libstdc++-v3/po/Makefile.in -index 8e93445acd2..d6ff06e5ddb 100644 ---- a/libstdc++-v3/po/Makefile.in -+++ b/libstdc++-v3/po/Makefile.in -@@ -561,6 +561,7 @@ uninstall-am: - - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) --- -2.50.1 - diff --git a/cross/gcc-armhf/0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch b/cross/gcc-armhf/0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch deleted file mode 100644 index 2f12bd585..000000000 --- a/cross/gcc-armhf/0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 62966418472466142a9962892177f4b1f9f56944 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:52:07 +0000 -Subject: [PATCH] Don't declare asprintf if defined as a macro. - ---- - include/libiberty.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/libiberty.h b/include/libiberty.h -index d4e8791b14b..c074980ed80 100644 ---- a/include/libiberty.h -+++ b/include/libiberty.h -@@ -678,8 +678,11 @@ extern void *bsearch_r (const void *, const void *, - /* Like sprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. */ - -+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ -+#ifndef asprintf - extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; - #endif -+#endif - - /* Like asprintf but allocates memory without fail. This works like - xmalloc. */ --- -2.50.1 - diff --git a/cross/gcc-armhf/0012-libiberty-copy-PIC-objects-during-build-process.patch b/cross/gcc-armhf/0012-libiberty-copy-PIC-objects-during-build-process.patch deleted file mode 100644 index e907d44c1..000000000 --- a/cross/gcc-armhf/0012-libiberty-copy-PIC-objects-during-build-process.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0351f4f3dd00bdece780ce5e24d972e97ca1b7ed Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:53:00 +0000 -Subject: [PATCH] libiberty: copy PIC objects during build process - ---- - libiberty/Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in -index ce54d88278d..10c212a1ad3 100644 ---- a/libiberty/Makefile.in -+++ b/libiberty/Makefile.in -@@ -266,6 +266,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - --- -2.50.1 - diff --git a/cross/gcc-armhf/0013-libgcc_s.patch b/cross/gcc-armhf/0013-libgcc_s.patch deleted file mode 100644 index 7f0987263..000000000 --- a/cross/gcc-armhf/0013-libgcc_s.patch +++ /dev/null @@ -1,57 +0,0 @@ -From bd7e32d5405b6b4f3994a212a77ff2cd33134c74 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Sat, 24 Oct 2015 20:09:53 +0000 -Subject: [PATCH] libgcc_s - ---- - 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 cdfd94d3c73..a3a6c988833 100644 ---- a/gcc/config/i386/i386-expand.cc -+++ b/gcc/config/i386/i386-expand.cc -@@ -13643,10 +13643,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 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 2484dc839bf..e980030ef23 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) --- -2.50.1 - diff --git a/cross/gcc-armhf/0014-nopie.patch b/cross/gcc-armhf/0014-nopie.patch deleted file mode 100644 index 303c80d2a..000000000 --- a/cross/gcc-armhf/0014-nopie.patch +++ /dev/null @@ -1,85 +0,0 @@ -From c191dc86f4f7340542066f4156aa57be9cfbf876 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Sat, 7 Nov 2015 02:08:05 +0000 -Subject: [PATCH] nopie - ---- - gcc/configure | 25 +++++++++++++++++++++++++ - gcc/configure.ac | 11 +++++++++++ - 2 files changed, 36 insertions(+) - -diff --git a/gcc/configure b/gcc/configure -index 0f4a5d52c30..343563c8948 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -34586,6 +34586,29 @@ rm -f core conftest.err conftest.$ac_objext \ - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_no_pie" >&5 - $as_echo "$gcc_cv_no_pie" >&6; } -+# Check if -nopie works. -+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 -+$as_echo_n "checking for -nopie option... " >&6; } -+if ${gcc_cv_nopie+:} false; then : -+ $as_echo_n "(cached) " >&6 -+else -+ saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+int main(void) {return 0;} -+_ACEOF -+if ac_fn_cxx_try_link "$LINENO"; then : -+ gcc_cv_nopie=yes -+else -+ gcc_cv_nopie=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 -+$as_echo "$gcc_cv_nopie" >&6; } - - if test x$enable_host_shared = xyes; then - PICFLAG=-fPIC -@@ -34603,6 +34626,8 @@ if test x$enable_host_pie = xyes; then - LD_PICFLAG=-pie - elif test x$gcc_cv_no_pie = xyes; then - LD_PICFLAG=-no-pie -+elif test x$gcc_cv_nopie = xyes; then -+ LD_PICFLAG=-nopie - else - LD_PICFLAG= - fi -diff --git a/gcc/configure.ac b/gcc/configure.ac -index b0e3615e5aa..b3948469d17 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -7802,6 +7802,15 @@ AC_CACHE_CHECK([for -no-pie option], - [gcc_cv_no_pie=yes], - [gcc_cv_no_pie=no]) - LDFLAGS="$saved_LDFLAGS"]) -+# Check if -nopie works. -+AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) {return 0;}])], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) - - if test x$enable_host_shared = xyes; then - PICFLAG=-fPIC -@@ -7819,6 +7828,8 @@ if test x$enable_host_pie = xyes; then - LD_PICFLAG=-pie - elif test x$gcc_cv_no_pie = xyes; then - LD_PICFLAG=-no-pie -+elif test x$gcc_cv_nopie = xyes; then -+ LD_PICFLAG=-nopie - else - LD_PICFLAG= - fi --- -2.50.1 - diff --git a/cross/gcc-armhf/0015-ada-fix-shared-linking.patch b/cross/gcc-armhf/0015-ada-fix-shared-linking.patch deleted file mode 100644 index 09fbaa4d7..000000000 --- a/cross/gcc-armhf/0015-ada-fix-shared-linking.patch +++ /dev/null @@ -1,42 +0,0 @@ -From f1d6c0950e0f12fb8cf2429da570f478a1369286 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:59:16 +0000 -Subject: [PATCH] ada: fix shared linking - ---- - gcc/ada/link.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/gcc/ada/link.c b/gcc/ada/link.c -index 9e3385ca94f..2c0cca6e480 100644 ---- a/gcc/ada/link.c -+++ b/gcc/ada/link.c -@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; - || defined (__NetBSD__) || defined (__OpenBSD__) \ - || defined (__QNX__) - const char *__gnat_object_file_option = "-Wl,@"; --const char *__gnat_run_path_option = "-Wl,-rpath,"; --char __gnat_shared_libgnat_default = STATIC; --char __gnat_shared_libgcc_default = STATIC; -+const char *__gnat_run_path_option = ""; -+char __gnat_shared_libgnat_default = SHARED; -+char __gnat_shared_libgcc_default = SHARED; - int __gnat_link_max = 8192; - unsigned char __gnat_objlist_file_supported = 1; - const char *__gnat_object_library_extension = ".a"; -@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir = "lib"; - - #elif defined (__linux__) || defined (__GLIBC__) - const char *__gnat_object_file_option = "-Wl,@"; --const char *__gnat_run_path_option = "-Wl,-rpath,"; --char __gnat_shared_libgnat_default = STATIC; --char __gnat_shared_libgcc_default = STATIC; -+const char *__gnat_run_path_option = ""; -+char __gnat_shared_libgnat_default = SHARED; -+char __gnat_shared_libgcc_default = SHARED; - int __gnat_link_max = 8192; - unsigned char __gnat_objlist_file_supported = 1; - const char *__gnat_object_library_extension = ".a"; --- -2.50.1 - diff --git a/cross/gcc-armhf/0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch b/cross/gcc-armhf/0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch deleted file mode 100644 index d7b8b1677..000000000 --- a/cross/gcc-armhf/0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 8773e0cf880da9fe80de7f8a662359664bb0b234 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 06:59:43 +0000 -Subject: [PATCH] build: fix CXXFLAGS_FOR_BUILD passing - ---- - Makefile.in | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/Makefile.in b/Makefile.in -index b1ed67d3d4f..1e039c20550 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -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. --- -2.50.1 - diff --git a/cross/gcc-armhf/0017-add-fortify-headers-paths.patch b/cross/gcc-armhf/0017-add-fortify-headers-paths.patch deleted file mode 100644 index 12e81eb81..000000000 --- a/cross/gcc-armhf/0017-add-fortify-headers-paths.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 625b8095796f24389fdda5bb5bc6ff9fbb365813 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 07:01:06 +0000 -Subject: [PATCH] add fortify-headers paths - ---- - gcc/config/linux.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/gcc/config/linux.h b/gcc/config/linux.h -index d6280a4d4dd..ba69fb9fad7 100644 ---- a/gcc/config/linux.h -+++ b/gcc/config/linux.h -@@ -159,6 +159,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - - #ifdef NATIVE_SYSTEM_HEADER_DIR - #define INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \ -+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \ - { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 }, - #else --- -2.50.1 - diff --git a/cross/gcc-armhf/0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch b/cross/gcc-armhf/0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch deleted file mode 100644 index 21e51a825..000000000 --- a/cross/gcc-armhf/0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c557286adc46536fe033df400c50a880b672cfd6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Fri, 21 Aug 2020 07:03:00 +0000 -Subject: [PATCH] Alpine musl package provides libssp_nonshared.a. We link to - it unconditionally, as otherwise we get link failures if some objects are - -fstack-protector built and final link happens with -fno-stack-protector. - This seems to be the common case when bootstrapping gcc, the piepatches do - not seem to fully fix the crosstoolchain and bootstrap sequence wrt. - stack-protector flag usage. - ---- - gcc/gcc.cc | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 7b0d3d2743b..e46e976a2e8 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1017,8 +1017,7 @@ proper position among the other output files. */ - - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP --#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -- "|fstack-protector-strong|fstack-protector-explicit:}" -+#define LINK_SSP_SPEC "-lssp_nonshared" - #else - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ - "|fstack-protector-strong|fstack-protector-explicit" \ --- -2.50.1 - diff --git a/cross/gcc-armhf/0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch b/cross/gcc-armhf/0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch deleted file mode 100644 index a0585d80e..000000000 --- a/cross/gcc-armhf/0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch +++ /dev/null @@ -1,69 +0,0 @@ -From d698fead9d201ef032e2e978898864335a9ab513 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 07:03:42 +0000 -Subject: [PATCH] DP: Use --push-state/--pop-state for gold as well when - linking libtsan. - ---- - gcc/gcc.cc | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index e46e976a2e8..607c8ca1d42 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -775,10 +775,10 @@ proper position among the other output files. */ - #define LIBASAN_SPEC STATIC_LIBASAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION "}" \ -- " %{!static-libasan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libasan:--push-state --no-as-needed}" \ - " -lasan " \ - " %{static-libasan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libasan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libasan:--pop-state}" \ - STATIC_LIBASAN_LIBS - #else - #define LIBASAN_SPEC "-lasan" STATIC_LIBASAN_LIBS -@@ -814,10 +814,10 @@ proper position among the other output files. */ - #define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \ -- " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libtsan:--push-state --no-as-needed}" \ - " -ltsan " \ - " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libtsan:--pop-state}" \ - STATIC_LIBTSAN_LIBS - #else - #define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS -@@ -835,10 +835,10 @@ proper position among the other output files. */ - #define LIBLSAN_SPEC STATIC_LIBLSAN_LIBS - #elif defined(HAVE_LD_STATIC_DYNAMIC) - #define LIBLSAN_SPEC "%{static-liblsan:" LD_STATIC_OPTION "}" \ -- " %{!static-liblsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-liblsan:--push-state --no-as-needed}" \ - " -llsan " \ - " %{static-liblsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-liblsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-liblsan:--pop-state}" \ - STATIC_LIBLSAN_LIBS - #else - #define LIBLSAN_SPEC "-llsan" STATIC_LIBLSAN_LIBS -@@ -854,10 +854,10 @@ proper position among the other output files. */ - " %{static-libubsan|static:%:include(libsanitizer.spec)%(link_libubsan)}" - #ifdef HAVE_LD_STATIC_DYNAMIC - #define LIBUBSAN_SPEC "%{static-libubsan:" LD_STATIC_OPTION "}" \ -- " %{!static-libubsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \ -+ " %{!static-libubsan:--push-state --no-as-needed}" \ - " -lubsan " \ - " %{static-libubsan:" LD_DYNAMIC_OPTION "}" \ -- " %{!static-libubsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \ -+ " %{!static-libubsan:--pop-state}" \ - STATIC_LIBUBSAN_LIBS - #else - #define LIBUBSAN_SPEC "-lubsan" STATIC_LIBUBSAN_LIBS --- -2.50.1 - diff --git a/cross/gcc-armhf/0020-aarch64-disable-multilib-support.patch b/cross/gcc-armhf/0020-aarch64-disable-multilib-support.patch deleted file mode 100644 index 5f250f594..000000000 --- a/cross/gcc-armhf/0020-aarch64-disable-multilib-support.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9cf1916bd52d61ea0fd7a8b6acebb1dc4a1f2488 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Thu, 6 Jan 2022 03:12:55 +0000 -Subject: [PATCH] aarch64: disable multilib support - -multilib is unsupported on Alpine GCC ---- - gcc/config/aarch64/t-aarch64-linux | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/config/aarch64/t-aarch64-linux b/gcc/config/aarch64/t-aarch64-linux -index 70e36b3299e..e00c3becd3f 100644 ---- a/gcc/config/aarch64/t-aarch64-linux -+++ b/gcc/config/aarch64/t-aarch64-linux -@@ -22,7 +22,7 @@ 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) -+MULTILIB_OSDIRNAMES = mabi.lp64=../lib - MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) - - MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32) --- -2.50.1 - diff --git a/cross/gcc-armhf/0021-s390x-disable-multilib-support.patch b/cross/gcc-armhf/0021-s390x-disable-multilib-support.patch deleted file mode 100644 index e994c6979..000000000 --- a/cross/gcc-armhf/0021-s390x-disable-multilib-support.patch +++ /dev/null @@ -1,25 +0,0 @@ -From dc07fb7df8d4f997877d8f98ea9ef8292f738ed3 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Thu, 6 Jan 2022 03:13:59 +0000 -Subject: [PATCH] s390x: disable multilib support - -multilib is not supported on Alpine GCC at present ---- - gcc/config/s390/t-linux64 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/config/s390/t-linux64 b/gcc/config/s390/t-linux64 -index cc6ab367072..7f498ee1cdc 100644 ---- a/gcc/config/s390/t-linux64 -+++ b/gcc/config/s390/t-linux64 -@@ -7,5 +7,5 @@ - - MULTILIB_OPTIONS = m64/m31 - MULTILIB_DIRNAMES = 64 32 --MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu) --MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 --- -2.50.1 - diff --git a/cross/gcc-armhf/0022-ppc64-le-disable-multilib-support.patch b/cross/gcc-armhf/0022-ppc64-le-disable-multilib-support.patch deleted file mode 100644 index 229fce89b..000000000 --- a/cross/gcc-armhf/0022-ppc64-le-disable-multilib-support.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 496067ded4a3698468412e240b899755d92b314c Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Thu, 6 Jan 2022 03:14:33 +0000 -Subject: [PATCH] ppc64[le]: disable multilib support - -multilib is not presently supported on Alpine GCC ---- - gcc/config/rs6000/t-linux | 6 ++++-- - gcc/config/rs6000/t-linux64 | 4 ++-- - gcc/config/rs6000/t-linux64bele | 4 ++-- - gcc/config/rs6000/t-linux64lebe | 4 ++-- - 4 files changed, 10 insertions(+), 8 deletions(-) - -diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux -index 4e371255533..128c75c7d39 100644 ---- a/gcc/config/rs6000/t-linux -+++ b/gcc/config/rs6000/t-linux -@@ -2,7 +2,8 @@ - # or soft-float. - ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) - ifneq (,$(findstring powerpc64,$(target))) --MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - else - MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu) - endif -@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target))) - MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) - endif - ifneq (,$(findstring powerpc64le,$(target))) --MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - endif - endif - -diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 -index f56b47c268e..c5f757a6284 100644 ---- a/gcc/config/rs6000/t-linux64 -+++ b/gcc/config/rs6000/t-linux64 -@@ -28,8 +28,8 @@ - MULTILIB_OPTIONS := m64/m32 - MULTILIB_DIRNAMES := 64 32 - 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 := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - - rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.cc - $(COMPILE) $< -diff --git a/gcc/config/rs6000/t-linux64bele b/gcc/config/rs6000/t-linux64bele -index 97c1ee6fb4d..08d72639cb6 100644 ---- a/gcc/config/rs6000/t-linux64bele -+++ b/gcc/config/rs6000/t-linux64bele -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mlittle - MULTILIB_DIRNAMES += le --MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} -diff --git a/gcc/config/rs6000/t-linux64lebe b/gcc/config/rs6000/t-linux64lebe -index 2e63bdb9fc9..c6e1c5db65d 100644 ---- a/gcc/config/rs6000/t-linux64lebe -+++ b/gcc/config/rs6000/t-linux64lebe -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mbig - MULTILIB_DIRNAMES += be --MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} --- -2.50.1 - diff --git a/cross/gcc-armhf/0023-x86_64-disable-multilib-support.patch b/cross/gcc-armhf/0023-x86_64-disable-multilib-support.patch deleted file mode 100644 index 2a56f0cd7..000000000 --- a/cross/gcc-armhf/0023-x86_64-disable-multilib-support.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 3d0f96f3f53a7ff81532f077e9db69d7318db796 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Thu, 6 Jan 2022 03:14:54 +0000 -Subject: [PATCH] x86_64: disable multilib support - -multilib is not presently supported on Alpine GCC ---- - gcc/config/i386/t-linux64 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/gcc/config/i386/t-linux64 b/gcc/config/i386/t-linux64 -index 64a4a20e64f..9a8eb8dd8d1 100644 ---- a/gcc/config/i386/t-linux64 -+++ b/gcc/config/i386/t-linux64 -@@ -33,6 +33,6 @@ - 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 = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) --- -2.50.1 - diff --git a/cross/gcc-armhf/0024-riscv-disable-multilib-support.patch b/cross/gcc-armhf/0024-riscv-disable-multilib-support.patch deleted file mode 100644 index b43715953..000000000 --- a/cross/gcc-armhf/0024-riscv-disable-multilib-support.patch +++ /dev/null @@ -1,78 +0,0 @@ -From b1ab523d6fa44aae8f3ec5f787a8f86f8686bf64 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Mon, 3 Jan 2022 07:14:48 +0100 -Subject: [PATCH] riscv: disable multilib support -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From the musl wiki [1]: - - musl does not support sharing an include directory between archs - […], and thus is not compatible with GCC-style multilib. It is - recommended that distributions build GCC with multilib disabled, - and use library directories named lib, not lib64 or lib32. - -For this reason, we patch existing GCC configuration files (gcc/config) -to pin MULTILIB_OSDIRNAMES to lib, there is also a corresponding GCC -upstream bug about this issue [2]. Avoiding the use of lib64 and lib32 -directories is a bit more difficult on the RISC-V architecture. This is -due to the fact that the default RISC-V configuration does not only use -the lib64 and lib32 directories but also subdirectories within these -directories for different RISC-V ABIs (e.g. lp64d, lp64, …) [3]. - -This patch aligns the RISC-V configuration with other architectures by -pinning MULTILIB_OSDIRNAMES to lib for rv64gc (our default RISC-V --march). Furthermore, this patch removes the ABI-specific startfile -prefix spec. Since both of these impact the default LIBRARY_PATH [4] -this patch thereby aligns the default RISC-V LIBRARY_PATH with that from -other Alpine architectures and thereby fixes #13369 [5]. - -Incidentally, this also fixes gccgo on riscv64, as without this patch -gccgo is otherwise not able to find the *.gox files for the Go standard -library. - -[1]: https://wiki.musl-libc.org/guidelines-for-distributions.html#Multilib/multi_arch -[2]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90077 -[3]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103889#c14 -[4]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.c;h=d4c8746b0aa322286decf92aa72a12f0a393b655;hb=HEAD#l9122 -[5]: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13369 ---- - gcc/config/riscv/linux.h | 8 -------- - gcc/config/riscv/t-linux | 7 +++++-- - 2 files changed, 5 insertions(+), 10 deletions(-) - -diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h -index 282c77b6a7b..07adae3d59c 100644 ---- a/gcc/config/riscv/linux.h -+++ b/gcc/config/riscv/linux.h -@@ -61,11 +61,3 @@ along with GCC; see the file COPYING3. If not see - %{rdynamic:-export-dynamic} \ - -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \ - %{static:-static} %{static-pie:-static -pie --no-dynamic-linker -z text}}" -- --#define STARTFILE_PREFIX_SPEC \ -- "/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ -- "/usr/lib" XLEN_SPEC "/" ABI_SPEC "/ " \ -- "/lib/ " \ -- "/usr/lib/ " -- --#define RISCV_USE_CUSTOMISED_MULTI_LIB select_by_abi -diff --git a/gcc/config/riscv/t-linux b/gcc/config/riscv/t-linux -index a6f64f88d25..f88776ec520 100644 ---- a/gcc/config/riscv/t-linux -+++ b/gcc/config/riscv/t-linux -@@ -1,5 +1,8 @@ --# Only XLEN and ABI affect Linux multilib dir names, e.g. /lib32/ilp32d/ --MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib64,$(MULTILIB_DIRNAMES))) -+MULTILIB_OPTIONS := march=rv64gc -+MULTILIB_DIRNAMES := rv64gc -+ -+MULTILIB_DIRNAMES := $(patsubst rv32%,lib32,$(patsubst rv64%,lib,$(MULTILIB_DIRNAMES))) - MULTILIB_OSDIRNAMES := $(patsubst lib%,../lib%,$(MULTILIB_DIRNAMES)) -+MULTILIB_MATCHES := march?rv64gc=march?rv64imafdc - - MULTIARCH_DIRNAME := $(call if_multiarch,$(firstword $(subst -, ,$(target)))-linux-gnu) --- -2.50.1 - diff --git a/cross/gcc-armhf/0025-always-build-libgcc_eh.a.patch b/cross/gcc-armhf/0025-always-build-libgcc_eh.a.patch deleted file mode 100644 index 424660727..000000000 --- a/cross/gcc-armhf/0025-always-build-libgcc_eh.a.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ee64e5ead8938d5be6cedd674158a25d93711fe3 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 21 Aug 2020 07:05:41 +0000 -Subject: [PATCH] always build libgcc_eh.a - -highly inspired by: - http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch ---- - libgcc/Makefile.in | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) - -diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in -index 0719fd0615d..80bb8f1622f 100644 ---- a/libgcc/Makefile.in -+++ b/libgcc/Makefile.in -@@ -971,8 +971,9 @@ ifneq ($(LIBUNWIND),) - all: libunwind.a - endif - -+all: libgcc_eh.a - ifeq ($(enable_shared),yes) --all: libgcc_eh.a libgcc_s$(SHLIB_EXT) -+all: libgcc_s$(SHLIB_EXT) - ifneq ($(LIBUNWIND),) - all: libunwind$(SHLIB_EXT) - libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) -@@ -1177,10 +1178,6 @@ install-libunwind: - install-shared: - $(mkinstalldirs) $(DESTDIR)$(inst_libdir) - -- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- - $(subst @multilib_dir@,$(MULTIDIR),$(subst \ - @shlib_base_name@,libgcc_s,$(subst \ - @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) -@@ -1197,6 +1194,10 @@ ifeq ($(enable_gcov),yes) - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a - endif - -+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ - parts="$(INSTALL_PARTS)"; \ - for file in $$parts; do \ - rm -f $(DESTDIR)$(inst_libdir)/$$file; \ --- -2.50.1 - diff --git a/cross/gcc-armhf/0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch b/cross/gcc-armhf/0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch deleted file mode 100644 index d5f15cbd0..000000000 --- a/cross/gcc-armhf/0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 5adfe740c027fb8dc9931053f55f7eae222e6bb4 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 02:09:02 -0700 -Subject: [PATCH] ada: libgnarl: remove use of glibc-specific - pthread_rwlockattr_setkind_np - -musl's thread library does not implement it - -Signed-off-by: Ariadne Conill ---- - gcc/ada/libgnarl/s-osinte__linux.ads | 10 ---------- - gcc/ada/libgnarl/s-taprop__linux.adb | 7 ------- - 2 files changed, 17 deletions(-) - -diff --git a/gcc/ada/libgnarl/s-osinte__linux.ads b/gcc/ada/libgnarl/s-osinte__linux.ads -index 7aeb15da523..5551b701e5a 100644 ---- a/gcc/ada/libgnarl/s-osinte__linux.ads -+++ b/gcc/ada/libgnarl/s-osinte__linux.ads -@@ -402,16 +402,6 @@ package System.OS_Interface is - (attr : access pthread_rwlockattr_t) return int; - pragma Import (C, pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy"); - -- PTHREAD_RWLOCK_PREFER_READER_NP : constant := 0; -- PTHREAD_RWLOCK_PREFER_WRITER_NP : constant := 1; -- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2; -- -- function pthread_rwlockattr_setkind_np -- (attr : access pthread_rwlockattr_t; -- pref : int) return int; -- pragma Import -- (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np"); -- - function pthread_rwlock_init - (mutex : access pthread_rwlock_t; - attr : access pthread_rwlockattr_t) return int; -diff --git a/gcc/ada/libgnarl/s-taprop__linux.adb b/gcc/ada/libgnarl/s-taprop__linux.adb -index 8f4c835baa7..6df36c7d8f4 100644 ---- a/gcc/ada/libgnarl/s-taprop__linux.adb -+++ b/gcc/ada/libgnarl/s-taprop__linux.adb -@@ -409,16 +409,9 @@ package body System.Task_Primitives.Operations is - Result : C.int; - - begin -- -- Set the rwlock to prefer writer to avoid writers starvation -- - Result := pthread_rwlockattr_init (RWlock_Attr'Access); - pragma Assert (Result = 0); - -- Result := pthread_rwlockattr_setkind_np -- (RWlock_Attr'Access, -- PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); -- pragma Assert (Result = 0); -- - Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access); - - pragma Assert (Result in 0 | ENOMEM); --- -2.50.1 - diff --git a/cross/gcc-armhf/0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch b/cross/gcc-armhf/0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch deleted file mode 100644 index cba042707..000000000 --- a/cross/gcc-armhf/0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch +++ /dev/null @@ -1,50 +0,0 @@ -From c8edb618208a854d121ff73c0d82d7cc467a3611 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 02:13:19 -0700 -Subject: [PATCH] ada: libgnarl: use posix_openpt instead of glibc-specific - getpt to open a pty - -musl only implements posix_openpt(3), not the older glibc-specific getpt() -and glibc implements both for ages. - -Signed-off-by: Ariadne Conill ---- - gcc/ada/terminals.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c -index 89f887556c0..93557fe2631 100644 ---- a/gcc/ada/terminals.c -+++ b/gcc/ada/terminals.c -@@ -1134,7 +1134,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED, - /* POSIX does not specify how to open the master side of a terminal.Several - methods are available (system specific): - 1- using a cloning device (USE_CLONE_DEVICE) -- 2- getpt (USE_GETPT) -+ 2- posix_openpt (USE_POSIX_OPENPT) - 3- openpty (USE_OPENPTY) - - When using the cloning device method, the macro USE_CLONE_DEVICE should -@@ -1148,7 +1148,7 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED, - #if defined (__APPLE__) || defined (BSD) - #define USE_OPENPTY - #elif defined (__linux__) --#define USE_GETPT -+#define USE_POSIX_OPENPT - #elif defined (__sun__) - #define USE_CLONE_DEVICE "/dev/ptmx" - #elif defined (_AIX) -@@ -1197,8 +1197,8 @@ allocate_pty_desc (pty_desc **desc) { - int master_fd = -1; - char *slave_name = NULL; - --#ifdef USE_GETPT -- master_fd = getpt (); -+#if defined(USE_POSIX_OPENPT) -+ master_fd = posix_openpt(O_RDWR | O_NOCTTY); - #elif defined (USE_OPENPTY) - status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); - #elif defined (USE_CLONE_DEVICE) --- -2.50.1 - diff --git a/cross/gcc-armhf/0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch b/cross/gcc-armhf/0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch deleted file mode 100644 index 5dca2c462..000000000 --- a/cross/gcc-armhf/0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch +++ /dev/null @@ -1,54 +0,0 @@ -From d3c515c40b9ec0133787388ae7df037e88a95f73 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Fri, 25 Jul 2025 02:18:49 -0700 -Subject: [PATCH] ada: libgnarl: adaint: fix sched.h inclusion for musl - -Signed-off-by: Ariadne Conill ---- - gcc/ada/adaint.c | 6 +++++- - gcc/ada/adaint.h | 5 +++++ - 2 files changed, 10 insertions(+), 1 deletion(-) - -diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c -index 1fcfae165a7..67318e647ed 100644 ---- a/gcc/ada/adaint.c -+++ b/gcc/ada/adaint.c -@@ -95,6 +95,11 @@ - #include - #endif - -+#if defined (linux) || defined(__linux__) -+#define _GNU_SOURCE 1 -+#include -+#endif -+ - #ifdef __PikeOS__ - #define __BSD_VISIBLE 1 - #endif -@@ -3476,7 +3481,6 @@ __gnat_lwp_self (void) - #endif - - #if defined (__linux__) --#include - - /* glibc versions earlier than 2.7 do not define the routines to handle - dynamically allocated CPU sets. For these targets, we use the static -diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h -index 3df12b5f956..26a489f2b78 100644 ---- a/gcc/ada/adaint.h -+++ b/gcc/ada/adaint.h -@@ -40,6 +40,11 @@ extern "C" { - #include "mingw32.h" - #endif - -+#if defined (linux) || defined(__linux__) -+#define _GNU_SOURCE 1 -+#include -+#endif -+ - #include - - /* Constants used for the form parameter encoding values */ --- -2.50.1 - diff --git a/cross/gcc-armhf/0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch b/cross/gcc-armhf/0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch deleted file mode 100644 index ceec7a739..000000000 --- a/cross/gcc-armhf/0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch +++ /dev/null @@ -1,256 +0,0 @@ -From 3d13edda0134af3fbb802cdec6406c91003bbc33 Mon Sep 17 00:00:00 2001 -From: Drew DeVault -Date: Wed, 9 Dec 2020 07:42:06 +0000 -Subject: [PATCH] configure: Add --enable-autolink-libatomic, use in - LINK_GCC_C_SEQUENCE_SPEC [PR81358] - -This fixes issues with RISC-V. ---- - Makefile.in | 1 + - gcc/config.in | 6 ++++++ - gcc/config/gnu-user.h | 12 +++++++++++- - gcc/configure | 31 ++++++++++++++++++++++++++++++- - gcc/configure.ac | 21 +++++++++++++++++++++ - gcc/doc/install.texi | 8 ++++++++ - gcc/doc/tm.texi | 8 +++++++- - gcc/doc/tm.texi.in | 8 +++++++- - gcc/gcc.cc | 12 +++++++++++- - 9 files changed, 102 insertions(+), 5 deletions(-) - -diff --git a/Makefile.in b/Makefile.in -index 1e039c20550..20f535a306a 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -238,6 +238,7 @@ HOST_EXPORTS = \ - RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \ - READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \ - TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ -+ TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS; \ - HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \ - GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ - GMPINC="$(HOST_GMPINC)"; export GMPINC; \ -diff --git a/gcc/config.in b/gcc/config.in -index 8a531ed591c..40045ff35a5 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -131,6 +131,12 @@ - #endif - - -+/* Define if libatomic should always be linked. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_AUTOLINK_LIBATOMIC -+#endif -+ -+ - /* Define to 1 to specify that we are using the BID decimal floating point - format instead of DPD */ - #ifndef USED_FOR_TARGET -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index 3c17ac6eade..0426efdb8c3 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -109,8 +109,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " - #endif - -+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC) -+# ifdef LD_AS_NEEDED_OPTION -+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION -+# else -+# define LINK_LIBATOMIC_SPEC "-latomic" -+# endif -+#elif !defined(LINK_LIBATOMIC_SPEC) -+# define LINK_LIBATOMIC_SPEC "" -+#endif -+ - #define GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC \ -- "%{static|static-pie:--start-group} %G %{!nolibc:%L} \ -+ "%{static|static-pie:--start-group} %G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L} \ - %{static|static-pie:--end-group}%{!static:%{!static-pie:%G}}" - - #undef LINK_GCC_C_SEQUENCE_SPEC -diff --git a/gcc/configure b/gcc/configure -index 343563c8948..54300a2a867 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -1003,6 +1003,7 @@ with_changes_root_url - enable_languages - with_multilib_list - with_multilib_generator -+enable_autolink_libatomic - with_zstd - with_zstd_include - with_zstd_lib -@@ -1742,6 +1743,9 @@ Optional Features: - --disable-shared don't provide a shared libgcc - --disable-gcov don't provide libgcov and related host tools - --enable-languages=LIST specify which front-ends to build -+ --enable-autolink-libatomic -+ enable automatic linking of libatomic (ignored if -+ not built) - --disable-rpath do not hardcode runtime library paths - --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling -@@ -8400,7 +8404,6 @@ else - fi - - -- - # Check whether --with-multilib-generator was given. - if test "${with_multilib_generator+set}" = set; then : - withval=$with_multilib_generator; : -@@ -8408,6 +8411,32 @@ else - with_multilib_generator=default - fi - -+# If libatomic is available, whether it should be linked automatically -+# Check whether --enable-autolink-libatomic was given. -+if test "${enable_autolink_libatomic+set}" = set; then : -+ enableval=$enable_autolink_libatomic; -+ case $enable_autolink_libatomic in -+ yes | no) ;; -+ *) as_fn_error $? "'$enable_autolink_libatomic' is an invalid value for -+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'." "$LINENO" 5 ;; -+ esac -+ -+else -+ enable_autolink_libatomic='' -+fi -+ -+ -+if test x$enable_autolink_libatomic = xyes; then -+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then -+ -+$as_echo "#define ENABLE_AUTOLINK_LIBATOMIC 1" >>confdefs.h -+ -+ else -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&5 -+$as_echo "$as_me: WARNING: libatomic is not build for this target, --enable-autolink-libatomic ignored" >&2;} -+ fi -+fi -+ - - # ------------------------- - # Checks for other programs -diff --git a/gcc/configure.ac b/gcc/configure.ac -index b3948469d17..81c070830e2 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -1227,6 +1227,27 @@ AC_ARG_WITH(multilib-generator, - :, - with_multilib_generator=default) - -+# If libatomic is available, whether it should be linked automatically -+AC_ARG_ENABLE(autolink-libatomic, -+[AS_HELP_STRING([--enable-autolink-libatomic], -+ [enable automatic linking of libatomic (ignored if not built)])], -+[ -+ case $enable_autolink_libatomic in -+ yes | no) ;; -+ *) AC_MSG_ERROR(['$enable_autolink_libatomic' is an invalid value for -+--enable-autolink-libatomic. Valid choices are 'yes' and 'no'.]) ;; -+ esac -+], [enable_autolink_libatomic='']) -+ -+if test x$enable_autolink_libatomic = xyes; then -+ if echo " ${TARGET_CONFIGDIRS} " | grep " libatomic " > /dev/null 2>&1 ; then -+ AC_DEFINE(ENABLE_AUTOLINK_LIBATOMIC, 1, -+ [Define if libatomic should always be linked.]) -+ else -+ AC_MSG_WARN([libatomic is not build for this target, --enable-autolink-libatomic ignored]) -+ fi -+fi -+ - # ------------------------- - # Checks for other programs - # ------------------------- -diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi -index 3e9e09b4ae3..6e7b756be61 100644 ---- a/gcc/doc/install.texi -+++ b/gcc/doc/install.texi -@@ -2617,6 +2617,14 @@ files, but these changed header paths may conflict with some compilation - environments. Enabled by default, and may be disabled using - @option{--disable-canonical-system-headers}. - -+@item --enable-autolink-libatomic -+@itemx --disable-autolink-libatomic -+Tell GCC that it should automatically link libatomic; if supported by -+the linker, the file is only linked as needed. This flag is ignored -+when libatomic is not built. Note that this conigure flag is in particular -+useful when building an offloading-target compiler; as for those, a -+user had to specify @code{-foffload=target=-latomic} otherwise. -+ - @item --with-glibc-version=@var{major}.@var{minor} - Tell GCC that when the GNU C Library (glibc) is used on the target it - will be version @var{major}.@var{minor} or later. Normally this can -diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi -index a96700c0d38..16deedca64d 100644 ---- a/gcc/doc/tm.texi -+++ b/gcc/doc/tm.texi -@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search. - - @defmac LINK_GCC_C_SEQUENCE_SPEC - The sequence in which libgcc and libc are specified to the linker. --By default this is @code{%G %L %G}. -+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}. -+@end defmac -+ -+@defmac LINK_LIBATOMIC_SPEC -+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link -+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC} -+is set. - @end defmac - - @defmac POST_LINK_SPEC -diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in -index eccc4d88493..4ca4c610571 100644 ---- a/gcc/doc/tm.texi.in -+++ b/gcc/doc/tm.texi.in -@@ -390,7 +390,13 @@ the argument @option{-lgcc} to tell the linker to do the search. - - @defmac LINK_GCC_C_SEQUENCE_SPEC - The sequence in which libgcc and libc are specified to the linker. --By default this is @code{%G %L %G}. -+By default this is @code{%G LINK_LIBATOMIC_SPEC %L %G}. -+@end defmac -+ -+@defmac LINK_LIBATOMIC_SPEC -+This macro is used in the default @code{LINK_GCC_C_SEQUENCE_SPEC} to link -+libatomic. By default, it is unset unless @code{ENABLE_AUTOLINK_LIBATOMIC} -+is set. - @end defmac - - @defmac POST_LINK_SPEC -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index 607c8ca1d42..e9f78f0f4c1 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1000,13 +1000,23 @@ proper position among the other output files. */ - # define ASM_DEBUG_OPTION_SPEC "" - #endif - -+#if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC) -+# ifdef LD_AS_NEEDED_OPTION -+# define LINK_LIBATOMIC_SPEC LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION -+# else -+# define LINK_LIBATOMIC_SPEC "-latomic" -+# endif -+#elif !defined(LINK_LIBATOMIC_SPEC) -+# define LINK_LIBATOMIC_SPEC "" -+#endif -+ - /* Here is the spec for running the linker, after compiling all files. */ - - /* This is overridable by the target in case they need to specify the - -lgcc and -lc order specially, yet not require them to override all - of LINK_COMMAND_SPEC. */ - #ifndef LINK_GCC_C_SEQUENCE_SPEC --#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}" -+#define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:" LINK_LIBATOMIC_SPEC " %L %G}" - #endif - - #ifdef ENABLE_DEFAULT_SSP --- -2.50.1 - diff --git a/cross/gcc-armhf/0030-configure-fix-detection-of-atomic-builtins-in-libato.patch b/cross/gcc-armhf/0030-configure-fix-detection-of-atomic-builtins-in-libato.patch deleted file mode 100644 index f17da9cdb..000000000 --- a/cross/gcc-armhf/0030-configure-fix-detection-of-atomic-builtins-in-libato.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ddc31942d7363acc938007d70f29e3e324064f76 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sun, 29 Aug 2021 12:23:34 +0200 -Subject: [PATCH] configure: fix detection of atomic builtins in libatomic - configure script - -Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by -default) causes the libatomic configure script to incorrectly detect -which builtins are available on riscv64. This then causes incorrect code -generation for libatomic since it assumes compiler builtins to be -available which are not actually available on riscv64. - -This commit fixes this issue by disabling linking of libatomic configure -test code entirely, thereby preventing linking against libatomic. - -See: - -* https://gitlab.alpinelinux.org/alpine/aports/-/issues/12948 -* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c6 ---- - libatomic/configure.tgt | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt -index 6db039d6e8b..2751b5c1387 100644 ---- a/libatomic/configure.tgt -+++ b/libatomic/configure.tgt -@@ -30,6 +30,26 @@ - # on ${target_cpu}. For example to allow proper use of multilibs. - configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}" - -+# The libatomic configure script performs several checks to determine -+# whether builtins for atomic operations are available. When compiling -+# with --enable-autolink-libatomic the test code compiled by the -+# configure script is also linked against libatomic. This causes it -+# to think that builtins are available, even if there are not, since -+# the tested symbols are provided by libatomic. -+# -+# This is a hack to ensure that we don't link against libatomic by not -+# linking any configure test code at all when --enable-autolink-libatomic -+# is given. -+# -+# See: -+# -+# * https://gitlab.alpinelinux.org/alpine/aports/-/issues/12817 -+# * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c4 -+# -+if test x$enable_autolink_libatomic = xyes; then -+ gcc_no_link=yes -+fi -+ - case "${target_cpu}" in - alpha*) - # fenv.c needs this option to generate inexact exceptions. --- -2.50.1 - diff --git a/cross/gcc-armhf/0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch b/cross/gcc-armhf/0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch deleted file mode 100644 index 5c5f63823..000000000 --- a/cross/gcc-armhf/0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e9f4662af949bc56eef27d531605dd90181bc300 Mon Sep 17 00:00:00 2001 -From: Samuel Holland -Date: Thu, 30 Jun 2022 16:44:51 +0000 -Subject: [PATCH] libstdc++: do not throw exceptions for non-C locales on musl - targets - ---- - libstdc++-v3/config/locale/generic/c_locale.cc | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/libstdc++-v3/config/locale/generic/c_locale.cc b/libstdc++-v3/config/locale/generic/c_locale.cc -index bfd02b5c2c6..16f9e84d66f 100644 ---- a/libstdc++-v3/config/locale/generic/c_locale.cc -+++ b/libstdc++-v3/config/locale/generic/c_locale.cc -@@ -242,9 +242,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION - // Currently, the generic model only supports the "C" locale. - // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html - __cloc = 0; -- if (strcmp(__s, "C")) -- __throw_runtime_error(__N("locale::facet::_S_create_c_locale " -- "name not valid")); - } - - void --- -2.50.1 - diff --git a/cross/gcc-armhf/0032-gdc-unconditionally-link-libgphobos-against-libucont.patch b/cross/gcc-armhf/0032-gdc-unconditionally-link-libgphobos-against-libucont.patch deleted file mode 100644 index 51171b4ad..000000000 --- a/cross/gcc-armhf/0032-gdc-unconditionally-link-libgphobos-against-libucont.patch +++ /dev/null @@ -1,26 +0,0 @@ -From b4c412a5d538f7478596880e89d0e6d5046ef16b Mon Sep 17 00:00:00 2001 -From: Mathias LANG -Date: Mon, 17 Jan 2022 03:49:21 +0000 -Subject: [PATCH] gdc: unconditionally link libgphobos against libucontext - -ref: alpine/aports#13422 ---- - Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.in b/Makefile.in -index 20f535a306a..c087bfe7cd4 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -54382,7 +54382,7 @@ configure-target-libphobos: - esac; \ - module_srcdir=libphobos; \ - rm -f no-such-file || : ; \ -- CONFIG_SITE=no-such-file $(SHELL) \ -+ CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \ - $$s/$$module_srcdir/configure \ - --srcdir=$${topdir}/$$module_srcdir \ - $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \ --- -2.50.1 - diff --git a/cross/gcc-armhf/0033-druntime-link-against-libucontext-on-all-platforms.patch b/cross/gcc-armhf/0033-druntime-link-against-libucontext-on-all-platforms.patch deleted file mode 100644 index d2c608a51..000000000 --- a/cross/gcc-armhf/0033-druntime-link-against-libucontext-on-all-platforms.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0c10e5ee09685a5ecc39650e8ec8a1b4f5e096e5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Sat, 16 Jul 2022 09:21:11 +0200 -Subject: [PATCH] druntime: link against libucontext on all platforms - -On musl-based Linux distributions, swapcontext etc. are not provided by -musl but instead by libucontext. Hence, we _always_ need to link against -an external library for these functions. ---- - libphobos/configure | 8 -------- - libphobos/m4/druntime/libraries.m4 | 8 -------- - 2 files changed, 16 deletions(-) - -diff --git a/libphobos/configure b/libphobos/configure -index 4f5be7d4ff4..0a48032edb4 100755 ---- a/libphobos/configure -+++ b/libphobos/configure -@@ -15420,14 +15420,6 @@ fi - # Keep this in sync with core/thread.d, set druntime_fiber_asm_external to - # "yes" for targets that have 'version = AsmExternal'. - druntime_fiber_asm_external=no -- case "$target_cpu" in -- aarch64* | \ -- arm* | \ -- i[34567]86|x86_64 | \ -- powerpc) -- druntime_fiber_asm_external=yes -- ;; -- esac - if test "$druntime_fiber_asm_external" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing swapcontext" >&5 - $as_echo_n "checking for library containing swapcontext... " >&6; } -diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4 -index 8dd9c7da107..b61bf528a14 100644 ---- a/libphobos/m4/druntime/libraries.m4 -+++ b/libphobos/m4/druntime/libraries.m4 -@@ -220,14 +220,6 @@ AC_DEFUN([DRUNTIME_LIBRARIES_UCONTEXT], - # Keep this in sync with core/thread.d, set druntime_fiber_asm_external to - # "yes" for targets that have 'version = AsmExternal'. - druntime_fiber_asm_external=no -- case "$target_cpu" in -- aarch64* | \ -- arm* | \ -- i[[34567]]86|x86_64 | \ -- powerpc) -- druntime_fiber_asm_external=yes -- ;; -- esac - if test "$druntime_fiber_asm_external" = no; then - AC_SEARCH_LIBS([swapcontext], [c ucontext], [], - AC_MSG_ERROR([swapcontext required but not found])) --- -2.50.1 - diff --git a/cross/gcc-armhf/0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch b/cross/gcc-armhf/0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch deleted file mode 100644 index 8f21b1029..000000000 --- a/cross/gcc-armhf/0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e5190522319c315efaf9a921737c05fae6a49e85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=B6ren=20Tempel?= -Date: Tue, 19 Jul 2022 14:54:07 +0200 -Subject: [PATCH] libgnat: time_t is always 64-bit on musl libc - ---- - gcc/ada/libgnat/s-parame.ads | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/ada/libgnat/s-parame.ads b/gcc/ada/libgnat/s-parame.ads -index 98284a4d13e..0d14f116a10 100644 ---- a/gcc/ada/libgnat/s-parame.ads -+++ b/gcc/ada/libgnat/s-parame.ads -@@ -101,7 +101,7 @@ package System.Parameters is - -- Characteristics of time_t type -- - ------------------------------------ - -- time_t_bits : constant := Long_Integer'Size; -+ time_t_bits : constant := Long_Long_Integer'Size; - -- Number of bits in type time_t - - ---------------------------------------------- --- -2.50.1 - diff --git a/cross/gcc-armhf/0035-libphobos-do-not-use-LFS64-symbols.patch b/cross/gcc-armhf/0035-libphobos-do-not-use-LFS64-symbols.patch deleted file mode 100644 index 89fc98ee6..000000000 --- a/cross/gcc-armhf/0035-libphobos-do-not-use-LFS64-symbols.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3fe1ff6c349a065daba97794c55961cafe6c4a10 Mon Sep 17 00:00:00 2001 -From: psykose -Date: Mon, 29 May 2023 15:33:11 +0000 -Subject: [PATCH] libphobos: do not use LFS64 symbols - -musl does not have these since 1.2.4, we can't use the compat interfaces. ---- - libphobos/libdruntime/core/sys/posix/sys/mman.d | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d -index b1eb9fa8107..3aee0d96319 100644 ---- a/libphobos/libdruntime/core/sys/posix/sys/mman.d -+++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d -@@ -293,11 +293,7 @@ else version (CRuntime_Bionic) - } - else version (CRuntime_Musl) - { -- static if (__USE_LARGEFILE64) void* mmap64(void*, size_t, int, int, int, off_t); -- static if (__USE_FILE_OFFSET64) -- alias mmap = mmap64; -- else -- void* mmap(void*, size_t, int, int, int, off_t); -+ void* mmap(void*, size_t, int, int, int, off_t); - int munmap(void*, size_t); - } - else version (CRuntime_UClibc) --- -2.50.1 - diff --git a/cross/gcc-armhf/0036-libgo-fix-lfs64-use.patch b/cross/gcc-armhf/0036-libgo-fix-lfs64-use.patch deleted file mode 100644 index f5a64d644..000000000 --- a/cross/gcc-armhf/0036-libgo-fix-lfs64-use.patch +++ /dev/null @@ -1,195 +0,0 @@ -From ff21b1649c1c5009a33722d21e28af9026c72cd7 Mon Sep 17 00:00:00 2001 -From: psykose -Date: Mon, 10 Jul 2023 23:23:29 +0000 -Subject: [PATCH] libgo: fix lfs64 use - ---- - .../go/internal/syscall/unix/at_largefile.go | 2 +- - libgo/go/os/dir_largefile.go | 2 +- - libgo/go/syscall/libcall_glibc.go | 2 +- - libgo/go/syscall/libcall_linux.go | 4 +-- - libgo/go/syscall/libcall_posix_largefile.go | 26 +++++++++---------- - libgo/runtime/go-varargs.c | 2 +- - libgo/sysinfo.c | 9 +++---- - 7 files changed, 22 insertions(+), 25 deletions(-) - -diff --git a/libgo/go/internal/syscall/unix/at_largefile.go b/libgo/go/internal/syscall/unix/at_largefile.go -index 82e0dcfd074..16151ecad1b 100644 ---- a/libgo/go/internal/syscall/unix/at_largefile.go -+++ b/libgo/go/internal/syscall/unix/at_largefile.go -@@ -10,5 +10,5 @@ import ( - "syscall" - ) - --//extern fstatat64 -+//extern fstatat - func fstatat(int32, *byte, *syscall.Stat_t, int32) int32 -diff --git a/libgo/go/os/dir_largefile.go b/libgo/go/os/dir_largefile.go -index 1fc5ee0771f..0c6dffe1a75 100644 ---- a/libgo/go/os/dir_largefile.go -+++ b/libgo/go/os/dir_largefile.go -@@ -11,5 +11,5 @@ package os - - import "syscall" - --//extern readdir64 -+//extern readdir - func libc_readdir(*syscall.DIR) *syscall.Dirent -diff --git a/libgo/go/syscall/libcall_glibc.go b/libgo/go/syscall/libcall_glibc.go -index 5c1ec483c75..5a1245ed44b 100644 ---- a/libgo/go/syscall/libcall_glibc.go -+++ b/libgo/go/syscall/libcall_glibc.go -@@ -114,7 +114,7 @@ func Pipe2(p []int, flags int) (err error) { - } - - //sys sendfile(outfd int, infd int, offset *Offset_t, count int) (written int, err error) --//sendfile64(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t -+//sendfile(outfd _C_int, infd _C_int, offset *Offset_t, count Size_t) Ssize_t - - func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - if race.Enabled { -diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go -index 03ca7261b59..ad21fd0b3ac 100644 ---- a/libgo/go/syscall/libcall_linux.go -+++ b/libgo/go/syscall/libcall_linux.go -@@ -158,7 +158,7 @@ func Reboot(cmd int) (err error) { - //adjtimex(buf *Timex) _C_int - - //sys Fstatfs(fd int, buf *Statfs_t) (err error) --//fstatfs64(fd _C_int, buf *Statfs_t) _C_int -+//fstatfs(fd _C_int, buf *Statfs_t) _C_int - - func Gettid() (tid int) { - r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0) -@@ -245,7 +245,7 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i - } - - //sys Statfs(path string, buf *Statfs_t) (err error) --//statfs64(path *byte, buf *Statfs_t) _C_int -+//statfs(path *byte, buf *Statfs_t) _C_int - - //sysnb Sysinfo(info *Sysinfo_t) (err error) - //sysinfo(info *Sysinfo_t) _C_int -diff --git a/libgo/go/syscall/libcall_posix_largefile.go b/libgo/go/syscall/libcall_posix_largefile.go -index f90055bb29a..334212f0af1 100644 ---- a/libgo/go/syscall/libcall_posix_largefile.go -+++ b/libgo/go/syscall/libcall_posix_largefile.go -@@ -10,40 +10,40 @@ - package syscall - - //sys Creat(path string, mode uint32) (fd int, err error) --//creat64(path *byte, mode Mode_t) _C_int -+//creat(path *byte, mode Mode_t) _C_int - - //sys Fstat(fd int, stat *Stat_t) (err error) --//fstat64(fd _C_int, stat *Stat_t) _C_int -+//fstat(fd _C_int, stat *Stat_t) _C_int - - //sys Ftruncate(fd int, length int64) (err error) --//ftruncate64(fd _C_int, length Offset_t) _C_int -+//ftruncate(fd _C_int, length Offset_t) _C_int - - //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) --//getrlimit64(resource _C_int, rlim *Rlimit) _C_int -+//getrlimit(resource _C_int, rlim *Rlimit) _C_int - - //sys Lstat(path string, stat *Stat_t) (err error) --//lstat64(path *byte, stat *Stat_t) _C_int -+//lstat(path *byte, stat *Stat_t) _C_int - - //sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) --//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte -+//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte - - //sys Open(path string, mode int, perm uint32) (fd int, err error) --//__go_open64(path *byte, mode _C_int, perm Mode_t) _C_int -+//__go_open(path *byte, mode _C_int, perm Mode_t) _C_int - - //sys Pread(fd int, p []byte, offset int64) (n int, err error) --//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t -+//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t - - //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) --//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t -+//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t - - //sys Seek(fd int, offset int64, whence int) (off int64, err error) --//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t -+//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t - - //sysnb Setrlimit(resource int, rlim *Rlimit) (err error) --//setrlimit64(resource int, rlim *Rlimit) _C_int -+//setrlimit(resource int, rlim *Rlimit) _C_int - - //sys Stat(path string, stat *Stat_t) (err error) --//stat64(path *byte, stat *Stat_t) _C_int -+//stat(path *byte, stat *Stat_t) _C_int - - //sys Truncate(path string, length int64) (err error) --//truncate64(path *byte, length Offset_t) _C_int -+//truncate(path *byte, length Offset_t) _C_int -diff --git a/libgo/runtime/go-varargs.c b/libgo/runtime/go-varargs.c -index f84860891e6..7efc9615985 100644 ---- a/libgo/runtime/go-varargs.c -+++ b/libgo/runtime/go-varargs.c -@@ -84,7 +84,7 @@ __go_ioctl_ptr (int d, int request, void *arg) - int - __go_open64 (char *path, int mode, mode_t perm) - { -- return open64 (path, mode, perm); -+ return open (path, mode, perm); - } - - #endif -diff --git a/libgo/sysinfo.c b/libgo/sysinfo.c -index 180f5c31d74..1d717d55c0e 100644 ---- a/libgo/sysinfo.c -+++ b/libgo/sysinfo.c -@@ -366,7 +366,7 @@ typedef loff_t libgo_loff_t_type; - #endif - - #if defined(HAVE_OFF64_T) --typedef off64_t libgo_off_t_type; -+typedef off_t libgo_off_t_type; - #else - typedef off_t libgo_off_t_type; - #endif -@@ -398,13 +398,11 @@ typedef off_t libgo_off_t_type; - - // From dirent.h - SREF(dirent); --SREF(dirent64); - OTREF(DIR); - EREF(DT_UNKNOWN); - - // From fcntl.h - SREF(flock); --SREF(flock64); - - // From ffi headers - SREF(_ffi_type); -@@ -485,11 +483,10 @@ EREF(SS_ONSTACK); - EREF(SEGV_MAPERR); - - // From stat.h --SREF(stat64); -+SREF(stat); - - // From statfs.h - SREF(statfs); --SREF(statfs64); - - // From sysinfo.h - SREF(sysinfo); -@@ -519,7 +516,7 @@ EREF(PTRACE_PEEKTEXT); - - // From sys/resource.h - SREF(rusage); --SREF(rlimit64); -+SREF(rlimit); - EREF(RLIMIT_NOFILE); - EREF(PRIO_USER); - EREF(RUSAGE_SELF); --- -2.50.1 - diff --git a/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch b/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch deleted file mode 100644 index f17391cdb..000000000 --- a/cross/gcc-armhf/0037-loongarch-disable-multilib-support.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0e09546330c7500b0d6d4e6d4bbf4fe751d57c34 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Mon, 7 Aug 2023 15:25:58 +0800 -Subject: [PATCH] loongarch disable multilib support - -Signed-off-by: Jingyun Hua ---- - gcc/config/loongarch/t-linux | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/gcc/config/loongarch/t-linux b/gcc/config/loongarch/t-linux -index 45862048abf..73155acd832 100644 ---- a/gcc/config/loongarch/t-linux -+++ b/gcc/config/loongarch/t-linux -@@ -21,11 +21,6 @@ MULTIOSDIR_lp64f := ../lib64/f32$(call if_multiarch,:loongarch64-linux-gnuf32) - MULTIOSDIR_lp64s := ../lib64/sf$(call if_multiarch,:loongarch64-linux-gnusf) - - # Don't define MULTILIB_OSDIRNAMES if multilib is disabled. --ifeq ($(filter LA_DISABLE_MULTILIB,$(tm_defines)),) -- -- MULTILIB_OSDIRNAMES = .=$(MULTIOSDIR_$(mlib_default)) -- MULTILIB_OSDIRNAMES += mabi.lp64d=$(MULTIOSDIR_lp64d) -- MULTILIB_OSDIRNAMES += mabi.lp64f=$(MULTIOSDIR_lp64f) -- MULTILIB_OSDIRNAMES += mabi.lp64s=$(MULTIOSDIR_lp64s) -- --endif -+ MULTILIB_OSDIRNAMES = mabi.lp64d=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64f=../lib -+ MULTILIB_OSDIRNAMES += mabi.lp64s=../lib --- -2.50.1 - diff --git a/cross/gcc-armhf/0038-static-PIE-ensure-static-reaches-the-linker.patch b/cross/gcc-armhf/0038-static-PIE-ensure-static-reaches-the-linker.patch deleted file mode 100644 index 091620975..000000000 --- a/cross/gcc-armhf/0038-static-PIE-ensure-static-reaches-the-linker.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 05b462e0a6de90c0d69a48ed9c58a6f76158344e Mon Sep 17 00:00:00 2001 -From: Rich Felker -Date: Fri, 25 Jul 2025 02:41:46 -0700 -Subject: [PATCH] static PIE: ensure -static reaches the linker - -on some targets, the logic for the compiler option -static seems not -to be processed when -pie is present. rather than playing -whack-a-mole, just ensure LD_PIE_SPEC specs always pass -static to ld -if either -static or -static-pie is present on the compiler driver -command line. - -this may produce redundant -static arguments but it doesn't matter. ---- - gcc/common.opt | 4 ++-- - gcc/config/gnu-user.h | 17 ++++++++--------- - gcc/gcc.cc | 6 +++--- - 3 files changed, 13 insertions(+), 14 deletions(-) - -diff --git a/gcc/common.opt b/gcc/common.opt -index e65a575d9f8..7ad38711f6e 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -3968,11 +3968,11 @@ Driver - - no-pie - Driver RejectNegative Negative(shared) --Don't create a dynamically linked position independent executable. -+Don't create a position independent executable. - - pie - Driver RejectNegative Negative(no-pie) --Create a dynamically linked position independent executable. -+Create a position independent executable. - - static-pie - Driver RejectNegative Negative(pie) -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index 0426efdb8c3..866c8bd77f2 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -51,13 +51,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define GNU_USER_TARGET_STARTFILE_SPEC \ - "%{shared:; \ - pg|p|profile:%{static-pie:grcrt1.o%s;:gcrt1.o%s}; \ -- static:crt1.o%s; \ -- static-pie:rcrt1.o%s; \ -+ static|static-pie:%{" PIE_SPEC ":rcrt1.o%s;:crt1.o%s}; \ - " PIE_SPEC ":Scrt1.o%s; \ - :crt1.o%s} " \ - GNU_USER_TARGET_CRTI " \ -- %{static:crtbeginT.o%s; \ -- shared|static-pie|" PIE_SPEC ":crtbeginS.o%s; \ -+ %{shared|" PIE_SPEC ":crtbeginS.o%s; \ -+ static:crtbeginT.o%s; \ - :crtbegin.o%s} \ - %{fvtable-verify=none:%s; \ - fvtable-verify=preinit:vtv_start_preinit.o%s; \ -@@ -73,11 +72,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - GNU userspace "finalizer" file, `crtn.o'. */ - - #define GNU_USER_TARGET_ENDFILE_SPEC \ -- "%{!static:%{fvtable-verify=none:%s; \ -+ "%{static|static-pie:; \ -+ fvtable-verify=none:%s; \ - fvtable-verify=preinit:vtv_end_preinit.o%s; \ -- fvtable-verify=std:vtv_end.o%s}} \ -- %{static:crtend.o%s; \ -- shared|static-pie|" PIE_SPEC ":crtendS.o%s; \ -+ fvtable-verify=std:vtv_end.o%s} \ -+ %{shared|" PIE_SPEC ":crtendS.o%s; \ - :crtend.o%s} " \ - GNU_USER_TARGET_CRTN " " \ - CRTOFFLOADEND -@@ -106,7 +105,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #define LIB_SPEC GNU_USER_TARGET_LIB_SPEC - - #if defined(HAVE_LD_EH_FRAME_HDR) --#define LINK_EH_SPEC "%{!static|static-pie:--eh-frame-hdr} " -+#define LINK_EH_SPEC "%{!static|" PIE_SPEC ":--eh-frame-hdr} " - #endif - - #if !defined(LINK_LIBATOMIC_SPEC) && defined(ENABLE_AUTOLINK_LIBATOMIC) -diff --git a/gcc/gcc.cc b/gcc/gcc.cc -index e9f78f0f4c1..767ff65f348 100644 ---- a/gcc/gcc.cc -+++ b/gcc/gcc.cc -@@ -1056,7 +1056,7 @@ proper position among the other output files. */ - #define NO_FPIE_AND_FPIC_SPEC NO_FPIE_SPEC "|" NO_FPIC_SPEC - #define FPIE_OR_FPIC_SPEC NO_FPIE_AND_FPIC_SPEC ":;" - #else --#define PIE_SPEC "pie" -+#define PIE_SPEC "pie|static-pie" - #define FPIE1_SPEC "fpie" - #define NO_FPIE1_SPEC FPIE1_SPEC ":;" - #define FPIE2_SPEC "fPIE" -@@ -1080,12 +1080,12 @@ proper position among the other output files. */ - #ifndef LINK_PIE_SPEC - #ifdef HAVE_LD_PIE - #ifndef LD_PIE_SPEC --#define LD_PIE_SPEC "-pie" -+#define LD_PIE_SPEC "-pie %{static|static-pie:--no-dynamic-linker -z text -Bsymbolic -static}" - #endif - #else - #define LD_PIE_SPEC "" - #endif --#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " -+#define LINK_PIE_SPEC "%{shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " - #endif - - #ifndef LINK_BUILDID_SPEC --- -2.50.1 - diff --git a/cross/gcc-armhf/0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch b/cross/gcc-armhf/0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch deleted file mode 100644 index b8a362002..000000000 --- a/cross/gcc-armhf/0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 4c8cc9a8621b91f8aa83d8ca81f22b00a98d9fa9 Mon Sep 17 00:00:00 2001 -From: Andrew Pinski -Date: Fri, 28 Mar 2025 17:25:56 -0700 -Subject: [PATCH] except: Don't use the cached value of the gcc_except_table - section for comdat functions [PR119507] - -This has been broken since GCC started to put the comdat functions' gcc_except_table into their -own section; r0-118218-g3e6011cfebedfb. What would happen is after a non-comdat function is processed, -the cached value would always be used even for comdat function. Instead we should create a new -section for comdat functions. - -OK? Bootstrapped and tested on x86_64-linux-gnu. - - PR middle-end/119507 - -gcc/ChangeLog: - - * except.cc (switch_to_exception_section): Don't use the cached section if - the current function is in comdat. - -gcc/testsuite/ChangeLog: - - * g++.dg/eh/pr119507.C: New test. - -Signed-off-by: Andrew Pinski ---- - gcc/except.cc | 9 ++++++++- - gcc/testsuite/g++.dg/eh/pr119507.C | 17 +++++++++++++++++ - 2 files changed, 25 insertions(+), 1 deletion(-) - create mode 100644 gcc/testsuite/g++.dg/eh/pr119507.C - -diff --git a/gcc/except.cc b/gcc/except.cc -index 205811c6567..0fe1e093489 100644 ---- a/gcc/except.cc -+++ b/gcc/except.cc -@@ -2949,7 +2949,14 @@ switch_to_exception_section (const char * ARG_UNUSED (fnname)) - { - section *s; - -- if (exception_section) -+ if (exception_section -+ /* Don't use the cached section for comdat if it will be different. */ -+#ifdef HAVE_LD_EH_GC_SECTIONS -+ && !(targetm_common.have_named_sections -+ && DECL_COMDAT_GROUP (current_function_decl) -+ && HAVE_COMDAT_GROUP) -+#endif -+ ) - s = exception_section; - else - { -diff --git a/gcc/testsuite/g++.dg/eh/pr119507.C b/gcc/testsuite/g++.dg/eh/pr119507.C -new file mode 100644 -index 00000000000..50afa75a43f ---- /dev/null -+++ b/gcc/testsuite/g++.dg/eh/pr119507.C -@@ -0,0 +1,17 @@ -+// { dg-do compile { target comdat_group } } -+// Force off function sections -+// Force on exceptions -+// { dg-options "-fno-function-sections -fexceptions" } -+// PR middle-end/119507 -+ -+ -+inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; } -+int another_func_with_exception() { try { throw 1; } catch (int) { return 1; } return 0; } -+inline int comdat1() { try { throw 1; } catch (int) { return 1; } return 0; } -+int foo() { return comdat() + comdat1(); } -+ -+// Make sure the gcc puts the exception table for both comdat and comdat1 in their own section -+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z6comdatv" 1 } } -+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table._Z7comdat1v" 1 } } -+// There should be 3 exception tables, -+// { dg-final { scan-assembler-times ".section\[\t \]\[^\n\]*.gcc_except_table" 3 } } --- -2.50.1 - diff --git a/cross/gcc-armhf/0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch b/cross/gcc-armhf/0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch deleted file mode 100644 index 901daa7df..000000000 --- a/cross/gcc-armhf/0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch +++ /dev/null @@ -1,164 +0,0 @@ -From a6c08fc7fe3a144ebd767cd52fe22043947655e9 Mon Sep 17 00:00:00 2001 -From: Ariadne Conill -Date: Sat, 26 Jul 2025 02:59:45 -0700 -Subject: [PATCH] ada: libgnat: use stub symbolic module name functions - -The "linux" implementation depends on glibc internals and accordingly -does not work on musl. - -Signed-off-by: Ariadne Conill ---- - gcc/ada/Makefile.rtl | 32 ++++++++++++++++---------------- - 1 file changed, 16 insertions(+), 16 deletions(-) - -diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index cb41e6887cd..152ba70db4d 100644 ---- a/gcc/ada/Makefile.rtl -+++ b/gcc/ada/Makefile.rtl -@@ -1642,7 +1642,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),) - s-intman.adb -Date: Sat, 26 Jul 2025 03:02:38 -0700 -Subject: [PATCH] ada: libgnat: recognize linux-musleabi and linux-muslgnueabi - platforms for ARM - ---- - gcc/ada/Makefile.rtl | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl -index 152ba70db4d..89574cdfba7 100644 ---- a/gcc/ada/Makefile.rtl -+++ b/gcc/ada/Makefile.rtl -@@ -2500,7 +2500,7 @@ endif - - # ARM linux, GNU eabi - ifeq ($(SELECTED_PAIRS),PAIRS_NONE) --ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),) -+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),) - - SELECTED_PAIRS=arm-linux-gnueabi - --- -2.50.1 - diff --git a/cross/gcc-armhf/0042-libsanitizer-struct_sock_fprog_sz.patch b/cross/gcc-armhf/0042-libsanitizer-struct_sock_fprog_sz.patch deleted file mode 100644 index 5b7971d1e..000000000 --- a/cross/gcc-armhf/0042-libsanitizer-struct_sock_fprog_sz.patch +++ /dev/null @@ -1,31 +0,0 @@ -Provide struct_sock_fprog_sz on Linux, rather than on Linux+glibc. - -With `#include ` `struct sock_fprog` is available when -linux headers are available. It seems that glibc is just including that header -as an implementation detail, while musl does not. ---- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2025-08-08 08:51:45.621434001 +0200 -+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp 2026-02-25 20:29:28.519492722 +0100 -@@ -74,6 +74,7 @@ - #include - #include - #include -+#include - #if SANITIZER_ANDROID - #include - #endif -@@ -507,6 +508,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El - unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec); - unsigned struct_synth_info_sz = sizeof(struct synth_info); - unsigned struct_vt_mode_sz = sizeof(struct vt_mode); -+ unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog); - #endif // SANITIZER_LINUX - - #if SANITIZER_GLIBC -@@ -534,7 +536,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(El - - unsigned struct_audio_buf_info_sz = sizeof(struct audio_buf_info); - unsigned struct_ppp_stats_sz = sizeof(struct ppp_stats); -- unsigned struct_sock_fprog_sz = sizeof(struct sock_fprog); - # endif // SANITIZER_GLIBC - - # if !SANITIZER_ANDROID && !SANITIZER_APPLE diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD deleted file mode 100644 index 74c096d80..000000000 --- a/cross/gcc-armhf/APKBUILD +++ /dev/null @@ -1,830 +0,0 @@ -# Automatically generated aport, do not edit! -# Generator: pmbootstrap aportgen gcc-armhf -# Based on: main/gcc (from Alpine) -CTARGET_ARCH=armhf -CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" -LANG_D=false -LANG_OBJC=false -LANG_JAVA=false -LANG_GO=false -LANG_FORTRAN=false -LANG_ADA=false -options="!strip" - -# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH" -# when this variable matches "no*" -BOOTSTRAP="nobuildbase" - -# abuild will only cross compile when this variable is set, but it -# needs to find a valid package database in there for dependency -# resolving, so we set it to /. -CBUILDROOT="/" - -_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" - -maintainer="Oliver Smith " -pkgname=gcc-armhf -pkgver=15.2.0 -# i.e. 13.2.1, must match gcc/BASE-VER -_pkgbase="${pkgver%%_git*}" -# date component from snapshots -_pkgsnap="${pkgver##*_git}" -[ "$BOOTSTRAP" = "nolibc" ] && pkgname="gcc-pass2" -[ "$CBUILD" != "$CHOST" ] && _cross="-$CARCH" || _cross="" -[ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" - -pkgname=gcc-armhf -pkgrel=6 -pkgdesc="Stage2 cross-compiler for armhf" -url="https://gcc.gnu.org" -arch="aarch64 x86_64" -license="GPL-2.0-or-later AND LGPL-2.1-or-later" -_gccrel=$pkgver-r$pkgrel -depends="binutils-armhf mpc1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" - -case "$CARCH" in -aarch64) depends="$depends so:libc.musl-aarch64.so.1" ;; -x86_64) depends="$depends so:libc.musl-x86_64.so.1" ;; -esac -makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" -makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf" -subpackages="g++-armhf:gpp libstdc++-dev-armhf:libcxx_dev" -[ "$CHOST" = "$CTARGET" ] && subpackages="gcc-gdb gcc-doc" -replaces="libstdc++ binutils" -options="!strip !tracedeps toolchain" - -: "${LANG_CXX:=true}" -: "${LANG_D:=true}" -: "${LANG_OBJC:=true}" -: "${LANG_GO:=true}" -: "${LANG_FORTRAN:=true}" -: "${LANG_ADA:=true}" -: "${LANG_JIT:=true}" - -_libgomp=true -_libgcc=false -_libatomic=true -_libitm=true - -if [ "$CHOST" != "$CTARGET" ]; then - if [ "$BOOTSTRAP" = nolibc ]; then - LANG_CXX=false - LANG_D=false - LANG_ADA=false - _libgcc=false - _builddir="$srcdir/build-cross-pass2" - else - _builddir="$srcdir/build-cross-final" - fi - LANG_OBJC=false - LANG_GO=false - LANG_FORTRAN=false - LANG_JIT=false - _libgomp=false - _libatomic=false - _libitm=false - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/}" - export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/}" - unset CPPFLAGS - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - STRIP_FOR_TARGET="$CTARGET-strip" -elif [ "$CBUILD" != "$CHOST" ]; then - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/}" - export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/}" - unset CPPFLAGS - - # reset flags and cc for build - export CC_FOR_BUILD="gcc" - export CXX_FOR_BUILD="g++" - export CFLAGS_FOR_BUILD=" " - export CXXFLAGS_FOR_BUILD=" " - export LDFLAGS_FOR_BUILD=" " - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - # Languages that do not need bootstrapping - LANG_OBJC=false - LANG_GO=false - LANG_FORTRAN=false - LANG_JIT=false - - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build-cross-native" -else - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build" - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # pass -g0 by default to bypass -g, since we don't do debug - # if -dbg added, the -g is appended and overrides this - export CFLAGS="$CPPFLAGS -g0 ${CFLAGS/-Werror=format-security/} -O2" - export CXXFLAGS="$CPPFLAGS -g0 ${CXXFLAGS/-Werror=format-security/} -O2" - unset CPPFLAGS - # https://gcc.gnu.org/install/build.html - export CFLAGS_FOR_TARGET="$CFLAGS" - export CXXFLAGS_FOR_TARGET="$CXXFLAGS" - export LDFLAGS_FOR_TARGET="$LDFLAGS" - export BOOT_CFLAGS="$CFLAGS" - export BOOT_LDFLAGS="$LDFLAGS" -fi - -case "$CTARGET_ARCH" in -# GDC hasn't been ported to PowerPC (LIBDRUNTIME_ONLY=yes) -# See libphobos/configure.tgt in GCC sources for supported targets -# riscv fails with: error: static assert "unimplemented" -ppc*|riscv64) LANG_D=false ;; -# GDC does currently not work on 32-bit musl architectures. -# This is a known upstream issue. -# See: https://github.com/dlang/druntime/pull/3383 -armhf|armv7|x86) LANG_D=false ;; -esac - -# libitm has TEXTRELs in ARM build, so disable for now -case "$CTARGET_ARCH" in -arm*) _libitm=false ;; -mips*) _libitm=false ;; -riscv64) _libitm=false ;; -loongarch64) _libitm=false ;; -esac - -# Internal libffi fails to build on MIPS at the moment, need to -# investigate further. We disable LANG_GO on mips64 as it requires -# the internal libffi. -case "$CTARGET_ARCH" in -mips*) LANG_GO=false ;; -loongarch64) LANG_GO=false ;; -esac - -# Fortran uses libquadmath if toolchain has __float128 -# currently on x86, x86_64 and ia64 -_libquadmath=$LANG_FORTRAN -case "$CTARGET_ARCH" in -x86 | x86_64 | ppc64le) ;; -*) _libquadmath=false ;; -esac - -# libatomic is a dependency for openvswitch -$_libatomic && subpackages="$subpackages libatomic::$CTARGET_ARCH" -if $_libgcc; then - depends="$depends libgcc-static$_target" - subpackages="$subpackages libgcc::$CTARGET_ARCH libgcc-static$_target:libgccstatic:$CTARGET_ARCH" -fi -$_libquadmath && subpackages="$subpackages libquadmath::$CTARGET_ARCH" -if $_libgomp; then - depends="$depends libgomp=$_gccrel" - subpackages="$subpackages libgomp::$CTARGET_ARCH" -fi - -_languages=c -if $LANG_CXX; then - _languages="$_languages,c++" -fi -if $LANG_D; then - subpackages="$subpackages gcc-gdc$_target:gdc" - _languages="$_languages,d" - makedepends_build="$makedepends_build libucontext-dev" - if [ "$CBUILD" = "$CTARGET" ]; then - makedepends_build="$makedepends_build gcc-gdc-bootstrap" - subpackages="$subpackages libgphobos::$CTARGET_ARCH" - else - # shared libgphobos is for D programs to link against, so - # skip building that while cross-compiling the GDC compiler - makedepends_build="$makedepends_build gcc-gdc gcc-gdc$_cross" - fi -fi -if $LANG_OBJC; then - subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc" - _languages="$_languages,objc" -fi -if $LANG_GO; then - subpackages="$subpackages libgo::$CTARGET_ARCH gcc-go$_target:go" - _languages="$_languages,go" -fi -if $LANG_FORTRAN; then - subpackages="$subpackages libgfortran::$CTARGET_ARCH gfortran$_target:gfortran" - _languages="$_languages,fortran" -fi -if $LANG_ADA; then - subpackages="$subpackages gcc-gnat$_target:gnat libgnat::$CTARGET_ARCH" - _languages="$_languages,ada" - if [ "$CBUILD" = "$CTARGET" ]; then - makedepends_build="$makedepends_build gcc-gnat-bootstrap" - subpackages="$subpackages libgnat-static:libgnatstatic:$CTARGET_ARCH" - else - makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross" - fi -fi -if $LANG_JIT; then - subpackages="$subpackages libgccjit:jit libgccjit-dev:jitdev" -fi - -# when using upstream releases, use this URI template -# https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz -# -# right now, we are using a git snapshot. snapshots are taken from gcc.gnu.org/pub/gcc/snapshots. -# However, since they are periodically deleted from the GCC mirrors the utilized snapshots are -# mirrored on dev.alpinelinux.org. Please ensure that the snapshot Git commit (as stated in the -# README) matches the base commit on the version-specific branch in the Git repository below. -# -# PLEASE submit all patches to gcc to https://gitlab.alpinelinux.org/kaniini/alpine-gcc-patches, -# so that they can be properly tracked and easily rebased if needed. -#source="https://dev.alpinelinux.org/archive/gcc/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz" -#source="https://gcc.gnu.org/pub/gcc/snapshots/${_pkgbase%%.*}-$_pkgsnap/gcc-${_pkgbase%%.*}-$_pkgsnap.tar.xz" -source="https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgbase/gcc-$_pkgbase.tar.xz - 0001-posix_memalign.patch - 0002-gcc-poison-system-directories.patch - 0003-specs-turn-on-Wl-z-now-by-default.patch - 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch - 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch - 0006-Enable-Wformat-and-Wformat-security-by-default.patch - 0007-Enable-Wtrampolines-by-default.patch - 0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch - 0009-gcc-params-set-default-ssp-buffer-size-to-4.patch - 0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch - 0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch - 0012-libiberty-copy-PIC-objects-during-build-process.patch - 0013-libgcc_s.patch - 0014-nopie.patch - 0015-ada-fix-shared-linking.patch - 0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch - 0017-add-fortify-headers-paths.patch - 0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch - 0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch - 0020-aarch64-disable-multilib-support.patch - 0021-s390x-disable-multilib-support.patch - 0022-ppc64-le-disable-multilib-support.patch - 0023-x86_64-disable-multilib-support.patch - 0024-riscv-disable-multilib-support.patch - 0025-always-build-libgcc_eh.a.patch - 0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch - 0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch - 0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch - 0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch - 0030-configure-fix-detection-of-atomic-builtins-in-libato.patch - 0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch - 0032-gdc-unconditionally-link-libgphobos-against-libucont.patch - 0033-druntime-link-against-libucontext-on-all-platforms.patch - 0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch - 0035-libphobos-do-not-use-LFS64-symbols.patch - 0036-libgo-fix-lfs64-use.patch - 0037-loongarch-disable-multilib-support.patch - 0038-static-PIE-ensure-static-reaches-the-linker.patch - 0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch - 0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch - 0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch - 0042-libsanitizer-struct_sock_fprog_sz.patch - - 0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch - 0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch - " - -# secfixes: -# 13.2.1_git20231014-r0: -# - CVE-2023-4039 - -# we build out-of-tree -#builddir="$srcdir"/gcc-${_pkgbase%%.*}-$_pkgsnap -builddir="$srcdir"/gcc-$_pkgbase -_gcclibdir="usr/lib/gcc/$CTARGET/$_pkgbase" -_gcclibexec="usr/libexec/gcc/$CTARGET/$_pkgbase" - -prepare() { - default_prepare - echo $_pkgbase > gcc/BASE-VER -} - -build() { - local _arch_configure= - local _bootstrap_configure= - local _jit_configure= - local _sanitizer_configure= - - case "$CTARGET" in - aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64";; - armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --with-abi=aapcs-linux";; - armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6kz --with-tune=arm1176jzf-s --with-fpu=vfpv2 --with-float=hard --with-abi=aapcs-linux";; - armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";; - mips-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - mips64-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mips64el-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mipsel-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";; - powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no --enable-targets=powerpcle-linux";; - i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";; - i586-*-*-*) _arch_configure="--with-arch=pentium-m --with-fpmath=sse --with-tune=generic --enable-cld";; - s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";; - riscv64-*-*-*) _arch_configure="--with-arch=rv64gc --with-abi=lp64d --enable-autolink-libatomic";; - loongarch64-*-*-*) _arch_configure="--with-arch=la64v1.0 --with-abi=lp64d";; - esac - - case "$CTARGET_ARCH" in - *) _sanitizer_configure="--disable-libsanitizer" ;; - esac - - case "$CTARGET_ARCH" in - mips*) _hash_style_configure="--with-linker-hash-style=sysv" ;; - *) _hash_style_configure="--with-linker-hash-style=gnu" ;; - esac - - export libat_cv_have_ifunc=no - - - case "$BOOTSTRAP" in - nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;; - *) - # cross-bootstrap GDC with a static libphobos: due to GCC's - # ./configure not having a --disable-shared=libphobos option, - # we have to use --enable-shared with everything else instead. - if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then - _bootstrap_configure="--enable-shared=libgcc,libstdc++,libffi,zlib,boehm-gc,ada,libada,libgo,libobjc,libatomic,libgomp,libitm,libgfortran,libquadmath" - else - _bootstrap_configure="--enable-shared" - fi - _bootstrap_configure="$_bootstrap_configure --enable-threads --enable-tls" - ;; - esac - - $_libgomp || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" - $_libatomic || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" - $_libitm || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $_libquadmath || _arch_configure="$_arch_configure --disable-libquadmath" - - msg "Building the following:" - echo "" - echo " CBUILD=$CBUILD" - echo " CHOST=$CHOST" - echo " CTARGET=$CTARGET" - echo " CTARGET_ARCH=$CTARGET_ARCH" - echo " languages=$_languages" - echo " arch_configure=$_arch_configure" - echo " cross_configure=$_cross_configure" - echo " bootstrap_configure=$_bootstrap_configure" - echo " hash_style_configure=$_hash_style_configure" - echo "" - - local version="Alpine $pkgver" - local gccconfiguration=" - --prefix=/usr - --mandir=/usr/share/man - --infodir=/usr/share/info - --build=$CBUILD - --host=$CHOST - --target=$CTARGET - --enable-checking=release - --disable-cet - --disable-fixed-point - --disable-libstdcxx-pch - --disable-multilib - --disable-nls - --disable-werror - --disable-symvers - --enable-__cxa_atexit - --enable-default-pie - --enable-default-ssp - --enable-languages=$_languages - --enable-link-serialization=2 - --enable-linker-build-id - $_arch_configure - --disable-libssp - $_sanitizer_configure - $_cross_configure - $_bootstrap_configure - --with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues - --with-system-zlib - $_hash_style_configure - " - - mkdir -p "$_builddir" - cd "$_builddir" - "$builddir"/configure $gccconfiguration \ - --with-pkgversion="$version" - - msg "building gcc" - if $LANG_D && [ "$CBUILD" != "$CTARGET" ]; then - # cross-compiling libphobos with parallel make fails - make all-target-libphobos - fi - make - - # we build gccjit separate to not build all of gcc with --enable-host-shared - # as doing so slows it down a few %, so for some quick if's here we gain - # free performance - if $LANG_JIT; then - mkdir -p "$_builddir"/libgccjit-build - cd "$_builddir"/libgccjit-build - "$builddir"/configure $gccconfiguration \ - --disable-bootstrap \ - --enable-host-shared \ - --enable-languages=jit \ - --with-pkgversion="$version" - - msg "building libgccjit" - make all-gcc - fi -} - -package() { - cd "$_builddir" - make -j1 DESTDIR="$pkgdir" install - - [ "$CHOST" = "$CTARGET" ] && ln -s gcc "$pkgdir"/usr/bin/cc - ln -s ${CTARGET}-gcc "$pkgdir"/usr/bin/${CTARGET}-cc - - # symlink to vendor-less target triple for - # supporting clang --target's fallback match - # ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/16828 - ln -s "$CTARGET" "$pkgdir/usr/lib/gcc/${CTARGET%%-*}-${CTARGET#*-*-}" - - if $LANG_JIT; then - make -C "$_builddir"/libgccjit-build/gcc DESTDIR="$pkgdir" jit.install-common - fi - - # we dont support gcj -static - # and saving 35MB is not bad. - find "$pkgdir" \( -name libgtkpeer.a \ - -o -name libgjsmalsa.a \ - -o -name libgij.a \) \ - -delete - - # strip debug info from some static libs - find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \ - -o -name libgphobos.a -o -name libgdruntime.a \ - -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \ - -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \ - -o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \ - -a -type f \ - -exec $STRIP_FOR_TARGET -g {} + - - if $_libgomp; then - mv "$pkgdir"/usr/lib/libgomp.spec "$pkgdir"/$_gcclibdir - fi - if $_libitm; then - mv "$pkgdir"/usr/lib/libitm.spec "$pkgdir"/$_gcclibdir - fi - - # remove ffi - rm -f "$pkgdir"/usr/lib/libffi* "$pkgdir"/usr/share/man/man3/ffi* - find "$pkgdir" -name 'ffi*.h' -delete - - local gdblib=${_target:+$CTARGET/}lib - if [ -d "$pkgdir"/usr/$gdblib/ ]; then - for i in $(find "$pkgdir"/usr/$gdblib/ -type f -maxdepth 1 -name "*-gdb.py"); do - mkdir -p "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib - mv "$i" "$pkgdir"/usr/share/gdb/python/auto-load/usr/$gdblib/ - done - fi - - # move ada runtime libs - if $LANG_ADA; then - local libgnat_static= - [ "$CHOST" = "$CTARGET" ] && libgnat_static="libgna*.a" - for i in $(find "$pkgdir"/$_gcclibdir/adalib/ -type f -maxdepth 1 \( -name "libgna*.so" -o -name "$libgnat_static" \) ); do - mv "$i" "$pkgdir"/usr/lib/ - ln -s ../../../../${i##*/} $i - done - fi - - if [ "$CHOST" != "$CTARGET" ]; then - # cross-gcc: remove any files that would conflict with the - # native gcc package - rm -rf "$pkgdir"/usr/include "${pkgdir:?}"/usr/share - # libcc1 does not depend on target, don't ship it - rm -rf "$pkgdir"/usr/lib/libcc1.so* - - - # fixup gcc library symlinks to be linker scripts so - # linker finds the libs from relocated sysroot - for so in "$pkgdir"/usr/"$CTARGET"/lib/*.so; do - if [ -h "$so" ]; then - local _real=$(basename "$(readlink "$so")") - rm -f "$so" - echo "GROUP ($_real)" > "$so" - fi - done - else - # add c89/c99 wrapper scripts - cat >"$pkgdir"/usr/bin/c89 <<'EOF' -#!/bin/sh -_flavor="-std=c89" -for opt; do - case "$opt" in - -ansi|-std=c89|-std=iso9899:1990) _flavor="";; - -std=*) echo "$(basename $0) called with non ANSI/ISO C option $opt" >&2 - exit 1;; - esac -done -exec gcc $_flavor ${1+"$@"} -EOF - cat >"$pkgdir"/usr/bin/c99 <<'EOF' -#!/bin/sh -_flavor="-std=c99" -for opt; do - case "$opt" in - -std=c99|-std=iso9899:1999) _flavor="";; - -std=*) echo "$(basename $0) called with non ISO C99 option $opt" >&2 - exit 1;; - esac -done -exec gcc $_flavor ${1+"$@"} -EOF - chmod 755 "$pkgdir"/usr/bin/c?9 - - # install lto plugin so regular binutils may use it - mkdir -p "$pkgdir"/usr/lib/bfd-plugins - ln -s /$_gcclibexec/liblto_plugin.so "$pkgdir/usr/lib/bfd-plugins/" - fi -} - -libatomic() { - pkgdesc="GCC Atomic library" - depends= - replaces="gcc" - - amove usr/lib/libatomic.so.* -} - -libcxx() { - pkgdesc="GNU C++ standard runtime library" - depends= - - if [ "$CHOST" = "$CTARGET" ]; then - # verify that we are using clock_gettime rather than doing direct syscalls - # so we dont break 32 bit arches due to time64. - nm -D "$pkgdir"/usr/lib/libstdc++.so.* | grep clock_gettime - fi - - amove usr/lib/libstdc++.so.* -} - -libcxx_dev() { - pkgdesc="GNU C++ standard runtime library (development files)" - depends= - replaces="g++" - - amove usr/${_target:+$CTARGET/}lib/libstdc++.a \ - usr/${_target:+$CTARGET/}lib/libstdc++exp.a \ - usr/${_target:+$CTARGET/}lib/libstdc++.so \ - usr/${_target:+$CTARGET/}lib/libstdc++fs.a \ - usr/${_target:+$CTARGET/}lib/libsupc++.a \ - usr/${_target:+$CTARGET/}include/c++ -} - -gpp() { - pkgdesc="GNU C++ standard library and compiler" - depends="libstdc++-dev$_target=$_gccrel gcc$_target=$_gccrel musl-dev" - [ "$CHOST" = "$CTARGET" ] && depends="$depends libstdc++=$_gccrel" - - depends="$depends so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libz.so.1" - - case "$CARCH" in - aarch64) depends="$depends so:libc.musl-aarch64.so.1" ;; - x86_64) depends="$depends so:libc.musl-x86_64.so.1" ;; - esac - - amove $_gcclibexec/cc1plus - amove usr/bin/*++ -} - -jit() { - pkgdesc="GCC JIT Library" - depends= - amove usr/lib/libgccjit.so* -} - -jitdev() { - pkgdesc="GCC JIT Library (development files)" - depends="libgccjit" - amove usr/include/libgccjit*.h -} - -libobjc() { - pkgdesc="GNU Objective-C runtime" - replaces="objc" - depends= - - amove usr/lib/libobjc.so.* -} - -objc() { - pkgdesc="GNU Objective-C" - replaces="gcc" - depends="musl-dev gcc=$_gccrel libobjc=$_gccrel" - - amove $_gcclibexec/cc1obj - amove $_gcclibdir/include/objc - amove usr/lib/libobjc.so - amove usr/lib/libobjc.a -} - -libgcc() { - pkgdesc="GNU C compiler runtime libraries" - depends= - - amove usr/lib/libgcc_s.so.* - # Symlink for Clang to find the library. Gets overwritten by the real - # library if gcc is installed. - ln -s /usr/lib/libgcc_s.so.1 \ - "$subpkgdir"/usr/lib/libgcc_s.so -} - -libgccstatic() { - pkgdesc="GNU C compiler runtime libraries" - depends= - - amove usr/lib/gcc/"$CTARGET"/"$pkgver"/crtbegin.o - amove usr/lib/gcc/"$CTARGET"/"$pkgver"/crtbeginS.o - amove usr/lib/gcc/"$CTARGET"/"$pkgver"/crtendS.o - amove usr/lib/gcc/"$CTARGET"/"$pkgver"/libgcc.a -} - -libgomp() { - pkgdesc="GCC shared-memory parallel programming API library" - depends= - replaces="gcc" - - amove usr/lib/libgomp.so.* -} - -libgphobos() { - pkgdesc="D programming language standard library for GCC" - depends= - - amove usr/lib/libgdruntime.so.* - amove usr/lib/libgphobos.so.* -} - -gdc() { - pkgdesc="GCC-based D language compiler" - depends="gcc$_target=$_gccrel musl-dev libucontext-dev" - [ "$CBUILD" = "$CTARGET" ] && depends="$depends libgphobos=$_gccrel" - [ "$CHOST" = "$CTARGET" ] && provides="gcc-gdc-bootstrap=$_gccrel" - - # Copy: The installed '.d' files, the static lib, the binary itself - # The shared libs are part of 'libgphobos' so one can run program - # without installing the compiler - amove $_gcclibexec/d21 - amove $_gcclibdir/include/d - if [ "$CBUILD" = "$CTARGET" ]; then - amove usr/lib/libgdruntime.so - amove usr/lib/libgphobos.so - fi - amove usr/${_target:+$CTARGET/}lib/libgdruntime.a - amove usr/${_target:+$CTARGET/}lib/libgphobos.a - amove usr/${_target:+$CTARGET/}lib/libgphobos.spec - amove usr/bin/*gdc -} - -libgo() { - pkgdesc="Go runtime library for GCC" - depends= - - amove usr/lib/libgo.so.* -} - -go() { - pkgdesc="GCC Go frontend (intended for bootstrapping community/go)" - depends="gcc=$_gccrel libgo=$_gccrel !go" - - amove usr/lib/go - amove usr/bin/*go - amove usr/bin/*gofmt - amove $_gcclibexec/go1 - amove $_gcclibexec/cgo - amove $_gcclibexec/buildid - amove $_gcclibexec/test2json - amove $_gcclibexec/vet - amove usr/lib/libgo.a - amove usr/lib/libgo.so - amove usr/lib/libgobegin.a - amove usr/lib/libgolibbegin.a -} - -libgfortran() { - pkgdesc="Fortran runtime library for GCC" - depends= - - amove usr/lib/libgfortran.so.* -} - -libquadmath() { - replaces="gcc" - pkgdesc="128-bit math library for GCC" - depends= - - amove usr/lib/libquadmath.so.* -} - -gfortran() { - pkgdesc="GNU Fortran Compiler" - depends="gcc=$_gccrel libgfortran=$_gccrel" - $_libquadmath && depends="$depends libquadmath=$_gccrel" - replaces="gcc" - - amove usr/bin/*gfortran - amove usr/lib/libgfortran.a - amove usr/lib/libgfortran.so - if $_libquadmath; then - amove usr/lib/libquadmath.a - amove usr/lib/libquadmath.so - fi - amove $_gcclibdir/finclude - amove $_gcclibexec/f951 - mv -v "$pkgdir"/usr/lib/libgfortran.spec "$subpkgdir"/$_gcclibdir/ -} - -libgnat() { - pkgdesc="GNU Ada runtime shared libraries" - depends= - - amove usr/lib/libgna*.so -} - -libgnatstatic() { - pkgdesc="GNU Ada static libraries" - depends= - - amove usr/lib/libgna*.a -} - -gnat() { - pkgdesc="Ada support for GCC" - depends="gcc=$_gccrel" - provides="$pkgname-gnat-bootstrap=$_gccrel" - [ "$CHOST" = "$CTARGET" ] && depends="$depends libgnat=$_gccrel" - - amove $_gcclibexec/*gnat* - amove $_gcclibdir/*ada* - amove usr/bin/*gnat* -} - -gdb() { - pkgdesc="$pkgdesc (gdb printers)" - install_if="$pkgname=$pkgver-r$pkgrel gdb" - - amove \ - usr/share/gdb/python/ \ - usr/share/gcc-*/python/ -} - -sha512sums=" -89047a2e07bd9da265b507b516ed3635adb17491c7f4f67cf090f0bd5b3fc7f2ee6e4cc4008beef7ca884b6b71dffe2bb652b21f01a702e17b468cca2d10b2de gcc-15.2.0.tar.xz -fd5cebc5deb1d588583424acbc1b5a6d8d6f5b1bfa9f4bdbc082cfd406723f423d87011ee30e04ed18128a7ed8021cbfc9262becff5419125dc1afb6f407defa 0001-posix_memalign.patch -6634004cb9feea9ee0d063d6b6984d7db3b10c692b6139bb99169a4f2d74f0e10b5ca0ab31ce346ffef34b8eb9c3f536aa4d94bce1b27f8e0b8a9fc5cc4b7057 0002-gcc-poison-system-directories.patch -37e089791dbcbad73af866b662cda611dc0970d93e28251c7a9aa898db3b96446654e8b778d7866eb8550ba7f4a57cf22e8514d562bfed0c66613e65550d9c85 0003-specs-turn-on-Wl-z-now-by-default.patch -d4d5bfeb20a9fac968f37497d86d7eff4a9ac863e015dadbffae24c08236f5efde69b615d95191e2546672ce2d4b30d3627528c64a83fc64b715e8fa6fd4c372 0004-Turn-on-D_FORTIFY_SOURCE-2-by-default-for-C-C-ObjC-O.patch -4806687c806154dd3d5423ea9ef1203db344dfb8fd21f3eb3543d9f05f4dc01aacc4f012f45db8e890eeddc7b1c75ec06a6b29e29a1ef7b9ec6f853d1854cfd0 0005-On-linux-targets-pass-as-needed-by-default-to-the-li.patch -6b225df0dd76339b06d5efbe07edd6648391a7b9415a219041189c35c084ceffe8fb96b2660d60d62099e7afdfeb8e053622a2b6660d2e8a13adb924f4bc8c8a 0006-Enable-Wformat-and-Wformat-security-by-default.patch -e419b7f20a74384bfb1ac792e3625f9bfe69f8031c2c0beb23f4015df9d48a6c6f107d89bea3c20fa56309b022637863c13e90c1565d027eb47c08154389b7a0 0007-Enable-Wtrampolines-by-default.patch -e6307eec09196900bcd2c0154a62d6694576b4da48a1cf901750b97b4603cd694c4daee2476c33bce09f10bee92a72749face835eb18fbf2c2a50aa1dd251572 0008-gcc-disable-SSP-on-ffreestanding-nostdlib-and-nodefa.patch -969797f99602c119e1632f0c5be02a566be5fb4c7e59affefb5eb6084a06b97120d99d5ee63fef0dab6c0278c7cecf1d8caa53521cc5b6622de2aaa7deabf86e 0009-gcc-params-set-default-ssp-buffer-size-to-4.patch -c15f062790367c9e786a4933deec33931438680176ec752b172c2a0504463a23d588ead4350d32e474603750ceb130ba0ccadfcde601bcf8e2eabca5af8322d0 0010-Ensure-that-msgfmt-doesn-t-encounter-problems-during.patch -03a1012f1022cd68cf08440428e7d6cbf65ea2184e4a088a55976f34af627d80f42f15f713841ec9cbfc4afa39117d4fc384c3f27a4f9ad0ff3947bd45b71c4a 0011-Don-t-declare-asprintf-if-defined-as-a-macro.patch -8f098de9fcf4bbece0923dc4a2acfc67cf751c1d5c007535c5d88b8637a4482c1a42d5721a2760127498e327f6983bbc865a592a8e0db9ef7efc0e36b6d4102f 0012-libiberty-copy-PIC-objects-during-build-process.patch -bbe2b561b5288ca724af37353e17b413df8bf247bce724391e75373aee5cdcdb85e6489d51622c11f4041ed8f317278cf687aee14dfc8756398f03f1a796feb9 0013-libgcc_s.patch -ae34ca2bc5a53ed1c832651e3f6425ca29b5873f1e112b45613277fb9611693be41986d5879593f09149777e3e57d04ba17b142c43eaa990375d31e4e0b4adde 0014-nopie.patch -2c91a1eadf7236efff42eb53037862a342807596e37c6cc3c270d25c2d89078bf8db68bb2e93e57a8ad39b3af825e33db72e2f48a6311951fff53776933bc48c 0015-ada-fix-shared-linking.patch -1366d696a952ed35e5e56ab5bd1eba67e58a8ce752c0ef7e7fe4ad3eef44f25ce6016342d11add9548f9e719dc9ee0772064dda68784257a1a3234ae5957f3fb 0016-build-fix-CXXFLAGS_FOR_BUILD-passing.patch -af739373285e89a4ab0000042b537ff7197b0b366019b56991008c43f3d2b76709d472841cda40e9fb61e6f0dacc0fe8c6b888abb31f393ec1a87acc1c0585b3 0017-add-fortify-headers-paths.patch -c18f3eef4d7d6fcbfa64570edb71157a62dad1f3d7276f10fe3424e49caa33f57a0a5952f03189199472802a2dd966e4832789685a94911fe9a86bb1fd6c1d50 0018-Alpine-musl-package-provides-libssp_nonshared.a.-We-.patch -341d39a40ffd896db152863c717798c6885bdde44c9ac645c5d099c2364cbd8f6f526f97cc98302c420682cb5d6d88bbe28d838c7141456f2ba5581f3edfd64f 0019-DP-Use-push-state-pop-state-for-gold-as-well-when-li.patch -e603652f341909820789a2cec173b8e547ee607b040863f1745b998b8a69d51cb412a4ac55d2c9e3c5192cc298f6288f9dd48fa06fe53ba8f6b1cabbe61c997a 0020-aarch64-disable-multilib-support.patch -26819f3c3a5844c96cee89fc9766a4f8153e7bb22f6296c6c9fd6a13d45648e3f6c7059397ad7e5be66f55addc21054614b38f480b52a7c9a967cf389735644a 0021-s390x-disable-multilib-support.patch -8e6e6ed84c8cb39ecc35ad0986a91168fedbae2426c8ec1c83dec85a293777e0ec29eac13130193b1bdc2d98b6ffa180abf574dad70740d4720b4bfdab992ab8 0022-ppc64-le-disable-multilib-support.patch -264eaa54a76ec5a12294d91ad2f995eddac9210a569ba85aef27176cb015354aa427840bb22f1e3ba2f7761f6f85cc98ddb3b00584b295c6a10a9770c59a2607 0023-x86_64-disable-multilib-support.patch -47a1a407298b6c259d7faff774f26e4843c9d3764362d74230e7d3f77c46ea8bb51211e09a66bb51c04a9f276ea5b07570fb52312fdb1d354c72a0343bc40c57 0024-riscv-disable-multilib-support.patch -b86fcf40e75861bdffb00069d3a0c9cec3fe8042d49d6ce2beae48ffeadccc576b8ab36e5a85421db5cffeb080a75f3a66dbcbb825d7f4462d40ec621964efe3 0025-always-build-libgcc_eh.a.patch -1425543ce064bfd8e33d7e6e07f45cc16d94f156adcfe190c842722652d5ea0c9ba60f6a3e1b444bb0e5bc906ec4f9ca54720b306f274b441600b79bff47dc57 0026-ada-libgnarl-remove-use-of-glibc-specific-pthread_rw.patch -b8851d0e7fc66201e323007f7c1d702ea8a0d0405aa5945621128ebfb93afd967ec8b3ab6fd4ea779ec10dca2a32e1797f7a2622124ccf8ace2a7596f66ff0bf 0027-ada-libgnarl-use-posix_openpt-instead-of-glibc-speci.patch -12b09a171d61406a2bfa10bb25398cee8c92676b12506afe7aace7028e94cbf8d7df25f62ff7af07e8ed471c6edd3ab7811fa51dfaf3a221a6b367858b1f032c 0028-ada-libgnarl-adaint-fix-sched.h-inclusion-for-musl.patch -15bed06ee74a36e9f21f4b29d7bce9c4188769abb6391560e13ea6b165da51f5ae908e141de7510d3d7eec6b998d0fc53de1042fdb7bd056efa703d230a683b4 0029-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch -4c5501256669fd33527a5394eaa4b84451ee341a943dd24a179b661d3c53ef70e87ed5d5f3e76c6c3f9cb79cb5d120ea40101278a7b9d04a55d9405e4cbf9796 0030-configure-fix-detection-of-atomic-builtins-in-libato.patch -eecc77e2a9cf956fd752693ad7f8ff8253a7bb557e00564bb488bbc1deac895e63104cc1182a0bdd700e440763f4a72e29876f560e13e4f5e6de2a1d9438c2f6 0031-libstdc-do-not-throw-exceptions-for-non-C-locales-on.patch -2b09f90d9cb417170060c8ce198bd4aa2e4ef163286c8f24f6e6c5a673ae80f5a883b078b1a5dd5fa71bc1502e08c886687072694da039eb82baa1ea1948ac2c 0032-gdc-unconditionally-link-libgphobos-against-libucont.patch -99c74242b6d79e6a814f1199b9fb0b56c6a43eb93e5d1a79b674cea750bb025363cdd1505d05cd2195a43c918831fa586c427556ee5bc826aa79cd82e7ee1c24 0033-druntime-link-against-libucontext-on-all-platforms.patch -4f8f7876bf8647cda47cbd2b145ff31efe2a7ac21c012c4134174f93482aad1fbab2592c66aacc3b05fccd1a694ff97511b794139db4aac719e243c114373240 0034-libgnat-time_t-is-always-64-bit-on-musl-libc.patch -0069da1d8cb9adb9bab081a34fec680a9ebb1236e606a2497e4565e99bef434518a0f06474a9a1fdfa70811ed3da5d35ca95d267268328f2764bf41c50e924de 0035-libphobos-do-not-use-LFS64-symbols.patch -1cbe85b63ef13bdf2804bfd3173998a6e86752d8ffc09d4cc75a9ba80b98aec5a04efa732bce97a2f50a90c84b92c442ca8f6639841fe7d6618f928ea65916a6 0036-libgo-fix-lfs64-use.patch -98fcd5b893a1646edab961a5d00246151c47b449f8eca99c51f4026ffdb53f60b5b9f6426437c0a6411342da10db8983e20337a29cd46ed22b70e0478573ea30 0037-loongarch-disable-multilib-support.patch -1ad48e39dab351b7bb3e17d9b4b8b78e7de7c736e212638c9d6874b1dde0360dcfc85586c39f515fbd2a6d9910fedc4f0c6ad7ff652b10a5c288c47173671ec7 0038-static-PIE-ensure-static-reaches-the-linker.patch -9f4c3fa0d17cfcd72626bdbaf51992ff3018f878d673ab19b9056047ee2630b581e5a5a4d4857444f08ba9bcdb0fc94f90dcda6180816e39690d1652843f0d8a 0039-except-Don-t-use-the-cached-value-of-the-gcc_except_.patch -d166475e340c91bbb24cf257240aab37129b04f2609e5ce323b530ab83853a4c34c525e0072c15732717f1681db07e6b3b0a4d268720c31f460435ccf4c99b7f 0040-ada-libgnat-use-stub-symbolic-module-name-functions.patch -c717764ef52c0226a23cbf434654cdefa6cbf38ec625648575d9143c5513b16d8914c25015db743033b8a46ac5b2c33ab75e1b67076128d67bb1319e5a83dd85 0041-ada-libgnat-recognize-linux-musleabi-and-linux-muslg.patch -5dd452a80c496a587a8826b04a4917045e4028631606e85cabd8e87e0460642d188a2156c4e0cf37a5d88e66ebd08a08393d48a6065045178c69eaba2edd063e 0042-libsanitizer-struct_sock_fprog_sz.patch -c3b64b05332bd4dd7fad3fff3cacd4f9de0512943f1548c6f1205fab1a74c83622024f30471805f57d625198cc32f647b32172914528fd5605d0bf61cb0c3ff1 0001-tree-object-size.cc-Fix-assert-constant-offset-in-ch.patch -e91873055550eba051d9297bec5c6acd27abb9ee6ce8911cdd04b5faf37d77b6b2a7607ec588d2863f13f14b48af9398cb4ac42443d8567bfa5037dc6bd50404 0001-LoongArch-Only-allow-valid-binary-op-when-optimize-c.patch -" diff --git a/cross/gcc4-armhf/01_all_gcc49_configure.patch b/cross/gcc4-armhf/01_all_gcc49_configure.patch deleted file mode 100644 index ab9aae047..000000000 --- a/cross/gcc4-armhf/01_all_gcc49_configure.patch +++ /dev/null @@ -1,156 +0,0 @@ -2013-12-30 Magnus Granberg - - * gcc/configure.ac Add --enable-esp and define ENABLE_ESP. - Check if we support crtbeginP and define ENABLE_CRTBEGINP. - * gcc/configure Regenerated - - ---- a/gcc/configure.ac 2011-11-18 11:52:32.000000000 +0100 -+++ b/gcc/configure.ac 2012-10-02 17:39:15.649526241 +0200 -@@ -5130,6 +5237,55 @@ if test x"${LINKER_HASH_STYLE}" != x; th - [The linker hash style]) - fi - -+# -------------- -+# Esp checks -+# -------------- -+ -+# Check whether --enable-esp was given and target have the support. -+AC_ARG_ENABLE([esp], -+[AS_HELP_STRING([--enable-esp], -+ [Enable Stack protector and Position independent executable as -+ default if we have suppot for it when compiling -+ and link with -z now as default. -+ Linux targets supported i*86, x86_64, x32, -+ powerpc, powerpc64, ia64, arm and mips.])], -+ enable_esp=$enableval, -+ enable_esp=no) -+if test $enable_esp = yes ; then -+ AC_MSG_CHECKING(if $target support esp) -+ case "$target" in -+ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_esp=yes -+ AC_DEFINE(ENABLE_ESP, 1, -+ [Define if your target support esp and you have enable it.]) -+ ;; -+ *) -+ enable_esp=no -+ ;; -+ esac -+AC_MSG_RESULT($enable_esp) -+fi -+AC_SUBST([enable_esp]) -+if test $enable_esp = yes ; then -+ AC_MSG_CHECKING(checking for crtbeginP.o support) -+ if test x$enable_esp = xyes ; then -+ case "$target" in -+ ia64*-*-linux*) -+ enable_crtbeginP=no ;; -+ *-*-linux*) -+ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then -+ enable_crtbeginP=yes -+ AC_DEFINE(ENABLE_CRTBEGINP, 1, -+ [Define if your compiler will support crtbeginP.]) -+ fi -+ ;; -+ *) enable_crtbeginP=no ;; -+ esac -+ fi -+ AC_MSG_RESULT($enable_crtbeginP) -+fi -+AC_SUBST([enable_crtbeginP]) -+ - # Configure the subdirectories - # AC_CONFIG_SUBDIRS($subdirs) - ---- a/gcc/configure 2013-02-01 21:26:24.000000000 +0100 -+++ b/gcc/configure 2013-02-12 01:59:20.000000000 +0100 -@@ -600,6 +600,8 @@ - ac_subst_vars='LTLIBOBJS - LIBOBJS - PICFLAG -+enable_crtbeginP -+enable_esp - enable_host_shared - enable_plugin - pluginlibs -@@ -920,6 +922,7 @@ - enable_plugin - enable_libquadmath_support - with_linker_hash_style -+enable_esp - ' - ac_precious_vars='build_alias - host_alias -@@ -1633,6 +1636,11 @@ - --enable-plugin enable plugin support - --disable-libquadmath-support - disable libquadmath support for Fortran -+ --enable-esp Enable Stack protector and Position independent -+ executable as default if we have suppot for it when -+ compiling and link with -z now as default. -+ Linux targets supported i*86, x86_64, x32, -+ powerpc, powerpc64, ia64, arm and mips. - - Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] -@@ -27419,6 +27427,59 @@ - - fi - -+# -------------- -+# Esp checks -+# -------------- -+ -+# Check whether --enable-esp was given and target have the support. -+# Check whether --enable-esp was given. -+if test "${enable_esp+set}" = set; then : -+ enableval=$enable_esp; enable_esp=$enableval -+else -+ enable_esp=no -+fi -+ -+if test $enable_esp = yes ; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $target support esp" >&5 -+$as_echo_n "checking if $target support esp... " >&6; } -+ case "$target" in -+ i?86*-*-linux* | x86_64-*-linux* | powerpc*-*-linux* | mips*-*-linux* | arm*-*-linux* | ia64-*-linux*) -+ enable_esp=yes -+ -+$as_echo "#define ENABLE_ESP 1" >>confdefs.h -+ -+ ;; -+ *) -+ enable_esp=no -+ ;; -+ esac -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_esp" >&5 -+$as_echo "$enable_esp" >&6; } -+fi -+ -+if test $enable_esp = yes ; then -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking checking for crtbeginP.o support" >&5 -+$as_echo_n "checking checking for crtbeginP.o support... " >&6; } -+ if test x$enable_esp = xyes ; then -+ case "$target" in -+ ia64*-*-linux*) -+ enable_crtbeginP=no ;; -+ *-*-linux*) -+ if test x$gcc_cv_ld_pie = xyes && test x$lt_cv_prog_compiler_static_works = xyes; then -+ enable_crtbeginP=yes -+ -+$as_echo "#define ENABLE_CRTBEGINP 1" >>confdefs.h -+ -+ fi -+ ;; -+ *) enable_crtbeginP=no ;; -+ esac -+ fi -+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_crtbeginP" >&5 -+$as_echo "$enable_crtbeginP" >&6; } -+fi -+ -+ - # Configure the subdirectories - # AC_CONFIG_SUBDIRS($subdirs) - diff --git a/cross/gcc4-armhf/02_all_gcc48_config.in.patch b/cross/gcc4-armhf/02_all_gcc48_config.in.patch deleted file mode 100644 index 3ad51f317..000000000 --- a/cross/gcc4-armhf/02_all_gcc48_config.in.patch +++ /dev/null @@ -1,32 +0,0 @@ -2013-02-13 Magnus Granberg - - * gcc/config.in Add ENABLE_CRTBEGINP, ENABLE_ESP - ---- ./gcc/config.in 2009-04-21 11:08:08.000000000 +0200 -+++ ./gcc/config.in 2009-05-12 00:10:08.000000000 +0200 -@@ -46,6 +46,12 @@ - #endif - - -+/* Define to 1 to enable crtbeginP.o. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_CRTBEGINP -+#endif -+ -+ - /* Define to 1 to specify that we are using the BID decimal floating point - format instead of DPD */ - #ifndef USED_FOR_TARGET -@@ -65,6 +65,12 @@ - #endif - - -+/* Define to 1 to enable esp. */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_ESP -+#endif -+ -+ - /* Define to 1 to enable fixed-point arithmetic extension to C. */ - #ifndef USED_FOR_TARGET - #undef ENABLE_FIXED_POINT diff --git a/cross/gcc4-armhf/03_all_gcc49_Makefile.in.patch b/cross/gcc4-armhf/03_all_gcc49_Makefile.in.patch deleted file mode 100644 index bf53d3ca0..000000000 --- a/cross/gcc4-armhf/03_all_gcc49_Makefile.in.patch +++ /dev/null @@ -1,96 +0,0 @@ -2012-01-17 Magnus Granberg - - * gcc/Makefile.in Add -fno-PIE. to ALL_CFLAGS and - ALL_CXXFLAGS if enable_esp yes. - Echo enable_esp and enable_crtbeginP to tmp-libgcc.mvars. - * libgcc/Makefile.in Add crtbeginP.o to EXTRA_PARTS if enable_crtbeginP yes - We add new file crtbeginP.o if enable_crtbeginP yes - Add -fno-PIE. to CRTSTUFF_CFLAGS. - ---- a/gcc/Makefile.in 2011-11-09 02:20:14.000000000 +0100 -+++ b/gcc/Makefile.in 2011-12-24 22:28:08.864804375 +0100 -@@ -247,6 +247,14 @@ LINKER_FLAGS = $(CFLAGS) - endif - endif - -+# We don't want to compile the compiler with -fPIE, it make PCH fail. -+enable_esp = @enable_esp@ -+ifeq ($(enable_esp),yes) -+ESP_NOPIE_CFLAGS = -fno-PIE -+else -+ESP_NOPIE_CFLAGS= -+endif -+ - # ------------------------------------------- - # Programs which operate on the build machine - # ------------------------------------------- -@@ -974,12 +982,13 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@ - - # This is the variable actually used when we compile. If you change this, - # you probably want to update BUILD_CFLAGS in configure.ac --ALL_CFLAGS = $(T_CFLAGS) $(CFLAGS-$@) \ -+ALL_CFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) \ - $(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@ - - # The C++ version. --ALL_CXXFLAGS = $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) $(INTERNAL_CFLAGS) \ -- $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) $(WARN_CXXFLAGS) @DEFS@ -+ALL_CXXFLAGS = $(ESP_NOPIE_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS) \ -+ $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(NOEXCEPTION_FLAGS) \ -+ $(WARN_CXXFLAGS) @DEFS@ - - # Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro - # puts -I options in CPPFLAGS, our include files in the srcdir will always -@@ -1814,6 +1823,8 @@ libgcc.mvars: config.status Makefile spe - echo GCC_CFLAGS = '$(GCC_CFLAGS)' >> tmp-libgcc.mvars - echo INHIBIT_LIBC_CFLAGS = '$(INHIBIT_LIBC_CFLAGS)' >> tmp-libgcc.mvars - echo TARGET_SYSTEM_ROOT = '$(TARGET_SYSTEM_ROOT)' >> tmp-libgcc.mvars -+ echo enable_esp = '$(enable_esp)' >> tmp-libgcc.mvars -+ echo enable_crtbeginP = '@enable_crtbeginP@' >> tmp-libgcc.mvars - - mv tmp-libgcc.mvars libgcc.mvars - ---- a/libgcc/Makefile.in 2011-11-22 04:01:02.000000000 +0100 -+++ b/libgcc/Makefile.in 2011-12-25 15:18:22.449610631 +0100 -@@ -219,6 +219,17 @@ else - DECNUMINC = - endif - -+ifeq ($(enable_esp),yes) -+ESP_NOPIE_CFLAGS = -fno-PIE -+else -+ESP_NOPIE_CFLAGS= -+endif -+ -+# We add crtbeginP.o to the EXTRA_PARTS list if enable_crtbeginP = yes -+ifeq ($(enable_crtbeginP),yes) -+EXTRA_PARTS += crtbeginP.o -+endif -+ - # Options to use when compiling libgcc2.a. - # - LIBGCC2_DEBUG_CFLAGS = -g -@@ -279,7 +290,7 @@ INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CF - CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ - -finhibit-size-directive -fno-inline -fno-exceptions \ - -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ -- -fno-stack-protector \ -+ -fno-stack-protector $(ESP_NOPIE_CFLAGS) \ - $(INHIBIT_LIBC_CFLAGS) - - # Extra flags to use when compiling crt{begin,end}.o. -@@ -966,6 +977,13 @@ crtendS$(objext): $(srcdir)/crtstuff.c - # This is a version of crtbegin for -static links. - crtbeginT$(objext): $(srcdir)/crtstuff.c - $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O -+ -+# This is a version of crtbegin for -static -fPIE links. -+ifeq ($(enable_crtbeginP),yes) -+crtbeginP$(objext): $(srcdir)/crtstuff.c -+ $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \ -+ -c $< -DCRT_BEGIN -DCRTSTUFFT_O -DCRTSTUFFS_O -+endif - - ifeq ($(enable_vtable_verify),yes) - # These are used in vtable verification; see comments in source files for - \ No newline at end of file diff --git a/cross/gcc4-armhf/05_all_gcc48_gcc.c.patch b/cross/gcc4-armhf/05_all_gcc48_gcc.c.patch deleted file mode 100644 index 4cea772eb..000000000 --- a/cross/gcc4-armhf/05_all_gcc48_gcc.c.patch +++ /dev/null @@ -1,25 +0,0 @@ -2013-03-24 Magnus Granberg - - * gcc/gcc.c include esp.h - static const char *cc1_spec We set that in esp.h if ENABLE_ESP. - ---- ./gcc/gcc.c 2010-01-21 10:29:30.000000000 -0500 -+++ ./gcc/gcc.c 2010-01-29 23:29:16.000000000 -0500 -@@ -44,6 +44,7 @@ - #include "opts.h" - #include "params.h" - #include "vec.h" -+#include "config/esp.h" /* for --enable-esp support */ - #include "filenames.h" - - /* By default there is no special suffix for target executables. */ -@@ -822,7 +823,9 @@ - - static const char *asm_debug; - static const char *cpp_spec = CPP_SPEC; -+#ifndef ENABLE_ESP - static const char *cc1_spec = CC1_SPEC; -+#endif - static const char *cc1plus_spec = CC1PLUS_SPEC; - static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; - static const char *link_ssp_spec = LINK_SSP_SPEC; diff --git a/cross/gcc4-armhf/1001-fix-reload1-compile-error.patch b/cross/gcc4-armhf/1001-fix-reload1-compile-error.patch deleted file mode 100644 index 2f4699d7b..000000000 --- a/cross/gcc4-armhf/1001-fix-reload1-compile-error.patch +++ /dev/null @@ -1,17 +0,0 @@ -Avoid gcc/reload1.c compile error when building with newer gcc (e.g. gcc 11.2 on Ubuntu 21.10). - -The error was: - -.../esp-open-sdk/crosstool-NG/.build/src/gcc-4.8.5/gcc/reload1.c:89:24: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17 - ---- gcc-4.8.5/gcc/reload1.c~ 2013-01-21 06:55:05.000000000 -0800 -+++ gcc-4.8.5/gcc/reload1.c 2022-01-05 17:18:10.148547719 -0800 -@@ -440,7 +440,7 @@ - - while (memory_address_p (QImode, tem)) - { -- spill_indirect_levels++; -+ spill_indirect_levels = 1; - tem = gen_rtx_MEM (Pmode, tem); - } - diff --git a/cross/gcc4-armhf/12_all_default-warn-trampolines.patch b/cross/gcc4-armhf/12_all_default-warn-trampolines.patch deleted file mode 100644 index 2fd4051b1..000000000 --- a/cross/gcc4-armhf/12_all_default-warn-trampolines.patch +++ /dev/null @@ -1,24 +0,0 @@ -Enable -Wtrampolines by default. - ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -640,7 +640,7 @@ Common Var(warn_system_headers) Warning - Do not suppress warnings from system headers - - Wtrampolines --Common Var(warn_trampolines) Warning -+Common Var(warn_trampolines) Init(1) Warning - Warn whenever a trampoline is generated - - Wtype-limits ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -4007,6 +4007,8 @@ headers---for that, @option{-Wunknown-pragmas} must also be used. - 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. - -+ This warning is enabled by default in Gentoo. -+ - @item -Wfloat-equal - @opindex Wfloat-equal - @opindex Wno-float-equal diff --git a/cross/gcc4-armhf/15_all_libgfortran-Werror.patch b/cross/gcc4-armhf/15_all_libgfortran-Werror.patch deleted file mode 100644 index 5f15373d8..000000000 --- a/cross/gcc4-armhf/15_all_libgfortran-Werror.patch +++ /dev/null @@ -1,17 +0,0 @@ -libgfortran does not respect --disable-werror - -https://bugs.gentoo.org/433435 -http://gcc.gnu.org/PR54724 - - ---- a/libgfortran/configure -+++ b/libgfortran/configure -@@ -5764,7 +5764,7 @@ fi - - # Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC. - if test "x$GCC" = "xyes"; then -- AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring" -+ AM_FCFLAGS="-I . -Wall -fimplicit-none -fno-repack-arrays -fno-underscoring" - ## We like to use C99 routines when available. This makes sure that - ## __STDC_VERSION__ is set such that libc includes make them available. - AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings" diff --git a/cross/gcc4-armhf/16_all_gcc47_nopie_option.patch b/cross/gcc4-armhf/16_all_gcc47_nopie_option.patch deleted file mode 100644 index ed9a961d7..000000000 --- a/cross/gcc4-armhf/16_all_gcc47_nopie_option.patch +++ /dev/null @@ -1,16 +0,0 @@ -2012-01-24 Magnus Granberg - - * gcc/common.opt Add -nopie - ---- a/gcc/common.opt 2011-11-23 19:51:17.000000000 +0100 -+++ b//gcc/common.opt 2012-01-24 16:56:24.302224357 +0100 -@@ -2280,6 +2280,9 @@ Driver - nodefaultlibs - Driver - -+nopie -+Driver -+ - nostartfiles - Driver - diff --git a/cross/gcc4-armhf/16_all_libgomp-Werror.patch b/cross/gcc4-armhf/16_all_libgomp-Werror.patch deleted file mode 100644 index d6a355d67..000000000 --- a/cross/gcc4-armhf/16_all_libgomp-Werror.patch +++ /dev/null @@ -1,17 +0,0 @@ -libgomp does not respect --disable-werror - -https://bugs.gentoo.org/229059 -http://gcc.gnu.org/PR38436 - - ---- a/libgomp/configure -+++ b/libgomp/configure -@@ -4282,7 +4282,7 @@ save_CFLAGS="$CFLAGS" - - # Add -Wall -Werror if we are using GCC. - if test "x$GCC" = "xyes"; then -- XCFLAGS="$XCFLAGS -Wall -Werror" -+ XCFLAGS="$XCFLAGS -Wall" - fi - - # Find other programs we need. diff --git a/cross/gcc4-armhf/20_all_gcc49_config_crtbeginp.patch b/cross/gcc4-armhf/20_all_gcc49_config_crtbeginp.patch deleted file mode 100644 index 62474c022..000000000 --- a/cross/gcc4-armhf/20_all_gcc49_config_crtbeginp.patch +++ /dev/null @@ -1,40 +0,0 @@ -2014-04-23 Magnus Granberg - - * gcc/config/gnu-user.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o. - * gcc/config/rs6000/sysv4.h If ENABLE_CRTBEGINP, -static and -pie use crtbegineP.o. - ---- a/gcc/config/gnu-user.h 2014-01-02 23:23:26.000000000 +0100 -+++ b/gcc/config/gnu-user.h 2014-04-23 00:55:06.390265454 +0200 -@@ -40,7 +40,15 @@ see the files COPYING3 and COPYING.RUNTI - provides part of the support for getting C++ file-scope static - object constructed before entering `main'. */ - --#if defined HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP) -+#define GNU_USER_TARGET_STARTFILE_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ -+ crti.o%s %{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}; \ -+ shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ -+ %{fvtable-verify=none:%s; \ -+ fvtable-verify=preinit:vtv_start_preinit.o%s; \ -+ fvtable-verify=std:vtv_start.o%s}" -+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP) - #define GNU_USER_TARGET_STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ ---- a/gcc/config/rs6000/sysv4.h 2009-04-10 01:23:07.000000000 +0200 -+++ b/gcc/config/rs6000/sysv4.h 2009-09-08 04:41:50.000000000 +0200 -@@ -883,7 +883,12 @@ - %{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ - %{!shared: %{profile:-lc_p} %{!profile:-lc}}}" - --#ifdef HAVE_LD_PIE -+#if defined (HAVE_LD_PIE) && defined (ENABLE_CRTBEGINP) -+#define STARTFILE_LINUX_SPEC "\ -+%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ -+%{mnewlib:ecrti.o%s;:crti.o%s} \ -+%{static:%{pie:crtbeginP.o%s;:crtbeginT.o%s}} %{!static:%{shared|pie:crtbeginS.o%s;:crtbegin.o%s}}" -+#elif defined (HAVE_LD_PIE) && ! defined (ENABLE_CRTBEGINP) - #define STARTFILE_LINUX_SPEC "\ - %{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ - %{mnewlib:ecrti.o%s;:crti.o%s} \ diff --git a/cross/gcc4-armhf/24_all_gcc49_invoke.texi.patch b/cross/gcc4-armhf/24_all_gcc49_invoke.texi.patch deleted file mode 100644 index 20f98f690..000000000 --- a/cross/gcc4-armhf/24_all_gcc49_invoke.texi.patch +++ /dev/null @@ -1,44 +0,0 @@ -2014-04-24 Magnus Granberg - - * gcc/doc/invoke.texi Add NOTES about -fstack-protector-all, -pie and - -fPIE/-fpie when --enable-esp is enable, this options is on by default. - ---- a/gcc/doc/invoke.texi 2009-04-01 09:18:47.000000000 +0200 -+++ b/gcc/doc/invoke.texi 2009-06-18 14:08:38.000000000 +0200 -@@ -9233,6 +9245,11 @@ If a guard check fails, an error message - @opindex fstack-protector-all - Like @option{-fstack-protector} except that all functions are protected. - -+NOTE: NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-stack-protector}, -+@option{-nostdlib}, @option{-ffreestanding}, @option{-fstack-protector}, -+@option{-fstack-protector-strong}or @option{-fstack-protector-all}are found. -+ - @item -fstack-protector-strong - @opindex fstack-protector-strong - Like @option{-fstack-protector} but includes additional functions to -@@ -7960,6 +7965,12 @@ - that were used to generate code (@option{-fpie}, @option{-fPIE}, - or model suboptions) when you specify this option. - -+NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} -+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or -+@option{-nostartfiles} or @option{-shared} or @option{-pg} or @option{-p} -+are found. -+ - @item -rdynamic - @opindex rdynamic - Pass the flag @option{-export-dynamic} to the ELF linker, on targets -@@ -15889,6 +15910,11 @@ - @code{__pie__} and @code{__PIE__}. The macros have the value 1 - for @option{-fpie} and 2 for @option{-fPIE}. - -+NOTE: When --enable-esp this option is enabled by default -+for C, C++, ObjC, ObjC++, if neither @option{-fno-pie} or @option{-fno-PIE} -+or @option{-fno-pic} or @option{-fno-PIC} or @option{-nostdlib} or -+@option{-nostartfiles} or @option{-shared} are found. -+ - @item -fno-jump-tables - @opindex fno-jump-tables - Do not use jump tables for switch statements even where it would be diff --git a/cross/gcc4-armhf/34_all_gcc48_config_i386.patch b/cross/gcc4-armhf/34_all_gcc48_config_i386.patch deleted file mode 100644 index 9f0f7a3d4..000000000 --- a/cross/gcc4-armhf/34_all_gcc48_config_i386.patch +++ /dev/null @@ -1,56 +0,0 @@ -2013-03-24 Magnus Granberg - - * gcc/config/i386/gnu-user-common.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC. - * gcc/config/i386/gnu-user.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. - * gcc/config/i386/i386.h (SUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. - ---- a/gcc/config/i386/gnu-user-common.h 2013-01-10 21:38:27.000000000 +0100 -+++ b/gcc/config/i386/gnu-user-common.h 2013-02-14 00:51:44.689637605 +0100 -@@ -70,3 +70,7 @@ along with GCC; see the file COPYING3. - - /* Static stack checking is supported by means of probes. */ - #define STACK_CHECK_STATIC_BUILTIN 1 -+ -+#ifdef ENABLE_ESP -+#define DRIVER_SELF_SPECS ESP_DRIVER_SELF_SPEC -+#endif ---- a/gcc/config/i386/gnu-user.h 2011-05-05 14:32:50.000000000 +0200 -+++ b/gcc/config/i386/gnu-user.h 2012-07-09 14:28:38.726289455 +0200 -@@ -93,9 +93,16 @@ along with GCC; see the file COPYING3. - "--32 %{!mno-sse2avx:%{mavx:-msse2avx}} %{msse2avx:%{!mavx:-msse2avx}}" - - #undef SUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP - #define SUBTARGET_EXTRA_SPECS \ - { "link_emulation", GNU_USER_LINK_EMULATION },\ -- { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } -+ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }, \ -+ ESP_EXTRA_SPECS -+#else -+#define SUBTARGET_EXTRA_SPECS \ -+ { "link_emulation", GNU_USER_LINK_EMULATION },\ -+ { "dynamic_linker", GNU_USER_DYNAMIC_LINKER } -+#endif - - #undef LINK_SPEC - #define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \ ---- a/gcc/config/i386/i386.h 2011-11-24 23:11:12.000000000 +0100 -+++ b/gcc/config/i386/i386.h 2012-07-09 14:21:24.575276517 +0200 -@@ -617,13 +617,16 @@ enum target_cpu_default - Do not define this macro if it does not need to do anything. */ - - #ifndef SUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS -+#else - #define SUBTARGET_EXTRA_SPECS - #endif -+#endif - - #define EXTRA_SPECS \ - { "cc1_cpu", CC1_CPU_SPEC }, \ - SUBTARGET_EXTRA_SPECS -- - - /* Set the value of FLT_EVAL_METHOD in float.h. When using only the - FPU, assume that the fpcw is set to extended precision; when using diff --git a/cross/gcc4-armhf/35_all_gcc48_config_arm.patch b/cross/gcc4-armhf/35_all_gcc48_config_arm.patch deleted file mode 100644 index 5aecc6ba3..000000000 --- a/cross/gcc4-armhf/35_all_gcc48_config_arm.patch +++ /dev/null @@ -1,35 +0,0 @@ -2013-06-03 Magnus Granberg - - * gcc/config/arm/arm.h (DRIVER_SELF_SPECS): Add ESP_DRIVER_SELF_SPEC. - * gcc/config/arm/elf.h (SUBSUBTARGET_EXTRA_SPECS): Add ESP_EXTRA_SPECS. - ---- a/gcc/config/arm/arm.h 2013-01-15 17:17:28.000000000 +0100 -+++ b/gcc/config/arm/arm.h 2013-02-18 22:45:18.327284928 +0100 -@@ -2326,6 +2326,11 @@ extern const char *host_detect_local_cpu - # define MCPU_MTUNE_NATIVE_SPECS "" - #endif - --#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -- -+#ifdef ENABLE_ESP -+# define DRIVER_SELF_SPECS \ -+ MCPU_MTUNE_NATIVE_SPECS, \ -+ ESP_DRIVER_SELF_SPEC -+#else -+# define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS -+#endif - #endif /* ! GCC_ARM_H */ ---- a/gcc/config/arm/elf.h 2013-01-10 21:38:27.000000000 +0100 -+++ b/gcc/config/arm/elf.h 2013-05-19 02:15:49.595855825 +0200 -@@ -49,7 +49,11 @@ - #endif - - #undef SUBSUBTARGET_EXTRA_SPECS -+#ifdef ENABLE_ESP -+#define SUBSUBTARGET_EXTRA_SPECS ESP_EXTRA_SPECS -+#else - #define SUBSUBTARGET_EXTRA_SPECS -+#endif - - #ifndef ASM_SPEC - #define ASM_SPEC "\ diff --git a/cross/gcc4-armhf/40_all_gcc49_config_esp.patch b/cross/gcc4-armhf/40_all_gcc49_config_esp.patch deleted file mode 100644 index cc58e6e7d..000000000 --- a/cross/gcc4-armhf/40_all_gcc49_config_esp.patch +++ /dev/null @@ -1,135 +0,0 @@ -2014-05-12 Magnus Granberg - - * gcc/esp.h New file to support --enable-esp - Version 20140512.1 - ---- a/gcc/config/esp.h 2010-04-09 16:14:00.000000000 +0200 -+++ b/gcc/config/esp.h 2012-06-23 01:00:31.248348491 +0200 -@@ -0,0 +1,127 @@ -+/* License terms see GNU GENERAL PUBLIC LICENSE Version 3. -+ * Version 20140512.1 -+ * Magnus Granberg (Zorry) */ -+#ifndef GCC_ESP_H -+#define GCC_ESP_H -+ -+/* This file will add -fstack-protector-all, -fstack-check, -fPIE, -pie and -z now -+ as default if the defines and the spec allow it. -+ Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass -+ to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. -+ This will add some unsupported upstream commands options as -nopie and -nonow. -+ -D__KERNEL__ is added so we don't have -fPIE, -pie and -fstack-protector-all and -fstack-check when building kernels. -+ ESP_CC1_SPEC is added to CC1_SPEC. -+ ESP_CC1_STRICT_OVERFLOW_SPEC is added so we don't disable the strict-overflow check. -+ ESP_LINK_PIE_CHECK_SPEC check for -pie, -p, -pg, -profile and -static. -+ ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie. -+*/ -+#ifdef ENABLE_ESP -+ -+ /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ -+ #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)" -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!fno-stack-check: }}}" -+ #else -+ #define ESP_CC1_SSP_SPEC "" -+ #endif -+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_CC1_PIE_SPEC "%{!nopie: }" -+ #else -+ #define ESP_CC1_PIE_SPEC "" -+ #endif -+ #define ESP_CC1_STRICT_OVERFLOW_SPEC "%{!fstrict-overflow:%{!fno-strict-overflow: -fno-strict-overflow}}" -+ -+ /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable -+ -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check -+ Don't remove the specs in the end */ -+ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) " -+ #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}" -+ -+ /* We use ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */ -+ #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \ -+ %(esp_link_pie)} %(esp_options_ssp) }" -+ -+ /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */ -+ #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) -+ #define ESP_OPTIONS_SSP_SPEC \ -+ "%{nostdlib|ffreestanding|fno-stack-protector|fstack-protector| \ -+ fstack-protector-all|fstack-protector-strong:;:-fstack-protector-all} \ -+ %{fstack-check|fstack-check=*:;: -fstack-check}" -+ #else -+ #define ESP_OPTIONS_SSP_SPEC "" -+ #endif -+ -+ /* If EFAULT_PIE or EFAULT_PIE_SSP is defined we will add -fPIE -pie */ -+ #if defined ( EFAULT_PIE ) || defined ( EFAULT_PIE_SSP ) -+ -+ /* This will add -fPIE if we don't have -pie -fpic -fPIC -fpie -fPIE -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -+ -nostdlib -nostartfiles. */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }" -+ #else -+ #define ESP_OPTIONS_PIE_SPEC \ -+ "%{!pie: %{!fpic:%{!fPIC:%{!fpie:%{!fPIE: %{!fno-pic:%{!fno-PIC:%{!fno-pie:%{!fno-PIE: \ -+ %{!shared: %{!static: %{!nostdlib: %{!nostartfiles:-fPIE}} } }}}} }}}} }}" -+ #endif -+ -+ /* This will add -pie if we don't have -pie -A -fno-pic -fno-PIC -fno-pie -fno-PIE -shared -static -r -nostdlib -+ -nostartfiles */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static -+ and we add -pie only to get the start and endfiles. -pie will not go to the linker. */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}" -+ #else -+ #define ESP_LINK_PIE_SPEC \ -+ "%{!pie:%{!A:%{!fno-pie:%{!fno-PIE:%{!fno-pic:%{!fno-PIC:%{!shared:%{!static:%{!r: \ -+ %{!nostdlib:%{!nostartfiles:-pie}}}}}}}}}}}" -+ #endif -+ -+ /* This will check if -pie is set when (-static) -pg -p -profile. If set it will make gcc print out -+ "-pie and (static)|pg|p|profile are incompatible when linking" */ -+ /* With ENABLE_CRTBEGINP we don't need to check for -static */ -+ #ifdef ENABLE_CRTBEGINP -+ #define ESP_LINK_PIE_CHECK_SPEC \ -+ "%{pie:%{pg|p|profile:%e-pie and -pg|p|profile are incompatible when linking}}" -+ #else -+ #define ESP_LINK_PIE_CHECK_SPEC \ -+ "%{pie:%{static|pg|p|profile:%e-pie and -static|pg|p|profile are incompatible when linking}}" -+ #endif -+ -+ /* We don't pass -pie to the linker when -static. */ -+ #ifdef ENABLE_CRTBEGINP -+ #define LINK_PIE_SPEC "%{!static:%{pie:-pie}} %(esp_link)" -+ #else -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" -+ #endif -+ -+ #else -+ #define ESP_OPTIONS_PIE_SPEC "" -+ #define ESP_LINK_PIE_CHECK_SPEC "" -+ #define ESP_LINK_PIE_SPEC "" -+ #define LINK_PIE_SPEC "%{pie:-pie} %(esp_link)" -+ #endif -+ -+ /* We add extra spec name's to the EXTRA_SPECS list */ -+ #define ESP_EXTRA_SPECS \ -+ { "esp_cc1", ESP_CC1_SPEC }, \ -+ { "esp_cc1_pie", ESP_CC1_PIE_SPEC }, \ -+ { "esp_cc1_ssp", ESP_CC1_SSP_SPEC }, \ -+ { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \ -+ { "esp_link", ESP_LINK_SPEC }, \ -+ { "esp_link_now", ESP_LINK_NOW_SPEC }, \ -+ { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ -+ { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \ -+ { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \ -+ { "esp_options_pie", ESP_OPTIONS_PIE_SPEC }, \ -+ { "esp_options_ssp", ESP_OPTIONS_SSP_SPEC } -+ -+ static const char *cc1_spec = CC1_SPEC ESP_CC1_SPEC; -+ -+#endif -+#endif /* End GCC_ESP_H */ diff --git a/cross/gcc4-armhf/41_all_gcc49_config_esp_alpine.patch b/cross/gcc4-armhf/41_all_gcc49_config_esp_alpine.patch deleted file mode 100644 index b8c88e286..000000000 --- a/cross/gcc4-armhf/41_all_gcc49_config_esp_alpine.patch +++ /dev/null @@ -1,67 +0,0 @@ -Apply Alpine Linux specific differences to Gentoo ESP configuration: -- default PIE and SSP by default without additional CFLAGS (to clean up APKBUILD) -- do not enable -fstack-check by default (caused failures in programs that setup - small stack in musl) -- enable -z relro by default -- enable -fstack-protector-strong instead of -fstack-protector-all by default - ---- gcc-4.9.2/gcc/config/esp.h 2014-12-10 15:54:19.925060848 +0000 -+++ gcc-4.9.2/gcc/config/esp.h 2014-12-10 15:59:16.793850060 +0000 -@@ -4,7 +4,7 @@ - #ifndef GCC_ESP_H - #define GCC_ESP_H - --/* This file will add -fstack-protector-all, -fstack-check, -fPIE, -pie and -z now -+/* This file will add -fstack-protector-strong, -fPIE, -pie, -z relro and -z now - as default if the defines and the spec allow it. - Added a hack for gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass - to support older hardened GCC patches and we don't need to change the code on gcc-specs-* and _filter-hardened. -@@ -16,11 +16,14 @@ - ENABLE_CRTBEGINP add support for crtbeginP.o, build -static with -fPIE or -fpie. - */ - #ifdef ENABLE_ESP -+ -+ /* Enable by default on Alpine */ -+ #define EFAULT_PIE_SSP - - /* Hack to support gcc-specs-* in toolchain-funcs.eclass and _filter-hardened in flag-o-matic.eclass */ - #define ESP_CC1_SPEC " %(esp_cc1_ssp) %(esp_cc1_pie) %(esp_cc1_strict_overflow)" - #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) -- #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: %{!fno-stack-check: }}}" -+ #define ESP_CC1_SSP_SPEC "%{!fno-stack-protector: %{!fno-stack-protector-all: }}" - #else - #define ESP_CC1_SSP_SPEC "" - #endif -@@ -34,20 +37,20 @@ - /* ESP_LINK_SPEC is added to LINK_PIE_SPEC if esp is enable - -z now will be added if we don't have -vanilla spec. We do a -pie incompatible check - Don't remove the specs in the end */ -- #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_pie_check) " -+ #define ESP_LINK_SPEC "%(esp_link_now) %(esp_link_relro) %(esp_link_pie_check) " - #define ESP_LINK_NOW_SPEC "%{!nonow:-z now}" -+ #define ESP_LINK_RELRO_SPEC "%{!norelro:-z relro}" - - /* We use ESP_DRIVER_SELF_SPEC to add pie and ssp command-line options. */ - #define ESP_DRIVER_SELF_SPEC "%{D__KERNEL__:;:%{!nopie:%(esp_options_pie) \ - %(esp_link_pie)} %(esp_options_ssp) }" - -- /* This will add -fstack-protector-all if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector -+ /* This will add -fstack-protector-strong if we don't have -nostdlib -nodefaultlibs -fno-stack-protector -fstack-protector - -fstack-protector-all and we have EFAULT_SSP or EFAULT_PIE_SSP defined. */ - #if defined ( EFAULT_SSP ) || defined ( EFAULT_PIE_SSP ) - #define ESP_OPTIONS_SSP_SPEC \ - "%{nostdlib|ffreestanding|fno-stack-protector|fstack-protector| \ -- fstack-protector-all|fstack-protector-strong:;:-fstack-protector-all} \ -- %{fstack-check|fstack-check=*:;: -fstack-check}" -+ fstack-protector-all|fstack-protector-strong:;:-fstack-protector-strong}" - #else - #define ESP_OPTIONS_SSP_SPEC "" - #endif -@@ -115,6 +118,7 @@ - { "esp_cc1_strict_overflow", ESP_CC1_STRICT_OVERFLOW_SPEC }, \ - { "esp_link", ESP_LINK_SPEC }, \ - { "esp_link_now", ESP_LINK_NOW_SPEC }, \ -+ { "esp_link_relro", ESP_LINK_RELRO_SPEC }, \ - { "esp_link_pie", ESP_LINK_PIE_SPEC }, \ - { "esp_link_pie_check", ESP_LINK_PIE_CHECK_SPEC }, \ - { "esp_driver_self", ESP_DRIVER_SELF_SPEC }, \ diff --git a/cross/gcc4-armhf/48_all_x86_pr53113_libitm-avx.patch b/cross/gcc4-armhf/48_all_x86_pr53113_libitm-avx.patch deleted file mode 100644 index b17653023..000000000 --- a/cross/gcc4-armhf/48_all_x86_pr53113_libitm-avx.patch +++ /dev/null @@ -1,28 +0,0 @@ -libitm checks for AVX support in the assembler and adds -mavx to x86_avx.cc -which defines the needed typedefs. User CFLAGS can override -mavx however, -so also use the fallback typedef if __AVX__ isn't defined. - -https://bugs.gentoo.org/417271 -http://gcc.gnu.org/PR53113 - - ---- a/libitm/config/x86/x86_avx.cc -+++ b/libitm/config/x86/x86_avx.cc -@@ -29,7 +29,7 @@ - - extern "C" { - --#ifndef HAVE_AS_AVX -+#if !defined (HAVE_AS_AVX) || !defined(__AVX__) - // If we don't have an AVX capable assembler, we didn't set -mavx on the - // command-line either, which means that libitm.h defined neither this type - // nor the functions in this file. Define the type and unconditionally -@@ -40,7 +40,7 @@ typedef float _ITM_TYPE_M256 __attribute__((vector_size(32), may_alias)); - // Re-define the memcpy implementations so that we can frob the - // interface to deal with possibly missing AVX instruction set support. - --#ifdef HAVE_AS_AVX -+#if defined(HAVE_AS_AVX) && defined(__AVX__) - #define RETURN(X) return X - #define STORE(X,Y) X = Y - #define OUTPUT(T) _ITM_TYPE_##T diff --git a/cross/gcc4-armhf/50_all_libiberty-asprintf.patch b/cross/gcc4-armhf/50_all_libiberty-asprintf.patch deleted file mode 100644 index 9ad4a9266..000000000 --- a/cross/gcc4-armhf/50_all_libiberty-asprintf.patch +++ /dev/null @@ -1,18 +0,0 @@ -2008-07-25 Magnus Granberg - - * include/libiberty.h (asprintf): Don't declare if defined as a macro - ---- a/include/libiberty.h -+++ b/include/libiberty.h -@@ -609,8 +609,11 @@ extern int pwait (int, int *, int); - /* Like sprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. */ - -+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ -+#ifndef asprintf - extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; - #endif -+#endif - - #if !HAVE_DECL_VASPRINTF - /* Like vsprintf but provides a pointer to malloc'd storage, which diff --git a/cross/gcc4-armhf/51_all_libiberty-pic.patch b/cross/gcc4-armhf/51_all_libiberty-pic.patch deleted file mode 100644 index b6160a730..000000000 --- a/cross/gcc4-armhf/51_all_libiberty-pic.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/libiberty/Makefile.in -+++ b/libiberty/Makefile.in -@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - diff --git a/cross/gcc4-armhf/67_all_gcc-poison-system-directories.patch b/cross/gcc4-armhf/67_all_gcc-poison-system-directories.patch deleted file mode 100644 index 475ef96b9..000000000 --- a/cross/gcc4-armhf/67_all_gcc-poison-system-directories.patch +++ /dev/null @@ -1,190 +0,0 @@ -From 160397ef3c3331099af028f1b8d3e085b07d88ad Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 08:59:00 +0400 -Subject: [PATCH 16/35] gcc: poison-system-directories - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate [distribution: codesourcery] ---- - gcc/Makefile.in | 2 +- - gcc/common.opt | 4 ++++ - gcc/config.in | 6 ++++++ - gcc/configure | 20 ++++++++++++++++++-- - gcc/configure.ac | 10 ++++++++++ - gcc/doc/invoke.texi | 9 +++++++++ - gcc/gcc.c | 2 ++ - gcc/incpath.c | 19 +++++++++++++++++++ - 8 files changed, 69 insertions(+), 3 deletions(-) - -Index: gcc-4.9-20140316/gcc/common.opt -=================================================================== ---- gcc-4.9-20140316.orig/gcc/common.opt -+++ gcc-4.9-20140316/gcc/common.opt -@@ -603,6 +603,10 @@ Wpedantic - Common Var(pedantic) Warning - Issue warnings needed for strict compliance to the standard - -+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 local variable shadows another -Index: gcc-4.9-20140316/gcc/config.in -=================================================================== ---- gcc-4.9-20140316.orig/gcc/config.in -+++ gcc-4.9-20140316/gcc/config.in -@@ -138,6 +138,12 @@ - #endif - - -+/* Define to warn for use of native system header directories */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_POISON_SYSTEM_DIRECTORIES -+#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. */ -Index: gcc-4.9-20140316/gcc/configure -=================================================================== ---- gcc-4.9-20140316.orig/gcc/configure -+++ gcc-4.9-20140316/gcc/configure -@@ -928,6 +928,7 @@ with_system_zlib - enable_maintainer_mode - enable_link_mutex - enable_version_specific_runtime_libs -+enable_poison_system_directories - enable_plugin - enable_host_shared - enable_libquadmath_support -@@ -1648,6 +1649,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 -@@ -27702,6 +27705,19 @@ if test "${enable_version_specific_runti - 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}" = "xyes"; then -+ -+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h -+ -+fi -+ - # Substitute configuration variables - - -Index: gcc-4.9-20140316/gcc/configure.ac -=================================================================== ---- gcc-4.9-20140316.orig/gcc/configure.ac -+++ gcc-4.9-20140316/gcc/configure.ac -@@ -5366,6 +5366,16 @@ AC_ARG_ENABLE(version-specific-runtime-l - [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]),, -+ [enable_poison_system_directories=no]) -+if test "x${enable_poison_system_directories}" = "xyes"; then -+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], -+ [1], -+ [Define to warn for use of native system header directories]) -+fi -+ - # Substitute configuration variables - AC_SUBST(subdirs) - AC_SUBST(srcdir) -Index: gcc-4.9-20140316/gcc/doc/invoke.texi -=================================================================== ---- gcc-4.9-20140316.orig/gcc/doc/invoke.texi -+++ gcc-4.9-20140316/gcc/doc/invoke.texi -@@ -260,6 +260,7 @@ Objective-C and Objective-C++ Dialects}. - -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol - -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol - -Wpointer-arith -Wno-pointer-to-int-cast @gol -+-Wno-poison-system-directories @gol - -Wredundant-decls -Wno-return-local-addr @gol - -Wreturn-type -Wsequence-point -Wshadow @gol - -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol -@@ -4230,6 +4231,14 @@ headers---for that, @option{-Wunknown-pr - 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 -Index: gcc-4.9-20140316/gcc/gcc.c -=================================================================== ---- gcc-4.9-20140316.orig/gcc/gcc.c -+++ gcc-4.9-20140316/gcc/gcc.c -@@ -764,6 +764,8 @@ proper position among the other output f - "%{fuse-ld=*:-fuse-ld=%*}\ - %X %{o*} %{e*} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \ -+ %{Wno-poison-system-directories:--no-poison-system-directories}\ -+ %{Werror=poison-system-directories:--error-poison-system-directories}\ - %{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\ - %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ - %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\ -Index: gcc-4.9-20140316/gcc/incpath.c -=================================================================== ---- gcc-4.9-20140316.orig/gcc/incpath.c -+++ gcc-4.9-20140316/gcc/incpath.c -@@ -28,6 +28,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. */ -@@ -382,6 +383,24 @@ merge_include_chains (const char *sysroo - } - fprintf (stderr, _("End of search list.\n")); - } -+ -+#ifdef ENABLE_POISON_SYSTEM_DIRECTORIES -+ if (flag_poison_system_directories) -+ { -+ struct cpp_dir *p; -+ -+ for (p = heads[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))) -+ 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/cross/gcc4-armhf/APKBUILD b/cross/gcc4-armhf/APKBUILD deleted file mode 100644 index b654dd75a..000000000 --- a/cross/gcc4-armhf/APKBUILD +++ /dev/null @@ -1,534 +0,0 @@ -# Automatically generated aport, do not edit! -# Generator: pmbootstrap aportgen gcc4-armhf -# Based on: main/gcc4 (from postmarketOS) -CTARGET_ARCH=armhf -CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" -LANG_D=false -LANG_OBJC=false -LANG_JAVA=false -LANG_GO=false -LANG_FORTRAN=false -LANG_ADA=false -options="!strip" - -# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH" -# when this variable matches "no*" -BOOTSTRAP="nobuildbase" - -# abuild will only cross compile when this variable is set, but it -# needs to find a valid package database in there for dependency -# resolving, so we set it to /. -CBUILDROOT="/" - -_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" - -maintainer="" -pkgname=gcc4-armhf -pkgver=9999 -_pkgver=4.9.4 -pkgrel=10 -pkgdesc="Stage2 cross-compiler for armhf" -url="http://gcc.gnu.org" -# loongarch64: not supported -# ppc64le, riscv64: doesn't build -arch="x86_64" -license="GPL-2.0-or-later AND LGPL-2.1-or-later" -_gccrel=$_pkgver-r$pkgrel -depends="binutils-armhf mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" -makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" -makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf" -options="!strip !tracedeps toolchain" - -# We only care about C, so we can compile old Linux kernels -LANG_CXX=false -LANG_OBJC=false -LANG_JAVA=false -LANG_GO=false -LANG_FORTRAN=false -LANG_ADA=false - -LIBGOMP="false" -LIBGCC="false" -LIBATOMIC="false" -LIBITM="false" - -if [ "$CHOST" != "$CTARGET" ]; then - if [ "$BOOTSTRAP" = nolibc ]; then - LANG_CXX=false - LANG_ADA=false - LIBGCC=false - _builddir="$srcdir/build-cross-pass2" - else - _builddir="$srcdir/build-cross-final" - fi - LANG_OBJC=false - LANG_JAVA=false - LANG_GO=false - LANG_FORTRAN=false - LIBGOMP=false - LIBATOMIC=false - LIBITM=false - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 4 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" - unset CPPFLAGS - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - STRIP_FOR_TARGET="$CTARGET-strip" -elif [ "$CBUILD" != "$CHOST" ]; then - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 4 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" - unset CPPFLAGS - - # reset flags and cc for build - export CC_FOR_BUILD="gcc" - export CXX_FOR_BUILD="g++" - export CFLAGS_FOR_BUILD=" " - export CXXFLAGS_FOR_BUILD=" " - export LDFLAGS_FOR_BUILD=" " - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - # Languages that do not need bootstrapping - LANG_OBJC=false - LANG_JAVA=false - LANG_GO=false - LANG_FORTRAN=false - - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build-cross-native" -else - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build" - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 4 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" - unset CPPFLAGS - # https://gcc.gnu.org/install/build.html - export CFLAGS_FOR_TARGET="$CFLAGS" - export CXXFLAGS_FOR_TARGET="$CXXFLAGS" - export LDFLAGS_FOR_TARGET="$LDFLAGS" - export BOOT_CFLAGS="$CFLAGS" - export BOOT_LDFLAGS="$LDFLAGS" -fi - -# Go needs {set,make,swap}context, unimplemented in musl -[ "$CTARGET_LIBC" = musl ] && LANG_GO=false - -# libitm has TEXTRELs in ARM build, so disable for now -case "$CTARGET_ARCH" in -arm*) LIBITM=false ;; -mips*) LIBITM=false ;; -esac - -# Fortran uses libquadmath if toolchain has __float128 -# currently on x86, x86_64 and ia64 -LIBQUADMATH=$LANG_FORTRAN -case "$CTARGET_ARCH" in -x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;; -*) LIBQUADMATH=false ;; -esac - -# libatomic is a dependency for openvswitch -$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH" -$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH" -$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH" -if $LIBGOMP; then - depends="$depends libgomp=$_gccrel" - subpackages="$subpackages libgomp::$CTARGET_ARCH" -fi - -_languages=c -if $LANG_CXX; then - _languages="$_languages,c++" -fi -if $LANG_OBJC; then - subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc" - _languages="$_languages,objc" -fi -if $LANG_JAVA; then - subpackages="$subpackages libgcj::$CTARGET_ARCH gcc-java$_target:java" - _languages="$_languages,java" -fi -if $LANG_GO; then - subpackages="$subpackages libgo::$CTARGET_ARCH gcc-go$_target:go" - _languages="$_languages,go" -fi -if $LANG_FORTRAN; then - subpackages="$subpackages libgfortran::$CTARGET_ARCH gfortran$_target:gfortran" - _languages="$_languages,fortran" -fi -if $LANG_ADA; then - subpackages="$subpackages libgnat::$CTARGET_ARCH gcc-gnat$_target:gnat" - _languages="$_languages,ada" - makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross" -fi -makedepends="$makedepends_build $makedepends_host" - -source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkgbase:-$_pkgver}.tar.gz - http://sourceware.org/pub/java/ecj-4.9.jar - - 01_all_gcc49_configure.patch - 02_all_gcc48_config.in.patch - 03_all_gcc49_Makefile.in.patch - 05_all_gcc48_gcc.c.patch - 16_all_gcc47_nopie_option.patch - 20_all_gcc49_config_crtbeginp.patch - 24_all_gcc49_invoke.texi.patch - 34_all_gcc48_config_i386.patch - 35_all_gcc48_config_arm.patch - 40_all_gcc49_config_esp.patch - 41_all_gcc49_config_esp_alpine.patch - - 12_all_default-warn-trampolines.patch - 15_all_libgfortran-Werror.patch - 16_all_libgomp-Werror.patch - 48_all_x86_pr53113_libitm-avx.patch - 50_all_libiberty-asprintf.patch - 51_all_libiberty-pic.patch - 67_all_gcc-poison-system-directories.patch - - gcc49-cloog-dl.patch - gcc-ice-hack.patch - gcc-spec-env.patch - libgcc-always-build-gcceh.a.patch - gcc-4.6-pr32219.patch - gcc-4.9-musl.patch - gcc-4.8-musl-fix-iteratephdr.patch - gcc-4.8-musl-libssp.patch - boehm-gc-uclibc.patch - boehm-gc-musl.patch - gcc-pure64.patch - fix-gcj-musl.patch - fix-gcj-iconv-musl.patch - musl-posix_memalign-c++.patch - pr63740.patch - - gcc-4.8-build-args.patch - fix-cxxflags-passing.patch - fix-cxxflags-for-target.patch - ada-no-pie.patch - ada-fixes.patch - ada-shared.patch - ada-musl.patch - - vanilla.specs - hardenednossp.specs - hardenednopie.specs - hardenednopiessp.specs - - 1001-fix-reload1-compile-error.patch - " - -# we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase:-$_pkgver} -_gcclibdir=/usr/lib/gcc/${CTARGET}/$_pkgver -_gcclibexec=/usr/libexec/gcc/${CTARGET}/$_pkgver - -prepare() { - cd "$_gccdir" - - _err= - for i in $source; do - case "$i" in - *.patch) - msg "Applying $i" - patch -p1 -F3 -i "$srcdir"/$i || _err="$_err $i" - ;; - esac - done - - if [ -n "$_err" ]; then - error "The following patches failed:" - for i in $_err; do - echo " $i" - done - return 1 - fi - - # see http://gcc.gnu.org/ml/java/2008-04/msg00027.html - mv "$srcdir"/ecj-*.jar ecj.jar - - echo ${_pkgver} > gcc/BASE-VER -} - -build() { - local _arch_configure= - local _libc_configure= - local _bootstrap_configure= - local _symvers= - - cd "$_gccdir" - - case "$CTARGET" in - aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64";; - armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --with-abi=aapcs-linux";; - armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6zk --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=hard --with-abi=aapcs-linux";; - armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";; - mips-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - mips64-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mips64el-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mipsel-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";; - powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no --enable-targets=powerpcle-linux";; - i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";; - i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=generic --enable-cld";; - s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";; - esac - - case "$CTARGET_ARCH" in - mips*) _hash_style_configure="--with-linker-hash-style=sysv" ;; - *) _hash_style_configure="--with-linker-hash-style=gnu" ;; - esac - - case "$CTARGET_LIBC" in - musl) - # musl does not support mudflap, or libsanitizer - # libmpx uses secure_getenv and struct _libc_fpstate not present in musl - # alpine musl provides libssp_nonshared.a, so we don't need libssp either - _libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer" - _symvers="--disable-symvers" - export libat_cv_have_ifunc=no - ;; - esac - - - case "$BOOTSTRAP" in - nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;; - *) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;; - esac - - $LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" - $LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" - $LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath" - - msg "Building the following:" - echo "" - echo " CBUILD=$CBUILD" - echo " CHOST=$CHOST" - echo " CTARGET=$CTARGET" - echo " CTARGET_ARCH=$CTARGET_ARCH" - echo " CTARGET_LIBC=$CTARGET_LIBC" - echo " languages=$_languages" - echo " arch_configure=$_arch_configure" - echo " libc_configure=$_libc_configure" - echo " cross_configure=$_cross_configure" - echo " bootstrap_configure=$_bootstrap_configure" - echo " hash_style_configure=$_hash_style_configure" - echo "" - - mkdir -p "$_builddir" - cd "$_builddir" - "$_gccdir"/configure --prefix=/usr/gcc4 \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ - --build=${CBUILD} \ - --host=${CHOST} \ - --target=${CTARGET} \ - --with-pkgversion="postmarketOS ${_pkgver}" \ - --enable-checking=release \ - --disable-fixed-point \ - --disable-libstdcxx-pch \ - \ - --disable-bootstrap \ - --disable-libstdcxx \ - \ - --disable-multilib \ - --disable-nls \ - --disable-werror \ - $_symvers \ - --enable-__cxa_atexit \ - --enable-default-pie \ - --enable-cloog-backend \ - --enable-languages=$_languages \ - $_arch_configure \ - $_libc_configure \ - $_cross_configure \ - $_bootstrap_configure \ - --with-system-zlib \ - $_hash_style_configure - make -} - -package() { - cd "$_builddir" - make -j1 DESTDIR="${pkgdir}" install - - local prefix=/usr/gcc4 - if [ "$CHOST" = "$CTARGET" ]; then - # gcc symlinks - ln -s gcc "$pkgdir$prefix"/bin/cc - ln -s gcc "$pkgdir$prefix"/bin/gcc4 - fi - - # remove docs - rm -r "$pkgdir/usr/share/" - - # we don't support gcj -static - # and saving 35MB is not bad. - find "$pkgdir" -name libgcj.a -o -name libgtkpeer.a \ - -o -name libgjsmalsa.a -o -name libgcj-tools.a \ - -o -name libjvm.a -o -name libgij.a -o -name libgcj_bc.a \ - -o -name libjavamath.a \ - | xargs rm -f - - # strip debug info from some static libs - ${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \ - -o -name libmudflap.a -o -name libmudflapth.a \ - -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \ - -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \ - -o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \ - -a -type f` - - if $LANG_JAVA; then - sed -i -e 's/lib: /&%{static:%eJava programs cannot be linked statically}/' \ - "$pkgdir"/usr/lib/libgcj.spec - fi - - if [ "$CHOST" != "$CTARGET" ]; then - # cross-gcc: remove any files that would conflict with the - # native gcc package - rm -rf "$pkgdir$prefix"/bin/cc \ - "$pkgdir$prefix"/include \ - "$pkgdir$prefix"/share - # libcc1 does not depend on target, don't ship it - rm -rf "$pkgdir$prefix"/lib/libcc1.so* - - # fixup gcc library symlinks to be linker scripts so - # linker finds the libs from relocated sysroot - for so in "$pkgdir$prefix"/$CTARGET/lib/*.so; do - if [ -h "$so" ]; then - local _real=$(basename $(readlink "$so")) - rm -f "$so" - echo "GROUP ($_real)" > "$so" - fi - done - - # Link binutils binaries to /usr/gcc4 - # This is the path GCC4 will look for them, if we don't create these - # symlinks, it will use the native binutils instead (which is of course - # failing and causes many headaches). See also: '-B' in 'man gcc'. - echo "Link binutils binaries to /usr/gcc4" - mkdir -p "$pkgdir$prefix/$CTARGET/bin" - for i in "as" "ld"; do - ln -sv "/usr/$CTARGET/bin/$i" \ - "$pkgdir$prefix/$CTARGET/bin/$i" - done - - # Link binutils to gcc4-* (so 'CROSS_COMPILE=gcc4-...' works) - echo "Link binutils to gcc4-*" - mkdir -p "$pkgdir/usr/bin" - for i in "elfedit" "gprof" "addr2line" "strings" "as" "ld" "size" "ld.bfd" \ - "readelf" "nm" "ar" "strip" "dwp" "objdump" "objcopy" "c++filt" "ranlib"; do - ln -sv "/usr/bin/$CTARGET-$i" \ - "$pkgdir/usr/bin/gcc4-$CTARGET-$i" - done - fi - - # Link all binaries from /usr/gcc4/bin/* to /usr/bin/gcc4-* - echo "Link all gcc binaries to /usr/bin/gcc4-*" - mkdir -p "$pkgdir"/usr/bin - cd "$pkgdir$prefix/bin/" - for i in *; do - ln -sv "$prefix/bin/$i" "$pkgdir/usr/bin/gcc4-$i" - done -} - -sha512sums=" -ca0f589f33987755195e81a9c7a83f797cfe5775fca908d025eb3ddbe8857edd666d272c2e97088c1808b268c5785326b72f2a340a277f6aa2c9bfe22c02ad69 gcc-4.9.4.tar.gz -28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar -618a8d037ccad15e60182acc9c85ba844cb9b5800a22ece0b814e43541b01b4e390a2847f86debb351f4b05580241747fde87e86a17060744e7bb2b9a3dc5bd4 01_all_gcc49_configure.patch -21770259c7916e55568027926e4a543eea468b04436cc61c28f749be5a6635c48e68b7924a8eb19a76733a9d2f00921ba06faddaedbf14b1cdad5ab1810cc6c6 02_all_gcc48_config.in.patch -3afe2cc407b5440333d9517daca3257e08a7318695d20645a9186cafac53afa6d0c075af67398ff7abd06250567cc6c751e6dabb65a310eef9a5d981e910aa25 03_all_gcc49_Makefile.in.patch -e98cc321d71e5bb62c6116b30ed6f11044bda440e238026a83dec63f04a0587440bdae50ec211b07976fcd9deb329f9dd1dac1317dae5003088a8a8bddbb97c1 05_all_gcc48_gcc.c.patch -98a4da3137177c5cad7dd7d35ad39cd416aa36f07867714e09ab8c0d8b759d2659063aa87b16ac1b708a283afd2ac54e20b327a32d1147720996d7bc11dcbd63 16_all_gcc47_nopie_option.patch -8fc6f2fd921c560fb1d7ba17b5cef4ea8071ee6909d372e41201667c011f948560fa543b1246cf55c0009622abf0dbc0bd79f718a853f2f0b59290e3df2c2968 20_all_gcc49_config_crtbeginp.patch -32bfe9c1f6f566de72c93388622001ff4b95086ea6f476bdfc08403ea474f98212f7396bc75d88a79a053159f78dca922ec6f641f83d9959ad419b0d8901b504 24_all_gcc49_invoke.texi.patch -dd5b9b30eb7716cb3c010ca79a83ed6219ff6e6f2557deb4e1d26cecac0f2b14c4ef7bf4dc5c2aec88aae5463763f5f64454b8a627ebd1d0a5c92984017025ad 34_all_gcc48_config_i386.patch -8829f85323d8b11e26e3c19ced4a51875fc63f1483cfdc4d0f579a6cb37e1b6e23fcf33a87a574a6e0007250374ea46d117a136e73a40fbe43f0e39d9b2dd1a8 35_all_gcc48_config_arm.patch -976994900d20a448b97fa91e1d758b6da6d8ad9121b3dbc2e8f66ff8006d8e496cd3dddc41394db6c4d20366d56fe12375b97f494d6fb9abb8e64ab626acc2ef 40_all_gcc49_config_esp.patch -e2d027be2e76a64a607ae44566d163bcc2a03c9e14d5bd20cd8bb15c2e9e395d8964b747a6a9c49541a5d1613d721855b73d60cce7c834427b44788fa92d44dc 41_all_gcc49_config_esp_alpine.patch -5069e4b741488913a646a9b5d871af8e7f7a606158ea09305d0ddd46257c5b659770627bc2ca3abeaae039da1717b3ba6c9cd90554a441da74eb4ecf24c13074 12_all_default-warn-trampolines.patch -c18a99b7303a734fe4dca9d4e90e21d18e5bd71c7d91e1a26c86b1354c73f567590a875941bfe64ce59f0393023b91c606c96b30885c55b98a790c3ab0c84ca7 15_all_libgfortran-Werror.patch -433404fd9bfa172d69fff4a5505e8648cbbbf5f052d2b4235608ff7af0c4063d557d25d80c85c5bd0d1e1ed64b568e7bbc0cdbce11cc74db4c0189af3a01634a 16_all_libgomp-Werror.patch -ff16f259fff8d78230593eee8641eab5a72c5c517c6ac5f09597edbc624d964b33f185a0dd5772d6029f757a5edb66431b3eab77dac71e76a0ef155bb7443d2c 48_all_x86_pr53113_libitm-avx.patch -c6c314a2d24531b4286436dec7189f83e443c4cfa9b88339a4c324c2d40812d766ed44dcfd4a0c3b67695bb76969a4d8a9784ff95876ceba23def305ef8a48f8 50_all_libiberty-asprintf.patch -0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 51_all_libiberty-pic.patch -9b623a0b00254326596a56fff23dacc97e560823ebdf35698799fc7ab5e98984c71b7ddfceeb1589bbbdd1ba89a742cd7becf8f70f0081dfc26bcef4198b1b5d 67_all_gcc-poison-system-directories.patch -9c6aa6d7f096c3aaebbe21d52967872195aea130b51d60a1934255b00bf1b23d24ec598c7763152f987f7999da9e56f512d169958666a3133641de3780a75d3f gcc49-cloog-dl.patch -7242876e4bba34235f6f3ea960d72439638bd31547284ca96cb94c97a2d46dd7b38a3709fd159cf86efa1e8a44e3e9125fe82bc3a1cc71153591755827d6c9fd gcc-ice-hack.patch -ce9c1f923e2c6d17347ec2d3d8482351a9644194b2753627389294d43bb4f11b9c2ef41eda1b46ad83d09901a0bedebd5b6b8a57a198646030ab61e8d2d8cb48 gcc-spec-env.patch -d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch -9fc5e32f2573ae67b6cf22119d636d10a47c42718635bceff7d457a93a3f664ae1ed10e154f70964ba2d26b0de04f879a8c05de6411112760d40433373dd0a80 gcc-4.6-pr32219.patch -e2be926c0ed4d67587857652678253a2a4e42294009a0c4b9fc420e53b0e6d44d1a2c6c2c62db837bc010470e9e62eb4af1ba7f51ff507c41e40922cd022dd26 gcc-4.9-musl.patch -b5b0210dfaccfe0b06f0a9090666b1fae2a3faa4140b7930146b29531f0da9beb1f2c1f7e7bc2bd29179f9fe05dc30e246e96220b8ff75a90f75e8350c9058a1 gcc-4.8-musl-fix-iteratephdr.patch -e6d9b103c128e5d4eca515b1496d78b05708de770597c883daddd95ea41e77b5ef1be613b989357cc870a7efd9e43b011022c2d302e7056cff7b69e764906ff2 gcc-4.8-musl-libssp.patch -e1d6a450dfb40b134ad7f759c4c10174d2490b0093fe47cb33479245f26a3a8c54ebcf6255943c0ccfcb5095600d1c05e530baeed35609c8ffe75caac8e57c49 boehm-gc-uclibc.patch -bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch -4a5aeff0399782c752e6e3f2f48d984b2056dfb5d229b23a24eee1562d241339989b2203f139821cfc03c9b25c9bd7da6ccbbdc7a09d242e4de7f0d606c6f63c gcc-pure64.patch -f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d452e9579924a523bc75da6e0648c1c976d42e40af48b10343b fix-gcj-musl.patch -54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 fix-gcj-iconv-musl.patch -7de81fc8c7eb36690949eb30082515454978440a8f389b12407ac5e9125ef6824d6059ffb5b063ab1ccc6c4827b1a6a0984b538f056b85e3171800a6f723ec8b musl-posix_memalign-c++.patch -095281d940ad7504ed7071cc9800d81db33eb4aa5465696ef7b12bf1213dbdfa701f4392095c5167b331c38219b19d25a0798524b319f1c77aa8522d76d8c92c pr63740.patch -abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch -35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch -c731f4aaaa65c8950e1b2bd9331410f92d378fd8c7e718532dccaa27ee11984d51d74216c3611e89a802325b81d7f184116839dce2dab50cae9b643c20a82fe7 fix-cxxflags-for-target.patch -e80a08de4b43fb71f7699bcce360cd99bc525dab20b9109e7152bd211def5d8e728f88771ed59f15ed520cbf069364debc4f822c10a1abf7e2c7badd67e1c83c ada-no-pie.patch -b37195a126476775e2ef16e0adc9173664c514339fb319f628debd8a4133fa53e022278387c68fc260cf813e58602617e9e629ea8177133bfdf5972398fe1c55 ada-fixes.patch -3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch -76d7d35066534c332956a88da84a95c8c54c6e0742c3c46e6b256395bf67f7c167b5ecd47fbed697fb1c9d7a41016c99e7dcd06465516a0e963707a0eab8f8b6 ada-musl.patch -83a0996a48096032bcc674a6d28524f1cd2d81837621ebe4c15b5aedbd551c77ce5576b6307adb673ef0e4ac0431d935ad6a427edca2af5c21b6be9176bfaddb vanilla.specs -e4d38905527c500c61c421d782a8ac6ef2b034b15fd81d868486ac330a70922937d3c47e0684e9f3250744569b56a8df199499a4a5c107a6d544dca84458dc12 hardenednossp.specs -b56f7c308c5aefd0cfc647abd75939508a6640c53fce7c19da7c7d8ef4405d29b0d88800117fc7ff8d0022b035d511fb6d478e745bb2ed12a1b63f9f8cf3e168 hardenednopie.specs -f5ac7282201006548ed2bd835234af64d6f79f13f0b9a3410f5c794537e0ea91601361ae72180f49870b6b0f9af5f16002c86660feb94df346b9b1d9602e9d3a hardenednopiessp.specs -6f3d708269cc3f1d28ad9af8cd1206753b7d4ddde6589c303ce201d34b531f1abb73a14032a7f8e16c5ec3041e0c227b3451c09b1952a58893a64a2765d12a00 1001-fix-reload1-compile-error.patch -" diff --git a/cross/gcc4-armhf/ada-fixes.patch b/cross/gcc4-armhf/ada-fixes.patch deleted file mode 100644 index c302f5be5..000000000 --- a/cross/gcc4-armhf/ada-fixes.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- gcc-4.8.1/gcc/ada/terminals.c.orig -+++ gcc-4.8.1/gcc/ada/terminals.c -@@ -984,13 +984,6 @@ - #include - #include - --/* On some system termio is either absent or including it will disable termios -- (HP-UX) */ --#if ! defined (__hpux__) && ! defined (FREEBSD) && \ -- ! defined (__APPLE__) && ! defined(__rtems__) --# include --#endif -- - #include - #include - #include -@@ -1078,7 +1078,7 @@ - char *slave_name = NULL; - - #ifdef USE_GETPT -- master_fd = getpt (); -+ master_fd = posix_openpt (O_RDWR); - #elif defined (USE_OPENPTY) - status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); - #elif defined (USE_CLONE_DEVICE) -@@ -1179,7 +1170,7 @@ - int status; - - /* ensure that s is filled with 0 */ -- bzero (&s, sizeof (&s)); -+ bzero (&s, sizeof (s)); - - /* Get the current terminal settings */ - status = tcgetattr (fd, &s); ---- gcc-4.8.1/gcc/ada/cal.c.orig -+++ gcc-4.8.1/gcc/ada/cal.c -@@ -65,6 +65,7 @@ - #include - #else - #include -+#include - #endif - - #ifdef __MINGW32__ diff --git a/cross/gcc4-armhf/ada-musl.patch b/cross/gcc4-armhf/ada-musl.patch deleted file mode 100644 index a94f0e744..000000000 --- a/cross/gcc4-armhf/ada-musl.patch +++ /dev/null @@ -1,136 +0,0 @@ -diff -ru gcc-4.9.2/gcc/ada/adaint.c gcc-4.9.2/gcc/ada/adaint.c ---- gcc-4.9.2/gcc/ada/adaint.c 2014-02-24 18:51:58.000000000 -0200 -+++ gcc-4.9.2/gcc/ada/adaint.c 2014-12-10 12:05:44.621173474 -0200 -@@ -67,6 +67,11 @@ - #include - #endif - -+#if defined (linux) -+#define _GNU_SOURCE 1 -+#include -+#endif -+ - #ifdef VMS - #define _POSIX_EXIT 1 - #define HOST_EXECUTABLE_SUFFIX ".exe" -@@ -3891,8 +3896,6 @@ - return (void *) syscall (__NR_gettid); - } - --#include -- - /* glibc versions earlier than 2.7 do not define the routines to handle - dynamically allocated CPU sets. For these targets, we use the static - versions. */ -@@ -3901,7 +3904,7 @@ - - /* Dynamic cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count) - { - return CPU_ALLOC (count); -@@ -3914,33 +3917,33 @@ - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { -- CPU_FREE (set); -+ CPU_FREE ((cpu_set_t *) set); - } - - void --__gnat_cpu_zero (size_t count, cpu_set_t *set) -+__gnat_cpu_zero (size_t count, void *set) - { -- CPU_ZERO_S (count, set); -+ CPU_ZERO_S (count, (cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET_S (cpu - 1, count, set); -+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set); - } - - #else /* !CPU_ALLOC */ - - /* Static cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED) - { -- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t)); -+ return xmalloc (sizeof (cpu_set_t)); - } - - size_t -@@ -3950,23 +3953,23 @@ - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { - free (set); - } - - void --__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set) - { -- CPU_ZERO (set); -+ CPU_ZERO ((cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET (cpu - 1, set); -+ CPU_SET (cpu - 1, (cpu_set_t *) set); - } - #endif /* !CPU_ALLOC */ - #endif /* linux */ -diff -ru gcc-4.9.2/gcc/ada/adaint.h gcc-4.9.2/gcc/ada/adaint.h ---- gcc-4.9.2/gcc/ada/adaint.h 2014-02-24 18:51:58.000000000 -0200 -+++ gcc-4.9.2/gcc/ada/adaint.h 2014-12-10 12:03:48.377834174 -0200 -@@ -266,13 +266,11 @@ - - /* Routines for interface to required CPU set primitives */ - --#include -- --extern cpu_set_t *__gnat_cpu_alloc (size_t); -+extern void * __gnat_cpu_alloc (size_t); - extern size_t __gnat_cpu_alloc_size (size_t); --extern void __gnat_cpu_free (cpu_set_t *); --extern void __gnat_cpu_zero (size_t, cpu_set_t *); --extern void __gnat_cpu_set (int, size_t, cpu_set_t *); -+extern void __gnat_cpu_free (void *); -+extern void __gnat_cpu_zero (size_t, void *); -+extern void __gnat_cpu_set (int, size_t, void *); - #endif - - #if defined (_WIN32) ---- gcc-4.9.2/gcc/ada/gcc-interface/Makefile.in.orig 2014-12-11 08:16:33.364902456 -0200 -+++ gcc-4.9.2/gcc/ada/gcc-interface/Makefile.in 2014-12-11 08:16:51.998236755 -0200 -@@ -1948,7 +1948,7 @@ - endif - - # ARM linux, GNU eabi --ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),) -+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),) - LIBGNAT_TARGET_PAIRS = \ - a-intnam.ads - # undef __KERNEL__ --# else -+# elif defined(__GLIBC__) - /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */ - /* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */ - /* prototypes, so we have to include the top-level sigcontext.h to */ ---- gcc-4.8.2/boehm-gc/dyn_load.c.orig 2014-02-17 14:13:09.519850231 +0200 -+++ gcc-4.8.2/boehm-gc/dyn_load.c 2014-02-17 14:14:27.906093514 +0200 -@@ -459,9 +459,7 @@ - /* For glibc 2.2.4+. Unfortunately, it doesn't work for older */ - /* versions. Thanks to Jakub Jelinek for most of the code. */ - --# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \ -- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ -- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) -+# if (defined(LINUX) || defined (__GLIBC__)) - - /* We have the header files for a glibc that includes dl_iterate_phdr. */ - /* It may still not be available in the library on the target system. */ ---- gcc-4.8.2/boehm-gc/include/private/gcconfig.h.orig 2014-02-17 14:14:36.026049422 +0200 -+++ gcc-4.8.2/boehm-gc/include/private/gcconfig.h 2014-02-17 14:17:11.345207887 +0200 -@@ -684,7 +684,7 @@ - # ifdef __ELF__ - # define DYNAMIC_LOADING - # include --# if defined(__GLIBC__)&& __GLIBC__>=2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else /* !GLIBC2 */ - extern char **__environ; -@@ -1147,7 +1147,7 @@ - # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) - # endif - # include --# if defined(__GLIBC__) && __GLIBC__ >= 2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else - extern char **__environ; -@@ -1367,7 +1367,7 @@ - # define HBLKSIZE 4096 - # endif - # define USE_GENERIC_PUSH_REGS --# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2 -+# if 1 - # define LINUX_STACKBOTTOM - # else - # define STACKBOTTOM 0x80000000 -@@ -1858,7 +1858,7 @@ - # ifdef __ELF__ - # define DYNAMIC_LOADING - # include --# if defined(__GLIBC__) && __GLIBC__ >= 2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else - extern char **__environ; diff --git a/cross/gcc4-armhf/boehm-gc-uclibc.patch b/cross/gcc4-armhf/boehm-gc-uclibc.patch deleted file mode 100644 index 0fa688410..000000000 --- a/cross/gcc4-armhf/boehm-gc-uclibc.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./boehm-gc/include/gc.h.orig -+++ ./boehm-gc/include/gc.h -@@ -503,7 +503,7 @@ - #if defined(__linux__) || defined(__GLIBC__) - # include - # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \ -- && !defined(__ia64__) -+ && !defined(__ia64__) && !defined(__UCLIBC__) - # ifndef GC_HAVE_BUILTIN_BACKTRACE - # define GC_HAVE_BUILTIN_BACKTRACE - # endif diff --git a/cross/gcc4-armhf/fix-cxxflags-for-target.patch b/cross/gcc4-armhf/fix-cxxflags-for-target.patch deleted file mode 100644 index 24dafe74b..000000000 --- a/cross/gcc4-armhf/fix-cxxflags-for-target.patch +++ /dev/null @@ -1,5 +0,0 @@ ---- gcc-4.8.1/config/mt-gnu.orig -+++ gcc-4.8.1/config/mt-gnu -@@ -1 +1 @@ --CXXFLAGS_FOR_TARGET = $(CXXFLAGS) -D_GNU_SOURCE -+CXXFLAGS_FOR_TARGET := $(CXXFLAGS_FOR_TARGET) -D_GNU_SOURCE diff --git a/cross/gcc4-armhf/fix-cxxflags-passing.patch b/cross/gcc4-armhf/fix-cxxflags-passing.patch deleted file mode 100644 index 8eb1de77d..000000000 --- a/cross/gcc4-armhf/fix-cxxflags-passing.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- gcc-4.8.1/Makefile.in.orig -+++ gcc-4.8.1/Makefile.in -@@ -169,6 +169,7 @@ - # built for the build system to override those in BASE_FLAGS_TO_PASSS. - 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. diff --git a/cross/gcc4-armhf/fix-gcj-iconv-musl.patch b/cross/gcc4-armhf/fix-gcj-iconv-musl.patch deleted file mode 100644 index b0015751e..000000000 --- a/cross/gcc4-armhf/fix-gcj-iconv-musl.patch +++ /dev/null @@ -1,120 +0,0 @@ ---- gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc.orig 2014-02-18 18:46:14.897880526 +0200 -+++ gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc 2014-02-18 18:50:08.766613550 +0200 -@@ -24,6 +24,13 @@ - - #ifdef HAVE_ICONV - #include -+#include -+ -+#if __BYTE_ORDER == __BIG_ENDIAN -+#define UCS2_CHARSET "UCS-2BE" -+#else -+#define UCS2_CHARSET "UCS-2LE" -+#endif - - template - static inline size_t -@@ -45,7 +52,7 @@ - _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer); - buffer[len] = '\0'; - -- iconv_t h = iconv_open ("UCS-2", buffer); -+ iconv_t h = iconv_open (UCS2_CHARSET, buffer); - if (h == (iconv_t) -1) - throw new ::java::io::UnsupportedEncodingException (encoding); - -@@ -99,18 +106,6 @@ - throw new ::java::io::CharConversionException (); - } - -- if (iconv_byte_swap) -- { -- size_t max = (old_out - outavail) / sizeof (jchar); -- for (size_t i = 0; i < max; ++i) -- { -- // Byte swap. -- jchar c = (((out[outpos + i] & 0xff) << 8) -- | ((out[outpos + i] >> 8) & 0xff)); -- outbuf[i] = c; -- } -- } -- - inpos += old_in - inavail; - return (old_out - outavail) / sizeof (jchar); - #else /* HAVE_ICONV */ -@@ -145,7 +140,7 @@ - _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer); - buffer[len] = '\0'; - -- iconv_t h = iconv_open (buffer, "UCS-2"); -+ iconv_t h = iconv_open (buffer, UCS2_CHARSET); - if (h == (iconv_t) -1) - throw new ::java::io::UnsupportedEncodingException (encoding); - -@@ -187,20 +182,6 @@ - char *inbuf = (char *) &chars[inpos]; - char *outbuf = (char *) &out[count]; - -- if (iconv_byte_swap) -- { -- // Ugly performance penalty -- don't use losing systems! -- temp_buffer = (jchar *) _Jv_Malloc (inlength * sizeof (jchar)); -- for (int i = 0; i < inlength; ++i) -- { -- // Byte swap. -- jchar c = (((chars[inpos + i] & 0xff) << 8) -- | ((chars[inpos + i] >> 8) & 0xff)); -- temp_buffer[i] = c; -- } -- inbuf = (char *) temp_buffer; -- } -- - size_t loop_old_in = old_in; - while (1) - { -@@ -252,44 +233,7 @@ - jboolean - gnu::gcj::convert::IOConverter::iconv_init (void) - { -- // Some versions of iconv() always return their UCS-2 results in -- // big-endian order, and they also require UCS-2 inputs to be in -- // big-endian order. For instance, glibc 2.1.3 does this. If the -- // UTF-8=>UCS-2 iconv converter has this feature, then we assume -- // that all UCS-2 converters do. (This might not be the best -- // heuristic, but is is all we've got.) -- jboolean result = false; --#ifdef HAVE_ICONV -- iconv_t handle = iconv_open ("UCS-2", "UTF-8"); -- if (handle != (iconv_t) -1) -- { -- jchar c; -- unsigned char in[4]; -- char *inp, *outp; -- size_t inc, outc, r; -- -- // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv -- // needs the trailing NUL byte, otherwise iconv fails with EINVAL. -- in[0] = 0xef; -- in[1] = 0xbb; -- in[2] = 0xbf; -- in[3] = 0x00; -- -- inp = (char *) in; -- inc = 4; -- outp = (char *) &c; -- outc = 2; -- -- r = iconv_adapter (iconv, handle, &inp, &inc, &outp, &outc); -- // Conversion must be complete for us to use the result. -- if (r != (size_t) -1 && inc == 0 && outc == 0) -- result = (c != 0xfeff); -- -- // Release iconv handle. -- iconv_close (handle); -- } --#endif /* HAVE_ICONV */ -- return result; -+ return false; - } - - void diff --git a/cross/gcc4-armhf/fix-gcj-musl.patch b/cross/gcc4-armhf/fix-gcj-musl.patch deleted file mode 100644 index d26f510c0..000000000 --- a/cross/gcc4-armhf/fix-gcj-musl.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc.orig 2014-02-18 10:55:08.617678779 +0200 -+++ gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc 2014-02-18 10:56:31.927227453 +0200 -@@ -289,7 +289,7 @@ - // just default to `en_US'. - setlocale (LC_ALL, ""); - char *locale = setlocale (LC_MESSAGES, ""); -- if (locale && strlen (locale) >= 2) -+ if (locale && strlen (locale) >= 2 && (locale[2] == '\0' || locale[2] == '_')) - { - char buf[3]; - buf[2] = '\0'; ---- gcc-4.8.2/libjava/posix-threads.cc.orig 2014-02-18 13:22:01.789933726 +0200 -+++ gcc-4.8.2/libjava/posix-threads.cc 2014-02-18 13:29:50.924058875 +0200 -@@ -657,6 +657,7 @@ - struct sched_param param; - pthread_attr_t attr; - struct starter *info; -+ size_t ss; - - if (data->flags & FLAG_START) - return; -@@ -675,8 +676,25 @@ - // Set stack size if -Xss option was given. - if (gcj::stack_size > 0) - { -- int e = pthread_attr_setstacksize (&attr, gcj::stack_size); -+ ss = gcj::stack_size; -+ } -+ else -+ { -+ int e = pthread_attr_getstacksize (&attr, &ss); -+ if (e != 0) -+ JvFail (strerror (e)); -+ -+ // Request at least 1meg of stack -+ if (ss >= 1024 * 1024) -+ ss = 0; -+ else -+ ss = 1024 * 1024; -+ } -+ -+ if (ss) -+ { -+ int e = pthread_attr_setstacksize (&attr, ss); - if (e != 0) - JvFail (strerror (e)); - } - - info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter)); diff --git a/cross/gcc4-armhf/gcc-4.6-pr32219.patch b/cross/gcc4-armhf/gcc-4.6-pr32219.patch deleted file mode 100644 index 8233e5b23..000000000 --- a/cross/gcc4-armhf/gcc-4.6-pr32219.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ./gcc/varasm.c.orig -+++ ./gcc/varasm.c -@@ -6758,6 +6758,10 @@ - /* Static variables are always local. */ - else if (! TREE_PUBLIC (exp)) - local_p = true; -+ /* Weak data can be overridden by a strong symbol -+ in another module and so are not local. */ -+ else if (DECL_WEAK (exp)) -+ local_p = false; - /* A variable is local if the user has said explicitly that it will - be. */ - else if ((DECL_VISIBILITY_SPECIFIED (exp) -@@ -6771,11 +6775,6 @@ - local. */ - else if (DECL_VISIBILITY (exp) != VISIBILITY_DEFAULT) - local_p = true; -- /* Default visibility weak data can be overridden by a strong symbol -- in another module and so are not local. */ -- else if (DECL_WEAK (exp) -- && !resolved_locally) -- local_p = false; - /* If PIC, then assume that any global name can be overridden by - symbols resolved from other modules. */ - else if (shlib) diff --git a/cross/gcc4-armhf/gcc-4.8-build-args.patch b/cross/gcc4-armhf/gcc-4.8-build-args.patch deleted file mode 100644 index c27e00961..000000000 --- a/cross/gcc4-armhf/gcc-4.8-build-args.patch +++ /dev/null @@ -1,41 +0,0 @@ -When cross compiling a target gcc, target flags may be used on the host - -Configure identifies a number of warning flags (WARN_CFLAGS and -WARN_CXXFLAGS) from the $CC value. The cross compiler may be different -from the host compiler and may not support the same set of flags. This -leads to problems such as: - -cc1plus: error: unrecognized command line option "-Wno-narrowing" -cc1plus: error: unrecognized command line option "-Wno-overlength-strings" - -Work around this problem by removing the warning flags from the -BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS. - -Upstream-Status: Pending - -Signed-off-by: Mark Hatle - -Index: gcc-4.8.0/gcc/configure -=================================================================== ---- gcc-4.8.0.orig/gcc/configure -+++ gcc-4.8.0/gcc/configure -@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - -Index: gcc-4.8.0/gcc/configure.ac -=================================================================== ---- gcc-4.8.0.orig/gcc/configure.ac -+++ gcc-4.8.0/gcc/configure.ac -@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - diff --git a/cross/gcc4-armhf/gcc-4.8-musl-fix-iteratephdr.patch b/cross/gcc4-armhf/gcc-4.8-musl-fix-iteratephdr.patch deleted file mode 100644 index b06597ec7..000000000 --- a/cross/gcc4-armhf/gcc-4.8-musl-fix-iteratephdr.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- gcc-4.8.1/gcc/configure.ac.orig 2013-09-25 04:08:25.046595893 +0000 -+++ gcc-4.8.1/gcc/configure.ac 2013-09-25 04:09:06.023263205 +0000 -@@ -4822,7 +4822,7 @@ - gcc_cv_target_dl_iterate_phdr=no - fi - ;; -- *-linux-musl*) -+ *-linux-musl* | *-linux-uclibc* | *-linux-gnu*) - gcc_cv_target_dl_iterate_phdr=yes - ;; - esac ---- gcc-4.8.1/gcc/configure.orig 2013-09-25 04:08:17.826596392 +0000 -+++ gcc-4.8.1/gcc/configure 2013-09-25 04:09:24.393263387 +0000 -@@ -26923,7 +26923,7 @@ - gcc_cv_target_dl_iterate_phdr=no - fi - ;; -- *-linux-musl*) -+ *-linux-musl* | *-linux-uclibc* | *-linux-gnu*) - gcc_cv_target_dl_iterate_phdr=yes - ;; - esac diff --git a/cross/gcc4-armhf/gcc-4.8-musl-libssp.patch b/cross/gcc4-armhf/gcc-4.8-musl-libssp.patch deleted file mode 100644 index 88725c8e4..000000000 --- a/cross/gcc4-armhf/gcc-4.8-musl-libssp.patch +++ /dev/null @@ -1,21 +0,0 @@ -Author: Timo Teräs - -Alpine musl package provides libssp_nonshared.a. We link to it unconditionally, -as otherwise we get link failures if some objects are -fstack-protector built -and final link happens with -fno-stack-protector. This seems to be the common -case when bootstrapping gcc, the piepatches do not seem to fully fix the -crosstoolchain and bootstrap sequence wrt. stack-protector flag usage. - ---- gcc-4.8.1/gcc/gcc.c.orig 2013-09-24 06:27:32.133894539 +0000 -+++ gcc-4.8.1/gcc/gcc.c 2013-09-24 06:29:35.790562854 +0000 -@@ -656,7 +656,9 @@ - #endif - - #ifndef LINK_SSP_SPEC --#ifdef TARGET_LIBC_PROVIDES_SSP -+#if DEFAULT_LIBC == LIBC_MUSL -+#define LINK_SSP_SPEC "-lssp_nonshared" -+#elif defined(TARGET_LIBC_PROVIDES_SSP) - #define LINK_SSP_SPEC "%{fstack-protector:}" - #else - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}" diff --git a/cross/gcc4-armhf/gcc-4.9-musl.patch b/cross/gcc4-armhf/gcc-4.9-musl.patch deleted file mode 100644 index 06381ce08..000000000 --- a/cross/gcc4-armhf/gcc-4.9-musl.patch +++ /dev/null @@ -1,703 +0,0 @@ -# HG changeset patch -# Parent 2f9df662aaaba956600bbdb123b6a227c8e64c59 -Use the generic implementation of libstdc++ primitives when we're on musl, not the glibc one. - -diff -r 2f9df662aaab libstdc++-v3/configure.host ---- a/libstdc++-v3/configure.host Tue May 20 11:00:21 2014 -0400 -+++ b/libstdc++-v3/configure.host Tue May 20 11:05:42 2014 -0400 -@@ -264,6 +264,13 @@ - os_include_dir="os/bsd/freebsd" - ;; - gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) -+ # check for musl by target -+ case "${host_os}" in -+ *-musl*) -+ os_include_dir="os/generic" -+ ;; -+ *) -+ - if [ "$uclibc" = "yes" ]; then - os_include_dir="os/uclibc" - elif [ "$bionic" = "yes" ]; then -@@ -272,6 +279,9 @@ - os_include_dir="os/gnu-linux" - fi - ;; -+ -+ esac -+ ;; - hpux*) - os_include_dir="os/hpux" - ;; -# HG changeset patch -# Parent b6f4ce05a3155dbcbc06d72aebdb67e2f8abc094 -Adding -mmusl as a musl libc specifier, and the necessary hacks for it to know how to find musl's dynamic linker. - -diff -r b6f4ce05a315 gcc/config.gcc ---- a/gcc/config.gcc Tue May 20 11:05:42 2014 -0400 -+++ b/gcc/config.gcc Tue May 20 11:05:45 2014 -0400 -@@ -594,7 +594,7 @@ - esac - - # Common C libraries. --tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" -+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4" - - # 32-bit x86 processors supported by --with-arch=. Each processor - # MUST be separated by exactly one space. -@@ -719,6 +719,9 @@ - *-*-*uclibc*) - tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC" - ;; -+ *-*-*musl*) -+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL" -+ ;; - *) - tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC" - ;; -diff -r b6f4ce05a315 gcc/config/linux.h ---- a/gcc/config/linux.h Tue May 20 11:05:42 2014 -0400 -+++ b/gcc/config/linux.h Tue May 20 11:05:45 2014 -0400 -@@ -32,10 +32,12 @@ - #define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC) - #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC) - #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC) -+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL) - #else - #define OPTION_GLIBC (linux_libc == LIBC_GLIBC) - #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC) - #define OPTION_BIONIC (linux_libc == LIBC_BIONIC) -+#define OPTION_MUSL (linux_libc == LIBC_MUSL) - #endif - - #define GNU_USER_TARGET_OS_CPP_BUILTINS() \ -@@ -53,18 +55,21 @@ - uClibc or Bionic is the default C library and whether - -muclibc or -mglibc or -mbionic has been passed to change the default. */ - --#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \ -- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}" -+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \ -+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}" - - #if DEFAULT_LIBC == LIBC_GLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ -- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B) -+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ -+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M) - #elif DEFAULT_LIBC == LIBC_UCLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ -- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B) -+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ -+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M) - #elif DEFAULT_LIBC == LIBC_BIONIC --#define CHOOSE_DYNAMIC_LINKER(G, U, B) \ -- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U) -+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ -+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M) -+#elif DEFAULT_LIBC == LIBC_MUSL -+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \ -+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B) - #else - #error "Unsupported DEFAULT_LIBC" - #endif /* DEFAULT_LIBC */ -@@ -84,21 +89,92 @@ - - #define GNU_USER_DYNAMIC_LINKER \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \ -- BIONIC_DYNAMIC_LINKER) -+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) - #define GNU_USER_DYNAMIC_LINKER32 \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \ -- BIONIC_DYNAMIC_LINKER32) -+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) - #define GNU_USER_DYNAMIC_LINKER64 \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \ -- BIONIC_DYNAMIC_LINKER64) -+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) - #define GNU_USER_DYNAMIC_LINKERX32 \ - CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \ -- BIONIC_DYNAMIC_LINKERX32) -+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32) - - /* Whether we have Bionic libc runtime */ - #undef TARGET_HAS_BIONIC - #define TARGET_HAS_BIONIC (OPTION_BIONIC) - -+/* musl avoids problematic includes by rearranging the include directories. -+ * Unfortunately, this is mostly duplicated from cppdefault.c */ -+#if DEFAULT_LIBC == LIBC_MUSL -+#define INCLUDE_DEFAULTS_MUSL_GPP \ -+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \ -+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \ -+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \ -+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \ -+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "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 }, -+#else -+#define INCLUDE_DEFAULTS_MUSL_LOCAL -+#endif -+ -+#ifdef PREFIX_INCLUDE_DIR -+#define INCLUDE_DEFAULTS_MUSL_PREFIX \ -+ { PREFIX_INCLUDE_DIR, 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}, -+#else -+#define INCLUDE_DEFAULTS_MUSL_CROSS -+#endif -+ -+#ifdef TOOL_INCLUDE_DIR -+#define INCLUDE_DEFAULTS_MUSL_TOOL \ -+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0}, -+#else -+#define INCLUDE_DEFAULTS_MUSL_TOOL -+#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 }, -+#else -+#define INCLUDE_DEFAULTS_MUSL_NATIVE -+#endif -+ -+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT) -+# undef INCLUDE_DEFAULTS_MUSL_LOCAL -+# define INCLUDE_DEFAULTS_MUSL_LOCAL -+# undef INCLUDE_DEFAULTS_MUSL_NATIVE -+# define INCLUDE_DEFAULTS_MUSL_NATIVE -+#else -+# undef INCLUDE_DEFAULTS_MUSL_CROSS -+# define INCLUDE_DEFAULTS_MUSL_CROSS -+#endif -+ -+#undef INCLUDE_DEFAULTS -+#define INCLUDE_DEFAULTS \ -+ { \ -+ INCLUDE_DEFAULTS_MUSL_GPP \ -+ INCLUDE_DEFAULTS_MUSL_PREFIX \ -+ INCLUDE_DEFAULTS_MUSL_CROSS \ -+ INCLUDE_DEFAULTS_MUSL_TOOL \ -+ INCLUDE_DEFAULTS_MUSL_NATIVE \ -+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \ -+ { 0, 0, 0, 0, 0, 0 } \ -+ } -+#endif -+ - #if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */ - /* This is a *uclinux* target. We don't define below macros to normal linux - versions, because doing so would require *uclinux* targets to include -diff -r b6f4ce05a315 gcc/config/linux.opt ---- a/gcc/config/linux.opt Tue May 20 11:05:42 2014 -0400 -+++ b/gcc/config/linux.opt Tue May 20 11:05:45 2014 -0400 -@@ -30,3 +30,7 @@ - muclibc - Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic) - Use uClibc C library -+ -+mmusl -+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc) -+Use musl C library -diff -r b6f4ce05a315 gcc/ginclude/stddef.h ---- a/gcc/ginclude/stddef.h Tue May 20 11:05:42 2014 -0400 -+++ b/gcc/ginclude/stddef.h Tue May 20 11:05:45 2014 -0400 -@@ -181,6 +181,7 @@ - #ifndef _GCC_SIZE_T - #ifndef _SIZET_ - #ifndef __size_t -+#ifndef __DEFINED_size_t /* musl */ - #define __size_t__ /* BeOS */ - #define __SIZE_T__ /* Cray Unicos/Mk */ - #define _SIZE_T -@@ -197,6 +198,7 @@ - #define ___int_size_t_h - #define _GCC_SIZE_T - #define _SIZET_ -+#define __DEFINED_size_t /* musl */ - #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ - || defined(__FreeBSD_kernel__) - /* __size_t is a typedef on FreeBSD 5, must not trash it. */ -@@ -214,6 +216,7 @@ - typedef long ssize_t; - #endif /* __BEOS__ */ - #endif /* !(defined (__GNUG__) && defined (size_t)) */ -+#endif /* __DEFINED_size_t */ - #endif /* __size_t */ - #endif /* _SIZET_ */ - #endif /* _GCC_SIZE_T */ -# HG changeset patch -# Parent 65d595ef9fc3cdbbde4894d927593f1b0f5bbcb7 -A fix for libgomp to correctly request a POSIX version for time support. - -diff -r 65d595ef9fc3 libgomp/config/posix/time.c ---- a/libgomp/config/posix/time.c Tue May 20 11:05:45 2014 -0400 -+++ b/libgomp/config/posix/time.c Tue May 20 11:05:48 2014 -0400 -@@ -28,6 +28,8 @@ - The following implementation uses the most simple POSIX routines. - If present, POSIX 4 clocks should be used instead. */ - -+#define _POSIX_C_SOURCE 199309L /* for clocks */ -+ - #include "libgomp.h" - #include - #if TIME_WITH_SYS_TIME -diff -r 95f4f1d7668b libgcc/unwind-dw2-fde-dip.c ---- a/libgcc/unwind-dw2-fde-dip.c Tue May 20 11:05:48 2014 -0400 -+++ b/libgcc/unwind-dw2-fde-dip.c Tue May 20 11:05:52 2014 -0400 -@@ -46,33 +46,13 @@ - #include "unwind-compat.h" - #include "gthr.h" - --#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ -- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ -- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) -+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) && defined(TARGET_DL_ITERATE_PHDR) - # define USE_PT_GNU_EH_FRAME --#endif -- --#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ -- && defined(__BIONIC__) --# define USE_PT_GNU_EH_FRAME --#endif -- --#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ -- && defined(__FreeBSD__) && __FreeBSD__ >= 7 --# define ElfW __ElfN --# define USE_PT_GNU_EH_FRAME --#endif -- --#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ -- && defined(__OpenBSD__) --# define ElfW(type) Elf_##type --# define USE_PT_GNU_EH_FRAME --#endif -- --#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ -- && defined(TARGET_DL_ITERATE_PHDR) \ -- && defined(__sun__) && defined(__svr4__) --# define USE_PT_GNU_EH_FRAME -+# ifdef __OpenBSD__ -+# define ElfW(type) Elf_##type -+# elif defined(__FreeBSD__) && __FreeBSD__ >= 7 -+# define ElfW __ElfN -+# endif - #endif - - #if defined(USE_PT_GNU_EH_FRAME) -diff -r ff03fa61c6b3 gcc/configure ---- a/gcc/configure Tue May 20 11:05:51 2014 -0400 -+++ b/gcc/configure Tue May 20 11:05:55 2014 -0400 -@@ -27300,6 +27300,9 @@ - else - gcc_cv_libc_provides_ssp=no - case "$target" in -+ *-*-musl*) -+ # All versions of musl provide stack protector -+ gcc_cv_libc_provides_ssp=yes;; - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) - # glibc 2.4 and later provides __stack_chk_fail and - # either __stack_chk_guard, or TLS access to stack guard canary. -@@ -27332,6 +27335,7 @@ - # ) and for now - # simply assert that glibc does provide this, which is true for all - # realistically usable GNU/Hurd configurations. -+ # All supported versions of musl provide it as well - gcc_cv_libc_provides_ssp=yes;; - *-*-darwin* | *-*-freebsd*) - ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail" -@@ -27421,6 +27425,9 @@ - gcc_cv_target_dl_iterate_phdr=no - fi - ;; -+ *-linux-musl*) -+ gcc_cv_target_dl_iterate_phdr=yes -+ ;; - esac - - if test x$gcc_cv_target_dl_iterate_phdr = xyes; then -diff -r ff03fa61c6b3 gcc/configure.ac ---- a/gcc/configure.ac Tue May 20 11:05:51 2014 -0400 -+++ b/gcc/configure.ac Tue May 20 11:05:55 2014 -0400 -@@ -5001,6 +5001,9 @@ - gcc_cv_libc_provides_ssp, - [gcc_cv_libc_provides_ssp=no - case "$target" in -+ *-*-musl*) -+ # All versions of musl provide stack protector -+ gcc_cv_libc_provides_ssp=yes;; - *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) - # glibc 2.4 and later provides __stack_chk_fail and - # either __stack_chk_guard, or TLS access to stack guard canary. -@@ -5027,6 +5030,7 @@ - # ) and for now - # simply assert that glibc does provide this, which is true for all - # realistically usable GNU/Hurd configurations. -+ # All supported versions of musl provide it as well - gcc_cv_libc_provides_ssp=yes;; - *-*-darwin* | *-*-freebsd*) - AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes], -@@ -5093,6 +5097,9 @@ - gcc_cv_target_dl_iterate_phdr=no - fi - ;; -+ *-linux-musl*) -+ gcc_cv_target_dl_iterate_phdr=yes -+ ;; - esac - GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR]) - if test x$gcc_cv_target_dl_iterate_phdr = xyes; then -# HG changeset patch -# Parent 26f591b9e77e3df3d0f772b840bd9c13ec24bd4c -Get rid of ever-broken fixincludes on musl. - -diff -r 26f591b9e77e fixincludes/mkfixinc.sh ---- a/fixincludes/mkfixinc.sh Tue May 20 11:05:55 2014 -0400 -+++ b/fixincludes/mkfixinc.sh Tue May 20 11:05:58 2014 -0400 -@@ -19,7 +19,8 @@ - powerpc-*-eabi* | \ - powerpc-*-rtems* | \ - powerpcle-*-eabisim* | \ -- powerpcle-*-eabi* ) -+ powerpcle-*-eabi* | \ -+ *-musl* ) - # IF there is no include fixing, - # THEN create a no-op fixer and exit - (echo "#! /bin/sh" ; echo "exit 0" ) > ${target} -# HG changeset patch -# Parent bc117c35705fcc39396c19af046101411f251161 -Support for i386-linux-musl and x86_64-linux-musl. - -diff -r bc117c35705f gcc/config/i386/linux.h ---- a/gcc/config/i386/linux.h Tue May 20 11:05:58 2014 -0400 -+++ b/gcc/config/i386/linux.h Tue May 20 11:06:01 2014 -0400 -@@ -21,3 +21,4 @@ - - #define GNU_USER_LINK_EMULATION "elf_i386" - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1" -diff -r bc117c35705f gcc/config/i386/linux64.h ---- a/gcc/config/i386/linux64.h Tue May 20 11:05:58 2014 -0400 -+++ b/gcc/config/i386/linux64.h Tue May 20 11:06:01 2014 -0400 -@@ -30,3 +30,7 @@ - #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 MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1" -+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1" -+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1" -diff -r bc117c35705f libitm/config/linux/x86/tls.h ---- a/libitm/config/linux/x86/tls.h Tue May 20 11:05:58 2014 -0400 -+++ b/libitm/config/linux/x86/tls.h Tue May 20 11:06:01 2014 -0400 -@@ -25,16 +25,19 @@ - #ifndef LIBITM_X86_TLS_H - #define LIBITM_X86_TLS_H 1 - --#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) -+#if defined(__GLIBC_PREREQ) -+#if __GLIBC_PREREQ(2, 10) - /* Use slots in the TCB head rather than __thread lookups. - GLIBC has reserved words 10 through 13 for TM. */ - #define HAVE_ARCH_GTM_THREAD 1 - #define HAVE_ARCH_GTM_THREAD_DISP 1 - #endif -+#endif - - #include "config/generic/tls.h" - --#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) -+#if defined(__GLIBC_PREREQ) -+#if __GLIBC_PREREQ(2, 10) - namespace GTM HIDDEN { - - #ifdef __x86_64__ -@@ -101,5 +104,6 @@ - - } // namespace GTM - #endif /* >= GLIBC 2.10 */ -+#endif - - #endif // LIBITM_X86_TLS_H -# HG changeset patch -# Parent 933c4f064622eb96a0b2ab213abd0cddbd977d1a -Support for arm-linux-musl. - -diff -r 933c4f064622 gcc/config/arm/linux-eabi.h ---- a/gcc/config/arm/linux-eabi.h Tue May 20 11:06:01 2014 -0400 -+++ b/gcc/config/arm/linux-eabi.h Tue May 20 11:06:04 2014 -0400 -@@ -77,6 +77,23 @@ - %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \ - %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}" - -+/* For ARM musl currently supports four dynamic linkers: -+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI -+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI -+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB -+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB -+ musl does not support the legacy OABI mode. -+ All the dynamic linkers live in /lib. -+ We default to soft-float, EL. */ -+#undef MUSL_DYNAMIC_LINKER -+#if TARGET_BIG_ENDIAN_DEFAULT -+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}" -+#else -+#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}.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. */ - #undef LINK_SPEC -diff -r 933c4f064622 libitm/config/arm/hwcap.cc ---- a/libitm/config/arm/hwcap.cc Tue May 20 11:06:01 2014 -0400 -+++ b/libitm/config/arm/hwcap.cc Tue May 20 11:06:04 2014 -0400 -@@ -40,7 +40,11 @@ - - #ifdef __linux__ - #include -+#ifdef __GLIBC__ - #include -+#else -+#include -+#endif - #include - - static void __attribute__((constructor)) -# HG changeset patch -# Parent 03fe896f3acaa911e935a8e999d15c7542ee73d1 -Support for mips-linux-musl. - -diff -r 03fe896f3aca gcc/config/mips/linux.h ---- a/gcc/config/mips/linux.h Tue May 20 11:06:04 2014 -0400 -+++ b/gcc/config/mips/linux.h Tue May 20 11:06:08 2014 -0400 -@@ -23,3 +23,10 @@ - #undef UCLIBC_DYNAMIC_LINKER - #define UCLIBC_DYNAMIC_LINKER \ - "%{mnan=2008:/lib/ld-uClibc-mipsn8.so.0;:/lib/ld-uClibc.so.0}" -+ -+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */ -+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}" -+#else -+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}" -+#endif -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips" MUSL_DYNAMIC_LINKER_E ".so.1" -# HG changeset patch -# Parent 6097333f2ab47a4ce37ccfb18b0f07a0cdcfec49 -Support for powerpc-linux-musl. - -diff -r 6097333f2ab4 gcc/config.gcc ---- a/gcc/config.gcc Tue May 20 11:06:08 2014 -0400 -+++ b/gcc/config.gcc Tue May 20 11:06:11 2014 -0400 -@@ -2326,6 +2326,10 @@ - powerpc*-*-linux*paired*) - tm_file="${tm_file} rs6000/750cl.h" ;; - esac -+ case ${target} in -+ *-linux*-musl*) -+ enable_secureplt=yes ;; -+ esac - if test x${enable_secureplt} = xyes; then - tm_file="rs6000/secureplt.h ${tm_file}" - fi -diff -r 6097333f2ab4 gcc/config/rs6000/linux64.h ---- a/gcc/config/rs6000/linux64.h Tue May 20 11:06:08 2014 -0400 -+++ b/gcc/config/rs6000/linux64.h Tue May 20 11:06:11 2014 -0400 -@@ -375,17 +375,21 @@ - #endif - #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0" - #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0" -+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1" -+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1" - #if DEFAULT_LIBC == LIBC_UCLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" - #elif DEFAULT_LIBC == LIBC_GLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" -+#elif DEFAULT_LIBC == LIBC_MUSL -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" - #else - #error "Unsupported DEFAULT_LIBC" - #endif - #define GNU_USER_DYNAMIC_LINKER32 \ -- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32) -+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32) - #define GNU_USER_DYNAMIC_LINKER64 \ -- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64) -+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64) - - #undef DEFAULT_ASM_ENDIAN - #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) -diff -r 6097333f2ab4 gcc/config/rs6000/secureplt.h ---- a/gcc/config/rs6000/secureplt.h Tue May 20 11:06:08 2014 -0400 -+++ b/gcc/config/rs6000/secureplt.h Tue May 20 11:06:11 2014 -0400 -@@ -18,3 +18,4 @@ - . */ - - #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt" -+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt" -diff -r 6097333f2ab4 gcc/config/rs6000/sysv4.h ---- a/gcc/config/rs6000/sysv4.h Tue May 20 11:06:08 2014 -0400 -+++ b/gcc/config/rs6000/sysv4.h Tue May 20 11:06:11 2014 -0400 -@@ -537,6 +537,9 @@ - #ifndef CC1_SECURE_PLT_DEFAULT_SPEC - #define CC1_SECURE_PLT_DEFAULT_SPEC "" - #endif -+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC -+#define LINK_SECURE_PLT_DEFAULT_SPEC "" -+#endif - - /* Pass -G xxx to the compiler. */ - #define CC1_SPEC "%{G*} %(cc1_cpu)" \ -@@ -585,7 +588,8 @@ - - /* Override the default target of the linker. */ - #define LINK_TARGET_SPEC \ -- ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") -+ ENDIAN_SELECT("", " --oformat elf32-powerpcle", "") \ -+ "%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}" - - /* Any specific OS flags. */ - #define LINK_OS_SPEC "\ -@@ -763,15 +767,18 @@ - - #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" - #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1" - #if DEFAULT_LIBC == LIBC_UCLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}" -+#elif DEFAULT_LIBC == LIBC_MUSL -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}" - #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC --#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" -+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}" - #else - #error "Unsupported DEFAULT_LIBC" - #endif - #define GNU_USER_DYNAMIC_LINKER \ -- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) -+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER) - - #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ - %{rdynamic:-export-dynamic} \ -@@ -894,6 +901,7 @@ - { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ - { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ - { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ -+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \ - { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ - { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ - { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ -diff -r 813971b9f083 gcc/config/aarch64/aarch64-linux.h ---- a/gcc/config/aarch64/aarch64-linux.h Tue May 20 11:06:11 2014 -0400 -+++ b/gcc/config/aarch64/aarch64-linux.h Tue May 20 11:06:14 2014 -0400 -@@ -23,6 +23,8 @@ - - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}.so.1" - -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64.so.1" -+ - #define CPP_SPEC "%{pthread:-D_REENTRANT}" - - #define LINUX_TARGET_LINK_SPEC "%{h*} \ -# HG changeset patch -# Parent 4a62a6813db995fe195d47ff73234d455975ac30 -Microblaze support (again). - -diff -r 4a62a6813db9 gcc/config/microblaze/linux.h ---- a/gcc/config/microblaze/linux.h Tue May 20 11:06:14 2014 -0400 -+++ b/gcc/config/microblaze/linux.h Tue May 20 11:06:17 2014 -0400 -@@ -25,7 +25,22 @@ - #undef TLS_NEEDS_GOT - #define TLS_NEEDS_GOT 1 - --#define DYNAMIC_LINKER "/lib/ld.so.1" -+#if TARGET_BIG_ENDIAN_DEFAULT == 0 /* LE */ -+#define MUSL_DYNAMIC_LINKER_E "%{EB:;:el}" -+#else -+#define MUSL_DYNAMIC_LINKER_E "%{EL:el}" -+#endif -+ -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-microblaze" MUSL_DYNAMIC_LINKER_E ".so.1" -+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" -+ -+#if DEFAULT_LIBC == LIBC_MUSL -+#define DYNAMIC_LINKER MUSL_DYNAMIC_LINKER -+#else -+#define DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER -+#endif -+ -+ - #undef SUBTARGET_EXTRA_SPECS - #define SUBTARGET_EXTRA_SPECS \ - { "dynamic_linker", DYNAMIC_LINKER } -From 478ee0c03a08e2ef9371fd88d516738936943e78 Mon Sep 17 00:00:00 2001 -From: David Holsgrove -Date: Fri, 28 Sep 2012 16:32:03 +1000 -Subject: [PATCH 06/11] [Patch, microblaze]: Add SIZE_TYPE and PTRDIFF_TYPE to - microblaze.h - -Fixes warnings like; - -warning: format '%zX' expects argument of type 'size_t', -but argument 3 has type 'unsigned int' [-Wformat] - -Changelog - -2013-03-18 David Holsgrove - - * gcc/config/microblaze/microblaze.h: Define SIZE_TYPE - and PTRDIFF_TYPE. - -Signed-off-by: David Holsgrove ---- - gcc/config/microblaze/microblaze.h | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff -r 20d1c995f5de gcc/config/microblaze/microblaze.h ---- a/gcc/config/microblaze/microblaze.h Tue May 20 11:06:17 2014 -0400 -+++ b/gcc/config/microblaze/microblaze.h Tue May 20 11:06:20 2014 -0400 -@@ -218,6 +218,12 @@ - #undef PTRDIFF_TYPE - #define PTRDIFF_TYPE "int" - -+#undef SIZE_TYPE -+#define SIZE_TYPE "unsigned int" -+ -+#undef PTRDIFF_TYPE -+#define PTRDIFF_TYPE "int" -+ - #define CONSTANT_ALIGNMENT(EXP, ALIGN) \ - ((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \ - && (ALIGN) < BITS_PER_WORD \ -diff -r 2f999fc929da gcc/config/sh/linux.h ---- a/gcc/config/sh/linux.h Fri Sep 28 16:32:03 2012 +1000 -+++ b/gcc/config/sh/linux.h Tue May 20 11:06:23 2014 -0400 -@@ -43,7 +43,14 @@ - - #define TARGET_ASM_FILE_END file_end_indicate_exec_stack - -+#if TARGET_BIG_ENDIAN_DEFAULT /* BE */ -+#define MUSL_DYNAMIC_LINKER_E "eb" -+#else -+#define MUSL_DYNAMIC_LINKER_E -+#endif -+ - #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E ".so.1" - - #undef SUBTARGET_LINK_EMUL_SUFFIX - #define SUBTARGET_LINK_EMUL_SUFFIX "_linux" diff --git a/cross/gcc4-armhf/gcc-ice-hack.patch b/cross/gcc4-armhf/gcc-ice-hack.patch deleted file mode 100644 index f99323507..000000000 --- a/cross/gcc4-armhf/gcc-ice-hack.patch +++ /dev/null @@ -1,304 +0,0 @@ -# DP: Retry the build on an ice, save the calling options and preprocessed -# DP: source when the ice is reproducible. - -2004-01-23 Jakub Jelinek - - * gcc.c (execute): Don't free first string early, but at the end - of the function. Call retry_ice if compiler exited with - ICE_EXIT_CODE. - (retry_ice): New function. - * diagnostic.c (diagnostic_count_diagnostic, - diagnostic_action_after_output, error_recursion): Exit with - ICE_EXIT_CODE instead of FATAL_EXIT_CODE. - -Index: b/gcc/gcc.c -=================================================================== ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -249,6 +249,9 @@ - #if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX) - static const char *convert_filename (const char *, int, int); - #endif -+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS)) -+static void retry_ice (const char *prog, const char **argv); -+#endif - - static const char *getenv_spec_function (int, const char **); - static const char *if_exists_spec_function (int, const char **); -@@ -2771,7 +2774,7 @@ - } - } - -- if (string != commands[i].prog) -+ if (i && string != commands[i].prog) - free (CONST_CAST (char *, string)); - } - -@@ -2824,6 +2827,16 @@ - else if (WIFEXITED (status) - && WEXITSTATUS (status) >= MIN_FATAL_STATUS) - { -+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS)) -+ /* For ICEs in cc1, cc1obj, cc1plus see if it is -+ reproducible or not. */ -+ const char *p; -+ if (WEXITSTATUS (status) == ICE_EXIT_CODE -+ && i == 0 -+ && (p = strrchr (commands[0].argv[0], DIR_SEPARATOR)) -+ && ! strncmp (p + 1, "cc1", 3)) -+ retry_ice (commands[0].prog, commands[0].argv); -+#endif - if (WEXITSTATUS (status) > greatest_status) - greatest_status = WEXITSTATUS (status); - ret_code = -1; -@@ -2881,6 +2894,9 @@ - } - } - -+ if (commands[0].argv[0] != commands[0].prog) -+ free (CONST_CAST (char *, commands[0].argv[0])); -+ - return ret_code; - } - } -@@ -6034,6 +6050,227 @@ - switches[switchnum].validated = true; - } - -+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS)) -+#define RETRY_ICE_ATTEMPTS 2 -+ -+static void -+retry_ice (const char *prog, const char **argv) -+{ -+ int nargs, out_arg = -1, quiet = 0, attempt; -+ int pid, retries, sleep_interval; -+ const char **new_argv; -+ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2]; -+ -+ if (gcc_input_filename == NULL || ! strcmp (gcc_input_filename, "-")) -+ return; -+ -+ for (nargs = 0; argv[nargs] != NULL; ++nargs) -+ /* Only retry compiler ICEs, not preprocessor ones. */ -+ if (! strcmp (argv[nargs], "-E")) -+ return; -+ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o') -+ { -+ if (out_arg == -1) -+ out_arg = nargs; -+ else -+ return; -+ } -+ /* If the compiler is going to output any time information, -+ it might varry between invocations. */ -+ else if (! strcmp (argv[nargs], "-quiet")) -+ quiet = 1; -+ else if (! strcmp (argv[nargs], "-ftime-report")) -+ return; -+ -+ if (out_arg == -1 || !quiet) -+ return; -+ -+ memset (temp_filenames, '\0', sizeof (temp_filenames)); -+ new_argv = XALLOCAVEC (const char *, nargs + 3); -+ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *)); -+ new_argv[nargs++] = "-frandom-seed=0"; -+ new_argv[nargs] = NULL; -+ if (new_argv[out_arg][2] == '\0') -+ new_argv[out_arg + 1] = "-"; -+ else -+ new_argv[out_arg] = "-o-"; -+ -+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt) -+ { -+ int fd = -1; -+ int status; -+ -+ temp_filenames[attempt * 2] = make_temp_file (".out"); -+ temp_filenames[attempt * 2 + 1] = make_temp_file (".err"); -+ -+ if (attempt == RETRY_ICE_ATTEMPTS) -+ { -+ int i; -+ int fd1, fd2; -+ struct stat st1, st2; -+ size_t n, len; -+ char *buf; -+ -+ buf = XNEWVEC (char, 8192); -+ -+ for (i = 0; i < 2; ++i) -+ { -+ fd1 = open (temp_filenames[i], O_RDONLY); -+ fd2 = open (temp_filenames[2 + i], O_RDONLY); -+ -+ if (fd1 < 0 || fd2 < 0) -+ { -+ i = -1; -+ close (fd1); -+ close (fd2); -+ break; -+ } -+ -+ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0) -+ { -+ i = -1; -+ close (fd1); -+ close (fd2); -+ break; -+ } -+ -+ if (st1.st_size != st2.st_size) -+ { -+ close (fd1); -+ close (fd2); -+ break; -+ } -+ -+ len = 0; -+ for (n = st1.st_size; n; n -= len) -+ { -+ len = n; -+ if (len > 4096) -+ len = 4096; -+ -+ if (read (fd1, buf, len) != (int) len -+ || read (fd2, buf + 4096, len) != (int) len) -+ { -+ i = -1; -+ break; -+ } -+ -+ if (memcmp (buf, buf + 4096, len) != 0) -+ break; -+ } -+ -+ close (fd1); -+ close (fd2); -+ -+ if (n) -+ break; -+ } -+ -+ free (buf); -+ if (i == -1) -+ break; -+ -+ if (i != 2) -+ { -+ fnotice (stderr, "The bug is not reproducible, so it is" -+ " likely a hardware or OS problem.\n"); -+ break; -+ } -+ -+ fd = open (temp_filenames[attempt * 2], O_RDWR); -+ if (fd < 0) -+ break; -+ write (fd, "//", 2); -+ for (i = 0; i < nargs; i++) -+ { -+ write (fd, " ", 1); -+ write (fd, new_argv[i], strlen (new_argv[i])); -+ } -+ write (fd, "\n", 1); -+ new_argv[nargs] = "-E"; -+ new_argv[nargs + 1] = NULL; -+ } -+ -+ /* Fork a subprocess; wait and retry if it fails. */ -+ sleep_interval = 1; -+ pid = -1; -+ for (retries = 0; retries < 4; retries++) -+ { -+ pid = fork (); -+ if (pid >= 0) -+ break; -+ sleep (sleep_interval); -+ sleep_interval *= 2; -+ } -+ -+ if (pid < 0) -+ break; -+ else if (pid == 0) -+ { -+ if (attempt != RETRY_ICE_ATTEMPTS) -+ fd = open (temp_filenames[attempt * 2], O_RDWR); -+ if (fd < 0) -+ exit (-1); -+ if (fd != 1) -+ { -+ close (1); -+ dup (fd); -+ close (fd); -+ } -+ -+ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR); -+ if (fd < 0) -+ exit (-1); -+ if (fd != 2) -+ { -+ close (2); -+ dup (fd); -+ close (fd); -+ } -+ -+ if (prog == new_argv[0]) -+ execvp (prog, CONST_CAST2 (char *const *, const char **, new_argv)); -+ else -+ execv (new_argv[0], CONST_CAST2 (char *const *, const char **, new_argv)); -+ exit (-1); -+ } -+ -+ if (waitpid (pid, &status, 0) < 0) -+ break; -+ -+ if (attempt < RETRY_ICE_ATTEMPTS -+ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE)) -+ { -+ fnotice (stderr, "The bug is not reproducible, so it is" -+ " likely a hardware or OS problem.\n"); -+ break; -+ } -+ else if (attempt == RETRY_ICE_ATTEMPTS) -+ { -+ close (fd); -+ if (WIFEXITED (status) -+ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE) -+ { -+ fnotice (stderr, "Preprocessed source stored into %s file," -+ " please attach this to your bugreport.\n", -+ temp_filenames[attempt * 2]); -+ /* Make sure it is not deleted. */ -+ free (temp_filenames[attempt * 2]); -+ temp_filenames[attempt * 2] = NULL; -+ break; -+ } -+ } -+ } -+ -+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++) -+ if (temp_filenames[attempt]) -+ { -+ unlink (temp_filenames[attempt]); -+ free (temp_filenames[attempt]); -+ } -+} -+#endif -+ - /* Search for a file named NAME trying various prefixes including the - user's -B prefix and some standard ones. - Return the absolute file name found. If nothing is found, return NAME. */ -Index: b/gcc/diagnostic.c -=================================================================== ---- a/gcc/diagnostic.c -+++ b/gcc/diagnostic.c -@@ -455,7 +455,7 @@ - real_abort (); - diagnostic_finish (context); - fnotice (stderr, "compilation terminated.\n"); -- exit (FATAL_EXIT_CODE); -+ exit (ICE_EXIT_CODE); - - default: - gcc_unreachable (); diff --git a/cross/gcc4-armhf/gcc-pure64.patch b/cross/gcc4-armhf/gcc-pure64.patch deleted file mode 100644 index 6ff4cdc5e..000000000 --- a/cross/gcc4-armhf/gcc-pure64.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000 -+++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000 -@@ -34,6 +34,6 @@ - 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 = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) diff --git a/cross/gcc4-armhf/gcc-spec-env.patch b/cross/gcc4-armhf/gcc-spec-env.patch deleted file mode 100644 index 57e7567e5..000000000 --- a/cross/gcc4-armhf/gcc-spec-env.patch +++ /dev/null @@ -1,42 +0,0 @@ - Add support for external spec file via the GCC_SPECS env var. This - allows us to easily control pie/ssp defaults with gcc-config profiles. - - Original patch by Rob Holland - Extended to support multiple entries separated by ':' by Kevin F. Quinn - Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill - ---- gcc-4/gcc/gcc.c -+++ gcc-4/gcc/gcc.c -@@ -6482,6 +6482,32 @@ - - /* Process any user specified specs in the order given on the command - line. */ -+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) -+ /* Add specs listed in GCC_SPECS. Note; in the process of separating -+ * each spec listed, the string is overwritten at token boundaries -+ * (':') with '\0', an effect of strtok_r(). -+ */ -+ specs_file = getenv ("GCC_SPECS"); -+ if (specs_file && (strlen(specs_file) > 0)) -+ { -+ char *spec, *saveptr; -+ for (spec=strtok_r(specs_file,":",&saveptr); -+ spec!=NULL; -+ spec=strtok_r(NULL,":",&saveptr)) -+ { -+ struct user_specs *user = (struct user_specs *) -+ xmalloc (sizeof (struct user_specs)); -+ -+ user->next = (struct user_specs *) 0; -+ user->filename = spec; -+ if (user_specs_tail) -+ user_specs_tail->next = user; -+ else -+ user_specs_head = user; -+ user_specs_tail = user; -+ } -+ } -+#endif - for (uptr = user_specs_head; uptr; uptr = uptr->next) - { - char *filename = find_a_file (&startfile_prefixes, uptr->filename, diff --git a/cross/gcc4-armhf/gcc49-cloog-dl.patch b/cross/gcc4-armhf/gcc49-cloog-dl.patch deleted file mode 100644 index 93db9483e..000000000 --- a/cross/gcc4-armhf/gcc49-cloog-dl.patch +++ /dev/null @@ -1,478 +0,0 @@ -http://pkgs.fedoraproject.org/cgit/gcc.git/plain/gcc49-cloog-dl.patch - ---- a/gcc/Makefile.in.jj 2012-12-13 17:09:20.000000000 +0100 -+++ b/gcc/Makefile.in 2012-12-14 11:45:22.585670055 +0100 -@@ -1006,7 +1006,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) - # and the system's installed libraries. - LIBS = @LIBS@ libcommon.a $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \ - $(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS) --BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ -+BACKENDLIBS = $(if $(CLOOGLIBS),-ldl) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \ - $(ZLIB) - # Any system libraries needed just for GNAT. - SYSLIBS = @GNAT_LIBEXC@ -@@ -2011,6 +2011,15 @@ $(out_object_file): $(out_file) - $(common_out_object_file): $(common_out_file) - $(COMPILE) $< - $(POSTCOMPILE) -+ -+graphite%.o : \ -+ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS)) -+graphite.o : \ -+ ALL_CFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CFLAGS)) -+graphite%.o : \ -+ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS)) -+graphite.o : \ -+ ALL_CXXFLAGS := -O $(filter-out -fkeep-inline-functions, $(ALL_CXXFLAGS)) - # - # Generate header and source files from the machine description, - # and compile them. ---- a/gcc/graphite-poly.h.jj 2012-12-13 11:31:27.000000000 +0100 -+++ b/gcc/graphite-poly.h 2012-12-14 13:41:41.970800726 +0100 -@@ -22,6 +22,371 @@ along with GCC; see the file COPYING3. - #ifndef GCC_GRAPHITE_POLY_H - #define GCC_GRAPHITE_POLY_H - -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#define DYNSYMS \ -+ DYNSYM (clast_pprint); \ -+ DYNSYM (cloog_clast_create_from_input); \ -+ DYNSYM (cloog_clast_free); \ -+ DYNSYM (cloog_domain_from_isl_set); \ -+ DYNSYM (cloog_input_alloc); \ -+ DYNSYM (cloog_isl_state_malloc); \ -+ DYNSYM (cloog_options_free); \ -+ DYNSYM (cloog_options_malloc); \ -+ DYNSYM (cloog_scattering_from_isl_map); \ -+ DYNSYM (cloog_state_free); \ -+ DYNSYM (cloog_union_domain_add_domain); \ -+ DYNSYM (cloog_union_domain_alloc); \ -+ DYNSYM (cloog_union_domain_set_name); \ -+ DYNSYM (isl_aff_add_coefficient_si); \ -+ DYNSYM (isl_aff_add_constant); \ -+ DYNSYM (isl_aff_free); \ -+ DYNSYM (isl_aff_get_coefficient); \ -+ DYNSYM (isl_aff_get_space); \ -+ DYNSYM (isl_aff_mod); \ -+ DYNSYM (isl_aff_set_coefficient_si); \ -+ DYNSYM (isl_aff_set_constant_si); \ -+ DYNSYM (isl_aff_zero_on_domain); \ -+ DYNSYM (isl_band_free); \ -+ DYNSYM (isl_band_get_children); \ -+ DYNSYM (isl_band_get_partial_schedule); \ -+ DYNSYM (isl_band_has_children); \ -+ DYNSYM (isl_band_list_free); \ -+ DYNSYM (isl_band_list_get_band); \ -+ DYNSYM (isl_band_list_get_ctx); \ -+ DYNSYM (isl_band_list_n_band); \ -+ DYNSYM (isl_band_member_is_zero_distance); \ -+ DYNSYM (isl_band_n_member); \ -+ DYNSYM (isl_basic_map_add_constraint); \ -+ DYNSYM (isl_basic_map_project_out); \ -+ DYNSYM (isl_basic_map_universe); \ -+ DYNSYM (isl_constraint_set_coefficient); \ -+ DYNSYM (isl_constraint_set_coefficient_si); \ -+ DYNSYM (isl_constraint_set_constant); \ -+ DYNSYM (isl_constraint_set_constant_si); \ -+ DYNSYM (isl_ctx_alloc); \ -+ DYNSYM (isl_ctx_free); \ -+ DYNSYM (isl_equality_alloc); \ -+ DYNSYM (isl_id_alloc); \ -+ DYNSYM (isl_id_copy); \ -+ DYNSYM (isl_id_free); \ -+ DYNSYM (isl_inequality_alloc); \ -+ DYNSYM (isl_local_space_copy); \ -+ DYNSYM (isl_local_space_free); \ -+ DYNSYM (isl_local_space_from_space); \ -+ DYNSYM (isl_local_space_range); \ -+ DYNSYM (isl_map_add_constraint); \ -+ DYNSYM (isl_map_add_dims); \ -+ DYNSYM (isl_map_align_params); \ -+ DYNSYM (isl_map_apply_range); \ -+ DYNSYM (isl_map_copy); \ -+ DYNSYM (isl_map_dim); \ -+ DYNSYM (isl_map_dump); \ -+ DYNSYM (isl_map_equate); \ -+ DYNSYM (isl_map_fix_si); \ -+ DYNSYM (isl_map_flat_product); \ -+ DYNSYM (isl_map_flat_range_product); \ -+ DYNSYM (isl_map_free); \ -+ DYNSYM (isl_map_from_basic_map); \ -+ DYNSYM (isl_map_from_pw_aff); \ -+ DYNSYM (isl_map_from_union_map); \ -+ DYNSYM (isl_map_get_ctx); \ -+ DYNSYM (isl_map_get_space); \ -+ DYNSYM (isl_map_get_tuple_id); \ -+ DYNSYM (isl_map_insert_dims); \ -+ DYNSYM (isl_map_intersect); \ -+ DYNSYM (isl_map_intersect_domain); \ -+ DYNSYM (isl_map_intersect_range); \ -+ DYNSYM (isl_map_is_empty); \ -+ DYNSYM (isl_map_lex_ge); \ -+ DYNSYM (isl_map_lex_le); \ -+ DYNSYM (isl_map_n_out); \ -+ DYNSYM (isl_map_range); \ -+ DYNSYM (isl_map_set_tuple_id); \ -+ DYNSYM (isl_map_universe); \ -+ DYNSYM (isl_options_set_on_error); \ -+ DYNSYM (isl_options_set_schedule_fuse); \ -+ DYNSYM (isl_options_set_schedule_max_constant_term); \ -+ DYNSYM (isl_options_set_schedule_maximize_band_depth); \ -+ DYNSYM (isl_printer_free); \ -+ DYNSYM (isl_printer_print_aff); \ -+ DYNSYM (isl_printer_print_constraint); \ -+ DYNSYM (isl_printer_print_map); \ -+ DYNSYM (isl_printer_print_set); \ -+ DYNSYM (isl_printer_to_file); \ -+ DYNSYM (isl_pw_aff_add); \ -+ DYNSYM (isl_pw_aff_alloc); \ -+ DYNSYM (isl_pw_aff_copy); \ -+ DYNSYM (isl_pw_aff_eq_set); \ -+ DYNSYM (isl_pw_aff_free); \ -+ DYNSYM (isl_pw_aff_from_aff); \ -+ DYNSYM (isl_pw_aff_ge_set); \ -+ DYNSYM (isl_pw_aff_gt_set); \ -+ DYNSYM (isl_pw_aff_is_cst); \ -+ DYNSYM (isl_pw_aff_le_set); \ -+ DYNSYM (isl_pw_aff_lt_set); \ -+ DYNSYM (isl_pw_aff_mod); \ -+ DYNSYM (isl_pw_aff_mul); \ -+ DYNSYM (isl_pw_aff_ne_set); \ -+ DYNSYM (isl_pw_aff_nonneg_set); \ -+ DYNSYM (isl_pw_aff_set_tuple_id); \ -+ DYNSYM (isl_pw_aff_sub); \ -+ DYNSYM (isl_pw_aff_zero_set); \ -+ DYNSYM (isl_schedule_free); \ -+ DYNSYM (isl_schedule_get_band_forest); \ -+ DYNSYM (isl_set_add_constraint); \ -+ DYNSYM (isl_set_add_dims); \ -+ DYNSYM (isl_set_apply); \ -+ DYNSYM (isl_set_coalesce); \ -+ DYNSYM (isl_set_copy); \ -+ DYNSYM (isl_set_dim); \ -+ DYNSYM (isl_set_fix_si); \ -+ DYNSYM (isl_set_free); \ -+ DYNSYM (isl_set_from_cloog_domain); \ -+ DYNSYM (isl_set_get_space); \ -+ DYNSYM (isl_set_get_tuple_id); \ -+ DYNSYM (isl_set_intersect); \ -+ DYNSYM (isl_set_is_empty); \ -+ DYNSYM (isl_set_max); \ -+ DYNSYM (isl_set_min); \ -+ DYNSYM (isl_set_n_dim); \ -+ DYNSYM (isl_set_nat_universe); \ -+ DYNSYM (isl_set_project_out); \ -+ DYNSYM (isl_set_set_tuple_id); \ -+ DYNSYM (isl_set_universe); \ -+ DYNSYM (isl_space_add_dims); \ -+ DYNSYM (isl_space_alloc); \ -+ DYNSYM (isl_space_copy); \ -+ DYNSYM (isl_space_dim); \ -+ DYNSYM (isl_space_domain); \ -+ DYNSYM (isl_space_find_dim_by_id); \ -+ DYNSYM (isl_space_free); \ -+ DYNSYM (isl_space_from_domain); \ -+ DYNSYM (isl_space_get_tuple_id); \ -+ DYNSYM (isl_space_params_alloc); \ -+ DYNSYM (isl_space_range); \ -+ DYNSYM (isl_space_set_alloc); \ -+ DYNSYM (isl_space_set_dim_id); \ -+ DYNSYM (isl_space_set_tuple_id); \ -+ DYNSYM (isl_union_map_add_map); \ -+ DYNSYM (isl_union_map_align_params); \ -+ DYNSYM (isl_union_map_apply_domain); \ -+ DYNSYM (isl_union_map_apply_range); \ -+ DYNSYM (isl_union_map_compute_flow); \ -+ DYNSYM (isl_union_map_copy); \ -+ DYNSYM (isl_union_map_empty); \ -+ DYNSYM (isl_union_map_flat_range_product); \ -+ DYNSYM (isl_union_map_foreach_map); \ -+ DYNSYM (isl_union_map_free); \ -+ DYNSYM (isl_union_map_from_map); \ -+ DYNSYM (isl_union_map_get_ctx); \ -+ DYNSYM (isl_union_map_get_space); \ -+ DYNSYM (isl_union_map_gist_domain); \ -+ DYNSYM (isl_union_map_gist_range); \ -+ DYNSYM (isl_union_map_intersect_domain); \ -+ DYNSYM (isl_union_map_is_empty); \ -+ DYNSYM (isl_union_map_subtract); \ -+ DYNSYM (isl_union_map_union); \ -+ DYNSYM (isl_union_set_add_set); \ -+ DYNSYM (isl_union_set_compute_schedule); \ -+ DYNSYM (isl_union_set_copy); \ -+ DYNSYM (isl_union_set_empty); \ -+ DYNSYM (isl_union_set_from_set); \ -+ DYNSYM (stmt_ass); \ -+ DYNSYM (stmt_block); \ -+ DYNSYM (stmt_for); \ -+ DYNSYM (stmt_guard); \ -+ DYNSYM (stmt_root); \ -+ DYNSYM (stmt_user); -+extern struct cloog_pointers_s__ -+{ -+ bool inited; -+ void *h; -+#define DYNSYM(x) __typeof (x) *p_##x -+ DYNSYMS -+#undef DYNSYM -+} cloog_pointers__; -+ -+#define cloog_block_alloc (*cloog_pointers__.p_cloog_block_alloc) -+#define clast_pprint (*cloog_pointers__.p_clast_pprint) -+#define cloog_clast_create_from_input (*cloog_pointers__.p_cloog_clast_create_from_input) -+#define cloog_clast_free (*cloog_pointers__.p_cloog_clast_free) -+#define cloog_domain_from_isl_set (*cloog_pointers__.p_cloog_domain_from_isl_set) -+#define cloog_input_alloc (*cloog_pointers__.p_cloog_input_alloc) -+#define cloog_isl_state_malloc (*cloog_pointers__.p_cloog_isl_state_malloc) -+#define cloog_options_free (*cloog_pointers__.p_cloog_options_free) -+#define cloog_options_malloc (*cloog_pointers__.p_cloog_options_malloc) -+#define cloog_scattering_from_isl_map (*cloog_pointers__.p_cloog_scattering_from_isl_map) -+#define cloog_state_free (*cloog_pointers__.p_cloog_state_free) -+#define cloog_union_domain_add_domain (*cloog_pointers__.p_cloog_union_domain_add_domain) -+#define cloog_union_domain_alloc (*cloog_pointers__.p_cloog_union_domain_alloc) -+#define cloog_union_domain_set_name (*cloog_pointers__.p_cloog_union_domain_set_name) -+#define isl_aff_add_coefficient_si (*cloog_pointers__.p_isl_aff_add_coefficient_si) -+#define isl_aff_add_constant (*cloog_pointers__.p_isl_aff_add_constant) -+#define isl_aff_free (*cloog_pointers__.p_isl_aff_free) -+#define isl_aff_get_coefficient (*cloog_pointers__.p_isl_aff_get_coefficient) -+#define isl_aff_get_space (*cloog_pointers__.p_isl_aff_get_space) -+#define isl_aff_mod (*cloog_pointers__.p_isl_aff_mod) -+#define isl_aff_set_coefficient_si (*cloog_pointers__.p_isl_aff_set_coefficient_si) -+#define isl_aff_set_constant_si (*cloog_pointers__.p_isl_aff_set_constant_si) -+#define isl_aff_zero_on_domain (*cloog_pointers__.p_isl_aff_zero_on_domain) -+#define isl_band_free (*cloog_pointers__.p_isl_band_free) -+#define isl_band_get_children (*cloog_pointers__.p_isl_band_get_children) -+#define isl_band_get_partial_schedule (*cloog_pointers__.p_isl_band_get_partial_schedule) -+#define isl_band_has_children (*cloog_pointers__.p_isl_band_has_children) -+#define isl_band_list_free (*cloog_pointers__.p_isl_band_list_free) -+#define isl_band_list_get_band (*cloog_pointers__.p_isl_band_list_get_band) -+#define isl_band_list_get_ctx (*cloog_pointers__.p_isl_band_list_get_ctx) -+#define isl_band_list_n_band (*cloog_pointers__.p_isl_band_list_n_band) -+#define isl_band_member_is_zero_distance (*cloog_pointers__.p_isl_band_member_is_zero_distance) -+#define isl_band_n_member (*cloog_pointers__.p_isl_band_n_member) -+#define isl_basic_map_add_constraint (*cloog_pointers__.p_isl_basic_map_add_constraint) -+#define isl_basic_map_project_out (*cloog_pointers__.p_isl_basic_map_project_out) -+#define isl_basic_map_universe (*cloog_pointers__.p_isl_basic_map_universe) -+#define isl_constraint_set_coefficient (*cloog_pointers__.p_isl_constraint_set_coefficient) -+#define isl_constraint_set_coefficient_si (*cloog_pointers__.p_isl_constraint_set_coefficient_si) -+#define isl_constraint_set_constant (*cloog_pointers__.p_isl_constraint_set_constant) -+#define isl_constraint_set_constant_si (*cloog_pointers__.p_isl_constraint_set_constant_si) -+#define isl_ctx_alloc (*cloog_pointers__.p_isl_ctx_alloc) -+#define isl_ctx_free (*cloog_pointers__.p_isl_ctx_free) -+#define isl_equality_alloc (*cloog_pointers__.p_isl_equality_alloc) -+#define isl_id_alloc (*cloog_pointers__.p_isl_id_alloc) -+#define isl_id_copy (*cloog_pointers__.p_isl_id_copy) -+#define isl_id_free (*cloog_pointers__.p_isl_id_free) -+#define isl_inequality_alloc (*cloog_pointers__.p_isl_inequality_alloc) -+#define isl_local_space_copy (*cloog_pointers__.p_isl_local_space_copy) -+#define isl_local_space_free (*cloog_pointers__.p_isl_local_space_free) -+#define isl_local_space_from_space (*cloog_pointers__.p_isl_local_space_from_space) -+#define isl_local_space_range (*cloog_pointers__.p_isl_local_space_range) -+#define isl_map_add_constraint (*cloog_pointers__.p_isl_map_add_constraint) -+#define isl_map_add_dims (*cloog_pointers__.p_isl_map_add_dims) -+#define isl_map_align_params (*cloog_pointers__.p_isl_map_align_params) -+#define isl_map_apply_range (*cloog_pointers__.p_isl_map_apply_range) -+#define isl_map_copy (*cloog_pointers__.p_isl_map_copy) -+#define isl_map_dim (*cloog_pointers__.p_isl_map_dim) -+#define isl_map_dump (*cloog_pointers__.p_isl_map_dump) -+#define isl_map_equate (*cloog_pointers__.p_isl_map_equate) -+#define isl_map_fix_si (*cloog_pointers__.p_isl_map_fix_si) -+#define isl_map_flat_product (*cloog_pointers__.p_isl_map_flat_product) -+#define isl_map_flat_range_product (*cloog_pointers__.p_isl_map_flat_range_product) -+#define isl_map_free (*cloog_pointers__.p_isl_map_free) -+#define isl_map_from_basic_map (*cloog_pointers__.p_isl_map_from_basic_map) -+#define isl_map_from_pw_aff (*cloog_pointers__.p_isl_map_from_pw_aff) -+#define isl_map_from_union_map (*cloog_pointers__.p_isl_map_from_union_map) -+#define isl_map_get_ctx (*cloog_pointers__.p_isl_map_get_ctx) -+#define isl_map_get_space (*cloog_pointers__.p_isl_map_get_space) -+#define isl_map_get_tuple_id (*cloog_pointers__.p_isl_map_get_tuple_id) -+#define isl_map_insert_dims (*cloog_pointers__.p_isl_map_insert_dims) -+#define isl_map_intersect (*cloog_pointers__.p_isl_map_intersect) -+#define isl_map_intersect_domain (*cloog_pointers__.p_isl_map_intersect_domain) -+#define isl_map_intersect_range (*cloog_pointers__.p_isl_map_intersect_range) -+#define isl_map_is_empty (*cloog_pointers__.p_isl_map_is_empty) -+#define isl_map_lex_ge (*cloog_pointers__.p_isl_map_lex_ge) -+#define isl_map_lex_le (*cloog_pointers__.p_isl_map_lex_le) -+#define isl_map_n_out (*cloog_pointers__.p_isl_map_n_out) -+#define isl_map_range (*cloog_pointers__.p_isl_map_range) -+#define isl_map_set_tuple_id (*cloog_pointers__.p_isl_map_set_tuple_id) -+#define isl_map_universe (*cloog_pointers__.p_isl_map_universe) -+#define isl_options_set_on_error (*cloog_pointers__.p_isl_options_set_on_error) -+#define isl_options_set_schedule_fuse (*cloog_pointers__.p_isl_options_set_schedule_fuse) -+#define isl_options_set_schedule_max_constant_term (*cloog_pointers__.p_isl_options_set_schedule_max_constant_term) -+#define isl_options_set_schedule_maximize_band_depth (*cloog_pointers__.p_isl_options_set_schedule_maximize_band_depth) -+#define isl_printer_free (*cloog_pointers__.p_isl_printer_free) -+#define isl_printer_print_aff (*cloog_pointers__.p_isl_printer_print_aff) -+#define isl_printer_print_constraint (*cloog_pointers__.p_isl_printer_print_constraint) -+#define isl_printer_print_map (*cloog_pointers__.p_isl_printer_print_map) -+#define isl_printer_print_set (*cloog_pointers__.p_isl_printer_print_set) -+#define isl_printer_to_file (*cloog_pointers__.p_isl_printer_to_file) -+#define isl_pw_aff_add (*cloog_pointers__.p_isl_pw_aff_add) -+#define isl_pw_aff_alloc (*cloog_pointers__.p_isl_pw_aff_alloc) -+#define isl_pw_aff_copy (*cloog_pointers__.p_isl_pw_aff_copy) -+#define isl_pw_aff_eq_set (*cloog_pointers__.p_isl_pw_aff_eq_set) -+#define isl_pw_aff_free (*cloog_pointers__.p_isl_pw_aff_free) -+#define isl_pw_aff_from_aff (*cloog_pointers__.p_isl_pw_aff_from_aff) -+#define isl_pw_aff_ge_set (*cloog_pointers__.p_isl_pw_aff_ge_set) -+#define isl_pw_aff_gt_set (*cloog_pointers__.p_isl_pw_aff_gt_set) -+#define isl_pw_aff_is_cst (*cloog_pointers__.p_isl_pw_aff_is_cst) -+#define isl_pw_aff_le_set (*cloog_pointers__.p_isl_pw_aff_le_set) -+#define isl_pw_aff_lt_set (*cloog_pointers__.p_isl_pw_aff_lt_set) -+#define isl_pw_aff_mod (*cloog_pointers__.p_isl_pw_aff_mod) -+#define isl_pw_aff_mul (*cloog_pointers__.p_isl_pw_aff_mul) -+#define isl_pw_aff_ne_set (*cloog_pointers__.p_isl_pw_aff_ne_set) -+#define isl_pw_aff_nonneg_set (*cloog_pointers__.p_isl_pw_aff_nonneg_set) -+#define isl_pw_aff_set_tuple_id (*cloog_pointers__.p_isl_pw_aff_set_tuple_id) -+#define isl_pw_aff_sub (*cloog_pointers__.p_isl_pw_aff_sub) -+#define isl_pw_aff_zero_set (*cloog_pointers__.p_isl_pw_aff_zero_set) -+#define isl_schedule_free (*cloog_pointers__.p_isl_schedule_free) -+#define isl_schedule_get_band_forest (*cloog_pointers__.p_isl_schedule_get_band_forest) -+#define isl_set_add_constraint (*cloog_pointers__.p_isl_set_add_constraint) -+#define isl_set_add_dims (*cloog_pointers__.p_isl_set_add_dims) -+#define isl_set_apply (*cloog_pointers__.p_isl_set_apply) -+#define isl_set_coalesce (*cloog_pointers__.p_isl_set_coalesce) -+#define isl_set_copy (*cloog_pointers__.p_isl_set_copy) -+#define isl_set_dim (*cloog_pointers__.p_isl_set_dim) -+#define isl_set_fix_si (*cloog_pointers__.p_isl_set_fix_si) -+#define isl_set_free (*cloog_pointers__.p_isl_set_free) -+#define isl_set_from_cloog_domain (*cloog_pointers__.p_isl_set_from_cloog_domain) -+#define isl_set_get_space (*cloog_pointers__.p_isl_set_get_space) -+#define isl_set_get_tuple_id (*cloog_pointers__.p_isl_set_get_tuple_id) -+#define isl_set_intersect (*cloog_pointers__.p_isl_set_intersect) -+#define isl_set_is_empty (*cloog_pointers__.p_isl_set_is_empty) -+#define isl_set_max (*cloog_pointers__.p_isl_set_max) -+#define isl_set_min (*cloog_pointers__.p_isl_set_min) -+#define isl_set_n_dim (*cloog_pointers__.p_isl_set_n_dim) -+#define isl_set_nat_universe (*cloog_pointers__.p_isl_set_nat_universe) -+#define isl_set_project_out (*cloog_pointers__.p_isl_set_project_out) -+#define isl_set_set_tuple_id (*cloog_pointers__.p_isl_set_set_tuple_id) -+#define isl_set_universe (*cloog_pointers__.p_isl_set_universe) -+#define isl_space_add_dims (*cloog_pointers__.p_isl_space_add_dims) -+#define isl_space_alloc (*cloog_pointers__.p_isl_space_alloc) -+#define isl_space_copy (*cloog_pointers__.p_isl_space_copy) -+#define isl_space_dim (*cloog_pointers__.p_isl_space_dim) -+#define isl_space_domain (*cloog_pointers__.p_isl_space_domain) -+#define isl_space_find_dim_by_id (*cloog_pointers__.p_isl_space_find_dim_by_id) -+#define isl_space_free (*cloog_pointers__.p_isl_space_free) -+#define isl_space_from_domain (*cloog_pointers__.p_isl_space_from_domain) -+#define isl_space_get_tuple_id (*cloog_pointers__.p_isl_space_get_tuple_id) -+#define isl_space_params_alloc (*cloog_pointers__.p_isl_space_params_alloc) -+#define isl_space_range (*cloog_pointers__.p_isl_space_range) -+#define isl_space_set_alloc (*cloog_pointers__.p_isl_space_set_alloc) -+#define isl_space_set_dim_id (*cloog_pointers__.p_isl_space_set_dim_id) -+#define isl_space_set_tuple_id (*cloog_pointers__.p_isl_space_set_tuple_id) -+#define isl_union_map_add_map (*cloog_pointers__.p_isl_union_map_add_map) -+#define isl_union_map_align_params (*cloog_pointers__.p_isl_union_map_align_params) -+#define isl_union_map_apply_domain (*cloog_pointers__.p_isl_union_map_apply_domain) -+#define isl_union_map_apply_range (*cloog_pointers__.p_isl_union_map_apply_range) -+#define isl_union_map_compute_flow (*cloog_pointers__.p_isl_union_map_compute_flow) -+#define isl_union_map_copy (*cloog_pointers__.p_isl_union_map_copy) -+#define isl_union_map_empty (*cloog_pointers__.p_isl_union_map_empty) -+#define isl_union_map_flat_range_product (*cloog_pointers__.p_isl_union_map_flat_range_product) -+#define isl_union_map_foreach_map (*cloog_pointers__.p_isl_union_map_foreach_map) -+#define isl_union_map_free (*cloog_pointers__.p_isl_union_map_free) -+#define isl_union_map_from_map (*cloog_pointers__.p_isl_union_map_from_map) -+#define isl_union_map_get_ctx (*cloog_pointers__.p_isl_union_map_get_ctx) -+#define isl_union_map_get_space (*cloog_pointers__.p_isl_union_map_get_space) -+#define isl_union_map_gist_domain (*cloog_pointers__.p_isl_union_map_gist_domain) -+#define isl_union_map_gist_range (*cloog_pointers__.p_isl_union_map_gist_range) -+#define isl_union_map_intersect_domain (*cloog_pointers__.p_isl_union_map_intersect_domain) -+#define isl_union_map_is_empty (*cloog_pointers__.p_isl_union_map_is_empty) -+#define isl_union_map_subtract (*cloog_pointers__.p_isl_union_map_subtract) -+#define isl_union_map_union (*cloog_pointers__.p_isl_union_map_union) -+#define isl_union_set_add_set (*cloog_pointers__.p_isl_union_set_add_set) -+#define isl_union_set_compute_schedule (*cloog_pointers__.p_isl_union_set_compute_schedule) -+#define isl_union_set_copy (*cloog_pointers__.p_isl_union_set_copy) -+#define isl_union_set_empty (*cloog_pointers__.p_isl_union_set_empty) -+#define isl_union_set_from_set (*cloog_pointers__.p_isl_union_set_from_set) -+#define stmt_ass (*cloog_pointers__.p_stmt_ass) -+#define stmt_block (*cloog_pointers__.p_stmt_block) -+#define stmt_for (*cloog_pointers__.p_stmt_for) -+#define stmt_guard (*cloog_pointers__.p_stmt_guard) -+#define stmt_root (*cloog_pointers__.p_stmt_root) -+#define stmt_user (*cloog_pointers__.p_stmt_user) -+ - typedef struct poly_dr *poly_dr_p; - - typedef struct poly_bb *poly_bb_p; ---- a/gcc/graphite.c.jj 2012-12-13 11:31:00.000000000 +0100 -+++ b/gcc/graphite.c 2012-12-14 13:40:44.155136961 +0100 -@@ -78,6 +78,34 @@ along with GCC; see the file COPYING3. - - CloogState *cloog_state; - -+__typeof (cloog_pointers__) cloog_pointers__; -+ -+static bool -+init_cloog_pointers (void) -+{ -+ void *h; -+ -+ if (cloog_pointers__.inited) -+ return cloog_pointers__.h != NULL; -+ h = dlopen ("libcloog-isl.so.4", RTLD_LAZY); -+ cloog_pointers__.h = h; -+ if (h == NULL) -+ return false; -+#define DYNSYM(x) \ -+ do \ -+ { \ -+ union { __typeof (cloog_pointers__.p_##x) p; void *q; } u; \ -+ u.q = dlsym (h, #x); \ -+ if (u.q == NULL) \ -+ return false; \ -+ cloog_pointers__.p_##x = u.p; \ -+ } \ -+ while (0) -+ DYNSYMS -+#undef DYNSYM -+ return true; -+} -+ - /* Print global statistics to FILE. */ - - static void -@@ -277,6 +305,15 @@ graphite_transform_loops (void) - if (parallelized_function_p (cfun->decl)) - return; - -+ if (number_of_loops (cfun) <= 1) -+ return; -+ -+ if (!init_cloog_pointers ()) -+ { -+ sorry ("Graphite loop optimizations cannot be used"); -+ return; -+ } -+ - ctx = isl_ctx_alloc (); - isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT); - if (!graphite_initialize (ctx)) ---- a/gcc/graphite-clast-to-gimple.c.jj 2012-12-13 11:31:27.000000000 +0100 -+++ b/gcc/graphite-clast-to-gimple.c 2012-12-14 13:27:47.196519858 +0100 -@@ -910,7 +910,7 @@ compute_bounds_for_loop (struct clast_fo - from STMT_FOR. */ - - static tree --type_for_clast_for (struct clast_for *stmt_for, ivs_params_p ip) -+type_for_clast_for (struct clast_for *stmt_fora, ivs_params_p ip) - { - mpz_t bound_one, bound_two; - tree lb_type, ub_type; -@@ -918,8 +918,8 @@ type_for_clast_for (struct clast_for *st - mpz_init (bound_one); - mpz_init (bound_two); - -- lb_type = type_for_clast_expr (stmt_for->LB, ip, bound_one, bound_two); -- ub_type = type_for_clast_expr (stmt_for->UB, ip, bound_one, bound_two); -+ lb_type = type_for_clast_expr (stmt_fora->LB, ip, bound_one, bound_two); -+ ub_type = type_for_clast_expr (stmt_fora->UB, ip, bound_one, bound_two); - - mpz_clear (bound_one); - mpz_clear (bound_two); diff --git a/cross/gcc4-armhf/hardenednopie.specs b/cross/gcc4-armhf/hardenednopie.specs deleted file mode 100644 index ccc4d7643..000000000 --- a/cross/gcc4-armhf/hardenednopie.specs +++ /dev/null @@ -1,12 +0,0 @@ -*esp_cc1_pie: - - -*esp_options_pie: - - -*esp_link_pie_check: - - -*esp_link_pie: - - diff --git a/cross/gcc4-armhf/hardenednopiessp.specs b/cross/gcc4-armhf/hardenednopiessp.specs deleted file mode 100644 index 307abbdaa..000000000 --- a/cross/gcc4-armhf/hardenednopiessp.specs +++ /dev/null @@ -1,4 +0,0 @@ -%include -%include - - diff --git a/cross/gcc4-armhf/hardenednossp.specs b/cross/gcc4-armhf/hardenednossp.specs deleted file mode 100644 index 2c6a8d095..000000000 --- a/cross/gcc4-armhf/hardenednossp.specs +++ /dev/null @@ -1,6 +0,0 @@ -*esp_cc1_ssp: - - -*esp_options_ssp: - - diff --git a/cross/gcc4-armhf/libgcc-always-build-gcceh.a.patch b/cross/gcc4-armhf/libgcc-always-build-gcceh.a.patch deleted file mode 100644 index 74ae89730..000000000 --- a/cross/gcc4-armhf/libgcc-always-build-gcceh.a.patch +++ /dev/null @@ -1,39 +0,0 @@ -Highly inspired by: - http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch - -diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in ---- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100 -+++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200 -@@ -772,8 +772,9 @@ - libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) - endif - -+all: libgcc_eh.a - ifeq ($(enable_shared),yes) --all: libgcc_eh.a libgcc_s$(SHLIB_EXT) -+all: libgcc_s$(SHLIB_EXT) - ifneq ($(LIBUNWIND),) - all: libunwind$(SHLIB_EXT) - endif -@@ -950,10 +951,6 @@ - install-shared: - $(mkinstalldirs) $(DESTDIR)$(inst_libdir) - -- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- - $(subst @multilib_dir@,$(MULTIDIR),$(subst \ - @shlib_base_name@,libgcc_s,$(subst \ - @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) -@@ -968,6 +965,10 @@ - chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a - -+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ - parts="$(INSTALL_PARTS)"; \ - for file in $$parts; do \ - rm -f $(DESTDIR)$(inst_libdir)/$$file; \ diff --git a/cross/gcc4-armhf/musl-posix_memalign-c++.patch b/cross/gcc4-armhf/musl-posix_memalign-c++.patch deleted file mode 100644 index f3fad93ae..000000000 --- a/cross/gcc4-armhf/musl-posix_memalign-c++.patch +++ /dev/null @@ -1,27 +0,0 @@ -Fix conflicting prototype of posix_memalign for c++ -http://www.openwall.com/lists/musl/2013/11/10/1 - ---- ./gcc/config/i386/pmm_malloc.h.orig -+++ ./gcc/config/i386/pmm_malloc.h -@@ -28,11 +28,7 @@ - - /* We can't depend on since the prototype of posix_memalign - may not be visible. */ --#ifndef __cplusplus --extern int posix_memalign (void **, size_t, size_t); --#else --extern "C" int posix_memalign (void **, size_t, size_t) throw (); --#endif -+extern int __gcc_posix_memalign (void **, size_t, size_t) __asm__("posix_memalign"); - - static __inline void * - _mm_malloc (size_t size, size_t alignment) -@@ -42,7 +38,7 @@ - return malloc (size); - if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4)) - alignment = sizeof (void *); -- if (posix_memalign (&ptr, alignment, size) == 0) -+ if (__gcc_posix_memalign (&ptr, alignment, size) == 0) - return ptr; - else - return NULL; diff --git a/cross/gcc4-armhf/pr63740.patch b/cross/gcc4-armhf/pr63740.patch deleted file mode 100644 index 234d46873..000000000 --- a/cross/gcc4-armhf/pr63740.patch +++ /dev/null @@ -1,17 +0,0 @@ -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63740 - ---- trunk/gcc/lra-lives.c 2014/06/16 09:25:26 211700 -+++ trunk/gcc/lra-lives.c 2014/06/16 09:58:34 211701 -@@ -558,7 +558,11 @@ - /* It might be 'inheritance pseudo <- reload pseudo'. */ - || (src_regno >= lra_constraint_new_regno_start - && ((int) REGNO (SET_DEST (set)) -- >= lra_constraint_new_regno_start)))) -+ >= lra_constraint_new_regno_start) -+ /* Remember to skip special cases where src/dest regnos are -+ the same, e.g. insn SET pattern has matching constraints -+ like =r,0. */ -+ && src_regno != (int) REGNO (SET_DEST (set))))) - { - int hard_regno = -1, regno = -1; - diff --git a/cross/gcc4-armhf/vanilla.specs b/cross/gcc4-armhf/vanilla.specs deleted file mode 100644 index 545699de3..000000000 --- a/cross/gcc4-armhf/vanilla.specs +++ /dev/null @@ -1,11 +0,0 @@ -%include -%include -*esp_link_now: - - -*esp_link_relro: - - -*esp_cc1_strict_overflow: - - diff --git a/cross/gcc6-armhf/0001-i386-Move-struct-ix86_frame-to-machine_function.patch b/cross/gcc6-armhf/0001-i386-Move-struct-ix86_frame-to-machine_function.patch deleted file mode 100644 index ecec2bad6..000000000 --- a/cross/gcc6-armhf/0001-i386-Move-struct-ix86_frame-to-machine_function.patch +++ /dev/null @@ -1,241 +0,0 @@ -From b1d2df5090abc9202a7bf2d224ac90de22908d21 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Mon, 15 Jan 2018 11:27:24 +0000 -Subject: [PATCH 01/13] i386: Move struct ix86_frame to machine_function - -Make ix86_frame available to i386 code generation. This is needed to -backport the patch set of -mindirect-branch= to mitigate variant #2 of -the speculative execution vulnerabilities on x86 processors identified -by CVE-2017-5715, aka Spectre. - - Backport from mainline - 2017-06-01 Bernd Edlinger - - * config/i386/i386.c (ix86_frame): Moved to ... - * config/i386/i386.h (ix86_frame): Here. - (machine_function): Add frame. - * config/i386/i386.c (ix86_compute_frame_layout): Repace the - frame argument with &cfun->machine->frame. - (ix86_can_use_return_insn_p): Don't pass &frame to - ix86_compute_frame_layout. Copy frame from cfun->machine->frame. - (ix86_can_eliminate): Likewise. - (ix86_expand_prologue): Likewise. - (ix86_expand_epilogue): Likewise. - (ix86_expand_split_stack_prologue): Likewise. ---- - gcc/config/i386/i386.c | 68 ++++++++++---------------------------------------- - gcc/config/i386/i386.h | 53 ++++++++++++++++++++++++++++++++++++++- - 2 files changed, 65 insertions(+), 56 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 8b5faac5129..a1ff32b648b 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -2434,53 +2434,6 @@ struct GTY(()) stack_local_entry { - struct stack_local_entry *next; - }; - --/* Structure describing stack frame layout. -- Stack grows downward: -- -- [arguments] -- <- ARG_POINTER -- saved pc -- -- saved static chain if ix86_static_chain_on_stack -- -- saved frame pointer if frame_pointer_needed -- <- HARD_FRAME_POINTER -- [saved regs] -- <- regs_save_offset -- [padding0] -- -- [saved SSE regs] -- <- sse_regs_save_offset -- [padding1] | -- | <- FRAME_POINTER -- [va_arg registers] | -- | -- [frame] | -- | -- [padding2] | = to_allocate -- <- STACK_POINTER -- */ --struct ix86_frame --{ -- int nsseregs; -- int nregs; -- int va_arg_size; -- int red_zone_size; -- int outgoing_arguments_size; -- -- /* The offsets relative to ARG_POINTER. */ -- HOST_WIDE_INT frame_pointer_offset; -- HOST_WIDE_INT hard_frame_pointer_offset; -- HOST_WIDE_INT stack_pointer_offset; -- HOST_WIDE_INT hfp_save_offset; -- HOST_WIDE_INT reg_save_offset; -- HOST_WIDE_INT sse_reg_save_offset; -- -- /* When save_regs_using_mov is set, emit prologue using -- move instead of push instructions. */ -- bool save_regs_using_mov; --}; -- - /* Which cpu are we scheduling for. */ - enum attr_cpu ix86_schedule; - -@@ -2572,7 +2525,7 @@ static unsigned int ix86_function_arg_boundary (machine_mode, - const_tree); - static rtx ix86_static_chain (const_tree, bool); - static int ix86_function_regparm (const_tree, const_tree); --static void ix86_compute_frame_layout (struct ix86_frame *); -+static void ix86_compute_frame_layout (void); - static bool ix86_expand_vector_init_one_nonzero (bool, machine_mode, - rtx, rtx, int); - static void ix86_add_new_builtins (HOST_WIDE_INT); -@@ -10944,7 +10897,8 @@ ix86_can_use_return_insn_p (void) - if (crtl->args.pops_args && crtl->args.size >= 32768) - return 0; - -- ix86_compute_frame_layout (&frame); -+ ix86_compute_frame_layout (); -+ frame = cfun->machine->frame; - return (frame.stack_pointer_offset == UNITS_PER_WORD - && (frame.nregs + frame.nsseregs) == 0); - } -@@ -11355,8 +11309,8 @@ ix86_can_eliminate (const int from, const int to) - HOST_WIDE_INT - ix86_initial_elimination_offset (int from, int to) - { -- struct ix86_frame frame; -- ix86_compute_frame_layout (&frame); -+ ix86_compute_frame_layout (); -+ struct ix86_frame frame = cfun->machine->frame; - - if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) - return frame.hard_frame_pointer_offset; -@@ -11395,8 +11349,9 @@ ix86_builtin_setjmp_frame_value (void) - /* Fill structure ix86_frame about frame of currently computed function. */ - - static void --ix86_compute_frame_layout (struct ix86_frame *frame) -+ix86_compute_frame_layout (void) - { -+ struct ix86_frame *frame = &cfun->machine->frame; - unsigned HOST_WIDE_INT stack_alignment_needed; - HOST_WIDE_INT offset; - unsigned HOST_WIDE_INT preferred_alignment; -@@ -12702,7 +12657,8 @@ ix86_expand_prologue (void) - m->fs.sp_offset = INCOMING_FRAME_SP_OFFSET; - m->fs.sp_valid = true; - -- ix86_compute_frame_layout (&frame); -+ ix86_compute_frame_layout (); -+ frame = m->frame; - - if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl)) - { -@@ -13379,7 +13335,8 @@ ix86_expand_epilogue (int style) - bool using_drap; - - ix86_finalize_stack_realign_flags (); -- ix86_compute_frame_layout (&frame); -+ ix86_compute_frame_layout (); -+ frame = m->frame; - - m->fs.sp_valid = (!frame_pointer_needed - || (crtl->sp_is_unchanging -@@ -13876,7 +13833,8 @@ ix86_expand_split_stack_prologue (void) - gcc_assert (flag_split_stack && reload_completed); - - ix86_finalize_stack_realign_flags (); -- ix86_compute_frame_layout (&frame); -+ ix86_compute_frame_layout (); -+ frame = cfun->machine->frame; - allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET; - - /* This is the label we will branch to if we have enough stack -diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h -index 8113f83c7fd..54144166172 100644 ---- a/gcc/config/i386/i386.h -+++ b/gcc/config/i386/i386.h -@@ -2427,9 +2427,56 @@ enum avx_u128_state - - #define FASTCALL_PREFIX '@' - -+#ifndef USED_FOR_TARGET -+/* Structure describing stack frame layout. -+ Stack grows downward: -+ -+ [arguments] -+ <- ARG_POINTER -+ saved pc -+ -+ saved static chain if ix86_static_chain_on_stack -+ -+ saved frame pointer if frame_pointer_needed -+ <- HARD_FRAME_POINTER -+ [saved regs] -+ <- regs_save_offset -+ [padding0] -+ -+ [saved SSE regs] -+ <- sse_regs_save_offset -+ [padding1] | -+ | <- FRAME_POINTER -+ [va_arg registers] | -+ | -+ [frame] | -+ | -+ [padding2] | = to_allocate -+ <- STACK_POINTER -+ */ -+struct GTY(()) ix86_frame -+{ -+ int nsseregs; -+ int nregs; -+ int va_arg_size; -+ int red_zone_size; -+ int outgoing_arguments_size; -+ -+ /* The offsets relative to ARG_POINTER. */ -+ HOST_WIDE_INT frame_pointer_offset; -+ HOST_WIDE_INT hard_frame_pointer_offset; -+ HOST_WIDE_INT stack_pointer_offset; -+ HOST_WIDE_INT hfp_save_offset; -+ HOST_WIDE_INT reg_save_offset; -+ HOST_WIDE_INT sse_reg_save_offset; -+ -+ /* When save_regs_using_mov is set, emit prologue using -+ move instead of push instructions. */ -+ bool save_regs_using_mov; -+}; -+ - /* Machine specific frame tracking during prologue/epilogue generation. */ - --#ifndef USED_FOR_TARGET - struct GTY(()) machine_frame_state - { - /* This pair tracks the currently active CFA as reg+offset. When reg -@@ -2475,6 +2522,9 @@ struct GTY(()) machine_function { - int varargs_fpr_size; - int optimize_mode_switching[MAX_386_ENTITIES]; - -+ /* Cached initial frame layout for the current function. */ -+ struct ix86_frame frame; -+ - /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE - has been computed for. */ - int use_fast_prologue_epilogue_nregs; -@@ -2554,6 +2604,7 @@ struct GTY(()) machine_function { - #define ix86_current_function_calls_tls_descriptor \ - (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG)) - #define ix86_static_chain_on_stack (cfun->machine->static_chain_on_stack) -+#define ix86_red_zone_size (cfun->machine->frame.red_zone_size) - - /* Control behavior of x86_file_start. */ - #define X86_FILE_START_VERSION_DIRECTIVE false --- -2.16.3 - diff --git a/cross/gcc6-armhf/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch b/cross/gcc6-armhf/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch deleted file mode 100644 index 79219e858..000000000 --- a/cross/gcc6-armhf/0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch +++ /dev/null @@ -1,69 +0,0 @@ -From b1fc91cda7c15264116f3dde6944ead149123653 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Mon, 15 Jan 2018 11:28:44 +0000 -Subject: [PATCH 02/13] i386: Use reference of struct ix86_frame to avoid copy - -When there is no need to make a copy of ix86_frame, we can use reference -of struct ix86_frame to avoid copy. - - Backport from mainline - 2017-11-06 H.J. Lu - - * config/i386/i386.c (ix86_can_use_return_insn_p): Use reference - of struct ix86_frame. - (ix86_initial_elimination_offset): Likewise. - (ix86_expand_split_stack_prologue): Likewise. ---- - gcc/config/i386/i386.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index a1ff32b648b..13ebf107e90 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -10887,7 +10887,6 @@ symbolic_reference_mentioned_p (rtx op) - bool - ix86_can_use_return_insn_p (void) - { -- struct ix86_frame frame; - - if (! reload_completed || frame_pointer_needed) - return 0; -@@ -10898,7 +10897,7 @@ ix86_can_use_return_insn_p (void) - return 0; - - ix86_compute_frame_layout (); -- frame = cfun->machine->frame; -+ struct ix86_frame &frame = cfun->machine->frame; - return (frame.stack_pointer_offset == UNITS_PER_WORD - && (frame.nregs + frame.nsseregs) == 0); - } -@@ -11310,7 +11309,7 @@ HOST_WIDE_INT - ix86_initial_elimination_offset (int from, int to) - { - ix86_compute_frame_layout (); -- struct ix86_frame frame = cfun->machine->frame; -+ struct ix86_frame &frame = cfun->machine->frame; - - if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM) - return frame.hard_frame_pointer_offset; -@@ -13821,7 +13820,6 @@ static GTY(()) rtx split_stack_fn_large; - void - ix86_expand_split_stack_prologue (void) - { -- struct ix86_frame frame; - HOST_WIDE_INT allocate; - unsigned HOST_WIDE_INT args_size; - rtx_code_label *label; -@@ -13834,7 +13832,7 @@ ix86_expand_split_stack_prologue (void) - - ix86_finalize_stack_realign_flags (); - ix86_compute_frame_layout (); -- frame = cfun->machine->frame; -+ struct ix86_frame &frame = cfun->machine->frame; - allocate = frame.stack_pointer_offset - INCOMING_FRAME_SP_OFFSET; - - /* This is the label we will branch to if we have enough stack --- -2.16.3 - diff --git a/cross/gcc6-armhf/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch b/cross/gcc6-armhf/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch deleted file mode 100644 index 2f293946f..000000000 --- a/cross/gcc6-armhf/0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 3e39c0a8053b3e960cf4c3aea3c814e7dc97cfd6 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Sat, 27 Jan 2018 13:10:24 +0000 -Subject: [PATCH 03/13] i386: Use const reference of struct ix86_frame to avoid - copy - -We can use const reference of struct ix86_frame to avoid making a local -copy of ix86_frame. ix86_expand_epilogue makes a local copy of struct -ix86_frame and uses the reg_save_offset field as a local variable. This -patch uses a separate local variable for reg_save_offset. - -Tested on x86-64 with ada. - - Backport from mainline - PR target/83905 - * config/i386/i386.c (ix86_expand_prologue): Use cost reference - of struct ix86_frame. - (ix86_expand_epilogue): Likewise. Add a local variable for - the reg_save_offset field in struct ix86_frame. - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257123 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/config/i386/i386.c | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 13ebf107e90..6c98f7581e2 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -12633,7 +12633,6 @@ ix86_expand_prologue (void) - { - struct machine_function *m = cfun->machine; - rtx insn, t; -- struct ix86_frame frame; - HOST_WIDE_INT allocate; - bool int_registers_saved; - bool sse_registers_saved; -@@ -12657,7 +12656,7 @@ ix86_expand_prologue (void) - m->fs.sp_valid = true; - - ix86_compute_frame_layout (); -- frame = m->frame; -+ const struct ix86_frame &frame = cfun->machine->frame; - - if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl)) - { -@@ -13329,13 +13328,12 @@ ix86_expand_epilogue (int style) - { - struct machine_function *m = cfun->machine; - struct machine_frame_state frame_state_save = m->fs; -- struct ix86_frame frame; - bool restore_regs_via_mov; - bool using_drap; - - ix86_finalize_stack_realign_flags (); - ix86_compute_frame_layout (); -- frame = m->frame; -+ const struct ix86_frame &frame = cfun->machine->frame; - - m->fs.sp_valid = (!frame_pointer_needed - || (crtl->sp_is_unchanging -@@ -13377,11 +13375,13 @@ ix86_expand_epilogue (int style) - + UNITS_PER_WORD); - } - -+ HOST_WIDE_INT reg_save_offset = frame.reg_save_offset; -+ - /* Special care must be taken for the normal return case of a function - using eh_return: the eax and edx registers are marked as saved, but - not restored along this path. Adjust the save location to match. */ - if (crtl->calls_eh_return && style != 2) -- frame.reg_save_offset -= 2 * UNITS_PER_WORD; -+ reg_save_offset -= 2 * UNITS_PER_WORD; - - /* EH_RETURN requires the use of moves to function properly. */ - if (crtl->calls_eh_return) -@@ -13397,11 +13397,11 @@ ix86_expand_epilogue (int style) - else if (TARGET_EPILOGUE_USING_MOVE - && cfun->machine->use_fast_prologue_epilogue - && (frame.nregs > 1 -- || m->fs.sp_offset != frame.reg_save_offset)) -+ || m->fs.sp_offset != reg_save_offset)) - restore_regs_via_mov = true; - else if (frame_pointer_needed - && !frame.nregs -- && m->fs.sp_offset != frame.reg_save_offset) -+ && m->fs.sp_offset != reg_save_offset) - restore_regs_via_mov = true; - else if (frame_pointer_needed - && TARGET_USE_LEAVE -@@ -13439,7 +13439,7 @@ ix86_expand_epilogue (int style) - rtx t; - - if (frame.nregs) -- ix86_emit_restore_regs_using_mov (frame.reg_save_offset, style == 2); -+ ix86_emit_restore_regs_using_mov (reg_save_offset, style == 2); - - /* eh_return epilogues need %ecx added to the stack pointer. */ - if (style == 2) -@@ -13529,19 +13529,19 @@ ix86_expand_epilogue (int style) - epilogues. */ - if (!m->fs.sp_valid - || (TARGET_SEH -- && (m->fs.sp_offset - frame.reg_save_offset -+ && (m->fs.sp_offset - reg_save_offset - >= SEH_MAX_FRAME_SIZE))) - { - pro_epilogue_adjust_stack (stack_pointer_rtx, hard_frame_pointer_rtx, - GEN_INT (m->fs.fp_offset -- - frame.reg_save_offset), -+ - reg_save_offset), - style, false); - } -- else if (m->fs.sp_offset != frame.reg_save_offset) -+ else if (m->fs.sp_offset != reg_save_offset) - { - pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (m->fs.sp_offset -- - frame.reg_save_offset), -+ - reg_save_offset), - style, - m->fs.cfa_reg == stack_pointer_rtx); - } --- -2.16.3 - diff --git a/cross/gcc6-armhf/0004-x86-Add-mindirect-branch.patch b/cross/gcc6-armhf/0004-x86-Add-mindirect-branch.patch deleted file mode 100644 index db5fe2f48..000000000 --- a/cross/gcc6-armhf/0004-x86-Add-mindirect-branch.patch +++ /dev/null @@ -1,2149 +0,0 @@ -From 64da0f4b794672ae14350b09c276422f79f78fc0 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 6 Jan 2018 22:29:55 -0800 -Subject: [PATCH 04/13] x86: Add -mindirect-branch= - -Add -mindirect-branch= option to convert indirect call and jump to call -and return thunks. The default is 'keep', which keeps indirect call and -jump unmodified. 'thunk' converts indirect call and jump to call and -return thunk. 'thunk-inline' converts indirect call and jump to inlined -call and return thunk. 'thunk-extern' converts indirect call and jump to -external call and return thunk provided in a separate object file. You -can control this behavior for a specific function by using the function -attribute indirect_branch. - -2 kinds of thunks are geneated. Memory thunk where the function address -is at the top of the stack: - -__x86_indirect_thunk: - call L2 -L1: - pause - lfence - jmp L1 -L2: - lea 8(%rsp), %rsp|lea 4(%esp), %esp - ret - -Indirect jmp via memory, "jmp mem", is converted to - - push memory - jmp __x86_indirect_thunk - -Indirect call via memory, "call mem", is converted to - - jmp L2 -L1: - push [mem] - jmp __x86_indirect_thunk -L2: - call L1 - -Register thunk where the function address is in a register, reg: - -__x86_indirect_thunk_reg: - call L2 -L1: - pause - lfence - jmp L1 -L2: - movq %reg, (%rsp)|movl %reg, (%esp) - ret - -where reg is one of (r|e)ax, (r|e)dx, (r|e)cx, (r|e)bx, (r|e)si, (r|e)di, -(r|e)bp, r8, r9, r10, r11, r12, r13, r14 and r15. - -Indirect jmp via register, "jmp reg", is converted to - - jmp __x86_indirect_thunk_reg - -Indirect call via register, "call reg", is converted to - - call __x86_indirect_thunk_reg - -gcc/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * config/i386/i386-opts.h (indirect_branch): New. - * config/i386/i386-protos.h (ix86_output_indirect_jmp): Likewise. - * config/i386/i386.c (ix86_using_red_zone): Disallow red-zone - with local indirect jump when converting indirect call and jump. - (ix86_set_indirect_branch_type): New. - (ix86_set_current_function): Call ix86_set_indirect_branch_type. - (indirectlabelno): New. - (indirect_thunk_needed): Likewise. - (indirect_thunk_bnd_needed): Likewise. - (indirect_thunks_used): Likewise. - (indirect_thunks_bnd_used): Likewise. - (INDIRECT_LABEL): Likewise. - (indirect_thunk_name): Likewise. - (output_indirect_thunk): Likewise. - (output_indirect_thunk_function): Likewise. - (ix86_output_indirect_branch_via_reg): Likewise. - (ix86_output_indirect_branch_via_push): Likewise. - (ix86_output_indirect_branch): Likewise. - (ix86_output_indirect_jmp): Likewise. - (ix86_code_end): Call output_indirect_thunk_function if needed. - (ix86_output_call_insn): Call ix86_output_indirect_branch if - needed. - (ix86_handle_fndecl_attribute): Handle indirect_branch. - (ix86_attribute_table): Add indirect_branch. - * config/i386/i386.h (machine_function): Add indirect_branch_type - and has_local_indirect_jump. - * config/i386/i386.md (indirect_jump): Set has_local_indirect_jump - to true. - (tablejump): Likewise. - (*indirect_jump): Use ix86_output_indirect_jmp. - (*tablejump_1): Likewise. - (simple_return_indirect_internal): Likewise. - * config/i386/i386.opt (mindirect-branch=): New option. - (indirect_branch): New. - (keep): Likewise. - (thunk): Likewise. - (thunk-inline): Likewise. - (thunk-extern): Likewise. - * doc/extend.texi: Document indirect_branch function attribute. - * doc/invoke.texi: Document -mindirect-branch= option. - -gcc/testsuite/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * gcc.target/i386/indirect-thunk-1.c: New test. - * gcc.target/i386/indirect-thunk-2.c: Likewise. - * gcc.target/i386/indirect-thunk-3.c: Likewise. - * gcc.target/i386/indirect-thunk-4.c: Likewise. - * gcc.target/i386/indirect-thunk-5.c: Likewise. - * gcc.target/i386/indirect-thunk-6.c: Likewise. - * gcc.target/i386/indirect-thunk-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-8.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-5.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-6.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-5.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-6.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. ---- - gcc/config/i386/i386-opts.h | 13 + - gcc/config/i386/i386-protos.h | 1 + - gcc/config/i386/i386.c | 639 ++++++++++++++++++++- - gcc/config/i386/i386.h | 7 + - gcc/config/i386/i386.md | 26 +- - gcc/config/i386/i386.opt | 20 + - gcc/doc/extend.texi | 10 + - gcc/doc/invoke.texi | 13 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 20 + - gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 20 + - gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 21 + - gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 21 + - gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 17 + - gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 18 + - gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 44 ++ - .../gcc.target/i386/indirect-thunk-attr-1.c | 23 + - .../gcc.target/i386/indirect-thunk-attr-2.c | 21 + - .../gcc.target/i386/indirect-thunk-attr-3.c | 23 + - .../gcc.target/i386/indirect-thunk-attr-4.c | 22 + - .../gcc.target/i386/indirect-thunk-attr-5.c | 22 + - .../gcc.target/i386/indirect-thunk-attr-6.c | 21 + - .../gcc.target/i386/indirect-thunk-attr-7.c | 44 ++ - .../gcc.target/i386/indirect-thunk-attr-8.c | 42 ++ - .../gcc.target/i386/indirect-thunk-bnd-1.c | 20 + - .../gcc.target/i386/indirect-thunk-bnd-2.c | 21 + - .../gcc.target/i386/indirect-thunk-bnd-3.c | 19 + - .../gcc.target/i386/indirect-thunk-bnd-4.c | 20 + - .../gcc.target/i386/indirect-thunk-extern-1.c | 19 + - .../gcc.target/i386/indirect-thunk-extern-2.c | 19 + - .../gcc.target/i386/indirect-thunk-extern-3.c | 20 + - .../gcc.target/i386/indirect-thunk-extern-4.c | 20 + - .../gcc.target/i386/indirect-thunk-extern-5.c | 16 + - .../gcc.target/i386/indirect-thunk-extern-6.c | 17 + - .../gcc.target/i386/indirect-thunk-extern-7.c | 43 ++ - .../gcc.target/i386/indirect-thunk-inline-1.c | 20 + - .../gcc.target/i386/indirect-thunk-inline-2.c | 20 + - .../gcc.target/i386/indirect-thunk-inline-3.c | 21 + - .../gcc.target/i386/indirect-thunk-inline-4.c | 21 + - .../gcc.target/i386/indirect-thunk-inline-5.c | 17 + - .../gcc.target/i386/indirect-thunk-inline-6.c | 18 + - .../gcc.target/i386/indirect-thunk-inline-7.c | 44 ++ - 41 files changed, 1486 insertions(+), 17 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-5.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-6.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-7.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c - -diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h -index b7f92e3bea1..cc21152875f 100644 ---- a/gcc/config/i386/i386-opts.h -+++ b/gcc/config/i386/i386-opts.h -@@ -99,4 +99,17 @@ enum stack_protector_guard { - SSP_GLOBAL /* global canary */ - }; - -+/* This is used to mitigate variant #2 of the speculative execution -+ vulnerabilities on x86 processors identified by CVE-2017-5715, aka -+ Spectre. They convert indirect branches and function returns to -+ call and return thunks to avoid speculative execution via indirect -+ call, jmp and ret. */ -+enum indirect_branch { -+ indirect_branch_unset = 0, -+ indirect_branch_keep, -+ indirect_branch_thunk, -+ indirect_branch_thunk_inline, -+ indirect_branch_thunk_extern -+}; -+ - #endif -diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h -index ff47bc15600..eca4cbf0776 100644 ---- a/gcc/config/i386/i386-protos.h -+++ b/gcc/config/i386/i386-protos.h -@@ -311,6 +311,7 @@ extern enum attr_cpu ix86_schedule; - #endif - - extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op); -+extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p); - extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load, - enum machine_mode mode); - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 6c98f7581e2..0b9fc4d3026 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -3662,12 +3662,23 @@ make_pass_stv (gcc::context *ctxt) - return new pass_stv (ctxt); - } - --/* Return true if a red-zone is in use. */ -+/* Return true if a red-zone is in use. We can't use red-zone when -+ there are local indirect jumps, like "indirect_jump" or "tablejump", -+ which jumps to another place in the function, since "call" in the -+ indirect thunk pushes the return address onto stack, destroying -+ red-zone. -+ -+ TODO: If we can reserve the first 2 WORDs, for PUSH and, another -+ for CALL, in red-zone, we can allow local indirect jumps with -+ indirect thunk. */ - - bool - ix86_using_red_zone (void) - { -- return TARGET_RED_ZONE && !TARGET_64BIT_MS_ABI; -+ return (TARGET_RED_ZONE -+ && !TARGET_64BIT_MS_ABI -+ && (!cfun->machine->has_local_indirect_jump -+ || cfun->machine->indirect_branch_type == indirect_branch_keep)); - } - - /* Return a string that documents the current -m options. The caller is -@@ -6350,6 +6361,37 @@ ix86_reset_previous_fndecl (void) - ix86_previous_fndecl = NULL_TREE; - } - -+/* Set the indirect_branch_type field from the function FNDECL. */ -+ -+static void -+ix86_set_indirect_branch_type (tree fndecl) -+{ -+ if (cfun->machine->indirect_branch_type == indirect_branch_unset) -+ { -+ tree attr = lookup_attribute ("indirect_branch", -+ DECL_ATTRIBUTES (fndecl)); -+ if (attr != NULL) -+ { -+ tree args = TREE_VALUE (attr); -+ if (args == NULL) -+ gcc_unreachable (); -+ tree cst = TREE_VALUE (args); -+ if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0) -+ cfun->machine->indirect_branch_type = indirect_branch_keep; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0) -+ cfun->machine->indirect_branch_type = indirect_branch_thunk; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0) -+ cfun->machine->indirect_branch_type = indirect_branch_thunk_inline; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0) -+ cfun->machine->indirect_branch_type = indirect_branch_thunk_extern; -+ else -+ gcc_unreachable (); -+ } -+ else -+ cfun->machine->indirect_branch_type = ix86_indirect_branch; -+ } -+} -+ - /* Establish appropriate back-end context for processing the function - FNDECL. The argument might be NULL to indicate processing at top - level, outside of any function scope. */ -@@ -6360,7 +6402,13 @@ ix86_set_current_function (tree fndecl) - several times in the course of compiling a function, and we don't want to - slow things down too much or call target_reinit when it isn't safe. */ - if (fndecl == ix86_previous_fndecl) -- return; -+ { -+ /* There may be 2 function bodies for the same function FNDECL, -+ one is extern inline and one isn't. */ -+ if (fndecl != NULL_TREE) -+ ix86_set_indirect_branch_type (fndecl); -+ return; -+ } - - tree old_tree; - if (ix86_previous_fndecl == NULL_TREE) -@@ -6377,6 +6425,8 @@ ix86_set_current_function (tree fndecl) - return; - } - -+ ix86_set_indirect_branch_type (fndecl); -+ - tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl); - if (new_tree == NULL_TREE) - new_tree = target_option_default_node; -@@ -10962,6 +11012,220 @@ ix86_setup_frame_addresses (void) - # endif - #endif - -+/* Label count for call and return thunks. It is used to make unique -+ labels in call and return thunks. */ -+static int indirectlabelno; -+ -+/* True if call and return thunk functions are needed. */ -+static bool indirect_thunk_needed = false; -+/* True if call and return thunk functions with the BND prefix are -+ needed. */ -+static bool indirect_thunk_bnd_needed = false; -+ -+/* Bit masks of integer registers, which contain branch target, used -+ by call and return thunks functions. */ -+static int indirect_thunks_used; -+/* Bit masks of integer registers, which contain branch target, used -+ by call and return thunks functions with the BND prefix. */ -+static int indirect_thunks_bnd_used; -+ -+#ifndef INDIRECT_LABEL -+# define INDIRECT_LABEL "LIND" -+#endif -+ -+/* Fills in the label name that should be used for the indirect thunk. */ -+ -+static void -+indirect_thunk_name (char name[32], int regno, bool need_bnd_p) -+{ -+ if (USE_HIDDEN_LINKONCE) -+ { -+ const char *bnd = need_bnd_p ? "_bnd" : ""; -+ if (regno >= 0) -+ { -+ const char *reg_prefix; -+ if (LEGACY_INT_REGNO_P (regno)) -+ reg_prefix = TARGET_64BIT ? "r" : "e"; -+ else -+ reg_prefix = ""; -+ sprintf (name, "__x86_indirect_thunk%s_%s%s", -+ bnd, reg_prefix, reg_names[regno]); -+ } -+ else -+ sprintf (name, "__x86_indirect_thunk%s", bnd); -+ } -+ else -+ { -+ if (regno >= 0) -+ { -+ if (need_bnd_p) -+ ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno); -+ else -+ ASM_GENERATE_INTERNAL_LABEL (name, "LITR", regno); -+ } -+ else -+ { -+ if (need_bnd_p) -+ ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0); -+ else -+ ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0); -+ } -+ } -+} -+ -+/* Output a call and return thunk for indirect branch. If BND_P is -+ true, the BND prefix is needed. If REGNO != -1, the function -+ address is in REGNO and the call and return thunk looks like: -+ -+ call L2 -+ L1: -+ pause -+ jmp L1 -+ L2: -+ mov %REG, (%sp) -+ ret -+ -+ Otherwise, the function address is on the top of stack and the -+ call and return thunk looks like: -+ -+ call L2 -+ L1: -+ pause -+ jmp L1 -+ L2: -+ lea WORD_SIZE(%sp), %sp -+ ret -+ */ -+ -+static void -+output_indirect_thunk (bool need_bnd_p, int regno) -+{ -+ char indirectlabel1[32]; -+ char indirectlabel2[32]; -+ -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1, INDIRECT_LABEL, -+ indirectlabelno++); -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2, INDIRECT_LABEL, -+ indirectlabelno++); -+ -+ /* Call */ -+ if (need_bnd_p) -+ fputs ("\tbnd call\t", asm_out_file); -+ else -+ fputs ("\tcall\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel2); -+ fputc ('\n', asm_out_file); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1); -+ -+ /* Pause + lfence. */ -+ fprintf (asm_out_file, "\tpause\n\tlfence\n"); -+ -+ /* Jump. */ -+ fputs ("\tjmp\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel1); -+ fputc ('\n', asm_out_file); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); -+ -+ if (regno >= 0) -+ { -+ /* MOV. */ -+ rtx xops[2]; -+ xops[0] = gen_rtx_MEM (word_mode, stack_pointer_rtx); -+ xops[1] = gen_rtx_REG (word_mode, regno); -+ output_asm_insn ("mov\t{%1, %0|%0, %1}", xops); -+ } -+ else -+ { -+ /* LEA. */ -+ rtx xops[2]; -+ xops[0] = stack_pointer_rtx; -+ xops[1] = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD); -+ output_asm_insn ("lea\t{%E1, %0|%0, %E1}", xops); -+ } -+ -+ if (need_bnd_p) -+ fputs ("\tbnd ret\n", asm_out_file); -+ else -+ fputs ("\tret\n", asm_out_file); -+} -+ -+/* Output a funtion with a call and return thunk for indirect branch. -+ If BND_P is true, the BND prefix is needed. If REGNO != -1, the -+ function address is in REGNO. Otherwise, the function address is -+ on the top of stack. */ -+ -+static void -+output_indirect_thunk_function (bool need_bnd_p, int regno) -+{ -+ char name[32]; -+ tree decl; -+ -+ /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */ -+ indirect_thunk_name (name, regno, need_bnd_p); -+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, -+ get_identifier (name), -+ build_function_type_list (void_type_node, NULL_TREE)); -+ DECL_RESULT (decl) = build_decl (BUILTINS_LOCATION, RESULT_DECL, -+ NULL_TREE, void_type_node); -+ TREE_PUBLIC (decl) = 1; -+ TREE_STATIC (decl) = 1; -+ DECL_IGNORED_P (decl) = 1; -+ -+#if TARGET_MACHO -+ if (TARGET_MACHO) -+ { -+ switch_to_section (darwin_sections[picbase_thunk_section]); -+ fputs ("\t.weak_definition\t", asm_out_file); -+ assemble_name (asm_out_file, name); -+ fputs ("\n\t.private_extern\t", asm_out_file); -+ assemble_name (asm_out_file, name); -+ putc ('\n', asm_out_file); -+ ASM_OUTPUT_LABEL (asm_out_file, name); -+ DECL_WEAK (decl) = 1; -+ } -+ else -+#endif -+ if (USE_HIDDEN_LINKONCE) -+ { -+ cgraph_node::create (decl)->set_comdat_group (DECL_ASSEMBLER_NAME (decl)); -+ -+ targetm.asm_out.unique_section (decl, 0); -+ switch_to_section (get_named_section (decl, NULL, 0)); -+ -+ targetm.asm_out.globalize_label (asm_out_file, name); -+ fputs ("\t.hidden\t", asm_out_file); -+ assemble_name (asm_out_file, name); -+ putc ('\n', asm_out_file); -+ ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl); -+ } -+ else -+ { -+ switch_to_section (text_section); -+ ASM_OUTPUT_LABEL (asm_out_file, name); -+ } -+ -+ DECL_INITIAL (decl) = make_node (BLOCK); -+ current_function_decl = decl; -+ allocate_struct_function (decl, false); -+ init_function_start (decl); -+ /* We're about to hide the function body from callees of final_* by -+ emitting it directly; tell them we're a thunk, if they care. */ -+ cfun->is_thunk = true; -+ first_function_block_is_cold = false; -+ /* Make sure unwind info is emitted for the thunk if needed. */ -+ final_start_function (emit_barrier (), asm_out_file, 1); -+ -+ output_indirect_thunk (need_bnd_p, regno); -+ -+ final_end_function (); -+ init_insn_lengths (); -+ free_after_compilation (cfun); -+ set_cfun (NULL); -+ current_function_decl = NULL; -+} -+ - static int pic_labels_used; - - /* Fills in the label name that should be used for a pc thunk for -@@ -10988,11 +11252,32 @@ ix86_code_end (void) - rtx xops[2]; - int regno; - -+ if (indirect_thunk_needed) -+ output_indirect_thunk_function (false, -1); -+ if (indirect_thunk_bnd_needed) -+ output_indirect_thunk_function (true, -1); -+ -+ for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++) -+ { -+ int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; -+ if ((indirect_thunks_used & (1 << i))) -+ output_indirect_thunk_function (false, regno); -+ -+ if ((indirect_thunks_bnd_used & (1 << i))) -+ output_indirect_thunk_function (true, regno); -+ } -+ - for (regno = AX_REG; regno <= SP_REG; regno++) - { - char name[32]; - tree decl; - -+ if ((indirect_thunks_used & (1 << regno))) -+ output_indirect_thunk_function (false, regno); -+ -+ if ((indirect_thunks_bnd_used & (1 << regno))) -+ output_indirect_thunk_function (true, regno); -+ - if (!(pic_labels_used & (1 << regno))) - continue; - -@@ -27369,12 +27654,292 @@ ix86_nopic_noplt_attribute_p (rtx call_op) - return false; - } - -+/* Output indirect branch via a call and return thunk. CALL_OP is a -+ register which contains the branch target. XASM is the assembly -+ template for CALL_OP. Branch is a tail call if SIBCALL_P is true. -+ A normal call is converted to: -+ -+ call __x86_indirect_thunk_reg -+ -+ and a tail call is converted to: -+ -+ jmp __x86_indirect_thunk_reg -+ */ -+ -+static void -+ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p) -+{ -+ char thunk_name_buf[32]; -+ char *thunk_name; -+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn); -+ int regno = REGNO (call_op); -+ -+ if (cfun->machine->indirect_branch_type -+ != indirect_branch_thunk_inline) -+ { -+ if (cfun->machine->indirect_branch_type == indirect_branch_thunk) -+ { -+ int i = regno; -+ if (i >= FIRST_REX_INT_REG) -+ i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1); -+ if (need_bnd_p) -+ indirect_thunks_bnd_used |= 1 << i; -+ else -+ indirect_thunks_used |= 1 << i; -+ } -+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p); -+ thunk_name = thunk_name_buf; -+ } -+ else -+ thunk_name = NULL; -+ -+ if (sibcall_p) -+ { -+ if (thunk_name != NULL) -+ { -+ if (need_bnd_p) -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ else -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ else -+ output_indirect_thunk (need_bnd_p, regno); -+ } -+ else -+ { -+ if (thunk_name != NULL) -+ { -+ if (need_bnd_p) -+ fprintf (asm_out_file, "\tbnd call\t%s\n", thunk_name); -+ else -+ fprintf (asm_out_file, "\tcall\t%s\n", thunk_name); -+ return; -+ } -+ -+ char indirectlabel1[32]; -+ char indirectlabel2[32]; -+ -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1, -+ INDIRECT_LABEL, -+ indirectlabelno++); -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2, -+ INDIRECT_LABEL, -+ indirectlabelno++); -+ -+ /* Jump. */ -+ if (need_bnd_p) -+ fputs ("\tbnd jmp\t", asm_out_file); -+ else -+ fputs ("\tjmp\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel2); -+ fputc ('\n', asm_out_file); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1); -+ -+ if (thunk_name != NULL) -+ { -+ if (need_bnd_p) -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ else -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ else -+ output_indirect_thunk (need_bnd_p, regno); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); -+ -+ /* Call. */ -+ if (need_bnd_p) -+ fputs ("\tbnd call\t", asm_out_file); -+ else -+ fputs ("\tcall\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel1); -+ fputc ('\n', asm_out_file); -+ } -+} -+ -+/* Output indirect branch via a call and return thunk. CALL_OP is -+ the branch target. XASM is the assembly template for CALL_OP. -+ Branch is a tail call if SIBCALL_P is true. A normal call is -+ converted to: -+ -+ jmp L2 -+ L1: -+ push CALL_OP -+ jmp __x86_indirect_thunk -+ L2: -+ call L1 -+ -+ and a tail call is converted to: -+ -+ push CALL_OP -+ jmp __x86_indirect_thunk -+ */ -+ -+static void -+ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm, -+ bool sibcall_p) -+{ -+ char thunk_name_buf[32]; -+ char *thunk_name; -+ char push_buf[64]; -+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn); -+ int regno = -1; -+ -+ if (cfun->machine->indirect_branch_type -+ != indirect_branch_thunk_inline) -+ { -+ if (cfun->machine->indirect_branch_type == indirect_branch_thunk) -+ { -+ if (need_bnd_p) -+ indirect_thunk_bnd_needed = true; -+ else -+ indirect_thunk_needed = true; -+ } -+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p); -+ thunk_name = thunk_name_buf; -+ } -+ else -+ thunk_name = NULL; -+ -+ snprintf (push_buf, sizeof (push_buf), "push{%c}\t%s", -+ TARGET_64BIT ? 'q' : 'l', xasm); -+ -+ if (sibcall_p) -+ { -+ output_asm_insn (push_buf, &call_op); -+ if (thunk_name != NULL) -+ { -+ if (need_bnd_p) -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ else -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ else -+ output_indirect_thunk (need_bnd_p, regno); -+ } -+ else -+ { -+ char indirectlabel1[32]; -+ char indirectlabel2[32]; -+ -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel1, -+ INDIRECT_LABEL, -+ indirectlabelno++); -+ ASM_GENERATE_INTERNAL_LABEL (indirectlabel2, -+ INDIRECT_LABEL, -+ indirectlabelno++); -+ -+ /* Jump. */ -+ if (need_bnd_p) -+ fputs ("\tbnd jmp\t", asm_out_file); -+ else -+ fputs ("\tjmp\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel2); -+ fputc ('\n', asm_out_file); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1); -+ -+ /* An external function may be called via GOT, instead of PLT. */ -+ if (MEM_P (call_op)) -+ { -+ struct ix86_address parts; -+ rtx addr = XEXP (call_op, 0); -+ if (ix86_decompose_address (addr, &parts) -+ && parts.base == stack_pointer_rtx) -+ { -+ /* Since call will adjust stack by -UNITS_PER_WORD, -+ we must convert "disp(stack, index, scale)" to -+ "disp+UNITS_PER_WORD(stack, index, scale)". */ -+ if (parts.index) -+ { -+ addr = gen_rtx_MULT (Pmode, parts.index, -+ GEN_INT (parts.scale)); -+ addr = gen_rtx_PLUS (Pmode, stack_pointer_rtx, -+ addr); -+ } -+ else -+ addr = stack_pointer_rtx; -+ -+ rtx disp; -+ if (parts.disp != NULL_RTX) -+ disp = plus_constant (Pmode, parts.disp, -+ UNITS_PER_WORD); -+ else -+ disp = GEN_INT (UNITS_PER_WORD); -+ -+ addr = gen_rtx_PLUS (Pmode, addr, disp); -+ call_op = gen_rtx_MEM (GET_MODE (call_op), addr); -+ } -+ } -+ -+ output_asm_insn (push_buf, &call_op); -+ -+ if (thunk_name != NULL) -+ { -+ if (need_bnd_p) -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ else -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ else -+ output_indirect_thunk (need_bnd_p, regno); -+ -+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); -+ -+ /* Call. */ -+ if (need_bnd_p) -+ fputs ("\tbnd call\t", asm_out_file); -+ else -+ fputs ("\tcall\t", asm_out_file); -+ assemble_name_raw (asm_out_file, indirectlabel1); -+ fputc ('\n', asm_out_file); -+ } -+} -+ -+/* Output indirect branch via a call and return thunk. CALL_OP is -+ the branch target. XASM is the assembly template for CALL_OP. -+ Branch is a tail call if SIBCALL_P is true. */ -+ -+static void -+ix86_output_indirect_branch (rtx call_op, const char *xasm, -+ bool sibcall_p) -+{ -+ if (REG_P (call_op)) -+ ix86_output_indirect_branch_via_reg (call_op, sibcall_p); -+ else -+ ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p); -+} -+/* Output indirect jump. CALL_OP is the jump target. Jump is a -+ function return if RET_P is true. */ -+ -+const char * -+ix86_output_indirect_jmp (rtx call_op, bool ret_p) -+{ -+ if (cfun->machine->indirect_branch_type != indirect_branch_keep) -+ { -+ /* We can't have red-zone if this isn't a function return since -+ "call" in the indirect thunk pushes the return address onto -+ stack, destroying red-zone. */ -+ if (!ret_p && ix86_red_zone_size != 0) -+ gcc_unreachable (); -+ -+ ix86_output_indirect_branch (call_op, "%0", true); -+ return ""; -+ } -+ else -+ return "%!jmp\t%A0"; -+} -+ - /* Output the assembly for a call instruction. */ - - const char * - ix86_output_call_insn (rtx_insn *insn, rtx call_op) - { - bool direct_p = constant_call_address_operand (call_op, VOIDmode); -+ bool output_indirect_p -+ = (!TARGET_SEH -+ && cfun->machine->indirect_branch_type != indirect_branch_keep); - bool seh_nop_p = false; - const char *xasm; - -@@ -27383,7 +27948,13 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op) - if (direct_p) - { - if (ix86_nopic_noplt_attribute_p (call_op)) -- xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ { -+ direct_p = false; -+ if (output_indirect_p) -+ xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ else -+ xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ } - else - xasm = "%!jmp\t%P0"; - } -@@ -27392,9 +27963,17 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op) - else if (TARGET_SEH) - xasm = "%!rex.W jmp\t%A0"; - else -- xasm = "%!jmp\t%A0"; -+ { -+ if (output_indirect_p) -+ xasm = "%0"; -+ else -+ xasm = "%!jmp\t%A0"; -+ } - -- output_asm_insn (xasm, &call_op); -+ if (output_indirect_p && !direct_p) -+ ix86_output_indirect_branch (call_op, xasm, true); -+ else -+ output_asm_insn (xasm, &call_op); - return ""; - } - -@@ -27431,14 +28010,28 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op) - if (direct_p) - { - if (ix86_nopic_noplt_attribute_p (call_op)) -- xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ { -+ direct_p = false; -+ if (output_indirect_p) -+ xasm = "{%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ else -+ xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}"; -+ } - else - xasm = "%!call\t%P0"; - } - else -- xasm = "%!call\t%A0"; -+ { -+ if (output_indirect_p) -+ xasm = "%0"; -+ else -+ xasm = "%!call\t%A0"; -+ } - -- output_asm_insn (xasm, &call_op); -+ if (output_indirect_p && !direct_p) -+ ix86_output_indirect_branch (call_op, xasm, false); -+ else -+ output_asm_insn (xasm, &call_op); - - if (seh_nop_p) - return "nop"; -@@ -44836,7 +45429,7 @@ ix86_handle_struct_attribute (tree *node, tree name, tree, int, - } - - static tree --ix86_handle_fndecl_attribute (tree *node, tree name, tree, int, -+ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int, - bool *no_add_attrs) - { - if (TREE_CODE (*node) != FUNCTION_DECL) -@@ -44845,6 +45438,29 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree, int, - name); - *no_add_attrs = true; - } -+ -+ if (is_attribute_p ("indirect_branch", name)) -+ { -+ tree cst = TREE_VALUE (args); -+ if (TREE_CODE (cst) != STRING_CST) -+ { -+ warning (OPT_Wattributes, -+ "%qE attribute requires a string constant argument", -+ name); -+ *no_add_attrs = true; -+ } -+ else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0) -+ { -+ warning (OPT_Wattributes, -+ "argument to %qE attribute is not " -+ "(keep|thunk|thunk-inline|thunk-extern)", name); -+ *no_add_attrs = true; -+ } -+ } -+ - return NULL_TREE; - } - -@@ -49072,6 +49688,9 @@ static const struct attribute_spec ix86_attribute_table[] = - false }, - { "callee_pop_aggregate_return", 1, 1, false, true, true, - ix86_handle_callee_pop_aggregate_return, true }, -+ { "indirect_branch", 1, 1, true, false, false, -+ ix86_handle_fndecl_attribute, false }, -+ - /* End element. */ - { NULL, 0, 0, false, false, false, NULL, false } - }; -diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h -index 54144166172..9dccdb0351e 100644 ---- a/gcc/config/i386/i386.h -+++ b/gcc/config/i386/i386.h -@@ -2572,6 +2572,13 @@ struct GTY(()) machine_function { - /* If true, it is safe to not save/restore DRAP register. */ - BOOL_BITFIELD no_drap_save_restore : 1; - -+ /* How to generate indirec branch. */ -+ ENUM_BITFIELD(indirect_branch) indirect_branch_type : 3; -+ -+ /* If true, the current function has local indirect jumps, like -+ "indirect_jump" or "tablejump". */ -+ BOOL_BITFIELD has_local_indirect_jump : 1; -+ - /* If true, there is register available for argument passing. This - is used only in ix86_function_ok_for_sibcall by 32-bit to determine - if there is scratch register available for indirect sibcall. In -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index d2bfe314f71..153e1622b2d 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -11807,13 +11807,18 @@ - { - if (TARGET_X32) - operands[0] = convert_memory_address (word_mode, operands[0]); -+ cfun->machine->has_local_indirect_jump = true; - }) - - (define_insn "*indirect_jump" - [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))] - "" -- "%!jmp\t%A0" -- [(set_attr "type" "ibr") -+ "* return ix86_output_indirect_jmp (operands[0], false);" -+ [(set (attr "type") -+ (if_then_else (match_test "(cfun->machine->indirect_branch_type -+ != indirect_branch_keep)") -+ (const_string "multi") -+ (const_string "ibr"))) - (set_attr "length_immediate" "0") - (set_attr "maybe_prefix_bnd" "1")]) - -@@ -11856,14 +11861,19 @@ - - if (TARGET_X32) - operands[0] = convert_memory_address (word_mode, operands[0]); -+ cfun->machine->has_local_indirect_jump = true; - }) - - (define_insn "*tablejump_1" - [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw")) - (use (label_ref (match_operand 1)))] - "" -- "%!jmp\t%A0" -- [(set_attr "type" "ibr") -+ "* return ix86_output_indirect_jmp (operands[0], false);" -+ [(set (attr "type") -+ (if_then_else (match_test "(cfun->machine->indirect_branch_type -+ != indirect_branch_keep)") -+ (const_string "multi") -+ (const_string "ibr"))) - (set_attr "length_immediate" "0") - (set_attr "maybe_prefix_bnd" "1")]) - -@@ -12520,8 +12530,12 @@ - [(simple_return) - (use (match_operand:SI 0 "register_operand" "r"))] - "reload_completed" -- "%!jmp\t%A0" -- [(set_attr "type" "ibr") -+ "* return ix86_output_indirect_jmp (operands[0], true);" -+ [(set (attr "type") -+ (if_then_else (match_test "(cfun->machine->indirect_branch_type -+ != indirect_branch_keep)") -+ (const_string "multi") -+ (const_string "ibr"))) - (set_attr "length_immediate" "0") - (set_attr "maybe_prefix_bnd" "1")]) - -diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt -index f304b621e6a..5ffa3349a30 100644 ---- a/gcc/config/i386/i386.opt -+++ b/gcc/config/i386/i386.opt -@@ -897,3 +897,23 @@ Enum(stack_protector_guard) String(global) Value(SSP_GLOBAL) - mmitigate-rop - Target Var(flag_mitigate_rop) Init(0) - Attempt to avoid generating instruction sequences containing ret bytes. -+ -+mindirect-branch= -+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep) -+Convert indirect call and jump to call and return thunks. -+ -+Enum -+Name(indirect_branch) Type(enum indirect_branch) -+Known indirect branch choices (for use with the -mindirect-branch= option): -+ -+EnumValue -+Enum(indirect_branch) String(keep) Value(indirect_branch_keep) -+ -+EnumValue -+Enum(indirect_branch) String(thunk) Value(indirect_branch_thunk) -+ -+EnumValue -+Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline) -+ -+EnumValue -+Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern) -diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi -index 8cc4f7e1f6a..8668dae9e99 100644 ---- a/gcc/doc/extend.texi -+++ b/gcc/doc/extend.texi -@@ -5419,6 +5419,16 @@ Specify which floating-point unit to use. You must specify the - @code{target("fpmath=sse,387")} option as - @code{target("fpmath=sse+387")} because the comma would separate - different options. -+ -+@item indirect_branch("@var{choice}") -+@cindex @code{indirect_branch} function attribute, x86 -+On x86 targets, the @code{indirect_branch} attribute causes the compiler -+to convert indirect call and jump with @var{choice}. @samp{keep} -+keeps indirect call and jump unmodified. @samp{thunk} converts indirect -+call and jump to call and return thunk. @samp{thunk-inline} converts -+indirect call and jump to inlined call and return thunk. -+@samp{thunk-extern} converts indirect call and jump to external call -+and return thunk provided in a separate object file. - @end table - - On the x86, the inliner does not inline a -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 1d3a824d7b8..6f60339a56a 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -1169,7 +1169,7 @@ See RS/6000 and PowerPC Options. - -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol - -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol - -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol ---mmitigate-rop} -+-mmitigate-rop -mindirect-branch=@var{choice}} - - @emph{x86 Windows Options} - @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol -@@ -24230,6 +24230,17 @@ opcodes, to mitigate against certain forms of attack. At the moment, - this option is limited in what it can do and should not be relied - on to provide serious protection. - -+@item -mindirect-branch=@var{choice} -+@opindex -mindirect-branch -+Convert indirect call and jump with @var{choice}. The default is -+@samp{keep}, which keeps indirect call and jump unmodified. -+@samp{thunk} converts indirect call and jump to call and return thunk. -+@samp{thunk-inline} converts indirect call and jump to inlined call -+and return thunk. @samp{thunk-extern} converts indirect call and jump -+to external call and return thunk provided in a separate object file. -+You can control this behavior for a specific function by using the -+function attribute @code{indirect_branch}. @xref{Function Attributes}. -+ - @end table - - These @samp{-m} switches are supported in addition to the above -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -new file mode 100644 -index 00000000000..d983e1c3e26 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -new file mode 100644 -index 00000000000..58f09b42d8a ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -new file mode 100644 -index 00000000000..f20d35c19b6 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -new file mode 100644 -index 00000000000..0eff8fb658a ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -new file mode 100644 -index 00000000000..a25b20dd808 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -@@ -0,0 +1,17 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */ -+ -+extern void bar (void); -+ -+void -+foo (void) -+{ -+ bar (); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -new file mode 100644 -index 00000000000..cff114a6c29 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */ -+ -+extern void bar (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -new file mode 100644 -index 00000000000..afdb6007986 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -@@ -0,0 +1,44 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+void func0 (void); -+void func1 (void); -+void func2 (void); -+void func3 (void); -+void func4 (void); -+void func4 (void); -+void func5 (void); -+ -+void -+bar (int i) -+{ -+ switch (i) -+ { -+ default: -+ func0 (); -+ break; -+ case 1: -+ func1 (); -+ break; -+ case 2: -+ func2 (); -+ break; -+ case 3: -+ func3 (); -+ break; -+ case 4: -+ func4 (); -+ break; -+ case 5: -+ func5 (); -+ break; -+ } -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -new file mode 100644 -index 00000000000..d64d978b699 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+extern void male_indirect_jump (long) -+ __attribute__ ((indirect_branch("thunk"))); -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -new file mode 100644 -index 00000000000..93067454d3d ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+__attribute__ ((indirect_branch("thunk"))) -+void -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -new file mode 100644 -index 00000000000..97744d65729 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+extern int male_indirect_jump (long) -+ __attribute__ ((indirect_branch("thunk-inline"))); -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -new file mode 100644 -index 00000000000..bfce3ea5cb2 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+__attribute__ ((indirect_branch("thunk-inline"))) -+int -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -new file mode 100644 -index 00000000000..0833606046b ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+extern int male_indirect_jump (long) -+ __attribute__ ((indirect_branch("thunk-extern"))); -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -new file mode 100644 -index 00000000000..2eba0fbd9b2 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+__attribute__ ((indirect_branch("thunk-extern"))) -+int -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -new file mode 100644 -index 00000000000..f58427eae11 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -@@ -0,0 +1,44 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -fno-pic" } */ -+ -+void func0 (void); -+void func1 (void); -+void func2 (void); -+void func3 (void); -+void func4 (void); -+void func4 (void); -+void func5 (void); -+ -+__attribute__ ((indirect_branch("thunk-extern"))) -+void -+bar (int i) -+{ -+ switch (i) -+ { -+ default: -+ func0 (); -+ break; -+ case 1: -+ func1 (); -+ break; -+ case 2: -+ func2 (); -+ break; -+ case 3: -+ func3 (); -+ break; -+ case 4: -+ func4 (); -+ break; -+ case 5: -+ func5 (); -+ break; -+ } -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c -new file mode 100644 -index 00000000000..564ed39547c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c -@@ -0,0 +1,42 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+ -+void func0 (void); -+void func1 (void); -+void func2 (void); -+void func3 (void); -+void func4 (void); -+void func4 (void); -+void func5 (void); -+ -+__attribute__ ((indirect_branch("keep"))) -+void -+bar (int i) -+{ -+ switch (i) -+ { -+ default: -+ func0 (); -+ break; -+ case 1: -+ func1 (); -+ break; -+ case 2: -+ func2 (); -+ break; -+ case 3: -+ func3 (); -+ break; -+ case 4: -+ func4 (); -+ break; -+ case 5: -+ func5 (); -+ break; -+ } -+} -+ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -new file mode 100644 -index 00000000000..50fbee20a5a ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile { target { ! x32 } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+ -+void (*dispatch) (char *); -+char buf[10]; -+ -+void -+foo (void) -+{ -+ dispatch (buf); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd ret" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -new file mode 100644 -index 00000000000..2976e67adce ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile { target { ! x32 } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+ -+void (*dispatch) (char *); -+char buf[10]; -+ -+int -+foo (void) -+{ -+ dispatch (buf); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd ret" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -new file mode 100644 -index 00000000000..da4bc98ef23 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -@@ -0,0 +1,19 @@ -+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+ -+void bar (char *); -+char buf[10]; -+ -+void -+foo (void) -+{ -+ bar (buf); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "bnd ret" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -new file mode 100644 -index 00000000000..c64d12ef989 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+ -+void bar (char *); -+char buf[10]; -+ -+int -+foo (void) -+{ -+ bar (buf); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler "bnd ret" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -new file mode 100644 -index 00000000000..49f27b49465 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -@@ -0,0 +1,19 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -new file mode 100644 -index 00000000000..a1e3eb6fc74 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -@@ -0,0 +1,19 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -new file mode 100644 -index 00000000000..395634e7e5c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -new file mode 100644 -index 00000000000..fd3f63379a1 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -new file mode 100644 -index 00000000000..ba2f92b6f34 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -@@ -0,0 +1,16 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+ -+extern void bar (void); -+ -+void -+foo (void) -+{ -+ bar (); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -new file mode 100644 -index 00000000000..0c5a2d472c6 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -@@ -0,0 +1,17 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+ -+extern void bar (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -new file mode 100644 -index 00000000000..665252327aa ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -@@ -0,0 +1,43 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+void func0 (void); -+void func1 (void); -+void func2 (void); -+void func3 (void); -+void func4 (void); -+void func4 (void); -+void func5 (void); -+ -+void -+bar (int i) -+{ -+ switch (i) -+ { -+ default: -+ func0 (); -+ break; -+ case 1: -+ func1 (); -+ break; -+ case 2: -+ func2 (); -+ break; -+ case 3: -+ func3 (); -+ break; -+ case 4: -+ func4 (); -+ break; -+ case 5: -+ func5 (); -+ break; -+ } -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -new file mode 100644 -index 00000000000..68c0ff713b3 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -new file mode 100644 -index 00000000000..e2da1fcb683 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -new file mode 100644 -index 00000000000..244fec708d6 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -new file mode 100644 -index 00000000000..107ebe32f54 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -@@ -0,0 +1,21 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch[256]; -+ -+int -+male_indirect_jump (long offset) -+{ -+ dispatch[offset](offset); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -new file mode 100644 -index 00000000000..17b04ef2229 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -@@ -0,0 +1,17 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+ -+extern void bar (void); -+ -+void -+foo (void) -+{ -+ bar (); -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -new file mode 100644 -index 00000000000..d9eb11285aa ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile { target *-*-linux* } } */ -+/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+ -+extern void bar (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -new file mode 100644 -index 00000000000..d02b1dcb1b9 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -@@ -0,0 +1,44 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+void func0 (void); -+void func1 (void); -+void func2 (void); -+void func3 (void); -+void func4 (void); -+void func4 (void); -+void func5 (void); -+ -+void -+bar (int i) -+{ -+ switch (i) -+ { -+ default: -+ func0 (); -+ break; -+ case 1: -+ func1 (); -+ break; -+ case 2: -+ func2 (); -+ break; -+ case 3: -+ func3 (); -+ break; -+ case 4: -+ func4 (); -+ break; -+ case 5: -+ func5 (); -+ break; -+ } -+} -+ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ --- -2.16.3 - diff --git a/cross/gcc6-armhf/0005-x86-Add-mfunction-return.patch b/cross/gcc6-armhf/0005-x86-Add-mfunction-return.patch deleted file mode 100644 index f311d0678..000000000 --- a/cross/gcc6-armhf/0005-x86-Add-mfunction-return.patch +++ /dev/null @@ -1,1565 +0,0 @@ -From 3b946bffc536481a484d9a2b98b829f3d71b5519 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 6 Jan 2018 22:29:56 -0800 -Subject: [PATCH 05/13] x86: Add -mfunction-return= - -Add -mfunction-return= option to convert function return to call and -return thunks. The default is 'keep', which keeps function return -unmodified. 'thunk' converts function return to call and return thunk. -'thunk-inline' converts function return to inlined call and return thunk. -'thunk-extern' converts function return to external call and return -thunk provided in a separate object file. You can control this behavior -for a specific function by using the function attribute function_return. - -Function return thunk is the same as memory thunk for -mindirect-branch= -where the return address is at the top of the stack: - -__x86_return_thunk: - call L2 -L1: - pause - lfence - jmp L1 -L2: - lea 8(%rsp), %rsp|lea 4(%esp), %esp - ret - -and function return becomes - - jmp __x86_return_thunk - --mindirect-branch= tests are updated with -mfunction-return=keep to -avoid false test failures when -mfunction-return=thunk is added to -RUNTESTFLAGS for "make check". - -gcc/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * config/i386/i386-protos.h (ix86_output_function_return): New. - * config/i386/i386.c (ix86_set_indirect_branch_type): Also - set function_return_type. - (indirect_thunk_name): Add ret_p to indicate thunk for function - return. - (output_indirect_thunk_function): Pass false to - indirect_thunk_name. - (ix86_output_indirect_branch_via_reg): Likewise. - (ix86_output_indirect_branch_via_push): Likewise. - (output_indirect_thunk_function): Create alias for function - return thunk if regno < 0. - (ix86_output_function_return): New function. - (ix86_handle_fndecl_attribute): Handle function_return. - (ix86_attribute_table): Add function_return. - * config/i386/i386.h (machine_function): Add - function_return_type. - * config/i386/i386.md (simple_return_internal): Use - ix86_output_function_return. - (simple_return_internal_long): Likewise. - * config/i386/i386.opt (mfunction-return=): New option. - (indirect_branch): Mention -mfunction-return=. - * doc/extend.texi: Document function_return function attribute. - * doc/invoke.texi: Document -mfunction-return= option. - -gcc/testsuite/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * gcc.target/i386/indirect-thunk-1.c (dg-options): Add - -mfunction-return=keep. - * gcc.target/i386/indirect-thunk-2.c: Likewise. - * gcc.target/i386/indirect-thunk-3.c: Likewise. - * gcc.target/i386/indirect-thunk-4.c: Likewise. - * gcc.target/i386/indirect-thunk-5.c: Likewise. - * gcc.target/i386/indirect-thunk-6.c: Likewise. - * gcc.target/i386/indirect-thunk-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-8.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-5.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-6.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-5.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-6.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. - * gcc.target/i386/ret-thunk-1.c: New test. - * gcc.target/i386/ret-thunk-10.c: Likewise. - * gcc.target/i386/ret-thunk-11.c: Likewise. - * gcc.target/i386/ret-thunk-12.c: Likewise. - * gcc.target/i386/ret-thunk-13.c: Likewise. - * gcc.target/i386/ret-thunk-14.c: Likewise. - * gcc.target/i386/ret-thunk-15.c: Likewise. - * gcc.target/i386/ret-thunk-16.c: Likewise. - * gcc.target/i386/ret-thunk-2.c: Likewise. - * gcc.target/i386/ret-thunk-3.c: Likewise. - * gcc.target/i386/ret-thunk-4.c: Likewise. - * gcc.target/i386/ret-thunk-5.c: Likewise. - * gcc.target/i386/ret-thunk-6.c: Likewise. - * gcc.target/i386/ret-thunk-7.c: Likewise. - * gcc.target/i386/ret-thunk-8.c: Likewise. - * gcc.target/i386/ret-thunk-9.c: Likewise. - -i386: Don't use ASM_OUTPUT_DEF for TARGET_MACHO - -ASM_OUTPUT_DEF isn't defined for TARGET_MACHO. Use ASM_OUTPUT_LABEL to -generate the __x86_return_thunk label, instead of the set directive. -Update testcase to remove the __x86_return_thunk label check. Since --fno-pic is ignored on Darwin, update testcases to sscan or "push" -only on Linux. - -gcc/ - - Backport from mainline - 2018-01-15 H.J. Lu - - PR target/83839 - * config/i386/i386.c (output_indirect_thunk_function): Use - ASM_OUTPUT_LABEL, instead of ASM_OUTPUT_DEF, for TARGET_MACHO - for __x86.return_thunk. - -gcc/testsuite/ - - Backport from mainline - 2018-01-15 H.J. Lu - - PR target/83839 - * gcc.target/i386/indirect-thunk-1.c: Scan for "push" only on - Linux. - * gcc.target/i386/indirect-thunk-2.c: Likewise. - * gcc.target/i386/indirect-thunk-3.c: Likewise. - * gcc.target/i386/indirect-thunk-4.c: Likewise. - * gcc.target/i386/indirect-thunk-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. - * gcc.target/i386/indirect-thunk-register-1.c: Likewise. - * gcc.target/i386/indirect-thunk-register-3.c: Likewise. - * gcc.target/i386/indirect-thunk-register-4.c: Likewise. - * gcc.target/i386/ret-thunk-10.c: Likewise. - * gcc.target/i386/ret-thunk-11.c: Likewise. - * gcc.target/i386/ret-thunk-12.c: Likewise. - * gcc.target/i386/ret-thunk-13.c: Likewise. - * gcc.target/i386/ret-thunk-14.c: Likewise. - * gcc.target/i386/ret-thunk-15.c: Likewise. - * gcc.target/i386/ret-thunk-9.c: Don't check the - __x86_return_thunk label. - Scan for "push" only for Linux. ---- - gcc/config/i386/i386-protos.h | 1 + - gcc/config/i386/i386.c | 152 +++++++++++++++++++-- - gcc/config/i386/i386.h | 3 + - gcc/config/i386/i386.md | 9 +- - gcc/config/i386/i386.opt | 6 +- - gcc/doc/extend.texi | 9 ++ - gcc/doc/invoke.texi | 14 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 4 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 4 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 4 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 4 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-1.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-2.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-3.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-4.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-5.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-6.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-7.c | 4 +- - .../gcc.target/i386/indirect-thunk-attr-8.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-1.c | 4 +- - .../gcc.target/i386/indirect-thunk-bnd-2.c | 4 +- - .../gcc.target/i386/indirect-thunk-bnd-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-1.c | 4 +- - .../gcc.target/i386/indirect-thunk-extern-2.c | 4 +- - .../gcc.target/i386/indirect-thunk-extern-3.c | 4 +- - .../gcc.target/i386/indirect-thunk-extern-4.c | 4 +- - .../gcc.target/i386/indirect-thunk-extern-5.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-6.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-7.c | 4 +- - .../gcc.target/i386/indirect-thunk-inline-1.c | 4 +- - .../gcc.target/i386/indirect-thunk-inline-2.c | 4 +- - .../gcc.target/i386/indirect-thunk-inline-3.c | 4 +- - .../gcc.target/i386/indirect-thunk-inline-4.c | 4 +- - .../gcc.target/i386/indirect-thunk-inline-5.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-6.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-7.c | 4 +- - gcc/testsuite/gcc.target/i386/ret-thunk-1.c | 13 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 23 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 23 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 22 +++ - gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 22 +++ - gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 22 +++ - gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 22 +++ - gcc/testsuite/gcc.target/i386/ret-thunk-16.c | 18 +++ - gcc/testsuite/gcc.target/i386/ret-thunk-2.c | 13 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-3.c | 12 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-4.c | 12 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-5.c | 15 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-6.c | 14 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-7.c | 13 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-8.c | 14 ++ - gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 24 ++++ - 56 files changed, 516 insertions(+), 74 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-10.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-11.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-12.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-13.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-14.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-15.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-16.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-3.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-4.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-5.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-6.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-7.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-8.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-9.c - -diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h -index eca4cbf0776..620d70ef9f6 100644 ---- a/gcc/config/i386/i386-protos.h -+++ b/gcc/config/i386/i386-protos.h -@@ -312,6 +312,7 @@ extern enum attr_cpu ix86_schedule; - - extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op); - extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p); -+extern const char * ix86_output_function_return (bool long_p); - extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load, - enum machine_mode mode); - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 0b9fc4d3026..34e26a3a3c7 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -6390,6 +6390,31 @@ ix86_set_indirect_branch_type (tree fndecl) - else - cfun->machine->indirect_branch_type = ix86_indirect_branch; - } -+ -+ if (cfun->machine->function_return_type == indirect_branch_unset) -+ { -+ tree attr = lookup_attribute ("function_return", -+ DECL_ATTRIBUTES (fndecl)); -+ if (attr != NULL) -+ { -+ tree args = TREE_VALUE (attr); -+ if (args == NULL) -+ gcc_unreachable (); -+ tree cst = TREE_VALUE (args); -+ if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0) -+ cfun->machine->function_return_type = indirect_branch_keep; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0) -+ cfun->machine->function_return_type = indirect_branch_thunk; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0) -+ cfun->machine->function_return_type = indirect_branch_thunk_inline; -+ else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0) -+ cfun->machine->function_return_type = indirect_branch_thunk_extern; -+ else -+ gcc_unreachable (); -+ } -+ else -+ cfun->machine->function_return_type = ix86_function_return; -+ } - } - - /* Establish appropriate back-end context for processing the function -@@ -11036,8 +11061,12 @@ static int indirect_thunks_bnd_used; - /* Fills in the label name that should be used for the indirect thunk. */ - - static void --indirect_thunk_name (char name[32], int regno, bool need_bnd_p) -+indirect_thunk_name (char name[32], int regno, bool need_bnd_p, -+ bool ret_p) - { -+ if (regno >= 0 && ret_p) -+ gcc_unreachable (); -+ - if (USE_HIDDEN_LINKONCE) - { - const char *bnd = need_bnd_p ? "_bnd" : ""; -@@ -11052,7 +11081,10 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p) - bnd, reg_prefix, reg_names[regno]); - } - else -- sprintf (name, "__x86_indirect_thunk%s", bnd); -+ { -+ const char *ret = ret_p ? "return" : "indirect"; -+ sprintf (name, "__x86_%s_thunk%s", ret, bnd); -+ } - } - else - { -@@ -11065,10 +11097,20 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p) - } - else - { -- if (need_bnd_p) -- ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0); -+ if (ret_p) -+ { -+ if (need_bnd_p) -+ ASM_GENERATE_INTERNAL_LABEL (name, "LRTB", 0); -+ else -+ ASM_GENERATE_INTERNAL_LABEL (name, "LRT", 0); -+ } - else -- ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0); -+ { -+ if (need_bnd_p) -+ ASM_GENERATE_INTERNAL_LABEL (name, "LITB", 0); -+ else -+ ASM_GENERATE_INTERNAL_LABEL (name, "LIT", 0); -+ } - } - } - } -@@ -11163,7 +11205,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno) - tree decl; - - /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */ -- indirect_thunk_name (name, regno, need_bnd_p); -+ indirect_thunk_name (name, regno, need_bnd_p, false); - decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, - get_identifier (name), - build_function_type_list (void_type_node, NULL_TREE)); -@@ -11206,6 +11248,36 @@ output_indirect_thunk_function (bool need_bnd_p, int regno) - ASM_OUTPUT_LABEL (asm_out_file, name); - } - -+ if (regno < 0) -+ { -+ /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */ -+ char alias[32]; -+ -+ indirect_thunk_name (alias, regno, need_bnd_p, true); -+#if TARGET_MACHO -+ if (TARGET_MACHO) -+ { -+ fputs ("\t.weak_definition\t", asm_out_file); -+ assemble_name (asm_out_file, alias); -+ fputs ("\n\t.private_extern\t", asm_out_file); -+ assemble_name (asm_out_file, alias); -+ putc ('\n', asm_out_file); -+ ASM_OUTPUT_LABEL (asm_out_file, alias); -+ } -+#else -+ ASM_OUTPUT_DEF (asm_out_file, alias, name); -+ if (USE_HIDDEN_LINKONCE) -+ { -+ fputs ("\t.globl\t", asm_out_file); -+ assemble_name (asm_out_file, alias); -+ putc ('\n', asm_out_file); -+ fputs ("\t.hidden\t", asm_out_file); -+ assemble_name (asm_out_file, alias); -+ putc ('\n', asm_out_file); -+ } -+#endif -+ } -+ - DECL_INITIAL (decl) = make_node (BLOCK); - current_function_decl = decl; - allocate_struct_function (decl, false); -@@ -27687,7 +27759,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p) - else - indirect_thunks_used |= 1 << i; - } -- indirect_thunk_name (thunk_name_buf, regno, need_bnd_p); -+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false); - thunk_name = thunk_name_buf; - } - else -@@ -27796,7 +27868,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm, - else - indirect_thunk_needed = true; - } -- indirect_thunk_name (thunk_name_buf, regno, need_bnd_p); -+ indirect_thunk_name (thunk_name_buf, regno, need_bnd_p, false); - thunk_name = thunk_name_buf; - } - else -@@ -27931,6 +28003,46 @@ ix86_output_indirect_jmp (rtx call_op, bool ret_p) - return "%!jmp\t%A0"; - } - -+/* Output function return. CALL_OP is the jump target. Add a REP -+ prefix to RET if LONG_P is true and function return is kept. */ -+ -+const char * -+ix86_output_function_return (bool long_p) -+{ -+ if (cfun->machine->function_return_type != indirect_branch_keep) -+ { -+ char thunk_name[32]; -+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn); -+ -+ if (cfun->machine->function_return_type -+ != indirect_branch_thunk_inline) -+ { -+ bool need_thunk = (cfun->machine->function_return_type -+ == indirect_branch_thunk); -+ indirect_thunk_name (thunk_name, -1, need_bnd_p, true); -+ if (need_bnd_p) -+ { -+ indirect_thunk_bnd_needed |= need_thunk; -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ } -+ else -+ { -+ indirect_thunk_needed |= need_thunk; -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ } -+ else -+ output_indirect_thunk (need_bnd_p, -1); -+ -+ return ""; -+ } -+ -+ if (!long_p || ix86_bnd_prefixed_insn_p (current_output_insn)) -+ return "%!ret"; -+ -+ return "rep%; ret"; -+} -+ - /* Output the assembly for a call instruction. */ - - const char * -@@ -45461,6 +45573,28 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int, - } - } - -+ if (is_attribute_p ("function_return", name)) -+ { -+ tree cst = TREE_VALUE (args); -+ if (TREE_CODE (cst) != STRING_CST) -+ { -+ warning (OPT_Wattributes, -+ "%qE attribute requires a string constant argument", -+ name); -+ *no_add_attrs = true; -+ } -+ else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0 -+ && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0) -+ { -+ warning (OPT_Wattributes, -+ "argument to %qE attribute is not " -+ "(keep|thunk|thunk-inline|thunk-extern)", name); -+ *no_add_attrs = true; -+ } -+ } -+ - return NULL_TREE; - } - -@@ -49690,6 +49824,8 @@ static const struct attribute_spec ix86_attribute_table[] = - ix86_handle_callee_pop_aggregate_return, true }, - { "indirect_branch", 1, 1, true, false, false, - ix86_handle_fndecl_attribute, false }, -+ { "function_return", 1, 1, true, false, false, -+ ix86_handle_fndecl_attribute, false }, - - /* End element. */ - { NULL, 0, 0, false, false, false, NULL, false } -diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h -index 9dccdb0351e..b34bc117c34 100644 ---- a/gcc/config/i386/i386.h -+++ b/gcc/config/i386/i386.h -@@ -2579,6 +2579,9 @@ struct GTY(()) machine_function { - "indirect_jump" or "tablejump". */ - BOOL_BITFIELD has_local_indirect_jump : 1; - -+ /* How to generate function return. */ -+ ENUM_BITFIELD(indirect_branch) function_return_type : 3; -+ - /* If true, there is register available for argument passing. This - is used only in ix86_function_ok_for_sibcall by 32-bit to determine - if there is scratch register available for indirect sibcall. In -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index 153e1622b2d..2da671e9f2d 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -12489,7 +12489,7 @@ - (define_insn "simple_return_internal" - [(simple_return)] - "reload_completed" -- "%!ret" -+ "* return ix86_output_function_return (false);" - [(set_attr "length" "1") - (set_attr "atom_unit" "jeu") - (set_attr "length_immediate" "0") -@@ -12503,12 +12503,7 @@ - [(simple_return) - (unspec [(const_int 0)] UNSPEC_REP)] - "reload_completed" --{ -- if (ix86_bnd_prefixed_insn_p (insn)) -- return "%!ret"; -- -- return "rep%; ret"; --} -+ "* return ix86_output_function_return (true);" - [(set_attr "length" "2") - (set_attr "atom_unit" "jeu") - (set_attr "length_immediate" "0") -diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt -index 5ffa3349a30..ad5916fb643 100644 ---- a/gcc/config/i386/i386.opt -+++ b/gcc/config/i386/i386.opt -@@ -902,9 +902,13 @@ mindirect-branch= - Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_indirect_branch) Init(indirect_branch_keep) - Convert indirect call and jump to call and return thunks. - -+mfunction-return= -+Target Report RejectNegative Joined Enum(indirect_branch) Var(ix86_function_return) Init(indirect_branch_keep) -+Convert function return to call and return thunk. -+ - Enum - Name(indirect_branch) Type(enum indirect_branch) --Known indirect branch choices (for use with the -mindirect-branch= option): -+Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options): - - EnumValue - Enum(indirect_branch) String(keep) Value(indirect_branch_keep) -diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi -index 8668dae9e99..2cb6bd1ef3e 100644 ---- a/gcc/doc/extend.texi -+++ b/gcc/doc/extend.texi -@@ -5429,6 +5429,15 @@ call and jump to call and return thunk. @samp{thunk-inline} converts - indirect call and jump to inlined call and return thunk. - @samp{thunk-extern} converts indirect call and jump to external call - and return thunk provided in a separate object file. -+ -+@item function_return("@var{choice}") -+@cindex @code{function_return} function attribute, x86 -+On x86 targets, the @code{function_return} attribute causes the compiler -+to convert function return with @var{choice}. @samp{keep} keeps function -+return unmodified. @samp{thunk} converts function return to call and -+return thunk. @samp{thunk-inline} converts function return to inlined -+call and return thunk. @samp{thunk-extern} converts function return to -+external call and return thunk provided in a separate object file. - @end table - - On the x86, the inliner does not inline a -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 6f60339a56a..337a761015a 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -1169,7 +1169,8 @@ See RS/6000 and PowerPC Options. - -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol - -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol - -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol ---mmitigate-rop -mindirect-branch=@var{choice}} -+-mmitigate-rop -mindirect-branch=@var{choice} @gol -+-mfunction-return=@var{choice}} - - @emph{x86 Windows Options} - @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol -@@ -24241,6 +24242,17 @@ to external call and return thunk provided in a separate object file. - You can control this behavior for a specific function by using the - function attribute @code{indirect_branch}. @xref{Function Attributes}. - -+@item -mfunction-return=@var{choice} -+@opindex -mfunction-return -+Convert function return with @var{choice}. The default is @samp{keep}, -+which keeps function return unmodified. @samp{thunk} converts function -+return to call and return thunk. @samp{thunk-inline} converts function -+return to inlined call and return thunk. @samp{thunk-extern} converts -+function return to external call and return thunk provided in a separate -+object file. You can control this behavior for a specific function by -+using the function attribute @code{function_return}. -+@xref{Function Attributes}. -+ - @end table - - These @samp{-m} switches are supported in addition to the above -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -index d983e1c3e26..e365ef5698a 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -index 58f09b42d8a..05a51ad9157 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -index f20d35c19b6..3c0d4c39f0b 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -index 0eff8fb658a..14d4ef6dd98 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -index a25b20dd808..b4836c38d6c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -index cff114a6c29..1f06bd1af74 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -index afdb6007986..bc6b47a636e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - void func0 (void); - void func1 (void); -@@ -35,7 +35,7 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -index d64d978b699..2257be3affa 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -14,7 +14,7 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -index 93067454d3d..e9cfdc5879e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -index 97744d65729..f938db050f7 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -14,7 +14,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -index bfce3ea5cb2..4e58599692a 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -13,7 +13,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -index 0833606046b..b8d50249d8b 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -14,7 +14,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -index 2eba0fbd9b2..455adabfe0e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -13,7 +13,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -index f58427eae11..4595b841ec0 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ - - void func0 (void); - void func1 (void); -@@ -36,7 +36,7 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c -index 564ed39547c..d730d31bda1 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - void func0 (void); - void func1 (void); -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -index 50fbee20a5a..5e3e118e9bd 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! x32 } } } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ - - void (*dispatch) (char *); - char buf[10]; -@@ -10,7 +10,7 @@ foo (void) - dispatch (buf); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ - /* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -index 2976e67adce..2801aa4192e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! x32 } } } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ - - void (*dispatch) (char *); - char buf[10]; -@@ -11,7 +11,7 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ - /* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ - /* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -index da4bc98ef23..70b4fb36eea 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ - - void bar (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -index c64d12ef989..3baf03ee77c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ --/* { dg-options "-O2 -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ - - void bar (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -index 49f27b49465..edeb264218c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -index a1e3eb6fc74..1d00413a76a 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -index 395634e7e5c..06ebf1c9063 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -index fd3f63379a1..1c8f9446636 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -index ba2f92b6f34..21740ac5b7f 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -index 0c5a2d472c6..a77c1f470b8 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -index 665252327aa..86e9fd1f1e4 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - void func0 (void); - void func1 (void); -@@ -35,7 +35,7 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -index 68c0ff713b3..3ecde878867 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -index e2da1fcb683..df32a19a2b5 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -index 244fec708d6..9540996de01 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -index 107ebe32f54..f3db6e2441f 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -index 17b04ef2229..0f687c3b027 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -index d9eb11285aa..b27c6fc96a2 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -index d02b1dcb1b9..764a375fc37 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - void func0 (void); - void func1 (void); -@@ -35,7 +35,7 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-1.c b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c -new file mode 100644 -index 00000000000..7223f67ba5e ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-1.c -@@ -0,0 +1,13 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk" } */ -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -new file mode 100644 -index 00000000000..3a6727b5c54 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 2 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -new file mode 100644 -index 00000000000..b8f68188313 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -@@ -0,0 +1,23 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -new file mode 100644 -index 00000000000..01b0a02f80b ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -new file mode 100644 -index 00000000000..4b497b5f8af ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+ -+extern void (*bar) (void); -+extern int foo (void) __attribute__ ((function_return("thunk"))); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 2 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -new file mode 100644 -index 00000000000..4ae4c44a3fd ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+__attribute__ ((function_return("thunk-inline"))) -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -new file mode 100644 -index 00000000000..5b5bc765a7e ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+__attribute__ ((function_return("thunk-extern"), indirect_branch("thunk"))) -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-16.c b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c -new file mode 100644 -index 00000000000..a16cad16aaa ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-16.c -@@ -0,0 +1,18 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk-extern -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+__attribute__ ((function_return("keep"), indirect_branch("keep"))) -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler-not "__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-2.c b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c -new file mode 100644 -index 00000000000..c6659e3ad09 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-2.c -@@ -0,0 +1,13 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */ -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-3.c b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c -new file mode 100644 -index 00000000000..0f7f388f459 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-3.c -@@ -0,0 +1,12 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */ -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-4.c b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c -new file mode 100644 -index 00000000000..9ae37e835a0 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-4.c -@@ -0,0 +1,12 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep" } */ -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-5.c b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c -new file mode 100644 -index 00000000000..4bd0d2a27bc ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-5.c -@@ -0,0 +1,15 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep" } */ -+ -+extern void foo (void) __attribute__ ((function_return("thunk"))); -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-6.c b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c -new file mode 100644 -index 00000000000..053841f6f7d ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-6.c -@@ -0,0 +1,14 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep" } */ -+ -+__attribute__ ((function_return("thunk-inline"))) -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-7.c b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c -new file mode 100644 -index 00000000000..262e6780112 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-7.c -@@ -0,0 +1,13 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=keep" } */ -+ -+__attribute__ ((function_return("thunk-extern"))) -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-8.c b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c -new file mode 100644 -index 00000000000..c1658e96673 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-8.c -@@ -0,0 +1,14 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */ -+ -+extern void foo (void) __attribute__ ((function_return("keep"))); -+ -+void -+foo (void) -+{ -+} -+ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -new file mode 100644 -index 00000000000..fa24a1f7365 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -@@ -0,0 +1,24 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ -+ -+extern void (*bar) (void); -+ -+int -+foo (void) -+{ -+ bar (); -+ return 0; -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */ -+/* { dg-final { scan-assembler-times {\tpause} 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times {\tpause} 2 { target { x32 } } } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 2 { target { x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ --- -2.16.3 - diff --git a/cross/gcc6-armhf/0006-x86-Add-mindirect-branch-register.patch b/cross/gcc6-armhf/0006-x86-Add-mindirect-branch-register.patch deleted file mode 100644 index 111e6e43d..000000000 --- a/cross/gcc6-armhf/0006-x86-Add-mindirect-branch-register.patch +++ /dev/null @@ -1,941 +0,0 @@ -From 61bb7f0e152ce5be700a44007d036ea0de4b254d Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 6 Jan 2018 22:29:56 -0800 -Subject: [PATCH 06/13] x86: Add -mindirect-branch-register - -Add -mindirect-branch-register to force indirect branch via register. -This is implemented by disabling patterns of indirect branch via memory, -similar to TARGET_X32. - --mindirect-branch= and -mfunction-return= tests are updated with --mno-indirect-branch-register to avoid false test failures when --mindirect-branch-register is added to RUNTESTFLAGS for "make check". - -gcc/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * config/i386/constraints.md (Bs): Disallow memory operand for - -mindirect-branch-register. - (Bw): Likewise. - * config/i386/predicates.md (indirect_branch_operand): Likewise. - (GOT_memory_operand): Likewise. - (call_insn_operand): Likewise. - (sibcall_insn_operand): Likewise. - (GOT32_symbol_operand): Likewise. - * config/i386/i386.md (indirect_jump): Call convert_memory_address - for -mindirect-branch-register. - (tablejump): Likewise. - (*sibcall_memory): Likewise. - (*sibcall_value_memory): Likewise. - Disallow peepholes of indirect call and jump via memory for - -mindirect-branch-register. - (*call_pop): Replace m with Bw. - (*call_value_pop): Likewise. - (*sibcall_pop_memory): Replace m with Bs. - * config/i386/i386.opt (mindirect-branch-register): New option. - * doc/invoke.texi: Document -mindirect-branch-register option. - -gcc/testsuite/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * gcc.target/i386/indirect-thunk-1.c (dg-options): Add - -mno-indirect-branch-register. - * gcc.target/i386/indirect-thunk-2.c: Likewise. - * gcc.target/i386/indirect-thunk-3.c: Likewise. - * gcc.target/i386/indirect-thunk-4.c: Likewise. - * gcc.target/i386/indirect-thunk-5.c: Likewise. - * gcc.target/i386/indirect-thunk-6.c: Likewise. - * gcc.target/i386/indirect-thunk-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-5.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-6.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-5.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-6.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. - * gcc.target/i386/ret-thunk-10.c: Likewise. - * gcc.target/i386/ret-thunk-11.c: Likewise. - * gcc.target/i386/ret-thunk-12.c: Likewise. - * gcc.target/i386/ret-thunk-13.c: Likewise. - * gcc.target/i386/ret-thunk-14.c: Likewise. - * gcc.target/i386/ret-thunk-15.c: Likewise. - * gcc.target/i386/ret-thunk-9.c: Likewise. - * gcc.target/i386/indirect-thunk-register-1.c: New test. - * gcc.target/i386/indirect-thunk-register-2.c: Likewise. - * gcc.target/i386/indirect-thunk-register-3.c: Likewise. - -i386: Rename to ix86_indirect_branch_register - -Rename the variable for -mindirect-branch-register to -ix86_indirect_branch_register to match the command-line option name. - - Backport from mainline - 2018-01-15 H.J. Lu - - * config/i386/constraints.md (Bs): Replace - ix86_indirect_branch_thunk_register with - ix86_indirect_branch_register. - (Bw): Likewise. - * config/i386/i386.md (indirect_jump): Likewise. - (tablejump): Likewise. - (*sibcall_memory): Likewise. - (*sibcall_value_memory): Likewise. - Peepholes of indirect call and jump via memory: Likewise. - * config/i386/i386.opt: Likewise. - * config/i386/predicates.md (indirect_branch_operand): Likewise. - (GOT_memory_operand): Likewise. - (call_insn_operand): Likewise. - (sibcall_insn_operand): Likewise. - (GOT32_symbol_operand): Likewise. - -x86: Rewrite ix86_indirect_branch_register logic - -Rewrite ix86_indirect_branch_register logic with - -(and (not (match_test "ix86_indirect_branch_register")) - (original condition before r256662)) - - Backport from mainline - 2018-01-15 H.J. Lu - - * config/i386/predicates.md (constant_call_address_operand): - Rewrite ix86_indirect_branch_register logic. - (sibcall_insn_operand): Likewise. - -Don't check ix86_indirect_branch_register for GOT operand - -Since GOT_memory_operand and GOT32_symbol_operand are simple pattern -matches, don't check ix86_indirect_branch_register here. If needed, --mindirect-branch= will convert indirect branch via GOT slot to a call -and return thunk. - - Backport from mainline - 2018-01-15 H.J. Lu - - * config/i386/constraints.md (Bs): Update - ix86_indirect_branch_register check. Don't check - ix86_indirect_branch_register with GOT_memory_operand. - (Bw): Likewise. - * config/i386/predicates.md (GOT_memory_operand): Don't check - ix86_indirect_branch_register here. - (GOT32_symbol_operand): Likewise. - -i386: Rewrite indirect_branch_operand logic - - Backport from mainline - 2018-01-15 H.J. Lu - - * config/i386/predicates.md (indirect_branch_operand): Rewrite - ix86_indirect_branch_register logic. ---- - gcc/config/i386/constraints.md | 6 ++-- - gcc/config/i386/i386.md | 34 ++++++++++++++-------- - gcc/config/i386/i386.opt | 4 +++ - gcc/config/i386/predicates.md | 21 +++++++------ - gcc/doc/invoke.texi | 6 +++- - gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 2 +- - gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-1.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-2.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-5.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-6.c | 2 +- - .../gcc.target/i386/indirect-thunk-attr-7.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-1.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-2.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-bnd-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-1.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-2.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-5.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-6.c | 2 +- - .../gcc.target/i386/indirect-thunk-extern-7.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-1.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-2.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-5.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-6.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-7.c | 2 +- - .../gcc.target/i386/indirect-thunk-register-1.c | 22 ++++++++++++++ - .../gcc.target/i386/indirect-thunk-register-2.c | 20 +++++++++++++ - .../gcc.target/i386/indirect-thunk-register-3.c | 19 ++++++++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 2 +- - gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 2 +- - 47 files changed, 147 insertions(+), 63 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c - -diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md -index 1a4c701ad13..9204c8e8487 100644 ---- a/gcc/config/i386/constraints.md -+++ b/gcc/config/i386/constraints.md -@@ -172,14 +172,16 @@ - - (define_constraint "Bs" - "@internal Sibcall memory operand." -- (ior (and (not (match_test "TARGET_X32")) -+ (ior (and (not (match_test "ix86_indirect_branch_register")) -+ (not (match_test "TARGET_X32")) - (match_operand 0 "sibcall_memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") - (match_operand 0 "GOT_memory_operand")))) - - (define_constraint "Bw" - "@internal Call memory operand." -- (ior (and (not (match_test "TARGET_X32")) -+ (ior (and (not (match_test "ix86_indirect_branch_register")) -+ (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") - (match_operand 0 "GOT_memory_operand")))) -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index 2da671e9f2d..05a88fff356 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -11805,7 +11805,7 @@ - [(set (pc) (match_operand 0 "indirect_branch_operand"))] - "" - { -- if (TARGET_X32) -+ if (TARGET_X32 || ix86_indirect_branch_register) - operands[0] = convert_memory_address (word_mode, operands[0]); - cfun->machine->has_local_indirect_jump = true; - }) -@@ -11859,7 +11859,7 @@ - OPTAB_DIRECT); - } - -- if (TARGET_X32) -+ if (TARGET_X32 || ix86_indirect_branch_register) - operands[0] = convert_memory_address (word_mode, operands[0]); - cfun->machine->has_local_indirect_jump = true; - }) -@@ -12048,7 +12048,7 @@ - [(call (mem:QI (match_operand:W 0 "memory_operand" "m")) - (match_operand 1)) - (unspec [(const_int 0)] UNSPEC_PEEPSIB)] -- "!TARGET_X32" -+ "!TARGET_X32 && !ix86_indirect_branch_register" - "* return ix86_output_call_insn (insn, operands[0]);" - [(set_attr "type" "call")]) - -@@ -12057,7 +12057,9 @@ - (match_operand:W 1 "memory_operand")) - (call (mem:QI (match_dup 0)) - (match_operand 3))] -- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1)) -+ "!TARGET_X32 -+ && !ix86_indirect_branch_register -+ && SIBLING_CALL_P (peep2_next_insn (1)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" - [(parallel [(call (mem:QI (match_dup 1)) -@@ -12070,7 +12072,9 @@ - (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) - (call (mem:QI (match_dup 0)) - (match_operand 3))] -- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2)) -+ "!TARGET_X32 -+ && !ix86_indirect_branch_register -+ && SIBLING_CALL_P (peep2_next_insn (2)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" - [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) -@@ -12092,7 +12096,7 @@ - }) - - (define_insn "*call_pop" -- [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lmBz")) -+ [(call (mem:QI (match_operand:SI 0 "call_insn_operand" "lBwBz")) - (match_operand 1)) - (set (reg:SI SP_REG) - (plus:SI (reg:SI SP_REG) -@@ -12112,7 +12116,7 @@ - [(set_attr "type" "call")]) - - (define_insn "*sibcall_pop_memory" -- [(call (mem:QI (match_operand:SI 0 "memory_operand" "m")) -+ [(call (mem:QI (match_operand:SI 0 "memory_operand" "Bs")) - (match_operand 1)) - (set (reg:SI SP_REG) - (plus:SI (reg:SI SP_REG) -@@ -12166,7 +12170,9 @@ - [(set (match_operand:W 0 "register_operand") - (match_operand:W 1 "memory_operand")) - (set (pc) (match_dup 0))] -- "!TARGET_X32 && peep2_reg_dead_p (2, operands[0])" -+ "!TARGET_X32 -+ && !ix86_indirect_branch_register -+ && peep2_reg_dead_p (2, operands[0])" - [(set (pc) (match_dup 1))]) - - ;; Call subroutine, returning value in operand 0 -@@ -12244,7 +12250,7 @@ - (call (mem:QI (match_operand:W 1 "memory_operand" "m")) - (match_operand 2))) - (unspec [(const_int 0)] UNSPEC_PEEPSIB)] -- "!TARGET_X32" -+ "!TARGET_X32 && !ix86_indirect_branch_register" - "* return ix86_output_call_insn (insn, operands[1]);" - [(set_attr "type" "callv")]) - -@@ -12254,7 +12260,9 @@ - (set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3)))] -- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (1)) -+ "!TARGET_X32 -+ && !ix86_indirect_branch_register -+ && SIBLING_CALL_P (peep2_next_insn (1)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" - [(parallel [(set (match_dup 2) -@@ -12269,7 +12277,9 @@ - (set (match_operand 2) - (call (mem:QI (match_dup 0)) - (match_operand 3)))] -- "!TARGET_X32 && SIBLING_CALL_P (peep2_next_insn (2)) -+ "!TARGET_X32 -+ && !ix86_indirect_branch_register -+ && SIBLING_CALL_P (peep2_next_insn (2)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" - [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE) -@@ -12294,7 +12304,7 @@ - - (define_insn "*call_value_pop" - [(set (match_operand 0) -- (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lmBz")) -+ (call (mem:QI (match_operand:SI 1 "call_insn_operand" "lBwBz")) - (match_operand 2))) - (set (reg:SI SP_REG) - (plus:SI (reg:SI SP_REG) -diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt -index ad5916fb643..a97f84f68f2 100644 ---- a/gcc/config/i386/i386.opt -+++ b/gcc/config/i386/i386.opt -@@ -921,3 +921,7 @@ Enum(indirect_branch) String(thunk-inline) Value(indirect_branch_thunk_inline) - - EnumValue - Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern) -+ -+mindirect-branch-register -+Target Report Var(ix86_indirect_branch_register) Init(0) -+Force indirect call and jump via register. -diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md -index 93dda7bb0e7..d1f0a7dbf61 100644 ---- a/gcc/config/i386/predicates.md -+++ b/gcc/config/i386/predicates.md -@@ -593,7 +593,8 @@ - ;; Test for a valid operand for indirect branch. - (define_predicate "indirect_branch_operand" - (ior (match_operand 0 "register_operand") -- (and (not (match_test "TARGET_X32")) -+ (and (not (match_test "ix86_indirect_branch_register")) -+ (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")))) - - ;; Return true if OP is a memory operands that can be used in sibcalls. -@@ -636,20 +637,22 @@ - (ior (match_test "constant_call_address_operand - (op, mode == VOIDmode ? mode : Pmode)") - (match_operand 0 "call_register_no_elim_operand") -- (ior (and (not (match_test "TARGET_X32")) -- (match_operand 0 "memory_operand")) -- (and (match_test "TARGET_X32 && Pmode == DImode") -- (match_operand 0 "GOT_memory_operand"))))) -+ (and (not (match_test "ix86_indirect_branch_register")) -+ (ior (and (not (match_test "TARGET_X32")) -+ (match_operand 0 "memory_operand")) -+ (and (match_test "TARGET_X32 && Pmode == DImode") -+ (match_operand 0 "GOT_memory_operand")))))) - - ;; Similarly, but for tail calls, in which we cannot allow memory references. - (define_special_predicate "sibcall_insn_operand" - (ior (match_test "constant_call_address_operand - (op, mode == VOIDmode ? mode : Pmode)") - (match_operand 0 "register_no_elim_operand") -- (ior (and (not (match_test "TARGET_X32")) -- (match_operand 0 "sibcall_memory_operand")) -- (and (match_test "TARGET_X32 && Pmode == DImode") -- (match_operand 0 "GOT_memory_operand"))))) -+ (and (not (match_test "ix86_indirect_branch_register")) -+ (ior (and (not (match_test "TARGET_X32")) -+ (match_operand 0 "sibcall_memory_operand")) -+ (and (match_test "TARGET_X32 && Pmode == DImode") -+ (match_operand 0 "GOT_memory_operand")))))) - - ;; Return true if OP is a 32-bit GOT symbol operand. - (define_predicate "GOT32_symbol_operand" -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 337a761015a..94374661f2d 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -1170,7 +1170,7 @@ See RS/6000 and PowerPC Options. - -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol - -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol - -mmitigate-rop -mindirect-branch=@var{choice} @gol ---mfunction-return=@var{choice}} -+-mfunction-return=@var{choice} -mindirect-branch-register} - - @emph{x86 Windows Options} - @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol -@@ -24253,6 +24253,10 @@ object file. You can control this behavior for a specific function by - using the function attribute @code{function_return}. - @xref{Function Attributes}. - -+@item -mindirect-branch-register -+@opindex -mindirect-branch-register -+Force indirect call and jump via register. -+ - @end table - - These @samp{-m} switches are supported in addition to the above -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -index e365ef5698a..60d09881a99 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -index 05a51ad9157..aac75163794 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -index 3c0d4c39f0b..9e24a385387 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -index 14d4ef6dd98..127b5d94523 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -index b4836c38d6c..fcaa18d10b7 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -index 1f06bd1af74..e4649283d10 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -index bc6b47a636e..17c2d0faf88 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - void func0 (void); - void func1 (void); -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -index 2257be3affa..9194ccf3cbc 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -index e9cfdc5879e..e51f261a612 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -index f938db050f7..4aeec1833cd 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -index 4e58599692a..ac0e5999f63 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -index b8d50249d8b..573cf1ef09e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -index 455adabfe0e..b2b37fc6e2e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -index 4595b841ec0..4a43e199931 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fno-pic" } */ - - void func0 (void); - void func1 (void); -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -index 5e3e118e9bd..ac84ab623fa 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! x32 } } } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ - - void (*dispatch) (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -index 2801aa4192e..ce655e8be1c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { ! x32 } } } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ - - void (*dispatch) (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -index 70b4fb36eea..d34485a0010 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ - - void bar (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -index 3baf03ee77c..0e19830de4d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target { *-*-linux* && { ! x32 } } } } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fcheck-pointer-bounds -mmpx -fpic -fno-plt" } */ - - void bar (char *); - char buf[10]; -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -index edeb264218c..579441f250e 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -index 1d00413a76a..c92e6f2b02d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -index 06ebf1c9063..d9964c25bbd 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -index 1c8f9446636..d4dca4dc5fe 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -index 21740ac5b7f..5c07e02df6a 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -index a77c1f470b8..3eb440693a0 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-extern" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -index 86e9fd1f1e4..aece9383697 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - void func0 (void); - void func1 (void); -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -index 3ecde878867..3aba5e8c81f 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -index df32a19a2b5..0f0181d6672 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -index 9540996de01..2eef6f35a75 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -index f3db6e2441f..e825a10f14c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - typedef void (*dispatch_t)(long offset); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -index 0f687c3b027..c6d77e10352 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -index b27c6fc96a2..6454827b780 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -@@ -1,5 +1,5 @@ - /* { dg-do compile { target *-*-linux* } } */ --/* { dg-options "-O2 -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -fpic -fno-plt -mindirect-branch=thunk-inline" } */ - - extern void bar (void); - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -index 764a375fc37..c67066cf197 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - void func0 (void); - void func1 (void); -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c -new file mode 100644 -index 00000000000..7d396a31953 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-1.c -@@ -0,0 +1,22 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -mindirect-branch-register -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk\n" } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk_bnd\n" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c -new file mode 100644 -index 00000000000..e7e616bb271 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-2.c -@@ -0,0 +1,20 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mindirect-branch-register -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "mov\[ \t\](%eax|%rax), \\((%esp|%rsp)\\)" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -+/* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c -new file mode 100644 -index 00000000000..5320e923be2 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-3.c -@@ -0,0 +1,19 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mindirect-branch-register -fno-pic" } */ -+ -+typedef void (*dispatch_t)(long offset); -+ -+dispatch_t dispatch; -+ -+void -+male_indirect_jump (long offset) -+{ -+ dispatch(offset); -+} -+ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-not "push(?:l|q)\[ \t\]*_?dispatch" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -+/* { dg-final { scan-assembler-not {\t(pause|pause|nop)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -index 3a6727b5c54..e6fea84a4d9 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-inline -mindirect-branch=thunk -fno-pic" } */ - - extern void (*bar) (void); - -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -index b8f68188313..e239ec4542f 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk-extern -mindirect-branch=thunk -fno-pic" } */ - - extern void (*bar) (void); - -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -index 01b0a02f80b..fa3181303c9 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk -fno-pic" } */ - - extern void (*bar) (void); - -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -index 4b497b5f8af..fd5b41fdd3f 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-inline -fno-pic" } */ - - extern void (*bar) (void); - extern int foo (void) __attribute__ ((function_return("thunk"))); -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -index 4ae4c44a3fd..d606373ead1 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=thunk-extern -fno-pic" } */ - - extern void (*bar) (void); - -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -index 5b5bc765a7e..75e45e226b8 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=keep -mindirect-branch=keep -fno-pic" } */ - - extern void (*bar) (void); - -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -index fa24a1f7365..d1db41cc128 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -@@ -1,5 +1,5 @@ - /* { dg-do compile } */ --/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ -+/* { dg-options "-O2 -mno-indirect-branch-register -mno-indirect-branch-register -mfunction-return=thunk -mindirect-branch=thunk -fno-pic" } */ - - extern void (*bar) (void); - --- -2.16.3 - diff --git a/cross/gcc6-armhf/0007-x86-Add-V-register-operand-modifier.patch b/cross/gcc6-armhf/0007-x86-Add-V-register-operand-modifier.patch deleted file mode 100644 index f75b2133c..000000000 --- a/cross/gcc6-armhf/0007-x86-Add-V-register-operand-modifier.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 92308185917678406afee3c165ea5e71b53b3cc1 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 6 Jan 2018 22:29:56 -0800 -Subject: [PATCH 07/13] x86: Add 'V' register operand modifier - -Add 'V', a special modifier which prints the name of the full integer -register without '%'. For - -extern void (*func_p) (void); - -void -foo (void) -{ - asm ("call __x86_indirect_thunk_%V0" : : "a" (func_p)); -} - -it generates: - -foo: - movq func_p(%rip), %rax - call __x86_indirect_thunk_rax - ret - -gcc/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * config/i386/i386.c (print_reg): Print the name of the full - integer register without '%'. - (ix86_print_operand): Handle 'V'. - * doc/extend.texi: Document 'V' modifier. - -gcc/testsuite/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * gcc.target/i386/indirect-thunk-register-4.c: New test. ---- - gcc/config/i386/i386.c | 13 ++++++++++++- - gcc/doc/extend.texi | 3 +++ - gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c | 13 +++++++++++++ - 3 files changed, 28 insertions(+), 1 deletion(-) - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 34e26a3a3c7..eeca7e5e490 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -16869,6 +16869,7 @@ put_condition_code (enum rtx_code code, machine_mode mode, bool reverse, - If CODE is 'h', pretend the reg is the 'high' byte register. - If CODE is 'y', print "st(0)" instead of "st", if the reg is stack op. - If CODE is 'd', duplicate the operand for AVX instruction. -+ If CODE is 'V', print naked full integer register name without %. - */ - - void -@@ -16879,7 +16880,7 @@ print_reg (rtx x, int code, FILE *file) - unsigned int regno; - bool duplicated; - -- if (ASSEMBLER_DIALECT == ASM_ATT) -+ if (ASSEMBLER_DIALECT == ASM_ATT && code != 'V') - putc ('%', file); - - if (x == pc_rtx) -@@ -16922,6 +16923,14 @@ print_reg (rtx x, int code, FILE *file) - && regno != FPSR_REG - && regno != FPCR_REG); - -+ if (code == 'V') -+ { -+ if (GENERAL_REGNO_P (regno)) -+ msize = GET_MODE_SIZE (word_mode); -+ else -+ error ("'V' modifier on non-integer register"); -+ } -+ - duplicated = code == 'd' && TARGET_AVX; - - switch (msize) -@@ -17035,6 +17044,7 @@ print_reg (rtx x, int code, FILE *file) - & -- print some in-use local-dynamic symbol name. - H -- print a memory address offset by 8; used for sse high-parts - Y -- print condition for XOP pcom* instruction. -+ V -- print naked full integer register name without %. - + -- print a branch hint as 'cs' or 'ds' prefix - ; -- print a semicolon (after prefixes due to bug in older gas). - ~ -- print "i" if TARGET_AVX2, "f" otherwise. -@@ -17259,6 +17269,7 @@ ix86_print_operand (FILE *file, rtx x, int code) - case 'X': - case 'P': - case 'p': -+ case 'V': - break; - - case 's': -diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi -index 2cb6bd1ef3e..76ba1d4f913 100644 ---- a/gcc/doc/extend.texi -+++ b/gcc/doc/extend.texi -@@ -8511,6 +8511,9 @@ The table below shows the list of supported modifiers and their effects. - @tab @code{2} - @end multitable - -+@code{V} is a special modifier which prints the name of the full integer -+register without @code{%}. -+ - @anchor{x86floatingpointasmoperands} - @subsubsection x86 Floating-Point @code{asm} Operands - -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c -new file mode 100644 -index 00000000000..f0cd9b75be8 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-register-4.c -@@ -0,0 +1,13 @@ -+/* { dg-do compile } */ -+/* { dg-options "-O2 -mindirect-branch=keep -fno-pic" } */ -+ -+extern void (*func_p) (void); -+ -+void -+foo (void) -+{ -+ asm("call __x86_indirect_thunk_%V0" : : "a" (func_p)); -+} -+ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_eax" { target ia32 } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_rax" { target { ! ia32 } } } } */ --- -2.16.3 - diff --git a/cross/gcc6-armhf/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch b/cross/gcc6-armhf/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch deleted file mode 100644 index 73a58bf86..000000000 --- a/cross/gcc6-armhf/0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch +++ /dev/null @@ -1,299 +0,0 @@ -From 087b12213a5b4b8654c70320c671bb05c1b1b012 Mon Sep 17 00:00:00 2001 -From: "H.J. Lu" -Date: Sat, 13 Jan 2018 18:01:54 -0800 -Subject: [PATCH 08/13] x86: Disallow -mindirect-branch=/-mfunction-return= - with -mcmodel=large - -Since the thunk function may not be reachable in large code model, --mcmodel=large is incompatible with -mindirect-branch=thunk, --mindirect-branch=thunk-extern, -mfunction-return=thunk and --mfunction-return=thunk-extern. Issue an error when they are used with --mcmodel=large. - -gcc/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * config/i386/i386.c (ix86_set_indirect_branch_type): Disallow - -mcmodel=large with -mindirect-branch=thunk, - -mindirect-branch=thunk-extern, -mfunction-return=thunk and - -mfunction-return=thunk-extern. - * doc/invoke.texi: Document -mcmodel=large is incompatible with - -mindirect-branch=thunk, -mindirect-branch=thunk-extern, - -mfunction-return=thunk and -mfunction-return=thunk-extern. - -gcc/testsuite/ - - Backport from mainline - 2018-01-14 H.J. Lu - - * gcc.target/i386/indirect-thunk-10.c: New test. - * gcc.target/i386/indirect-thunk-8.c: Likewise. - * gcc.target/i386/indirect-thunk-9.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-10.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-11.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-9.c: Likewise. - * gcc.target/i386/ret-thunk-17.c: Likewise. - * gcc.target/i386/ret-thunk-18.c: Likewise. - * gcc.target/i386/ret-thunk-19.c: Likewise. - * gcc.target/i386/ret-thunk-20.c: Likewise. - * gcc.target/i386/ret-thunk-21.c: Likewise. ---- - gcc/config/i386/i386.c | 26 ++++++++++++++++++++++ - gcc/doc/invoke.texi | 11 +++++++++ - gcc/testsuite/gcc.target/i386/indirect-thunk-10.c | 7 ++++++ - gcc/testsuite/gcc.target/i386/indirect-thunk-8.c | 7 ++++++ - gcc/testsuite/gcc.target/i386/indirect-thunk-9.c | 7 ++++++ - .../gcc.target/i386/indirect-thunk-attr-10.c | 9 ++++++++ - .../gcc.target/i386/indirect-thunk-attr-11.c | 9 ++++++++ - .../gcc.target/i386/indirect-thunk-attr-9.c | 9 ++++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-17.c | 7 ++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-18.c | 8 +++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-19.c | 8 +++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-20.c | 9 ++++++++ - gcc/testsuite/gcc.target/i386/ret-thunk-21.c | 9 ++++++++ - 13 files changed, 126 insertions(+) - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-10.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-8.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-9.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c - create mode 100644 gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-17.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-18.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-19.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-20.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-21.c - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index eeca7e5e490..9c038bee000 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -6389,6 +6389,19 @@ ix86_set_indirect_branch_type (tree fndecl) - } - else - cfun->machine->indirect_branch_type = ix86_indirect_branch; -+ -+ /* -mcmodel=large is not compatible with -mindirect-branch=thunk -+ nor -mindirect-branch=thunk-extern. */ -+ if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC) -+ && ((cfun->machine->indirect_branch_type -+ == indirect_branch_thunk_extern) -+ || (cfun->machine->indirect_branch_type -+ == indirect_branch_thunk))) -+ error ("%<-mindirect-branch=%s%> and %<-mcmodel=large%> are not " -+ "compatible", -+ ((cfun->machine->indirect_branch_type -+ == indirect_branch_thunk_extern) -+ ? "thunk-extern" : "thunk")); - } - - if (cfun->machine->function_return_type == indirect_branch_unset) -@@ -6414,6 +6427,19 @@ ix86_set_indirect_branch_type (tree fndecl) - } - else - cfun->machine->function_return_type = ix86_function_return; -+ -+ /* -mcmodel=large is not compatible with -mfunction-return=thunk -+ nor -mfunction-return=thunk-extern. */ -+ if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC) -+ && ((cfun->machine->function_return_type -+ == indirect_branch_thunk_extern) -+ || (cfun->machine->function_return_type -+ == indirect_branch_thunk))) -+ error ("%<-mfunction-return=%s%> and %<-mcmodel=large%> are not " -+ "compatible", -+ ((cfun->machine->function_return_type -+ == indirect_branch_thunk_extern) -+ ? "thunk-extern" : "thunk")); - } - } - -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 94374661f2d..1dee495c86b 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -24242,6 +24242,11 @@ to external call and return thunk provided in a separate object file. - You can control this behavior for a specific function by using the - function attribute @code{indirect_branch}. @xref{Function Attributes}. - -+Note that @option{-mcmodel=large} is incompatible with -+@option{-mindirect-branch=thunk} nor -+@option{-mindirect-branch=thunk-extern} since the thunk function may -+not be reachable in large code model. -+ - @item -mfunction-return=@var{choice} - @opindex -mfunction-return - Convert function return with @var{choice}. The default is @samp{keep}, -@@ -24253,6 +24258,12 @@ object file. You can control this behavior for a specific function by - using the function attribute @code{function_return}. - @xref{Function Attributes}. - -+Note that @option{-mcmodel=large} is incompatible with -+@option{-mfunction-return=thunk} nor -+@option{-mfunction-return=thunk-extern} since the thunk function may -+not be reachable in large code model. -+ -+ - @item -mindirect-branch-register - @opindex -mindirect-branch-register - Force indirect call and jump via register. -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c -new file mode 100644 -index 00000000000..a0674bd2363 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c -@@ -0,0 +1,7 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-inline -mfunction-return=keep -mcmodel=large" } */ -+ -+void -+bar (void) -+{ -+} -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c -new file mode 100644 -index 00000000000..7a80a8986e8 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c -@@ -0,0 +1,7 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk -mfunction-return=keep -mcmodel=large" } */ -+ -+void -+bar (void) -+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c -new file mode 100644 -index 00000000000..d4d45c5114d ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c -@@ -0,0 +1,7 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=thunk-extern -mfunction-return=keep -mcmodel=large" } */ -+ -+void -+bar (void) -+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c -new file mode 100644 -index 00000000000..3a2aeaddbc5 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+__attribute__ ((indirect_branch("thunk-extern"))) -+void -+bar (void) -+{ /* { dg-error "'-mindirect-branch=thunk-extern' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c -new file mode 100644 -index 00000000000..8e52f032b6c ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+__attribute__ ((indirect_branch("thunk-inline"))) -+void -+bar (void) -+{ -+} -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c -new file mode 100644 -index 00000000000..bdaa4f6911b ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mindirect-branch=keep -mfunction-return=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+__attribute__ ((indirect_branch("thunk"))) -+void -+bar (void) -+{ /* { dg-error "'-mindirect-branch=thunk' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-17.c b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c -new file mode 100644 -index 00000000000..0605e2c6542 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c -@@ -0,0 +1,7 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mfunction-return=thunk -mindirect-branch=keep -mcmodel=large" } */ -+ -+void -+bar (void) -+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-18.c b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c -new file mode 100644 -index 00000000000..307019dc242 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c -@@ -0,0 +1,8 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mfunction-return=thunk-extern -mindirect-branch=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+void -+bar (void) -+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-19.c b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c -new file mode 100644 -index 00000000000..772617f4010 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c -@@ -0,0 +1,8 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */ -+ -+__attribute__ ((function_return("thunk"))) -+void -+bar (void) -+{ /* { dg-error "'-mfunction-return=thunk' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-20.c b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c -new file mode 100644 -index 00000000000..1e9f9bd5a66 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+__attribute__ ((function_return("thunk-extern"))) -+void -+bar (void) -+{ /* { dg-error "'-mfunction-return=thunk-extern' and '-mcmodel=large' are not compatible" } */ -+} -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-21.c b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c -new file mode 100644 -index 00000000000..eea07f7abe1 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c -@@ -0,0 +1,9 @@ -+/* { dg-do compile { target { lp64 } } } */ -+/* { dg-options "-O2 -mfunction-return=keep -mindirect-branch=keep -mcmodel=large" } */ -+/* { dg-additional-options "-fPIC" { target fpic } } */ -+ -+__attribute__ ((function_return("thunk-inline"))) -+void -+bar (void) -+{ -+} --- -2.16.3 - diff --git a/cross/gcc6-armhf/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch b/cross/gcc6-armhf/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch deleted file mode 100644 index f33946c15..000000000 --- a/cross/gcc6-armhf/0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch +++ /dev/null @@ -1,121 +0,0 @@ -From 07857bd9fb9ccab67a932ad9df3e53f3f0c2c617 Mon Sep 17 00:00:00 2001 -From: uros -Date: Thu, 25 Jan 2018 19:39:01 +0000 -Subject: [PATCH 09/13] Use INVALID_REGNUM in indirect thunk processing - - Backport from mainline - 2018-01-17 Uros Bizjak - - * config/i386/i386.c (indirect_thunk_name): Declare regno - as unsigned int. Compare regno with INVALID_REGNUM. - (output_indirect_thunk): Ditto. - (output_indirect_thunk_function): Ditto. - (ix86_code_end): Declare regno as unsigned int. Use INVALID_REGNUM - in the call to output_indirect_thunk_function. - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257067 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/config/i386/i386.c | 30 +++++++++++++++--------------- - 1 file changed, 15 insertions(+), 15 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 9c038bee000..40126579c22 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -11087,16 +11087,16 @@ static int indirect_thunks_bnd_used; - /* Fills in the label name that should be used for the indirect thunk. */ - - static void --indirect_thunk_name (char name[32], int regno, bool need_bnd_p, -- bool ret_p) -+indirect_thunk_name (char name[32], unsigned int regno, -+ bool need_bnd_p, bool ret_p) - { -- if (regno >= 0 && ret_p) -+ if (regno != INVALID_REGNUM && ret_p) - gcc_unreachable (); - - if (USE_HIDDEN_LINKONCE) - { - const char *bnd = need_bnd_p ? "_bnd" : ""; -- if (regno >= 0) -+ if (regno != INVALID_REGNUM) - { - const char *reg_prefix; - if (LEGACY_INT_REGNO_P (regno)) -@@ -11114,7 +11114,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p, - } - else - { -- if (regno >= 0) -+ if (regno != INVALID_REGNUM) - { - if (need_bnd_p) - ASM_GENERATE_INTERNAL_LABEL (name, "LITBR", regno); -@@ -11166,7 +11166,7 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p, - */ - - static void --output_indirect_thunk (bool need_bnd_p, int regno) -+output_indirect_thunk (bool need_bnd_p, unsigned int regno) - { - char indirectlabel1[32]; - char indirectlabel2[32]; -@@ -11196,7 +11196,7 @@ output_indirect_thunk (bool need_bnd_p, int regno) - - ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2); - -- if (regno >= 0) -+ if (regno != INVALID_REGNUM) - { - /* MOV. */ - rtx xops[2]; -@@ -11220,12 +11220,12 @@ output_indirect_thunk (bool need_bnd_p, int regno) - } - - /* Output a funtion with a call and return thunk for indirect branch. -- If BND_P is true, the BND prefix is needed. If REGNO != -1, the -- function address is in REGNO. Otherwise, the function address is -+ If BND_P is true, the BND prefix is needed. If REGNO != INVALID_REGNUM, -+ the function address is in REGNO. Otherwise, the function address is - on the top of stack. */ - - static void --output_indirect_thunk_function (bool need_bnd_p, int regno) -+output_indirect_thunk_function (bool need_bnd_p, unsigned int regno) - { - char name[32]; - tree decl; -@@ -11274,7 +11274,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno) - ASM_OUTPUT_LABEL (asm_out_file, name); - } - -- if (regno < 0) -+ if (regno == INVALID_REGNUM) - { - /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */ - char alias[32]; -@@ -11348,16 +11348,16 @@ static void - ix86_code_end (void) - { - rtx xops[2]; -- int regno; -+ unsigned int regno; - - if (indirect_thunk_needed) -- output_indirect_thunk_function (false, -1); -+ output_indirect_thunk_function (false, INVALID_REGNUM); - if (indirect_thunk_bnd_needed) -- output_indirect_thunk_function (true, -1); -+ output_indirect_thunk_function (true, INVALID_REGNUM); - - for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++) - { -- int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; -+ unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; - if ((indirect_thunks_used & (1 << i))) - output_indirect_thunk_function (false, regno); - --- -2.16.3 - diff --git a/cross/gcc6-armhf/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch b/cross/gcc6-armhf/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch deleted file mode 100644 index 08593c2b3..000000000 --- a/cross/gcc6-armhf/0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3815e98f0f46b6c4c41e6810bad987bd083691aa Mon Sep 17 00:00:00 2001 -From: hjl -Date: Fri, 2 Feb 2018 16:47:02 +0000 -Subject: [PATCH 10/13] i386: Pass INVALID_REGNUM as invalid register number - - Backport from mainline - * config/i386/i386.c (ix86_output_function_return): Pass - INVALID_REGNUM, instead of -1, as invalid register number to - indirect_thunk_name and output_indirect_thunk. - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@257341 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - gcc/config/i386/i386.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 40126579c22..66502ee6da6 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -28056,7 +28056,8 @@ ix86_output_function_return (bool long_p) - { - bool need_thunk = (cfun->machine->function_return_type - == indirect_branch_thunk); -- indirect_thunk_name (thunk_name, -1, need_bnd_p, true); -+ indirect_thunk_name (thunk_name, INVALID_REGNUM, need_bnd_p, -+ true); - if (need_bnd_p) - { - indirect_thunk_bnd_needed |= need_thunk; -@@ -28069,7 +28070,7 @@ ix86_output_function_return (bool long_p) - } - } - else -- output_indirect_thunk (need_bnd_p, -1); -+ output_indirect_thunk (need_bnd_p, INVALID_REGNUM); - - return ""; - } --- -2.16.3 - diff --git a/cross/gcc6-armhf/0011-i386-Update-mfunction-return-for-return-with-pop.patch b/cross/gcc6-armhf/0011-i386-Update-mfunction-return-for-return-with-pop.patch deleted file mode 100644 index 3d528395b..000000000 --- a/cross/gcc6-armhf/0011-i386-Update-mfunction-return-for-return-with-pop.patch +++ /dev/null @@ -1,456 +0,0 @@ -From 771535dec733e4b85924f00a3a94c29683d614e5 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Mon, 26 Feb 2018 15:29:30 +0000 -Subject: [PATCH 11/13] i386: Update -mfunction-return= for return with pop - -When -mfunction-return= is used, simple_return_pop_internal should pop -return address into ECX register, adjust stack by bytes to pop from stack -and jump to the return thunk via ECX register. - -Revision 257992 removed the bool argument from ix86_output_indirect_jmp. -Update comments to reflect it. - -Tested on i686 and x86-64. - -gcc/ - - Backport from mainline - 2018-02-26 H.J. Lu - - * config/i386/i386.c (ix86_output_indirect_jmp): Update comments. - - 2018-02-26 H.J. Lu - - PR target/84530 - * config/i386/i386-protos.h (ix86_output_indirect_jmp): Remove - the bool argument. - (ix86_output_indirect_function_return): New prototype. - (ix86_split_simple_return_pop_internal): Likewise. - * config/i386/i386.c (indirect_return_via_cx): New. - (indirect_return_via_cx_bnd): Likewise. - (indirect_thunk_name): Handle return va CX_REG. - (output_indirect_thunk_function): Create alias for - __x86_return_thunk_[re]cx and __x86_return_thunk_[re]cx_bnd. - (ix86_output_indirect_jmp): Remove the bool argument. - (ix86_output_indirect_function_return): New function. - (ix86_split_simple_return_pop_internal): Likewise. - * config/i386/i386.md (*indirect_jump): Don't pass false - to ix86_output_indirect_jmp. - (*tablejump_1): Likewise. - (simple_return_pop_internal): Change it to define_insn_and_split. - Call ix86_split_simple_return_pop_internal to split it for - -mfunction-return=. - (simple_return_indirect_internal): Call - ix86_output_indirect_function_return instead of - ix86_output_indirect_jmp. - -gcc/testsuite/ - - Backport from mainline - 2018-02-26 H.J. Lu - - PR target/84530 - * gcc.target/i386/ret-thunk-22.c: New test. - * gcc.target/i386/ret-thunk-23.c: Likewise. - * gcc.target/i386/ret-thunk-24.c: Likewise. - * gcc.target/i386/ret-thunk-25.c: Likewise. - * gcc.target/i386/ret-thunk-26.c: Likewise. ---- - gcc/config/i386/i386-protos.h | 4 +- - gcc/config/i386/i386.c | 127 +++++++++++++++++++++++---- - gcc/config/i386/i386.md | 11 ++- - gcc/testsuite/gcc.target/i386/ret-thunk-22.c | 15 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-23.c | 15 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-24.c | 15 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-25.c | 15 ++++ - gcc/testsuite/gcc.target/i386/ret-thunk-26.c | 40 +++++++++ - 8 files changed, 222 insertions(+), 20 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-22.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-23.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-24.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-25.c - create mode 100644 gcc/testsuite/gcc.target/i386/ret-thunk-26.c - -diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h -index 620d70ef9f6..c7a0ccb58d3 100644 ---- a/gcc/config/i386/i386-protos.h -+++ b/gcc/config/i386/i386-protos.h -@@ -311,8 +311,10 @@ extern enum attr_cpu ix86_schedule; - #endif - - extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op); --extern const char * ix86_output_indirect_jmp (rtx call_op, bool ret_p); -+extern const char * ix86_output_indirect_jmp (rtx call_op); - extern const char * ix86_output_function_return (bool long_p); -+extern const char * ix86_output_indirect_function_return (rtx ret_op); -+extern void ix86_split_simple_return_pop_internal (rtx); - extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load, - enum machine_mode mode); - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 66502ee6da6..21c3c18bd3c 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -11080,6 +11080,12 @@ static int indirect_thunks_used; - by call and return thunks functions with the BND prefix. */ - static int indirect_thunks_bnd_used; - -+/* True if return thunk function via CX is needed. */ -+static bool indirect_return_via_cx; -+/* True if return thunk function via CX with the BND prefix is -+ needed. */ -+static bool indirect_return_via_cx_bnd; -+ - #ifndef INDIRECT_LABEL - # define INDIRECT_LABEL "LIND" - #endif -@@ -11090,12 +11096,13 @@ static void - indirect_thunk_name (char name[32], unsigned int regno, - bool need_bnd_p, bool ret_p) - { -- if (regno != INVALID_REGNUM && ret_p) -+ if (regno != INVALID_REGNUM && regno != CX_REG && ret_p) - gcc_unreachable (); - - if (USE_HIDDEN_LINKONCE) - { - const char *bnd = need_bnd_p ? "_bnd" : ""; -+ const char *ret = ret_p ? "return" : "indirect"; - if (regno != INVALID_REGNUM) - { - const char *reg_prefix; -@@ -11103,14 +11110,11 @@ indirect_thunk_name (char name[32], unsigned int regno, - reg_prefix = TARGET_64BIT ? "r" : "e"; - else - reg_prefix = ""; -- sprintf (name, "__x86_indirect_thunk%s_%s%s", -- bnd, reg_prefix, reg_names[regno]); -+ sprintf (name, "__x86_%s_thunk%s_%s%s", -+ ret, bnd, reg_prefix, reg_names[regno]); - } - else -- { -- const char *ret = ret_p ? "return" : "indirect"; -- sprintf (name, "__x86_%s_thunk%s", ret, bnd); -- } -+ sprintf (name, "__x86_%s_thunk%s", ret, bnd); - } - else - { -@@ -11274,9 +11278,23 @@ output_indirect_thunk_function (bool need_bnd_p, unsigned int regno) - ASM_OUTPUT_LABEL (asm_out_file, name); - } - -+ /* Create alias for __x86_return_thunk/__x86_return_thunk_bnd or -+ __x86_return_thunk_ecx/__x86_return_thunk_ecx_bnd. */ -+ bool need_alias; - if (regno == INVALID_REGNUM) -+ need_alias = true; -+ else if (regno == CX_REG) -+ { -+ if (need_bnd_p) -+ need_alias = indirect_return_via_cx_bnd; -+ else -+ need_alias = indirect_return_via_cx; -+ } -+ else -+ need_alias = false; -+ -+ if (need_alias) - { -- /* Create alias for __x86.return_thunk/__x86.return_thunk_bnd. */ - char alias[32]; - - indirect_thunk_name (alias, regno, need_bnd_p, true); -@@ -28019,18 +28037,17 @@ ix86_output_indirect_branch (rtx call_op, const char *xasm, - else - ix86_output_indirect_branch_via_push (call_op, xasm, sibcall_p); - } --/* Output indirect jump. CALL_OP is the jump target. Jump is a -- function return if RET_P is true. */ -+ -+/* Output indirect jump. CALL_OP is the jump target. */ - - const char * --ix86_output_indirect_jmp (rtx call_op, bool ret_p) -+ix86_output_indirect_jmp (rtx call_op) - { - if (cfun->machine->indirect_branch_type != indirect_branch_keep) - { -- /* We can't have red-zone if this isn't a function return since -- "call" in the indirect thunk pushes the return address onto -- stack, destroying red-zone. */ -- if (!ret_p && ix86_red_zone_size != 0) -+ /* We can't have red-zone since "call" in the indirect thunk -+ pushes the return address onto stack, destroying red-zone. */ -+ if (ix86_red_zone_size != 0) - gcc_unreachable (); - - ix86_output_indirect_branch (call_op, "%0", true); -@@ -28081,6 +28098,86 @@ ix86_output_function_return (bool long_p) - return "rep%; ret"; - } - -+/* Output indirect function return. RET_OP is the function return -+ target. */ -+ -+const char * -+ix86_output_indirect_function_return (rtx ret_op) -+{ -+ if (cfun->machine->function_return_type != indirect_branch_keep) -+ { -+ char thunk_name[32]; -+ bool need_bnd_p = ix86_bnd_prefixed_insn_p (current_output_insn); -+ unsigned int regno = REGNO (ret_op); -+ gcc_assert (regno == CX_REG); -+ -+ if (cfun->machine->function_return_type -+ != indirect_branch_thunk_inline) -+ { -+ bool need_thunk = (cfun->machine->function_return_type -+ == indirect_branch_thunk); -+ indirect_thunk_name (thunk_name, regno, need_bnd_p, true); -+ if (need_bnd_p) -+ { -+ if (need_thunk) -+ { -+ indirect_return_via_cx_bnd = true; -+ indirect_thunks_bnd_used |= 1 << CX_REG; -+ } -+ fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); -+ } -+ else -+ { -+ if (need_thunk) -+ { -+ indirect_return_via_cx = true; -+ indirect_thunks_used |= 1 << CX_REG; -+ } -+ fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); -+ } -+ } -+ else -+ output_indirect_thunk (need_bnd_p, regno); -+ -+ return ""; -+ } -+ else -+ return "%!jmp\t%A0"; -+} -+ -+/* Split simple return with popping POPC bytes from stack to indirect -+ branch with stack adjustment . */ -+ -+void -+ix86_split_simple_return_pop_internal (rtx popc) -+{ -+ struct machine_function *m = cfun->machine; -+ rtx ecx = gen_rtx_REG (SImode, CX_REG); -+ rtx_insn *insn; -+ -+ /* There is no "pascal" calling convention in any 64bit ABI. */ -+ gcc_assert (!TARGET_64BIT); -+ -+ insn = emit_insn (gen_pop (ecx)); -+ m->fs.cfa_offset -= UNITS_PER_WORD; -+ m->fs.sp_offset -= UNITS_PER_WORD; -+ -+ rtx x = plus_constant (Pmode, stack_pointer_rtx, UNITS_PER_WORD); -+ x = gen_rtx_SET (stack_pointer_rtx, x); -+ add_reg_note (insn, REG_CFA_ADJUST_CFA, x); -+ add_reg_note (insn, REG_CFA_REGISTER, gen_rtx_SET (ecx, pc_rtx)); -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ x = gen_rtx_PLUS (Pmode, stack_pointer_rtx, popc); -+ x = gen_rtx_SET (stack_pointer_rtx, x); -+ insn = emit_insn (x); -+ add_reg_note (insn, REG_CFA_ADJUST_CFA, x); -+ RTX_FRAME_RELATED_P (insn) = 1; -+ -+ /* Now return address is in ECX. */ -+ emit_jump_insn (gen_simple_return_indirect_internal (ecx)); -+} -+ - /* Output the assembly for a call instruction. */ - - const char * -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index 05a88fff356..857466a6361 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -11813,7 +11813,7 @@ - (define_insn "*indirect_jump" - [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw"))] - "" -- "* return ix86_output_indirect_jmp (operands[0], false);" -+ "* return ix86_output_indirect_jmp (operands[0]);" - [(set (attr "type") - (if_then_else (match_test "(cfun->machine->indirect_branch_type - != indirect_branch_keep)") -@@ -11868,7 +11868,7 @@ - [(set (pc) (match_operand:W 0 "indirect_branch_operand" "rBw")) - (use (label_ref (match_operand 1)))] - "" -- "* return ix86_output_indirect_jmp (operands[0], false);" -+ "* return ix86_output_indirect_jmp (operands[0]);" - [(set (attr "type") - (if_then_else (match_test "(cfun->machine->indirect_branch_type - != indirect_branch_keep)") -@@ -12520,11 +12520,14 @@ - (set_attr "prefix_rep" "1") - (set_attr "modrm" "0")]) - --(define_insn "simple_return_pop_internal" -+(define_insn_and_split "simple_return_pop_internal" - [(simple_return) - (use (match_operand:SI 0 "const_int_operand"))] - "reload_completed" - "%!ret\t%0" -+ "&& cfun->machine->function_return_type != indirect_branch_keep" -+ [(const_int 0)] -+ "ix86_split_simple_return_pop_internal (operands[0]); DONE;" - [(set_attr "length" "3") - (set_attr "atom_unit" "jeu") - (set_attr "length_immediate" "2") -@@ -12535,7 +12538,7 @@ - [(simple_return) - (use (match_operand:SI 0 "register_operand" "r"))] - "reload_completed" -- "* return ix86_output_indirect_jmp (operands[0], true);" -+ "* return ix86_output_indirect_function_return (operands[0]);" - [(set (attr "type") - (if_then_else (match_test "(cfun->machine->indirect_branch_type - != indirect_branch_keep)") -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-22.c b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c -new file mode 100644 -index 00000000000..89e086de97b ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-22.c -@@ -0,0 +1,15 @@ -+/* PR target/r84530 */ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2 -mfunction-return=thunk" } */ -+ -+struct s { _Complex unsigned short x; }; -+struct s gs = { 100 + 200i }; -+struct s __attribute__((noinline)) foo (void) { return gs; } -+ -+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-23.c b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c -new file mode 100644 -index 00000000000..43f0ccaa854 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-23.c -@@ -0,0 +1,15 @@ -+/* PR target/r84530 */ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2 -mfunction-return=thunk-extern" } */ -+ -+struct s { _Complex unsigned short x; }; -+struct s gs = { 100 + 200i }; -+struct s __attribute__((noinline)) foo (void) { return gs; } -+ -+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not {\tpause} } } */ -+/* { dg-final { scan-assembler-not {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-24.c b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c -new file mode 100644 -index 00000000000..8729e35147e ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-24.c -@@ -0,0 +1,15 @@ -+/* PR target/r84530 */ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2 -mfunction-return=thunk-inline" } */ -+ -+struct s { _Complex unsigned short x; }; -+struct s gs = { 100 + 200i }; -+struct s __attribute__((noinline)) foo (void) { return gs; } -+ -+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk_ecx" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-25.c b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c -new file mode 100644 -index 00000000000..f73553c9a9f ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-25.c -@@ -0,0 +1,15 @@ -+/* PR target/r84530 */ -+/* { dg-do compile { target ia32 } } */ -+/* { dg-options "-O2 -mfunction-return=thunk -fcheck-pointer-bounds -mmpx -fno-pic" } */ -+ -+struct s { _Complex unsigned short x; }; -+struct s gs = { 100 + 200i }; -+struct s __attribute__((noinline)) foo (void) { return gs; } -+ -+/* { dg-final { scan-assembler-times "popl\[\\t \]*%ecx" 1 } } */ -+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*4\\(%esp\\), %esp" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk_bnd_ecx" } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler {\tpause} } } */ -+/* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-26.c b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c -new file mode 100644 -index 00000000000..9144e988735 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-26.c -@@ -0,0 +1,40 @@ -+/* PR target/r84530 */ -+/* { dg-do run } */ -+/* { dg-options "-Os -mfunction-return=thunk" } */ -+ -+struct S { int i; }; -+__attribute__((const, noinline, noclone)) -+struct S foo (int x) -+{ -+ struct S s; -+ s.i = x; -+ return s; -+} -+ -+int a[2048], b[2048], c[2048], d[2048]; -+struct S e[2048]; -+ -+__attribute__((noinline, noclone)) void -+bar (void) -+{ -+ int i; -+ for (i = 0; i < 1024; i++) -+ { -+ e[i] = foo (i); -+ a[i+2] = a[i] + a[i+1]; -+ b[10] = b[10] + i; -+ c[i] = c[2047 - i]; -+ d[i] = d[i + 1]; -+ } -+} -+ -+int -+main () -+{ -+ int i; -+ bar (); -+ for (i = 0; i < 1024; i++) -+ if (e[i].i != i) -+ __builtin_abort (); -+ return 0; -+} --- -2.16.3 - diff --git a/cross/gcc6-armhf/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch b/cross/gcc6-armhf/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch deleted file mode 100644 index 1bd6134ce..000000000 --- a/cross/gcc6-armhf/0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch +++ /dev/null @@ -1,1003 +0,0 @@ -From a34d0b92e2c81792bd1f27e872c4c97a2df6861c Mon Sep 17 00:00:00 2001 -From: hjl -Date: Mon, 26 Feb 2018 17:00:46 +0000 -Subject: [PATCH 12/13] i386: Add TARGET_INDIRECT_BRANCH_REGISTER - -For - ---- -struct C { - virtual ~C(); - virtual void f(); -}; - -void -f (C *p) -{ - p->f(); - p->f(); -} ---- - --mindirect-branch=thunk-extern -O2 on x86-64 GNU/Linux generates: - -_Z1fP1C: -.LFB0: - .cfi_startproc - pushq %rbx - .cfi_def_cfa_offset 16 - .cfi_offset 3, -16 - movq (%rdi), %rax - movq %rdi, %rbx - jmp .LIND1 -.LIND0: - pushq 16(%rax) - jmp __x86_indirect_thunk -.LIND1: - call .LIND0 - movq (%rbx), %rax - movq %rbx, %rdi - popq %rbx - .cfi_def_cfa_offset 8 - movq 16(%rax), %rax - jmp __x86_indirect_thunk_rax - .cfi_endproc - -x86-64 is supposed to have asynchronous unwind tables by default, but -there is nothing that reflects the change in the (relative) frame -address after .LIND0. That region really has to be moved outside of -the .cfi_startproc/.cfi_endproc bracket. - -This patch adds TARGET_INDIRECT_BRANCH_REGISTER to force indirect -branch via register whenever -mindirect-branch= is used. Now, --mindirect-branch=thunk-extern -O2 on x86-64 GNU/Linux generates: - -_Z1fP1C: -.LFB0: - .cfi_startproc - pushq %rbx - .cfi_def_cfa_offset 16 - .cfi_offset 3, -16 - movq (%rdi), %rax - movq %rdi, %rbx - movq 16(%rax), %rax - call __x86_indirect_thunk_rax - movq (%rbx), %rax - movq %rbx, %rdi - popq %rbx - .cfi_def_cfa_offset 8 - movq 16(%rax), %rax - jmp __x86_indirect_thunk_rax - .cfi_endproc - -so that "-mindirect-branch=thunk-extern" is equivalent to -"-mindirect-branch=thunk-extern -mindirect-branch-register", which is -used by Linux kernel. - -gcc/ - - Backport from mainline - 2018-02-26 H.J. Lu - - PR target/84039 - * config/i386/constraints.md (Bs): Replace - ix86_indirect_branch_register with - TARGET_INDIRECT_BRANCH_REGISTER. - (Bw): Likewise. - * config/i386/i386.md (indirect_jump): Likewise. - (tablejump): Likewise. - (*sibcall_memory): Likewise. - (*sibcall_value_memory): Likewise. - Peepholes of indirect call and jump via memory: Likewise. - (*sibcall_GOT_32): Disallowed for TARGET_INDIRECT_BRANCH_REGISTER. - (*sibcall_value_GOT_32): Likewise. - * config/i386/predicates.md (indirect_branch_operand): Likewise. - (GOT_memory_operand): Likewise. - (call_insn_operand): Likewise. - (sibcall_insn_operand): Likewise. - (GOT32_symbol_operand): Likewise. - * config/i386/i386.h (TARGET_INDIRECT_BRANCH_REGISTER): New. - -gcc/testsuite/ - - Backport from mainline - 2018-02-26 H.J. Lu - - PR target/84039 - * gcc.target/i386/indirect-thunk-1.c: Updated. - * gcc.target/i386/indirect-thunk-2.c: Likewise. - * gcc.target/i386/indirect-thunk-3.c: Likewise. - * gcc.target/i386/indirect-thunk-4.c: Likewise. - * gcc.target/i386/indirect-thunk-5.c: Likewise. - * gcc.target/i386/indirect-thunk-6.c: Likewise. - * gcc.target/i386/indirect-thunk-7.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-1.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-2.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-3.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-4.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-5.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-6.c: Likewise. - * gcc.target/i386/indirect-thunk-attr-7.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-1.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-2.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-3.c: Likewise. - * gcc.target/i386/indirect-thunk-bnd-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-1.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-2.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-3.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-4.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-5.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-6.c: Likewise. - * gcc.target/i386/indirect-thunk-extern-7.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-1.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-2.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-3.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-4.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-5.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-6.c: Likewise. - * gcc.target/i386/indirect-thunk-inline-7.c: Likewise. - * gcc.target/i386/ret-thunk-9.c: Likewise. - * gcc.target/i386/ret-thunk-10.c: Likewise. - * gcc.target/i386/ret-thunk-11.c: Likewise. - * gcc.target/i386/ret-thunk-12.c: Likewise. - * gcc.target/i386/ret-thunk-13.c: Likewise. - * gcc.target/i386/ret-thunk-14.c: Likewise. - * gcc.target/i386/ret-thunk-15.c: Likewise. ---- - gcc/config/i386/constraints.md | 4 ++-- - gcc/config/i386/i386.h | 5 ++++ - gcc/config/i386/i386.md | 28 +++++++++++++--------- - gcc/config/i386/predicates.md | 6 ++--- - gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 5 ++-- - gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 5 ++-- - gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 5 ++-- - gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 5 ++-- - gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 6 +++-- - gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 12 ++++++---- - gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-attr-1.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-attr-2.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-attr-3.c | 3 +-- - .../gcc.target/i386/indirect-thunk-attr-4.c | 3 +-- - .../gcc.target/i386/indirect-thunk-attr-5.c | 9 ++++--- - .../gcc.target/i386/indirect-thunk-attr-6.c | 9 ++++--- - .../gcc.target/i386/indirect-thunk-attr-7.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-bnd-1.c | 6 ++--- - .../gcc.target/i386/indirect-thunk-bnd-2.c | 6 ++--- - .../gcc.target/i386/indirect-thunk-bnd-3.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-bnd-4.c | 7 +++--- - .../gcc.target/i386/indirect-thunk-extern-1.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-extern-2.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-extern-3.c | 9 ++++--- - .../gcc.target/i386/indirect-thunk-extern-4.c | 6 ++--- - .../gcc.target/i386/indirect-thunk-extern-5.c | 6 +++-- - .../gcc.target/i386/indirect-thunk-extern-6.c | 8 +++---- - .../gcc.target/i386/indirect-thunk-extern-7.c | 5 ++-- - .../gcc.target/i386/indirect-thunk-inline-1.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-2.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-3.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-4.c | 2 +- - .../gcc.target/i386/indirect-thunk-inline-5.c | 3 ++- - .../gcc.target/i386/indirect-thunk-inline-6.c | 3 ++- - .../gcc.target/i386/indirect-thunk-inline-7.c | 4 ++-- - gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 9 +++---- - gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 9 +++---- - gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 8 +++---- - gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 5 ++-- - gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 7 +++--- - gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 7 +++--- - gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 13 ++++------ - 43 files changed, 128 insertions(+), 141 deletions(-) - -diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md -index 9204c8e8487..ef684a95497 100644 ---- a/gcc/config/i386/constraints.md -+++ b/gcc/config/i386/constraints.md -@@ -172,7 +172,7 @@ - - (define_constraint "Bs" - "@internal Sibcall memory operand." -- (ior (and (not (match_test "ix86_indirect_branch_register")) -+ (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (not (match_test "TARGET_X32")) - (match_operand 0 "sibcall_memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") -@@ -180,7 +180,7 @@ - - (define_constraint "Bw" - "@internal Call memory operand." -- (ior (and (not (match_test "ix86_indirect_branch_register")) -+ (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") -diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h -index b34bc117c34..1816d710f4e 100644 ---- a/gcc/config/i386/i386.h -+++ b/gcc/config/i386/i386.h -@@ -2676,6 +2676,11 @@ extern void debug_dispatch_window (int); - #define TARGET_RECIP_VEC_DIV ((recip_mask & RECIP_MASK_VEC_DIV) != 0) - #define TARGET_RECIP_VEC_SQRT ((recip_mask & RECIP_MASK_VEC_SQRT) != 0) - -+ -+#define TARGET_INDIRECT_BRANCH_REGISTER \ -+ (ix86_indirect_branch_register \ -+ || cfun->machine->indirect_branch_type != indirect_branch_keep) -+ - #define IX86_HLE_ACQUIRE (1 << 16) - #define IX86_HLE_RELEASE (1 << 17) - -diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md -index 857466a6361..6a6dc26799c 100644 ---- a/gcc/config/i386/i386.md -+++ b/gcc/config/i386/i386.md -@@ -11805,7 +11805,7 @@ - [(set (pc) (match_operand 0 "indirect_branch_operand"))] - "" - { -- if (TARGET_X32 || ix86_indirect_branch_register) -+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER) - operands[0] = convert_memory_address (word_mode, operands[0]); - cfun->machine->has_local_indirect_jump = true; - }) -@@ -11859,7 +11859,7 @@ - OPTAB_DIRECT); - } - -- if (TARGET_X32 || ix86_indirect_branch_register) -+ if (TARGET_X32 || TARGET_INDIRECT_BRANCH_REGISTER) - operands[0] = convert_memory_address (word_mode, operands[0]); - cfun->machine->has_local_indirect_jump = true; - }) -@@ -12029,7 +12029,10 @@ - (match_operand:SI 0 "register_no_elim_operand" "U") - (match_operand:SI 1 "GOT32_symbol_operand")))) - (match_operand 2))] -- "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)" -+ "!TARGET_MACHO -+ && !TARGET_64BIT -+ && !TARGET_INDIRECT_BRANCH_REGISTER -+ && SIBLING_CALL_P (insn)" - { - rtx fnaddr = gen_rtx_PLUS (Pmode, operands[0], operands[1]); - fnaddr = gen_const_mem (Pmode, fnaddr); -@@ -12048,7 +12051,7 @@ - [(call (mem:QI (match_operand:W 0 "memory_operand" "m")) - (match_operand 1)) - (unspec [(const_int 0)] UNSPEC_PEEPSIB)] -- "!TARGET_X32 && !ix86_indirect_branch_register" -+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" - "* return ix86_output_call_insn (insn, operands[0]);" - [(set_attr "type" "call")]) - -@@ -12058,7 +12061,7 @@ - (call (mem:QI (match_dup 0)) - (match_operand 3))] - "!TARGET_X32 -- && !ix86_indirect_branch_register -+ && !TARGET_INDIRECT_BRANCH_REGISTER - && SIBLING_CALL_P (peep2_next_insn (1)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" -@@ -12073,7 +12076,7 @@ - (call (mem:QI (match_dup 0)) - (match_operand 3))] - "!TARGET_X32 -- && !ix86_indirect_branch_register -+ && !TARGET_INDIRECT_BRANCH_REGISTER - && SIBLING_CALL_P (peep2_next_insn (2)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" -@@ -12171,7 +12174,7 @@ - (match_operand:W 1 "memory_operand")) - (set (pc) (match_dup 0))] - "!TARGET_X32 -- && !ix86_indirect_branch_register -+ && !TARGET_INDIRECT_BRANCH_REGISTER - && peep2_reg_dead_p (2, operands[0])" - [(set (pc) (match_dup 1))]) - -@@ -12229,7 +12232,10 @@ - (match_operand:SI 1 "register_no_elim_operand" "U") - (match_operand:SI 2 "GOT32_symbol_operand")))) - (match_operand 3)))] -- "!TARGET_MACHO && !TARGET_64BIT && SIBLING_CALL_P (insn)" -+ "!TARGET_MACHO -+ && !TARGET_64BIT -+ && !TARGET_INDIRECT_BRANCH_REGISTER -+ && SIBLING_CALL_P (insn)" - { - rtx fnaddr = gen_rtx_PLUS (Pmode, operands[1], operands[2]); - fnaddr = gen_const_mem (Pmode, fnaddr); -@@ -12250,7 +12256,7 @@ - (call (mem:QI (match_operand:W 1 "memory_operand" "m")) - (match_operand 2))) - (unspec [(const_int 0)] UNSPEC_PEEPSIB)] -- "!TARGET_X32 && !ix86_indirect_branch_register" -+ "!TARGET_X32 && !TARGET_INDIRECT_BRANCH_REGISTER" - "* return ix86_output_call_insn (insn, operands[1]);" - [(set_attr "type" "callv")]) - -@@ -12261,7 +12267,7 @@ - (call (mem:QI (match_dup 0)) - (match_operand 3)))] - "!TARGET_X32 -- && !ix86_indirect_branch_register -+ && !TARGET_INDIRECT_BRANCH_REGISTER - && SIBLING_CALL_P (peep2_next_insn (1)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (1)))" -@@ -12278,7 +12284,7 @@ - (call (mem:QI (match_dup 0)) - (match_operand 3)))] - "!TARGET_X32 -- && !ix86_indirect_branch_register -+ && !TARGET_INDIRECT_BRANCH_REGISTER - && SIBLING_CALL_P (peep2_next_insn (2)) - && !reg_mentioned_p (operands[0], - CALL_INSN_FUNCTION_USAGE (peep2_next_insn (2)))" -diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md -index d1f0a7dbf61..5f8a98faead 100644 ---- a/gcc/config/i386/predicates.md -+++ b/gcc/config/i386/predicates.md -@@ -593,7 +593,7 @@ - ;; Test for a valid operand for indirect branch. - (define_predicate "indirect_branch_operand" - (ior (match_operand 0 "register_operand") -- (and (not (match_test "ix86_indirect_branch_register")) -+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")))) - -@@ -637,7 +637,7 @@ - (ior (match_test "constant_call_address_operand - (op, mode == VOIDmode ? mode : Pmode)") - (match_operand 0 "call_register_no_elim_operand") -- (and (not (match_test "ix86_indirect_branch_register")) -+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (ior (and (not (match_test "TARGET_X32")) - (match_operand 0 "memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") -@@ -648,7 +648,7 @@ - (ior (match_test "constant_call_address_operand - (op, mode == VOIDmode ? mode : Pmode)") - (match_operand 0 "register_no_elim_operand") -- (and (not (match_test "ix86_indirect_branch_register")) -+ (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) - (ior (and (not (match_test "TARGET_X32")) - (match_operand 0 "sibcall_memory_operand")) - (and (match_test "TARGET_X32 && Pmode == DImode") -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -index 60d09881a99..6e94d2c4865 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c -@@ -11,9 +11,8 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -index aac75163794..3c467078964 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c -@@ -11,9 +11,8 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -index 9e24a385387..2c7fb52b59d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c -@@ -12,9 +12,8 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -index 127b5d94523..0d3f895009d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c -@@ -12,9 +12,8 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -index fcaa18d10b7..fb26c005e80 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c -@@ -9,8 +9,10 @@ foo (void) - bar (); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -index e4649283d10..aa03fbd8446 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c -@@ -10,9 +10,13 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 { target x32 } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler {\tpause} } } */ - /* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -index 17c2d0faf88..3c72036dbaf 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c -@@ -35,9 +35,8 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -index 9194ccf3cbc..7106407b83d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c -@@ -14,9 +14,8 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -index e51f261a612..27c7e5b029b 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c -@@ -12,9 +12,8 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -index 4aeec1833cd..89a2bac8403 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c -@@ -14,10 +14,9 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler {\tpause} } } */ - /* { dg-final { scan-assembler {\tlfence} } } */ - /* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -index ac0e5999f63..3eb83c3779a 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c -@@ -13,10 +13,9 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler {\tpause} } } */ - /* { dg-final { scan-assembler {\tlfence} } } */ - /* { dg-final { scan-assembler-not "__x86_indirect_thunk" } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -index 573cf1ef09e..0098dd1133d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c -@@ -14,9 +14,8 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -index b2b37fc6e2e..ece8de15a4b 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c -@@ -13,9 +13,8 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -index 4a43e199931..d53fc887dcc 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c -@@ -36,9 +36,8 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -index ac84ab623fa..73d16baddc7 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c -@@ -10,9 +10,9 @@ foo (void) - dispatch (buf); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "bnd ret" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -index ce655e8be1c..856751ac224 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c -@@ -11,10 +11,8 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "pushq\[ \t\]%rax" { target x32 } } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */ - /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "bnd ret" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -index d34485a0010..42312f65588 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c -@@ -10,8 +10,9 @@ foo (void) - bar (buf); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd" } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk_bnd_rax" { target lp64 } } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_eax" { target ia32 } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "bnd call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "bnd ret" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -index 0e19830de4d..c8ca102c8df 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c -@@ -11,10 +11,9 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*__x86_indirect_thunk" } } */ --/* { dg-final { scan-assembler "bnd jmp\[ \t\]*\.LIND" } } */ --/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 2 } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "bnd call\[ \t\]*__x86_indirect_thunk_bnd_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-times "bnd call\[ \t\]*\.LIND" 1 } } */ - /* { dg-final { scan-assembler "bnd ret" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ - /* { dg-final { scan-assembler {\tlfence} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -index 579441f250e..c09dd0afd2d 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c -@@ -11,9 +11,8 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -index c92e6f2b02d..826425a5115 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c -@@ -11,9 +11,8 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -index d9964c25bbd..385626850a2 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c -@@ -12,9 +12,8 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -index d4dca4dc5fe..1ae49b137ca 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c -@@ -12,9 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -index 5c07e02df6a..53282390977 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c -@@ -9,8 +9,10 @@ foo (void) - bar (); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -index 3eb440693a0..8ae43482d0c 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c -@@ -10,8 +10,8 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ --/* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 1 } } */ --/* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 1 } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -index aece9383697..2b9a33e93dc 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c -@@ -35,9 +35,8 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ - /* { dg-final { scan-assembler-not {\t(lfence|pause)} } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -index 3aba5e8c81f..869d9040838 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch(offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -index 0f0181d6672..c5c16ed8bd8 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c -@@ -11,7 +11,7 @@ male_indirect_jump (long offset) - dispatch[offset](offset); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -index 2eef6f35a75..4a63ebed8ab 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -index e825a10f14c..a395ffca018 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c -@@ -12,7 +12,7 @@ male_indirect_jump (long offset) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?dispatch" { target { { ! x32 } && *-*-linux* } } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?dispatch" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -index c6d77e10352..21cbfd39582 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c -@@ -9,7 +9,8 @@ foo (void) - bar (); - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -index 6454827b780..d1300f18dc7 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c -@@ -10,7 +10,8 @@ foo (void) - return 0; - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" } } */ -+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*bar@GOT" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*bar@GOT" { target { ! x32 } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 2 } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ -diff --git a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -index c67066cf197..ea009245a58 100644 ---- a/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c -@@ -35,8 +35,8 @@ bar (int i) - } - } - --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*\.L\[0-9\]+\\(,%" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%(r|e)ax" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler {\tpause} } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -index e6fea84a4d9..af9023af613 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-10.c -@@ -15,9 +15,6 @@ foo (void) - /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ - /* { dg-final { scan-assembler-times {\tpause} 2 } } */ - /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -index e239ec4542f..ba467c59b36 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-11.c -@@ -15,9 +15,6 @@ foo (void) - /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -index fa3181303c9..43e57cac2c3 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-12.c -@@ -15,8 +15,6 @@ foo (void) - /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk:" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler "__x86_indirect_thunk_(r|e)ax:" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -index fd5b41fdd3f..55f156c4376 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-13.c -@@ -14,9 +14,8 @@ foo (void) - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ - /* { dg-final { scan-assembler-times {\tpause} 2 } } */ - /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ - /* { dg-final { scan-assembler-times "jmp\[ \t\]*\.LIND" 3 } } */ - /* { dg-final { scan-assembler-times "call\[ \t\]*\.LIND" 3 } } */ - /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_indirect_thunk" } } */ --/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler-not "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -index d606373ead1..1c790436a53 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-14.c -@@ -16,7 +16,6 @@ foo (void) - /* { dg-final { scan-assembler-not "jmp\[ \t\]*__x86_return_thunk" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -index 75e45e226b8..58aba319cba 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-15.c -@@ -16,7 +16,6 @@ foo (void) - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler-times {\tpause} 1 } } */ - /* { dg-final { scan-assembler-times {\tlfence} 1 } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target x32 } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -index d1db41cc128..d2df8b874e0 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -@@ -14,11 +14,8 @@ foo (void) - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */ --/* { dg-final { scan-assembler-times {\tpause} 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times {\tlfence} 1 { target { ! x32 } } } } */ --/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { { ! x32 } && *-*-linux* } } } } */ --/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */ --/* { dg-final { scan-assembler-times {\tpause} 2 { target { x32 } } } } */ --/* { dg-final { scan-assembler-times {\tlfence} 2 { target { x32 } } } } */ --/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" { target { x32 } } } } */ --/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" { target x32 } } } */ -+/* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ -+/* { dg-final { scan-assembler-times {\tpause} 2 } } */ -+/* { dg-final { scan-assembler-times {\tlfence} 2 } } */ -+/* { dg-final { scan-assembler "call\[ \t\]*__x86_indirect_thunk_(r|e)ax" } } */ -+/* { dg-final { scan-assembler-not "pushq\[ \t\]%rax" } } */ --- -2.16.3 - diff --git a/cross/gcc6-armhf/0013-i386-Don-t-generate-alias-for-function-return-thunk.patch b/cross/gcc6-armhf/0013-i386-Don-t-generate-alias-for-function-return-thunk.patch deleted file mode 100644 index d846ac77d..000000000 --- a/cross/gcc6-armhf/0013-i386-Don-t-generate-alias-for-function-return-thunk.patch +++ /dev/null @@ -1,225 +0,0 @@ -From e7fbaebc8ff650df76f43e92cb9ca59d5174ebe7 Mon Sep 17 00:00:00 2001 -From: hjl -Date: Thu, 15 Mar 2018 17:54:40 +0000 -Subject: [PATCH 13/13] i386: Don't generate alias for function return thunk - -Function return thunks shouldn't be aliased to indirect branch thunks -since indirect branch thunks are placed in COMDAT section and a COMDAT -section with indirect branch may not have function return thunk. This -patch generates function return thunks directly. - -gcc/ - - Backport from mainline - PR target/84574 - * config/i386/i386.c (indirect_thunk_needed): Update comments. - (indirect_thunk_bnd_needed): Likewise. - (indirect_thunks_used): Likewise. - (indirect_thunks_bnd_used): Likewise. - (indirect_return_needed): New. - (indirect_return_bnd_needed): Likewise. - (output_indirect_thunk_function): Add a bool argument for - function return. - (output_indirect_thunk_function): Don't generate alias for - function return thunk. - (ix86_code_end): Call output_indirect_thunk_function to generate - function return thunks. - (ix86_output_function_return): Set indirect_return_bnd_needed - and indirect_return_needed instead of indirect_thunk_bnd_needed - and indirect_thunk_needed. - -gcc/testsuite/ - - Backport from mainline - PR target/84574 - * gcc.target/i386/ret-thunk-9.c: Expect __x86_return_thunk - label instead of __x86_indirect_thunk label. ---- - gcc/config/i386/i386.c | 92 ++++++++++------------------- - gcc/testsuite/gcc.target/i386/ret-thunk-9.c | 2 +- - 2 files changed, 33 insertions(+), 61 deletions(-) - -diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c -index 21c3c18bd3c..f4cd1c6f4e9 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -11067,19 +11067,23 @@ ix86_setup_frame_addresses (void) - labels in call and return thunks. */ - static int indirectlabelno; - --/* True if call and return thunk functions are needed. */ -+/* True if call thunk function is needed. */ - static bool indirect_thunk_needed = false; --/* True if call and return thunk functions with the BND prefix are -- needed. */ -+/* True if call thunk function with the BND prefix is needed. */ - static bool indirect_thunk_bnd_needed = false; - - /* Bit masks of integer registers, which contain branch target, used -- by call and return thunks functions. */ -+ by call thunk functions. */ - static int indirect_thunks_used; - /* Bit masks of integer registers, which contain branch target, used -- by call and return thunks functions with the BND prefix. */ -+ by call thunk functions with the BND prefix. */ - static int indirect_thunks_bnd_used; - -+/* True if return thunk function is needed. */ -+static bool indirect_return_needed = false; -+/* True if return thunk function with the BND prefix is needed. */ -+static bool indirect_return_bnd_needed = false; -+ - /* True if return thunk function via CX is needed. */ - static bool indirect_return_via_cx; - /* True if return thunk function via CX with the BND prefix is -@@ -11226,16 +11230,18 @@ output_indirect_thunk (bool need_bnd_p, unsigned int regno) - /* Output a funtion with a call and return thunk for indirect branch. - If BND_P is true, the BND prefix is needed. If REGNO != INVALID_REGNUM, - the function address is in REGNO. Otherwise, the function address is -- on the top of stack. */ -+ on the top of stack. Thunk is used for function return if RET_P is -+ true. */ - - static void --output_indirect_thunk_function (bool need_bnd_p, unsigned int regno) -+output_indirect_thunk_function (bool need_bnd_p, unsigned int regno, -+ bool ret_p) - { - char name[32]; - tree decl; - - /* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */ -- indirect_thunk_name (name, regno, need_bnd_p, false); -+ indirect_thunk_name (name, regno, need_bnd_p, ret_p); - decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, - get_identifier (name), - build_function_type_list (void_type_node, NULL_TREE)); -@@ -11278,50 +11284,6 @@ output_indirect_thunk_function (bool need_bnd_p, unsigned int regno) - ASM_OUTPUT_LABEL (asm_out_file, name); - } - -- /* Create alias for __x86_return_thunk/__x86_return_thunk_bnd or -- __x86_return_thunk_ecx/__x86_return_thunk_ecx_bnd. */ -- bool need_alias; -- if (regno == INVALID_REGNUM) -- need_alias = true; -- else if (regno == CX_REG) -- { -- if (need_bnd_p) -- need_alias = indirect_return_via_cx_bnd; -- else -- need_alias = indirect_return_via_cx; -- } -- else -- need_alias = false; -- -- if (need_alias) -- { -- char alias[32]; -- -- indirect_thunk_name (alias, regno, need_bnd_p, true); --#if TARGET_MACHO -- if (TARGET_MACHO) -- { -- fputs ("\t.weak_definition\t", asm_out_file); -- assemble_name (asm_out_file, alias); -- fputs ("\n\t.private_extern\t", asm_out_file); -- assemble_name (asm_out_file, alias); -- putc ('\n', asm_out_file); -- ASM_OUTPUT_LABEL (asm_out_file, alias); -- } --#else -- ASM_OUTPUT_DEF (asm_out_file, alias, name); -- if (USE_HIDDEN_LINKONCE) -- { -- fputs ("\t.globl\t", asm_out_file); -- assemble_name (asm_out_file, alias); -- putc ('\n', asm_out_file); -- fputs ("\t.hidden\t", asm_out_file); -- assemble_name (asm_out_file, alias); -- putc ('\n', asm_out_file); -- } --#endif -- } -- - DECL_INITIAL (decl) = make_node (BLOCK); - current_function_decl = decl; - allocate_struct_function (decl, false); -@@ -11368,19 +11330,29 @@ ix86_code_end (void) - rtx xops[2]; - unsigned int regno; - -+ if (indirect_return_needed) -+ output_indirect_thunk_function (false, INVALID_REGNUM, true); -+ if (indirect_return_bnd_needed) -+ output_indirect_thunk_function (true, INVALID_REGNUM, true); -+ -+ if (indirect_return_via_cx) -+ output_indirect_thunk_function (false, CX_REG, true); -+ if (indirect_return_via_cx_bnd) -+ output_indirect_thunk_function (true, CX_REG, true); -+ - if (indirect_thunk_needed) -- output_indirect_thunk_function (false, INVALID_REGNUM); -+ output_indirect_thunk_function (false, INVALID_REGNUM, false); - if (indirect_thunk_bnd_needed) -- output_indirect_thunk_function (true, INVALID_REGNUM); -+ output_indirect_thunk_function (true, INVALID_REGNUM, false); - - for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++) - { - unsigned int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1; - if ((indirect_thunks_used & (1 << i))) -- output_indirect_thunk_function (false, regno); -+ output_indirect_thunk_function (false, regno, false); - - if ((indirect_thunks_bnd_used & (1 << i))) -- output_indirect_thunk_function (true, regno); -+ output_indirect_thunk_function (true, regno, false); - } - - for (regno = AX_REG; regno <= SP_REG; regno++) -@@ -11389,10 +11361,10 @@ ix86_code_end (void) - tree decl; - - if ((indirect_thunks_used & (1 << regno))) -- output_indirect_thunk_function (false, regno); -+ output_indirect_thunk_function (false, regno, false); - - if ((indirect_thunks_bnd_used & (1 << regno))) -- output_indirect_thunk_function (true, regno); -+ output_indirect_thunk_function (true, regno, false); - - if (!(pic_labels_used & (1 << regno))) - continue; -@@ -28077,12 +28049,12 @@ ix86_output_function_return (bool long_p) - true); - if (need_bnd_p) - { -- indirect_thunk_bnd_needed |= need_thunk; -+ indirect_return_bnd_needed |= need_thunk; - fprintf (asm_out_file, "\tbnd jmp\t%s\n", thunk_name); - } - else - { -- indirect_thunk_needed |= need_thunk; -+ indirect_return_needed |= need_thunk; - fprintf (asm_out_file, "\tjmp\t%s\n", thunk_name); - } - } -diff --git a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -index d2df8b874e0..eee230ca2f6 100644 ---- a/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-9.c -@@ -13,7 +13,7 @@ foo (void) - /* { dg-final { scan-assembler "jmp\[ \t\]*__x86_return_thunk" } } */ - /* { dg-final { scan-assembler "jmp\[ \t\]*\.LIND" } } */ - /* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */ --/* { dg-final { scan-assembler "__x86_indirect_thunk:" } } */ -+/* { dg-final { scan-assembler "__x86_return_thunk:" } } */ - /* { dg-final { scan-assembler "mov(?:l|q)\[ \t\]*_?bar" { target *-*-linux* } } } */ - /* { dg-final { scan-assembler-times {\tpause} 2 } } */ - /* { dg-final { scan-assembler-times {\tlfence} 2 } } */ --- -2.16.3 - diff --git a/cross/gcc6-armhf/0014-fix-missing-includes-isl-0.20.patch b/cross/gcc6-armhf/0014-fix-missing-includes-isl-0.20.patch deleted file mode 100644 index 36d7893fa..000000000 --- a/cross/gcc6-armhf/0014-fix-missing-includes-isl-0.20.patch +++ /dev/null @@ -1,54 +0,0 @@ -From e31e485e7b453cd6cddf5a0a137b9c98bc797ea5 Mon Sep 17 00:00:00 2001 -From: Matthias Klose -Date: Tue, 14 Aug 2018 15:15:39 +0000 -Subject: [PATCH] backport: re PR tree-optimization/86724 (Compilation error - with new isl 0.20 (missing includes)) - -2018-08-14 Matthias Klose - - Backport from mainline - 2018-08-01 Richard Biener - - PR bootstrap/86724 - * graphite.h: Include isl/id.h and isl/space.h to allow build - with ISL 0.20. - -From-SVN: r263539 ---- - gcc/ChangeLog | 9 +++++++++ - gcc/graphite.h | 2 ++ - 2 files changed, 11 insertions(+) - -diff --git a/gcc/ChangeLog b/gcc/ChangeLog -index c7f61504757..4aaaeac328a 100644 ---- a/gcc/ChangeLog -+++ b/gcc/ChangeLog -@@ -1,3 +1,12 @@ -+2018-08-14 Matthias Klose -+ -+ Backport from mainline -+ 2018-08-01 Richard Biener -+ -+ PR bootstrap/86724 -+ * graphite.h: Include isl/id.h and isl/space.h to allow build -+ with ISL 0.20. -+ - 2018-08-10 Segher Boessenkool - - Backport from mainline -diff --git a/gcc/graphite.h b/gcc/graphite.h -index 578fa1a6d98..431d0ed0a5e 100644 ---- a/gcc/graphite.h -+++ b/gcc/graphite.h -@@ -40,6 +40,8 @@ along with GCC; see the file COPYING3. If not see - #ifdef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS - /* isl 0.15 or later. */ - #include -+#include -+#include - - #else - /* isl 0.14 or 0.13. */ --- -2.27.0 - diff --git a/cross/gcc6-armhf/0015-fix-error_p-null-error.patch b/cross/gcc6-armhf/0015-fix-error_p-null-error.patch deleted file mode 100644 index ac609b9e2..000000000 --- a/cross/gcc6-armhf/0015-fix-error_p-null-error.patch +++ /dev/null @@ -1,30 +0,0 @@ -This fixes - -/wrkdirs/usr/ports/lang/gcc7/work/gcc-7.5.0/gcc/config/i386/i386.c:9631:8: error: cannot initialize a variable of type 'bool' with an rvalue of type 'nullptr_t' - bool error_p = NULL; - ^ ~~~~ - -and comes from upstream as part of - - commit 9f36390d429502f0a0dee20bda5b4870da948f6a - Author: Uros Bizjak - Date: Sat May 6 09:01:51 2017 +0200 - - i386.c (ext_80387_constant_init): Do not explicitly initialize to zero. - - * config/i386/i386.c (ext_80387_constant_init): Do not explicitly - initialize to zero. - (init_regs): Remove declaration. - (function_arg_advance_32): Initialize error_p as boolean variable. - ---- a/gcc/config/i386/i386.c 2019-11-01 20:30:26 UTC -+++ b/gcc/config/i386/i386.c 2019-11-01 20:30:26 UTC -@@ -9628,7 +9628,7 @@ function_arg_advance_32 (CUMULATIVE_ARGS *cum, machine - HOST_WIDE_INT words) - { - int res = 0; -- bool error_p = NULL; -+ bool error_p = false; - - if (TARGET_IAMCU) - { diff --git a/cross/gcc6-armhf/001_all_default-ssp-strong.patch b/cross/gcc6-armhf/001_all_default-ssp-strong.patch deleted file mode 100644 index 95949eb00..000000000 --- a/cross/gcc6-armhf/001_all_default-ssp-strong.patch +++ /dev/null @@ -1,215 +0,0 @@ -# DP: Turn on -fstack-protector by default for C, C++, ObjC, ObjC++. -# DP: Build libgcc using -fno-stack-protector. - ---- - gcc/Makefile.in | 2 ++ - gcc/cp/lang-specs.h | 6 +++--- - gcc/doc/invoke.texi | 4 ++++ - gcc/gcc.c | 18 ++++++++++++++---- - gcc/objc/lang-specs.h | 10 +++++----- - gcc/objcp/lang-specs.h | 8 ++++---- - 6 files changed, 32 insertions(+), 16 deletions(-) - -Index: b/gcc/gcc.c -=================================================================== ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -858,6 +858,14 @@ proper position among the other output f - #define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G" - #endif - -+#ifndef SSP_DEFAULT_SPEC -+#ifdef TARGET_LIBC_PROVIDES_SSP -+#define SSP_DEFAULT_SPEC "%{!fno-stack-protector:%{!fstack-protector-all:%{!ffreestanding:%{!nostdlib:%{!fstack-protector:-fstack-protector-strong}}}}}" -+#else -+#define SSP_DEFAULT_SPEC "" -+#endif -+#endif -+ - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -@@ -1057,6 +1065,7 @@ static const char *cc1_spec = CC1_SPEC; - static const char *cc1plus_spec = CC1PLUS_SPEC; - static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC; - static const char *link_ssp_spec = LINK_SSP_SPEC; -+static const char *ssp_default_spec = SSP_DEFAULT_SPEC; - static const char *asm_spec = ASM_SPEC; - static const char *asm_final_spec = ASM_FINAL_SPEC; - static const char *link_spec = LINK_SPEC; -@@ -1112,7 +1121,7 @@ static const char *cpp_unique_options = - static const char *cpp_options = - "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\ - %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\ -- %{undef} %{save-temps*:-fpch-preprocess}"; -+ %{undef} %{save-temps*:-fpch-preprocess} %(ssp_default)"; - - /* This contains cpp options which are not passed when the preprocessor - output will be used by another program. */ -@@ -1301,9 +1310,9 @@ static const struct compiler default_com - %{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \ - %(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\ - cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \ -- %(cc1_options)}\ -+ %(cc1_options) %(ssp_default)}\ - %{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\ -- cc1 %(cpp_unique_options) %(cc1_options)}}}\ -+ cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1}, - {"-", - "%{!E:%e-E or -x required when input is from standard input}\ -@@ -1328,7 +1337,7 @@ static const struct compiler default_com - %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 %(cc1_options) %(ssp_default) %{!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}, -@@ -1560,6 +1569,7 @@ static struct spec_list static_specs[] = - INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec), - INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec), - INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec), -+ INIT_STATIC_SPEC ("ssp_default", &ssp_default_spec), - INIT_STATIC_SPEC ("endfile", &endfile_spec), - INIT_STATIC_SPEC ("link", &link_spec), - INIT_STATIC_SPEC ("lib", &lib_spec), -Index: b/gcc/cp/lang-specs.h -=================================================================== ---- a/gcc/cp/lang-specs.h -+++ b/gcc/cp/lang-specs.h -@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. - %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\ - cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ - %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2\ -+ %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:-o %g.s \ - %{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}}%V}}}}", -@@ -58,11 +58,11 @@ along with GCC; see the file COPYING3. - %(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\ - cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\ - %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2\ -+ %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:%(invoke_as)}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {".ii", "@c++-cpp-output", 0, 0, 0}, - {"@c++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1plus -fpreprocessed %i %(cc1_options) %2\ -+ cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -Index: b/gcc/params.def -=================================================================== ---- a/gcc/params.def -+++ b/gcc/params.def -@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT, - DEFPARAM (PARAM_SSP_BUFFER_SIZE, - "ssp-buffer-size", - "The lower bound for a buffer to be considered for stack smashing protection.", -- 8, 1, 0) -+ 4, 1, 0) - - DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING, - "min-size-for-stack-sharing", -Index: b/gcc/objc/lang-specs.h -=================================================================== ---- a/gcc/objc/lang-specs.h -+++ b/gcc/objc/lang-specs.h -@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3. - %{traditional|traditional-cpp:\ - %eGNU Objective C no longer supports traditional compilation}\ - %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\ -- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\ -+ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}\ - %{!save-temps*:%{!no-integrated-cpp:\ -- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\ -+ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objective-c-header", - "%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\ -@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3. - %{traditional|traditional-cpp:\ - %eGNU Objective C no longer supports traditional compilation}\ - %{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\ -- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ - -o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}%V}\ - %{!save-temps*:%{!no-integrated-cpp:\ -- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ - -o %g.s %{!o*:--output-pch=%i.gch}\ - %W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0}, - {".mi", "@objective-c-cpp-output", 0, 0, 0}, - {"@objective-c-cpp-output", -- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objc-cpp-output", - "%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\ -- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\ -+ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -Index: b/gcc/objcp/lang-specs.h -=================================================================== ---- a/gcc/objcp/lang-specs.h -+++ b/gcc/objcp/lang-specs.h -@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. - %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\ - cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\ - %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2\ -+ %(cc1_options) %(ssp_default) %2\ - -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {"@objective-c++", -@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3. - %(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\ - cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\ - %{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\ -- %(cc1_options) %2\ -+ %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:%(invoke_as)}}}}", - CPLUSPLUS_CPP_SPEC, 0, 0}, - {".mii", "@objective-c++-cpp-output", 0, 0, 0}, - {"@objective-c++-cpp-output", - "%{!M:%{!MM:%{!E:\ -- cc1objplus -fpreprocessed %i %(cc1_options) %2\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, - {"@objc++-cpp-output", - "%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\ - %{!M:%{!MM:%{!E:\ -- cc1objplus -fpreprocessed %i %(cc1_options) %2\ -+ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\ - %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, -Index: b/gcc/doc/invoke.texi -=================================================================== ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -9247,6 +9247,9 @@ - The minimum size of variables taking part in stack slot sharing when not - optimizing. The default value is 32. - -+The Alpine Linux default is "4", to increase -+the number of functions protected by the stack protector. -+ - @item max-jump-thread-duplication-stmts - Maximum number of statements allowed in a block that needs to be - duplicated when threading jumps. -@@ -10185,6 +10188,11 @@ - Like @option{-fstack-protector} but includes additional functions to - be protected --- those that have local array definitions, or have - references to local frame addresses. -+ -+NOTE: In Alpine Linux, -+@option{-fstack-protector-strong} is enabled by default for C, -+C++, ObjC, ObjC++, if none of @option{-fno-stack-protector}, -+@option{-nostdlib}, nor @option{-ffreestanding} are found. - - @item -fstack-protector-explicit - @opindex fstack-protector-explicit diff --git a/cross/gcc6-armhf/002_all_default-relro.patch b/cross/gcc6-armhf/002_all_default-relro.patch deleted file mode 100644 index c461017dc..000000000 --- a/cross/gcc6-armhf/002_all_default-relro.patch +++ /dev/null @@ -1,33 +0,0 @@ -# Turn on -Wl,-z,relro,-z,now by default. - ---- - gcc/doc/invoke.texi | 3 +++ - gcc/gcc.c | 1 + - 2 files changed, 4 insertions(+), 0 deletions(-) - -Index: b/gcc/doc/invoke.texi -=================================================================== ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map - linker. When using the GNU linker, you can also get the same effect with - @option{-Wl,-Map=output.map}. - -+NOTE: In Alpine Linux, for LDFLAGS, the option -+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}. -+ - @item -u @var{symbol} - @opindex u - Pretend the symbol @var{symbol} is undefined, to force linking of -Index: b/gcc/gcc.c -=================================================================== ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -890,6 +890,7 @@ proper position among the other output f - "%{flto|flto=*:%= 2, 0) -+C ObjC C++ ObjC++ Var(warn_format_security) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wformat=, warn_format >= 2, 0) - Warn about possible security problems with format functions - - Wformat-y2k -@@ -424,7 +424,7 @@ C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning LangEnabledBy(C ObjC C++ - Warn about zero-length formats - - Wformat= --C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) -+C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Init(1) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall, 1, 0) - Warn about printf/scanf/strftime/strfmon format string anomalies - - Wignored-qualifiers ---- a/gcc/doc/gcc.info -+++ b/gcc/doc/gcc.info -@@ -3451,6 +3451,8 @@ compiler warns that an unrecognized option is present. - '-Wno-format-contains-nul', '-Wno-format-extra-args', and - '-Wno-format-zero-length'. '-Wformat' is enabled by '-Wall'. - -+ This option is enabled by default in Alpine Linux. -+ - '-Wno-format-contains-nul' - If '-Wformat' is specified, do not warn about format strings - that contain NUL bytes. -@@ -3496,6 +3498,8 @@ compiler warns that an unrecognized option is present. - future warnings may be added to '-Wformat-security' that are - not included in '-Wformat-nonliteral'.) - -+ This option is enabled by default in Alpine Linux. -+ - '-Wformat-y2k' - If '-Wformat' is specified, also warn about 'strftime' formats - that may yield only a two-digit year. diff --git a/cross/gcc6-armhf/012_all_default-warn-trampolines.patch b/cross/gcc6-armhf/012_all_default-warn-trampolines.patch deleted file mode 100644 index 9ab4378d4..000000000 --- a/cross/gcc6-armhf/012_all_default-warn-trampolines.patch +++ /dev/null @@ -1,25 +0,0 @@ -Enable -Wtrampolines by default. - - ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -648,7 +648,7 @@ Common Var(warn_system_headers) Warning - Do not suppress warnings from system headers - - Wtrampolines --Common Var(warn_trampolines) Warning -+Common Var(warn_trampolines) Init(1) Warning - Warn whenever a trampoline is generated - - Wtype-limits ---- a/gcc/doc/gcc.info -+++ b/gcc/doc/gcc.info -@@ -4021,6 +4021,8 @@ compiler warns that an unrecognized option is present. - and thus requires the stack to be made executable in order for the - program to work properly. - -+ This warning is enabled by default in Gentoo. -+ - '-Wfloat-equal' - Warn if floating-point values are used in equality comparisons. - diff --git a/cross/gcc6-armhf/020_all_msgfmt-libstdc++-link.patch b/cross/gcc6-armhf/020_all_msgfmt-libstdc++-link.patch deleted file mode 100644 index a70ea50a0..000000000 --- a/cross/gcc6-armhf/020_all_msgfmt-libstdc++-link.patch +++ /dev/null @@ -1,39 +0,0 @@ -Ensure that msgfmt doesn't encounter problems during gcc bootstrapping. - -Solves error messages like the following: - -msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6) - -The libgcc_s.so used during build doesn't satisfy the needs of the -libstdc++.so that msgfmt is linked against. On the other hand, msgfmt -is used as a stand-alone application here, and what library it uses -behind the scenes is of no concern to the gcc build process. -Therefore, simply invoking it "as usual", i.e. without any special -library path, will make it work as expected here. - -2011-09-19 Martin von Gagern - -References: -https://bugs.gentoo.org/372377 -https://bugs.gentoo.org/295480 - ---- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am -+++ gcc-4.1.2/libstdc++-v3/po/Makefile.am -@@ -39,6 +39,7 @@ MSGFMT = msgfmt - EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN) - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) ---- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in -+++ gcc-4.1.2/libstdc++-v3/po/Makefile.in -@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am - - - .po.mo: -+ env --unset=LD_LIBRARY_PATH \ - $(MSGFMT) -o $@ $< - - all-local: all-local-$(USE_NLS) diff --git a/cross/gcc6-armhf/050_all_libiberty-asprintf.patch b/cross/gcc6-armhf/050_all_libiberty-asprintf.patch deleted file mode 100644 index bee0c4c23..000000000 --- a/cross/gcc6-armhf/050_all_libiberty-asprintf.patch +++ /dev/null @@ -1,18 +0,0 @@ -2008-07-25 Magnus Granberg - - * include/libiberty.h (asprintf): Don't declare if defined as a macro - ---- a/include/libiberty.h -+++ b/include/libiberty.h -@@ -609,8 +609,11 @@ extern int pwait (int, int *, int); - /* Like sprintf but provides a pointer to malloc'd storage, which must - be freed by the caller. */ - -+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */ -+#ifndef asprintf - extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2; - #endif -+#endif - - #if !HAVE_DECL_VASPRINTF - /* Like vsprintf but provides a pointer to malloc'd storage, which diff --git a/cross/gcc6-armhf/051_all_libiberty-pic.patch b/cross/gcc6-armhf/051_all_libiberty-pic.patch deleted file mode 100644 index b6160a730..000000000 --- a/cross/gcc6-armhf/051_all_libiberty-pic.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/libiberty/Makefile.in -+++ b/libiberty/Makefile.in -@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - $(AR) $(AR_FLAGS) $(TARGETLIB) \ - $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ -+ cp $(TARGETLIB) ../ ; \ - cd ..; \ - else true; fi - diff --git a/cross/gcc6-armhf/053_all_libitm-no-fortify-source.patch b/cross/gcc6-armhf/053_all_libitm-no-fortify-source.patch deleted file mode 100644 index 5ab15afc3..000000000 --- a/cross/gcc6-armhf/053_all_libitm-no-fortify-source.patch +++ /dev/null @@ -1,27 +0,0 @@ -https://bugs.gentoo.org/508852 -https://gcc.gnu.org/PR61164 - -2014-04-27 Magnus Granberg - - #508852 - * libitm/configure.tgt: Disable FORTIFY - ---- a/libitm/configure.tgt -+++ b/libitm/configure.tgt -@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then - esac - fi - -+# FIXME: error: inlining failed in call to always_inline -+# ‘int vfprintf(FILE*, const char*, __va_list_tag*)’ -+# : function body can be overwritten at link time -+# Disable Fortify in libitm for now. #508852 -+case "${target}" in -+ *-*-linux*) -+ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE" -+ ;; -+esac -+ - # Map the target cpu to an ARCH sub-directory. At the same time, - # work out any special compilation flags as necessary. - case "${target_cpu}" in diff --git a/cross/gcc6-armhf/067_all_gcc-poison-system-directories.patch b/cross/gcc6-armhf/067_all_gcc-poison-system-directories.patch deleted file mode 100644 index 103671617..000000000 --- a/cross/gcc6-armhf/067_all_gcc-poison-system-directories.patch +++ /dev/null @@ -1,194 +0,0 @@ -http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/gcc/gcc-6.1/0010-gcc-poison-system-directories.patch - -From d76250323dad69212c958e4857a98d99ab51a39e Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Fri, 29 Mar 2013 08:59:00 +0400 -Subject: [PATCH 10/46] gcc: poison-system-directories - -Signed-off-by: Khem Raj - -Upstream-Status: Inappropriate [distribution: codesourcery] ---- - gcc/common.opt | 4 ++++ - gcc/config.in | 6 ++++++ - gcc/configure | 16 ++++++++++++++++ - gcc/configure.ac | 10 ++++++++++ - gcc/doc/invoke.texi | 9 +++++++++ - gcc/gcc.c | 2 ++ - gcc/incpath.c | 19 +++++++++++++++++++ - 7 files changed, 66 insertions(+) - -diff --git a/gcc/common.opt b/gcc/common.opt -index 67048db..733185c 100644 ---- a/gcc/common.opt -+++ b/gcc/common.opt -@@ -659,6 +659,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 local variable shadows another. -diff --git a/gcc/config.in b/gcc/config.in -index 115cb61..105b30f 100644 ---- a/gcc/config.in -+++ b/gcc/config.in -@@ -187,6 +187,12 @@ - #endif - - -+/* Define to warn for use of native system header directories */ -+#ifndef USED_FOR_TARGET -+#undef ENABLE_POISON_SYSTEM_DIRECTORIES -+#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 1c6e340..8f83152 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -942,6 +942,7 @@ with_system_zlib - enable_maintainer_mode - enable_link_mutex - enable_version_specific_runtime_libs -+enable_poison_system_directories - enable_plugin - enable_host_shared - enable_libquadmath_support -@@ -1681,6 +1682,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 -@@ -28908,6 +28911,19 @@ 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}" = "xyes"; then -+ -+$as_echo "#define ENABLE_POISON_SYSTEM_DIRECTORIES 1" >>confdefs.h -+ -+fi -+ - # Substitute configuration variables - - -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 6c1dcd9..0fccaef 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -5861,6 +5861,16 @@ 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]),, -+ [enable_poison_system_directories=no]) -+if test "x${enable_poison_system_directories}" = "xyes"; then -+ AC_DEFINE([ENABLE_POISON_SYSTEM_DIRECTORIES], -+ [1], -+ [Define to warn for use of native system header directories]) -+fi -+ - # Substitute configuration variables - AC_SUBST(subdirs) - AC_SUBST(srcdir) -diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi -index 821f8fd..8bb49e7 100644 ---- a/gcc/doc/invoke.texi -+++ b/gcc/doc/invoke.texi -@@ -284,6 +284,7 @@ Objective-C and Objective-C++ Dialects}. - -Wparentheses -Wno-pedantic-ms-format @gol - -Wplacement-new -Wplacement-new=@var{n} @gol - -Wpointer-arith -Wno-pointer-to-int-cast @gol -+-Wno-poison-system-directories @gol - -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol - -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol - -Wshift-overflow -Wshift-overflow=@var{n} @gol -@@ -4723,6 +4724,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.c b/gcc/gcc.c -index 1af5920..4cfef7f 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -1017,6 +1017,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:%{!nostartfiles:%S}} \ -+ %{Wno-poison-system-directories:--no-poison-system-directories} \ -+ %{Werror=poison-system-directories:--error-poison-system-directories} \ - %{static:} %{L*} %(mfwrap) %(link_libgcc) " \ - VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o " CHKP_SPEC " \ - %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\ -diff --git a/gcc/incpath.c b/gcc/incpath.c -index ea40f4a..856da41 100644 ---- a/gcc/incpath.c -+++ b/gcc/incpath.c -@@ -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. */ -@@ -381,6 +382,24 @@ 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[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))) -+ 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 --- -2.8.2 - diff --git a/cross/gcc6-armhf/090_all_pr55930-dependency-tracking.patch b/cross/gcc6-armhf/090_all_pr55930-dependency-tracking.patch deleted file mode 100644 index a8743e08c..000000000 --- a/cross/gcc6-armhf/090_all_pr55930-dependency-tracking.patch +++ /dev/null @@ -1,18 +0,0 @@ -libatomic build failure if configured with --disable-dependency-tracking -load_n.c:115:1: fatal error: opening dependency file .deps/load_1_.lo.Ppo: No such file or directory - -https://bugs.gentoo.org/463463 -http://gcc.gnu.org/PR55930 - ---- a/libatomic/Makefile.in -+++ b/libatomic/Makefile.in -@@ -298,7 +298,8 @@ PAT_N = $(word 2,$(PAT_SPLIT)) - PAT_S = $(word 3,$(PAT_SPLIT)) - IFUNC_DEF = -DIFUNC_ALT=$(PAT_S) - IFUNC_OPT = $(word $(PAT_S),$(IFUNC_OPTIONS)) --M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo -+@AMDEP_TRUE@M_DEPS = -MT $@ -MD -MP -MF $(DEPDIR)/$(@F).Ppo -+@AMDEP_FALSE@M_DEPS = - M_SIZE = -DN=$(PAT_N) - M_IFUNC = $(if $(PAT_S),$(IFUNC_DEF) $(IFUNC_OPT)) - M_FILE = $(PAT_BASE)_n.c diff --git a/cross/gcc6-armhf/201-cilkrts.patch b/cross/gcc6-armhf/201-cilkrts.patch deleted file mode 100644 index 4aac10d6d..000000000 --- a/cross/gcc6-armhf/201-cilkrts.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 594e3c1ab576daddeb86015efc8b1677020b1878 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Sat, 24 Oct 2015 20:39:30 +0000 -Subject: [PATCH 1/6] cilkrts - ---- - libcilkrts/runtime/os-unix.c | 22 +++++++--------------- - 1 file changed, 7 insertions(+), 15 deletions(-) - -diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c -index cb582dd..e43d7d5 100644 ---- a/libcilkrts/runtime/os-unix.c -+++ b/libcilkrts/runtime/os-unix.c -@@ -51,6 +51,7 @@ - #if defined __linux__ - # include - # include -+# include - #elif defined __APPLE__ - # include - // Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output -@@ -400,28 +401,19 @@ COMMON_SYSDEP void __cilkrts_sleep(void) - - COMMON_SYSDEP void __cilkrts_yield(void) - { --#if __APPLE__ || __FreeBSD__ || __VXWORKS__ -- // On MacOS, call sched_yield to yield quantum. I'm not sure why we -- // don't do this on Linux also. -- sched_yield(); --#elif defined(__DragonFly__) -- // On DragonFly BSD, call sched_yield to yield quantum. -- sched_yield(); --#elif defined(__MIC__) -+#if defined(__MIC__) - // On MIC, pthread_yield() really trashes things. Arch's measurements - // showed that calling _mm_delay_32() (or doing nothing) was a better - // option. Delaying 1024 clock cycles is a reasonable compromise between - // giving up the processor and latency starting up when work becomes - // available - _mm_delay_32(1024); --#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__)) -- // On Android and Solaris, call sched_yield to yield quantum. I'm not -- // sure why we don't do this on Linux also. -- sched_yield(); --#else -- // On Linux, call pthread_yield (which in turn will call sched_yield) -- // to yield quantum. -+#elif defined(__sun__) && !defined(__svr4__) -+ // On old SunOS call pthread_yield to yield a quantum. - pthread_yield(); -+#else -+ // On other platforms call sched_yield to yield a quantum. -+ sched_yield(); - #endif - } - --- -2.8.1 - diff --git a/cross/gcc6-armhf/203-libgcc_s.patch b/cross/gcc6-armhf/203-libgcc_s.patch deleted file mode 100644 index c74351c71..000000000 --- a/cross/gcc6-armhf/203-libgcc_s.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Sat, 24 Oct 2015 20:09:53 +0000 -Subject: [PATCH 3/6] libgcc_s - ---- - gcc/config/i386/i386.c | 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.c b/gcc/config/i386/i386.c -index 3d044e8..82523e1 100644 ---- a/gcc/config/i386/i386.c -+++ b/gcc/config/i386/i386.c -@@ -40269,10 +40269,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 8c2248d..6c82f15 100644 ---- a/libgcc/config/i386/cpuinfo.c -+++ b/libgcc/config/i386/cpuinfo.c -@@ -485,7 +485,7 @@ __cpu_indicator_init (void) - return 0; - } - --#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 11bb46e..4f47f7b 100644 ---- a/libgcc/config/i386/t-linux -+++ b/libgcc/config/i386/t-linux -@@ -3,4 +3,4 @@ - # 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 -+HOST_LIBGCC2_CFLAGS += -mlong-double-80 --- -2.8.1 - diff --git a/cross/gcc6-armhf/204-linux_libc_has_function.patch b/cross/gcc6-armhf/204-linux_libc_has_function.patch deleted file mode 100644 index 2dcedc3a7..000000000 --- a/cross/gcc6-armhf/204-linux_libc_has_function.patch +++ /dev/null @@ -1,25 +0,0 @@ -From edec78452d693fb524daa9a6efd45c850b27b25c Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Fri, 6 Nov 2015 23:59:20 +0000 -Subject: [PATCH 4/6] linux_libc_has_function - ---- - gcc/config/linux.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/gcc/config/linux.c b/gcc/config/linux.c -index 250296b..16c3768 100644 ---- a/gcc/config/linux.c -+++ b/gcc/config/linux.c -@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see - bool - linux_libc_has_function (enum function_class fn_class) - { -- if (OPTION_GLIBC) -+ if (OPTION_GLIBC || OPTION_MUSL) - return true; - if (OPTION_BIONIC) - if (fn_class == function_c94 --- -2.8.1 - diff --git a/cross/gcc6-armhf/205-nopie.patch b/cross/gcc6-armhf/205-nopie.patch deleted file mode 100644 index e3da94d10..000000000 --- a/cross/gcc6-armhf/205-nopie.patch +++ /dev/null @@ -1,75 +0,0 @@ -From b6015aca9c9cc83739fd0ed637a835119b2c4e34 Mon Sep 17 00:00:00 2001 -From: Szabolcs Nagy -Date: Sat, 7 Nov 2015 02:08:05 +0000 -Subject: [PATCH 5/6] nopie - ---- - gcc/configure | 27 +++++++++++++++++++++++++++ - gcc/configure.ac | 13 +++++++++++++ - 2 files changed, 40 insertions(+) - -diff --git a/gcc/configure b/gcc/configure -index 1c6e340..7e8b5d6 100755 ---- a/gcc/configure -+++ b/gcc/configure -@@ -29390,6 +29390,33 @@ fi - $as_echo "$gcc_cv_no_pie" >&6; } - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -nopie option" >&5 -+$as_echo_n "checking for -nopie option... " >&6; } -+if test "${gcc_cv_nopie+set}" = set; then : -+ $as_echo_n "(cached) " >&6 -+else -+ saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext -+/* end confdefs.h. */ -+int main(void) {return 0;} -+_ACEOF -+if ac_fn_cxx_try_link "$LINENO"; then : -+ gcc_cv_nopie=yes -+else -+ gcc_cv_nopie=no -+fi -+rm -f core conftest.err conftest.$ac_objext \ -+ conftest$ac_exeext conftest.$ac_ext -+ LDFLAGS="$saved_LDFLAGS" -+fi -+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_nopie" >&5 -+$as_echo "$gcc_cv_nopie" >&6; } -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - - -diff --git a/gcc/configure.ac b/gcc/configure.ac -index 6c1dcd9..0ca7647 100644 ---- a/gcc/configure.ac -+++ b/gcc/configure.ac -@@ -6098,6 +6098,19 @@ AC_CACHE_CHECK([for -no-pie option], - LDFLAGS="$saved_LDFLAGS"]) - if test "$gcc_cv_no_pie" = "yes"; then - NO_PIE_FLAG="-no-pie" -+else -+ # Check if -nopie works. -+ AC_CACHE_CHECK([for -nopie option], -+ [gcc_cv_nopie], -+ [saved_LDFLAGS="$LDFLAGS" -+ LDFLAGS="$LDFLAGS -nopie" -+ AC_LINK_IFELSE([int main(void) {return 0;}], -+ [gcc_cv_nopie=yes], -+ [gcc_cv_nopie=no]) -+ LDFLAGS="$saved_LDFLAGS"]) -+ if test "$gcc_cv_nopie" = "yes"; then -+ NO_PIE_FLAG="-nopie" -+ fi - fi - AC_SUBST([NO_PIE_FLAG]) - --- -2.8.1 - diff --git a/cross/gcc6-armhf/207-static-pie.patch b/cross/gcc6-armhf/207-static-pie.patch deleted file mode 100644 index 9355c584b..000000000 --- a/cross/gcc6-armhf/207-static-pie.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h -index b0bf40a..d4b56fe 100644 ---- a/gcc/config/gnu-user.h -+++ b/gcc/config/gnu-user.h -@@ -51,10 +51,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - #if defined HAVE_LD_PIE - #define GNU_USER_TARGET_STARTFILE_SPEC \ - "%{!shared: %{pg|p|profile:gcrt1.o%s;: \ -- %{" PIE_SPEC ":Scrt1.o%s} %{" NO_PIE_SPEC ":crt1.o%s}}} \ -- crti.o%s %{static:crtbeginT.o%s;: %{shared:crtbeginS.o%s} \ -+ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \ -+ crti.o%s %{shared:crtbeginS.o%s;: \ - %{" PIE_SPEC ":crtbeginS.o%s} \ -- %{" NO_PIE_SPEC ":crtbegin.o%s}} \ -+ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \ - %{fvtable-verify=none:%s; \ - fvtable-verify=preinit:vtv_start_preinit.o%s; \ - fvtable-verify=std:vtv_start.o%s} \ -diff --git a/gcc/gcc.c b/gcc/gcc.c -index 0208d61..731564e 100644 ---- a/gcc/gcc.c -+++ b/gcc/gcc.c -@@ -870,7 +870,7 @@ proper position among the other output files. */ - #endif - - #ifdef ENABLE_DEFAULT_PIE --#define NO_PIE_SPEC "no-pie|static" -+#define NO_PIE_SPEC "no-pie" - #define PIE_SPEC NO_PIE_SPEC "|r|shared:;" - #define NO_FPIE1_SPEC "fno-pie" - #define FPIE1_SPEC NO_FPIE1_SPEC ":;" -@@ -916,7 +916,7 @@ proper position among the other output files. */ - #ifndef LINK_PIE_SPEC - #ifdef HAVE_LD_PIE - #ifndef LD_PIE_SPEC --#define LD_PIE_SPEC "-pie" -+#define LD_PIE_SPEC "-pie %{static:--no-dynamic-linker -Bsymbolic}" - #endif - #else - #define LD_PIE_SPEC "" diff --git a/cross/gcc6-armhf/300-main-gcc-add-musl-s390x-dynamic-linker.patch b/cross/gcc6-armhf/300-main-gcc-add-musl-s390x-dynamic-linker.patch deleted file mode 100644 index 241957871..000000000 --- a/cross/gcc6-armhf/300-main-gcc-add-musl-s390x-dynamic-linker.patch +++ /dev/null @@ -1,32 +0,0 @@ -From be841c16dd544553c67faac79bd4cc3cd10a1dc0 Mon Sep 17 00:00:00 2001 -From: "Tuan M. Hoang" -Date: Mon, 21 Nov 2016 01:42:16 +0700 -Subject: [PATCH] main/gcc: add musl s390x dynamic linker - ---- - gcc/config/s390/linux.h | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/gcc/config/s390/linux.h b/gcc/config/s390/linux.h -index 1e3ed35..a244214 100644 ---- a/gcc/config/s390/linux.h -+++ b/gcc/config/s390/linux.h -@@ -63,6 +63,15 @@ along with GCC; see the file COPYING3. If not see - #define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1" - #define GLIBC_DYNAMIC_LINKER64 "/lib/ld64.so.1" - -+#undef MUSL_DYNAMIC_LINKER -+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-s390x.so.1" -+#undef MUSL_DYNAMIC_LINKER32 -+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-s390x.so.1" -+#undef MUSL_DYNAMIC_LINKER64 -+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-s390x.so.1" -+#undef MUSL_DYNAMIC_LINKERX32 -+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-s390x.so.1" -+ - #undef LINK_SPEC - #define LINK_SPEC \ - "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \ --- -2.10.2 - diff --git a/cross/gcc6-armhf/310-build-gcj-s390x.patch b/cross/gcc6-armhf/310-build-gcj-s390x.patch deleted file mode 100644 index 1e522ee15..000000000 --- a/cross/gcc6-armhf/310-build-gcj-s390x.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 697a7ba791fce2ffab2ed723d909a89684019e3d Mon Sep 17 00:00:00 2001 -From: "Tuan M. Hoang" -Date: Sun, 19 Feb 2017 17:03:33 +0000 -Subject: [PATCH] main/gcc : when building gcc-java on s390x, libgcj.so - complains about undefined reference to __data_start. Using - SEARCH_FOR_DATA_START instead solved it. Credit to Andrew Haley at RedHat. - ---- - boehm-gc/include/private/gcconfig.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h -index 4ca6a80..a15fff6 100644 ---- a/boehm-gc/include/private/gcconfig.h -+++ b/boehm-gc/include/private/gcconfig.h -@@ -1837,8 +1837,7 @@ - # define OS_TYPE "LINUX" - # define LINUX_STACKBOTTOM - # define DYNAMIC_LOADING -- extern int __data_start[]; --# define DATASTART ((ptr_t)(__data_start)) -+# define SEARCH_FOR_DATA_START - extern int _end[]; - # define DATAEND (_end) - # define CACHE_LINE_SIZE 256 --- -2.11.1 - diff --git a/cross/gcc6-armhf/320-libffi-gnulinux.patch b/cross/gcc6-armhf/320-libffi-gnulinux.patch deleted file mode 100644 index b3b4fc931..000000000 --- a/cross/gcc6-armhf/320-libffi-gnulinux.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libffi/closures.c.orig b/libffi/closures.c -index 721ff00..22a699c 100644 ---- a/libffi/src/closures.c.orig -+++ b/libffi/src/closures.c -@@ -34,7 +34,7 @@ - #include - - #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE --# if __gnu_linux__ && !defined(__ANDROID__) -+# if __linux__ && !defined(__ANDROID__) - /* This macro indicates it may be forbidden to map anonymous memory - with both write and execute permission. Code compiled when this - option is defined will attempt to map such pages once, but if it diff --git a/cross/gcc6-armhf/APKBUILD b/cross/gcc6-armhf/APKBUILD deleted file mode 100644 index 431fc6eb6..000000000 --- a/cross/gcc6-armhf/APKBUILD +++ /dev/null @@ -1,552 +0,0 @@ -# Automatically generated aport, do not edit! -# Generator: pmbootstrap aportgen gcc6-armhf -# Based on: main/gcc6 (from postmarketOS) -CTARGET_ARCH=armhf -CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})" -LANG_D=false -LANG_OBJC=false -LANG_JAVA=false -LANG_GO=false -LANG_FORTRAN=false -LANG_ADA=false -options="!strip" - -# abuild doesn't try to tries to install "build-base-$CTARGET_ARCH" -# when this variable matches "no*" -BOOTSTRAP="nobuildbase" - -# abuild will only cross compile when this variable is set, but it -# needs to find a valid package database in there for dependency -# resolving, so we set it to /. -CBUILDROOT="/" - -_cross_configure="--disable-bootstrap --with-sysroot=/usr/$CTARGET" - -maintainer="" -pkgname=gcc6-armhf -pkgver=9999 -_pkgver=6.4.0 -pkgrel=15 -pkgdesc="Stage2 cross-compiler for armhf" -url="http://gcc.gnu.org" -# loongarch64: not relevant -# ppc64le: not relevant -# riscv64: doesn't build -arch="x86_64" -license="GPL-2.0-or-later AND LGPL-2.1-or-later" -_gccrel=$_pkgver-r$pkgrel -depends="binutils-armhf mpc1 so:libc.musl-x86_64.so.1 so:libgcc_s.so.1 so:libgmp.so.10 so:libisl.so.23 so:libmpc.so.3 so:libmpfr.so.6 so:libstdc++.so.6 so:libz.so.1" -makedepends_build="gcc g++ bison flex texinfo gawk zip gmp-dev mpfr-dev mpc1-dev zlib-dev" -makedepends_host="linux-headers gmp-dev mpfr-dev mpc1-dev isl-dev zlib-dev musl-dev-armhf binutils-armhf" -options="!strip !tracedeps toolchain" - -# We only care about C, so we can compile old Linux kernels -LANG_CXX=false -LANG_OBJC=false -LANG_JAVA=false -LANG_GO=false -LANG_FORTRAN=false -LANG_ADA=false - -LIBGOMP="false" -LIBGCC="false" -LIBATOMIC="false" -LIBITM="false" - -if [ "$CHOST" != "$CTARGET" ]; then - if [ "$BOOTSTRAP" = nolibc ]; then - LANG_CXX=false - LANG_ADA=false - LIBGCC=false - _builddir="$srcdir/build-cross-pass2" - else - _builddir="$srcdir/build-cross-final" - fi - LANG_OBJC=false - LANG_JAVA=false - LANG_GO=false - LANG_FORTRAN=false - LIBGOMP=false - LIBATOMIC=false - LIBITM=false - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 6 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" - unset CPPFLAGS - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - STRIP_FOR_TARGET="$CTARGET-strip" -elif [ "$CBUILD" != "$CHOST" ]; then - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 6 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS" - unset CPPFLAGS - - # reset flags and cc for build - export CC_FOR_BUILD="gcc" - export CXX_FOR_BUILD="g++" - export CFLAGS_FOR_BUILD=" " - export CXXFLAGS_FOR_BUILD=" " - export LDFLAGS_FOR_BUILD=" " - export CFLAGS_FOR_TARGET=" " - export CXXFLAGS_FOR_TARGET=" " - export LDFLAGS_FOR_TARGET=" " - - # Languages that do not need bootstrapping - LANG_OBJC=false - LANG_JAVA=false - LANG_GO=false - LANG_FORTRAN=false - - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build-cross-native" -else - STRIP_FOR_TARGET=${CROSS_COMPILE}strip - _builddir="$srcdir/build" - - # format-sec: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100431 - CFLAGS="${CFLAGS/-Werror=format-security/}" - CXXFLAGS="${CXXFLAGS/-Werror=format-security/}" - CPPFLAGS="${CPPFLAGS/-Werror=format-security/}" - # fstack-clash-protection is not known to GCC 6 - CFLAGS="${CFLAGS/-fstack-clash-protection/}" - CXXFLAGS="${CXXFLAGS/-fstack-clash-protection/}" - CPPFLAGS="${CPPFLAGS/-fstack-clash-protection/}" - # and neither is -fno-plt - CFLAGS="${CFLAGS/-fno-plt/}" - CXXFLAGS="${CXXFLAGS/-fno-plt/}" - CPPFLAGS="${CPPFLAGS/-fno-plt/}" - # reset target flags (should be set in crosscreate abuild) - # fixup flags. seems gcc treats CPPFLAGS as global without - # _FOR_xxx variants. wrap it in CFLAGS and CXXFLAGS. - export CFLAGS="$CPPFLAGS -g0 $CFLAGS -O2" - export CXXFLAGS="$CPPFLAGS -g0 $CXXFLAGS -O2" - unset CPPFLAGS - # https://gcc.gnu.org/install/build.html - export CFLAGS_FOR_TARGET="$CFLAGS" - export CXXFLAGS_FOR_TARGET="$CXXFLAGS" - export LDFLAGS_FOR_TARGET="$LDFLAGS" - export BOOT_CFLAGS="$CFLAGS" - export BOOT_LDFLAGS="$LDFLAGS" -fi - -# Go needs {set,make,swap}context, unimplemented in musl -[ "$CTARGET_LIBC" = musl ] && LANG_GO=false - -# libitm has TEXTRELs in ARM build, so disable for now -case "$CTARGET_ARCH" in -arm*) LIBITM=false ;; -mips*) LIBITM=false ;; -esac - -# Fortran uses libquadmath if toolchain has __float128 -# currently on x86, x86_64 and ia64 -LIBQUADMATH=$LANG_FORTRAN -case "$CTARGET_ARCH" in -x86 | x86_64) LIBQUADMATH=$LANG_FORTRAN ;; -*) LIBQUADMATH=false ;; -esac - -# libatomic is a dependency for openvswitch -$LIBATOMIC && subpackages="$subpackages libatomic::$CTARGET_ARCH" -$LIBGCC && subpackages="$subpackages libgcc::$CTARGET_ARCH" -$LIBQUADMATH && subpackages="$subpackages libquadmath::$CTARGET_ARCH" -if $LIBGOMP; then - depends="$depends libgomp=$_gccrel" - subpackages="$subpackages libgomp::$CTARGET_ARCH" -fi - -_languages=c -if $LANG_CXX; then - _languages="$_languages,c++" -fi -if $LANG_OBJC; then - subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc" - _languages="$_languages,objc" -fi -if $LANG_JAVA; then - subpackages="$subpackages libgcj::$CTARGET_ARCH gcc-java$_target:java" - _languages="$_languages,java" -fi -if $LANG_GO; then - subpackages="$subpackages libgo::$CTARGET_ARCH gcc-go$_target:go" - _languages="$_languages,go" -fi -if $LANG_FORTRAN; then - subpackages="$subpackages libgfortran::$CTARGET_ARCH gfortran$_target:gfortran" - _languages="$_languages,fortran" -fi -if $LANG_ADA; then - subpackages="$subpackages libgnat::$CTARGET_ARCH gcc-gnat$_target:gnat" - _languages="$_languages,ada" - makedepends_build="$makedepends_build gcc-gnat gcc-gnat$_cross" -fi -makedepends="$makedepends_build $makedepends_host" - -source="http://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$_pkgver}/gcc-${_pkgbase:-$_pkgver}.tar.xz - http://sourceware.org/pub/java/ecj-4.9.jar - - 001_all_default-ssp-strong.patch - 002_all_default-relro.patch - 005_all_default-as-needed.patch - 011_all_default-warn-format-security.patch - 012_all_default-warn-trampolines.patch - 020_all_msgfmt-libstdc++-link.patch - 050_all_libiberty-asprintf.patch - 051_all_libiberty-pic.patch - 053_all_libitm-no-fortify-source.patch - 067_all_gcc-poison-system-directories.patch - 090_all_pr55930-dependency-tracking.patch - - 201-cilkrts.patch - 203-libgcc_s.patch - 204-linux_libc_has_function.patch - 205-nopie.patch - 207-static-pie.patch - - libgcc-always-build-gcceh.a.patch - gcc-6.1-musl-libssp.patch - boehm-gc-musl.patch - gcc-pure64.patch - fix-gcj-stdgnu14-link.patch - fix-gcj-musl.patch - fix-gcj-iconv-musl.patch - - gcc-4.8-build-args.patch - fix-cxxflags-passing.patch - ada-fixes.patch - ada-shared.patch - ada-musl.patch - ada-aarch64-multiarch.patch - - 300-main-gcc-add-musl-s390x-dynamic-linker.patch - 310-build-gcj-s390x.patch - 320-libffi-gnulinux.patch - - fix-rs6000-pie.patch - fix-linux-header-use-in-libgcc.patch - gcc-pure64-mips.patch - ada-mips64.patch - - gcc-6.4-isl.patch - - 0001-i386-Move-struct-ix86_frame-to-machine_function.patch - 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch - 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch - 0004-x86-Add-mindirect-branch.patch - 0005-x86-Add-mfunction-return.patch - 0006-x86-Add-mindirect-branch-register.patch - 0007-x86-Add-V-register-operand-modifier.patch - 0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch - 0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch - 0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch - 0011-i386-Update-mfunction-return-for-return-with-pop.patch - 0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch - 0013-i386-Don-t-generate-alias-for-function-return-thunk.patch - - 0014-fix-missing-includes-isl-0.20.patch - 0015-fix-error_p-null-error.patch - " - -# we build out-of-tree -_gccdir="$srcdir"/gcc-${_pkgbase:-$_pkgver} -_gcclibdir=/usr/lib/gcc/${CTARGET}/$_pkgver -_gcclibexec=/usr/libexec/gcc/${CTARGET}/$_pkgver - -prepare() { - cd "$_gccdir" - - _err= - for i in $source; do - case "$i" in - *.patch) - msg "Applying $i" - patch -p1 -F3 -i "$srcdir"/$i || _err="$_err $i" - ;; - esac - done - - if [ -n "$_err" ]; then - error "The following patches failed:" - for i in $_err; do - echo " $i" - done - return 1 - fi - - # see http://gcc.gnu.org/ml/java/2008-04/msg00027.html - mv "$srcdir"/ecj-*.jar ecj.jar - - echo ${_pkgver} > gcc/BASE-VER -} - -build() { - local _arch_configure= - local _libc_configure= - local _bootstrap_configure= - local _symvers= - - cd "$_gccdir" - - case "$CTARGET" in - aarch64-*-*-*) _arch_configure="--with-arch=armv8-a --with-abi=lp64";; - armv5-*-*-*eabi) _arch_configure="--with-arch=armv5te --with-tune=arm926ej-s --with-float=soft --with-abi=aapcs-linux";; - armv6-*-*-*eabihf) _arch_configure="--with-arch=armv6zk --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=hard --with-abi=aapcs-linux";; - armv7-*-*-*eabihf) _arch_configure="--with-arch=armv7-a --with-tune=generic-armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-abi=aapcs-linux --with-mode=thumb";; - mips-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - mips64-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mips64el-*-*-*) _arch_configure="--with-arch=mips3 --with-tune=mips64 --with-mips-plt --with-float=soft --with-abi=64";; - mipsel-*-*-*) _arch_configure="--with-arch=mips32 --with-mips-plt --with-float=soft --with-abi=32";; - powerpc-*-*-*) _arch_configure="--enable-secureplt --enable-decimal-float=no";; - powerpc64*-*-*-*) _arch_configure="--with-abi=elfv2 --enable-secureplt --enable-decimal-float=no --enable-targets=powerpcle-linux";; - i486-*-*-*) _arch_configure="--with-arch=i486 --with-tune=generic --enable-cld";; - i586-*-*-*) _arch_configure="--with-arch=i586 --with-tune=generic --enable-cld";; - s390x-*-*-*) _arch_configure="--with-arch=z196 --with-tune=zEC12 --with-zarch --with-long-double-128 --enable-decimal-float";; - esac - - case "$CTARGET_ARCH" in - mips*) _hash_style_configure="--with-linker-hash-style=sysv" ;; - *) _hash_style_configure="--with-linker-hash-style=gnu" ;; - esac - - case "$CTARGET_LIBC" in - musl) - # musl does not support mudflap, or libsanitizer - # libmpx uses secure_getenv and struct _libc_fpstate not present in musl - # alpine musl provides libssp_nonshared.a, so we don't need libssp either - _libc_configure="--disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer" - _symvers="--disable-symvers" - export libat_cv_have_ifunc=no - ;; - esac - - - case "$BOOTSTRAP" in - nolibc) _bootstrap_configure="--with-newlib --disable-shared --enable-threads=no" ;; - *) _bootstrap_configure="--enable-shared --enable-threads --enable-tls" ;; - esac - - $LIBGOMP || _bootstrap_configure="$_bootstrap_configure --disable-libgomp" - $LIBATOMIC || _bootstrap_configure="$_bootstrap_configure --disable-libatomic" - $LIBITM || _bootstrap_configure="$_bootstrap_configure --disable-libitm" - $LIBQUADMATH || _arch_configure="$_arch_configure --disable-libquadmath" - - msg "Building the following:" - echo "" - echo " CBUILD=$CBUILD" - echo " CHOST=$CHOST" - echo " CTARGET=$CTARGET" - echo " CTARGET_ARCH=$CTARGET_ARCH" - echo " CTARGET_LIBC=$CTARGET_LIBC" - echo " languages=$_languages" - echo " arch_configure=$_arch_configure" - echo " libc_configure=$_libc_configure" - echo " cross_configure=$_cross_configure" - echo " bootstrap_configure=$_bootstrap_configure" - echo " hash_style_configure=$_hash_style_configure" - echo "" - - mkdir -p "$_builddir" - cd "$_builddir" - "$_gccdir"/configure --prefix=/usr/gcc6 \ - --mandir=/usr/share/man \ - --infodir=/usr/share/info \ - --build=${CBUILD} \ - --host=${CHOST} \ - --target=${CTARGET} \ - --with-pkgversion="postmarketOS ${_pkgver}" \ - --enable-checking=release \ - --disable-fixed-point \ - --disable-libstdcxx-pch \ - \ - --disable-bootstrap \ - --disable-libstdcxx \ - \ - --disable-multilib \ - --disable-nls \ - --disable-werror \ - $_symvers \ - --enable-__cxa_atexit \ - --enable-default-pie \ - --enable-cloog-backend \ - --enable-languages=$_languages \ - $_arch_configure \ - $_libc_configure \ - $_cross_configure \ - $_bootstrap_configure \ - --with-system-zlib \ - $_hash_style_configure - make -} - -package() { - cd "$_builddir" - make -j1 DESTDIR="${pkgdir}" install - - local prefix=/usr/gcc6 - if [ "$CHOST" = "$CTARGET" ]; then - # gcc symlinks - ln -s gcc "$pkgdir$prefix"/bin/cc - ln -s gcc "$pkgdir$prefix"/bin/gcc6 - fi - - # remove docs - rm -r "$pkgdir/usr/share/" - - # we don't support gcj -static - # and saving 35MB is not bad. - find "$pkgdir" -name libgcj.a -o -name libgtkpeer.a \ - -o -name libgjsmalsa.a -o -name libgcj-tools.a \ - -o -name libjvm.a -o -name libgij.a -o -name libgcj_bc.a \ - -o -name libjavamath.a \ - | xargs rm -f - - # strip debug info from some static libs - ${STRIP_FOR_TARGET} -g `find "$pkgdir" \( -name libgfortran.a -o -name libobjc.a -o -name libgomp.a \ - -o -name libmudflap.a -o -name libmudflapth.a \ - -o -name libgcc.a -o -name libgcov.a -o -name libquadmath.a \ - -o -name libitm.a -o -name libgo.a -o -name libcaf\*.a \ - -o -name libatomic.a -o -name libasan.a -o -name libtsan.a \) \ - -a -type f` - - if $LANG_JAVA; then - sed -i -e 's/lib: /&%{static:%eJava programs cannot be linked statically}/' \ - "$pkgdir"/usr/lib/libgcj.spec - fi - - if [ "$CHOST" != "$CTARGET" ]; then - # cross-gcc: remove any files that would conflict with the - # native gcc package - rm -rf "$pkgdir$prefix"/bin/cc \ - "$pkgdir$prefix"/include \ - "$pkgdir$prefix"/share - # libcc1 does not depend on target, don't ship it - rm -rf "$pkgdir$prefix"/lib/libcc1.so* - - # fixup gcc library symlinks to be linker scripts so - # linker finds the libs from relocated sysroot - for so in "$pkgdir$prefix"/$CTARGET/lib/*.so; do - if [ -h "$so" ]; then - local _real=$(basename $(readlink "$so")) - rm -f "$so" - echo "GROUP ($_real)" > "$so" - fi - done - - # Link binutils binaries to /usr/gcc6 - # This is the path GCC6 will look for them, if we don't create these - # symlinks, it will use the native binutils instead (which is of course - # failing and causes many headaches). See also: '-B' in 'man gcc'. - echo "Link binutils binaries to /usr/gcc6" - mkdir -p "$pkgdir$prefix/$CTARGET/bin" - for i in "as" "ld"; do - ln -sv "/usr/$CTARGET/bin/$i" \ - "$pkgdir$prefix/$CTARGET/bin/$i" - done - - # Link binutils to gcc6-* (so 'CROSS_COMPILE=gcc6-...' works) - echo "Link binutils to gcc6-*" - mkdir -p "$pkgdir/usr/bin" - for i in "elfedit" "gprof" "addr2line" "strings" "as" "ld" "size" "ld.bfd" \ - "readelf" "nm" "ar" "strip" "dwp" "objdump" "objcopy" "c++filt" "ranlib"; do - ln -sv "/usr/bin/$CTARGET-$i" \ - "$pkgdir/usr/bin/gcc6-$CTARGET-$i" - done - fi - - # Link all binaries from /usr/gcc6/bin/* to /usr/bin/gcc6-* - echo "Link all gcc binaries to /usr/bin/gcc6-*" - mkdir -p "$pkgdir"/usr/bin - cd "$pkgdir$prefix/bin/" - for i in *; do - ln -sv "$prefix/bin/$i" "$pkgdir/usr/bin/gcc6-$i" - done -} - -sha512sums=" -02c60e54527c7adf584798d5251f8a0b80c93d5deafce82501b2c28e6692e0bd783927bbfc4bc527a863c0cccc025150a34740a9e29badb02d4b48e56a8aba90 gcc-6.4.0.tar.xz -28f8c6fdbcb19e950b1d0bafb3bcc7a8cba87bc673aa6027cece116599cdee80f0cf5e95a1440544890239f5c754e8a93ab46d9daedd937faef445d7ea33b226 ecj-4.9.jar -a1335adc2fbee98e36c4437ff2587771b98ed4180726779020f65039498235626a411cdb0100dbd20cd19d12f0d94f9a21af179ff624676c28cead9d60598b5d 001_all_default-ssp-strong.patch -e36e95b81489163abd6fe9d58f7867bdca43e61143afacbfb17f4698c0b16ec5fd0061d8fab7b2ae615540bebd721c2e2227f80401b4e7fc253da9da62e6b513 002_all_default-relro.patch -51282fea54c7e616367bbeb2479ba13fec6f24eb47bd04e2071907b3b36273b2ff24676f46ef8d22f241c8ab4857307861eee076eab66797c3a50a8ecaa1809a 005_all_default-as-needed.patch -3398386dd1e079d6545dd9799adc799c6b80e3984fac6899d0e1a7ee21b66d0c7e53cddf17a65d590c883db750f9f79aaedd857355a8b9f7fb9476c906237919 011_all_default-warn-format-security.patch -9adb0d2b9b67dd957df6c609b8714c7c078efb52cd88770905c37c67827be8fc83d1125037b9c29d77db21ce78756aa2bb0bacdb0b98d869ac126da76a298e21 012_all_default-warn-trampolines.patch -d35a3ac7e13a4446921a90e1ff3eec1079840c845f9d523c868e24ae21f94cf69ba041de5341ebef96432a6f57598e223381d4286e8fb8baaa25906707f29fbd 020_all_msgfmt-libstdc++-link.patch -840070a3c423e6206aaa6e63e1d9a0fcd6efd53626cd1240a193f0b60aa5d84216acc4a2a4fa8bce74549b07e6a316b01d638f20cea13dc62473491a302fb3d6 050_all_libiberty-asprintf.patch -0a0bc72b9366158f5d23fff1928e756fdd212433bac6ab1f00d632f241382820db8db5d475ddf11ea020eaf7e2e71b12fb9b1c3c870cf84adf6c2b16f15aabca 051_all_libiberty-pic.patch -e7a2eb1b1870e199d6fd753d065781575656fa12baa264f96c5d179689d88c31b8a3f92a5dae96088c05e96aa2bda138364ad7dbcc79e1819a102f192cbb7bab 053_all_libitm-no-fortify-source.patch -e87da18aa7ab92b02b06168658c63b42a6c73a08fad2a30f81ef6296100fdbe3c3a91548fd0cb24eaf591e862bb08e4b67249bc4b977b07da33523aee0c686bc 067_all_gcc-poison-system-directories.patch -4a328d1e1a56c20166307edcfa322068915784d9c08025b7f81cf69714da48fc266b6d34f77b9135c2f10da830d9df408276a1b78d1fd218637c2823506593c2 090_all_pr55930-dependency-tracking.patch -ef052d0c3c9642fcb5ed570069c5a49c8ef523c47ac8ce3f201a801766f72ae4ff7c3725a70ee66e52c0fb559621e35fe0cf5b88b901d71ceadd381f49653a08 201-cilkrts.patch -808e206f5e107084156fba333d4e091dcbd62f5d7756142bc292d4b0a52619f8c2aaca3617defc2f5b6552ba0439aebd33f4141329d88eab6ddf2dd637d92c08 203-libgcc_s.patch -fc0de05b36613b732a0222ea005c90653c6a40d6761b6894af2419272f4e74875f37e26af33a9b9940669ef89269c44c46d17ca5bcd54b5cd1176e5eaf2992c1 204-linux_libc_has_function.patch -98473bcaa77903a223ca9b0d2087c0921b287a2816d308cc32c8fe009e6cbf5dd1ae7fba27794ab8d9c09e117fe534413d91a464d1218474fc123ce0adfdc2c1 205-nopie.patch -3287d5b443bea8ec64132bcabe869c738ae98ea8f1a86df1c5d18c927f8816edbfcefeefc47792dbbb2bcacf50319af00e01b3735d34525913b64350770ad453 207-static-pie.patch -d08d7ead2de0429e5c9055d5b029ec2be9a8c821d22cecaf9b51f633652c493333f98963d9267fa2fa63850c50ae5eefd5f59e5910ec10d20044dac082182a8b libgcc-always-build-gcceh.a.patch -dbe0ee917fc7668571722364ab7c806731e3a31e8bfa30b4941b28b16b877d2a32b4a3897ef533399a28f82d43cac9b28e92de0493f0e779046db56584e07fa4 gcc-6.1-musl-libssp.patch -bda845a6aa1854d2c883910b115f79ccfa93dfc2b5eac69a3a236d83eb34cadc140731d616ffc24698c7abc8878dd15f231bcc5119f1860e575a120b311706c7 boehm-gc-musl.patch -fa62556719449caec6b2b434355bfbcaa5ae55ffe017b3e1f827f66a2aae21b79c571ee7a4ce723ea69169bc3a6447e73650991a200cc372adf2f102677518d7 gcc-pure64.patch -2253941f3d19b6d08801d3782f5f5ed56c3b73fbc9d3561a8f01c702963ac4fab91599c686076e7081eb6a80c37ccd33591ae978996d6eee1dc0ce0f1c50259a fix-gcj-stdgnu14-link.patch -f89ddeb21bc8f97e6a850a6b70b4501a8f3e49a4bc8cc82897488decda5d98ad01cb7f6c8b392d452e9579924a523bc75da6e0648c1c976d42e40af48b10343b fix-gcj-musl.patch -54d67cc008b735e47771314171930c5d8b8f5f5dc97fcf4214824c105c808f3e75d22d5a4fdf5068ed0457fa0d46c60cfb442e276259a4a5e9b8722a027d18e6 fix-gcj-iconv-musl.patch -abe9aaf9aa956058d0386a4396a511d176a46bb3906b90e952383646cdc158cbeb0a5dc616a1ccb1ca7d49fd0b5e351532aa15a3b13362abbf1ca4266f54a687 gcc-4.8-build-args.patch -35d6d59f0b7b968f282f56767c9e0823a7bdc5aa0d450aca50fbd802649a7ca608b47671244a3faa208a9b0d6832cabb5a22724157dc817b2c0ad63d09f93282 fix-cxxflags-passing.patch -9016b257abd8fa981de44a49512e35db814d1cbb47c1a87cd31c12d4ae20b13e9e149fe41691a7ec3c95bbcfde8a79194a8d2eaf547ceade3a246fad67c47dd8 ada-fixes.patch -3f5bc334d9f73d06f5f7c876738d02356acdd08958bea0e4d2095ebf15c2c2ec4e411abdae0297505ae9a1699ca01b17338e853184e84663203b192b0d35fc19 ada-shared.patch -631d4bdef6d8bde34df7978bb53ec28c3c909cf1f87139e5f148138d0f09adc58b41ecf0148bbf50fb4bc916c411e9bf8a2b6c046c75c0e77d754d8c35bcd4d7 ada-musl.patch -fa44c8158111627aa0e91c43e7cc3aa38642c2041c96532dd4f0932dae4d6f92ea2850b683abcf10e7e120299d42ea6b69adc00002a514c76be8e39e99fa052b ada-aarch64-multiarch.patch -4b4a0ff306a8ef34ff6e3284fbfca869012164a47ba7cb099085c1dd03e6ca0cdd462f82710e08c9a02895adc7484e4c5eef17b5aa264cf5d978fe8ad78eea93 300-main-gcc-add-musl-s390x-dynamic-linker.patch -385bc2fa50204f678964e5148c6170f572701dab920fbec8301f505bda34d182cde0adb7da042fee71719e12fb59f59181897f9b1bb4f4716ff59aad46ca1998 310-build-gcj-s390x.patch -f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45b58ba8764ab1eb575d4eb6d6dfc550a87a183f8b94e76181 320-libffi-gnulinux.patch -01c71cd5881fc07ea3b9b980697e89b3ca0fe98502958ceafc3fca18b2604c844e2f457feab711baf8e03f00a5383b0e38aac7eb954034e306f43d4a37f165ed fix-rs6000-pie.patch -34a818d5be67eb1f34e44a80b83c28a9b9c17d37fc9fac639f490d6bb5b53ebe3318140d09c236a17d7c98f5a7792ae3d6cefccda8067a5e942d6305b9d1f87c fix-linux-header-use-in-libgcc.patch -86be3338cc9c33089608bc4c5e3b7918c4e500a345c338f361b18c342119a6ed69af5495d72950de7106d760f003528b46ad14795e805f8a3331e206dcb234e3 gcc-pure64-mips.patch -508f3bca214d88531d739d761d07affc953689b1540905c73420b34c246e1e6b72588cf89f0e1462752633f8ddc88da8c0238be2a1b6e1c213829cecee7924cf ada-mips64.patch -80084d4f5984ea1c62f813c3c1fe7ce033d41d6cd5e6df3b10c649c0bbc2544ad0a58e7076fa28bf71d691df0211b07fc11eb0d5c9f462ef28eed4c3fbeeb9ee gcc-6.4-isl.patch -7912964bf3a985e9f870250d6e068f715582a4fb04270849d697a50e6aad0cf50df3d483ff80a0eb777d9940fd85526dd8d0b85da9bc71a5f2fbc07616263866 0001-i386-Move-struct-ix86_frame-to-machine_function.patch -baa27a4b912d8e27cd65a556b09cf45289a0e00e86dae3925f2923d1f3752080e80d80e159c996ef4156c4df1dfc3069114810a846672170ef3ae461ae0ab7e1 0002-i386-Use-reference-of-struct-ix86_frame-to-avoid-cop.patch -6701d15000bdd7c4c98a8fece8c814f5e4e73603eecf84fe4dc5ac10f79b3074afba7c2cc9e51d08b2abade1c34cb0c944c08ead7a85db94e97158c752fd1aac 0003-i386-Use-const-reference-of-struct-ix86_frame-to-avo.patch -4e7e71ae57e232b29a6455ec977f60b47df1356eca0e85976ae2b4567c4c39541be9f10c30fe0085d69be5acdb61dff51d3e9d7af587c95d9cd2cb9ee307bd13 0004-x86-Add-mindirect-branch.patch -07f7fdbd9b4876f36ed7715a35a369dbaf1016f46c42a8935930cfcc9ea250de2dbe8113f077373ccce3c39cd728f957b6c4c7c6a7da299f160a4109f0bbe88d 0005-x86-Add-mfunction-return.patch -76ea947591e5241f8e6216ce337baaf1b5dfe3f02d8251f77a4acd70e2a5e7798e2867d70f452027f51a2e3baf1b5c94c3bffe9ef8e0a5ce24dc5d509adaf414 0006-x86-Add-mindirect-branch-register.patch -1c33c5cd34efb44d4fa0ace56e3d27ec802a66e03b08a29ab6122cbc70edbbe22313a34114437a41e09e0a6869af3cea3fb18f5bcb49db2f8e3f155026fe15f0 0007-x86-Add-V-register-operand-modifier.patch -5366e2cff0629304394bf35e9417c7faea6b6f3fc565d0410a17fdafcb2b30c9a218f8ca098274c09ca4c982ff5b178ad6df5bf464ec541aa086966915c7fe11 0008-x86-Disallow-mindirect-branch-mfunction-return-with-.patch -67c738b1f6afb09b6f0469c9cb282ab4d51fc8dd8e39df1cfdff8831788c1022081fccd446a482623f649898733aeaaa205cba0aa41162cdbdc74e57de9bb6eb 0009-Use-INVALID_REGNUM-in-indirect-thunk-processing.patch -b7b59f3203bf53168de2170b91738cd456f6ae205b3fe5bf8aacbaa8cc5624dd09c941ad8f1071d1ab8ab4fb5f69068a4bc792c0486fdec1ee2eb9c83688bb78 0010-i386-Pass-INVALID_REGNUM-as-invalid-register-number.patch -c53d4c5968865abb709ee8a9af9d57917d43ea3ba31ee8312f9e8f338e9b1b44babf5aa3414848da7267e5cf13a9261815eb9185dc153cbd41ee7ce5ea23d2d0 0011-i386-Update-mfunction-return-for-return-with-pop.patch -955080ba3e42cfe2f604e5dcef46aa6fca7c899c7808398947af655ff3b7954e30807ef85246986a5cc7db36dbc870db151e9fa8d8bc967b89ea56efdf64614c 0012-i386-Add-TARGET_INDIRECT_BRANCH_REGISTER.patch -3aae3a9cef8e8afe5a5433db8d9f410e1a2882481af01bb1d33232f987dbb74d7780c32be70b868bb391b3601b65ed3a16d777afea946f5eeaff72aa1e7fa3a9 0013-i386-Don-t-generate-alias-for-function-return-thunk.patch -e926a9c43eb774f788bbba168f4363fe37ccf2d57531540a6bccb3e16a487aa42e85dfdfc4fb0a3370eb890d100cd1e93279efb2fc9af73b09e3225511afa132 0014-fix-missing-includes-isl-0.20.patch -a3ab3b63583587cf9e3e9c3f30089c440bc58c3d87199d50e7c3dda2bf308685eae162ed122d481e472814498008e41c192581ca393629adf4487ea0e3f91254 0015-fix-error_p-null-error.patch -" diff --git a/cross/gcc6-armhf/ada-aarch64-multiarch.patch b/cross/gcc6-armhf/ada-aarch64-multiarch.patch deleted file mode 100644 index ac60b6f6a..000000000 --- a/cross/gcc6-armhf/ada-aarch64-multiarch.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- gcc-6.4.0/gcc/ada/gcc-interface/Makefile.in.orig -+++ gcc-6.4.0/gcc/ada/gcc-interface/Makefile.in -@@ -2042,13 +2042,8 @@ - system.ads - #else - #include -+#include - #endif - - #ifdef __MINGW32__ ---- gcc-6.1.0.orig/gcc/ada/terminals.c -+++ gcc-6.1.0/gcc/ada/terminals.c -@@ -1068,13 +1068,6 @@ - #include - #include - --/* On some system termio is either absent or including it will disable termios -- (HP-UX) */ --#if !defined (__hpux__) && !defined (BSD) && !defined (__APPLE__) \ -- && !defined (__rtems__) --# include --#endif -- - #include - #include - #include -@@ -1169,7 +1162,7 @@ - char *slave_name = NULL; - - #ifdef USE_GETPT -- master_fd = getpt (); -+ master_fd = posix_openpt (O_RDWR); - #elif defined (USE_OPENPTY) - status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL); - #elif defined (USE_CLONE_DEVICE) diff --git a/cross/gcc6-armhf/ada-mips64.patch b/cross/gcc6-armhf/ada-mips64.patch deleted file mode 100644 index b7cd3debc..000000000 --- a/cross/gcc6-armhf/ada-mips64.patch +++ /dev/null @@ -1,224 +0,0 @@ -From 5bbd6ca3755e2a199de98d2b270d8a6f616aa6a6 Mon Sep 17 00:00:00 2001 -From: Nils Andreas Svee -Date: Thu, 21 Dec 2017 16:46:12 +0100 -Subject: [PATCH] ada-mips64 - ---- - gcc/ada/gcc-interface/Makefile.in | 29 ++++++-- - gcc/ada/system-linux-mips64.ads | 147 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 171 insertions(+), 5 deletions(-) - create mode 100644 gcc/ada/system-linux-mips64.ads - -diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in -index 598b262d9..1844a6962 100644 ---- a/gcc/ada/gcc-interface/Makefile.in -+++ b/gcc/ada/gcc-interface/Makefile.in -@@ -1854,9 +1854,9 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),) - LIBRARY_VERSION := $(LIB_VERSION) - endif - --# Mips Linux --ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),) -- LIBGNAT_TARGET_PAIRS = \ -+# Mips and Mips64 Linux -+ifeq ($(strip $(filter-out mips mips64 linux%,$(target_cpu) $(target_os))),) -+ LIBGNAT_TARGET_PAIRS_COMMON = \ - a-intnam.ads. -- -+-- -- -+-- GNAT was originally developed by the GNAT team at New York University. -- -+-- Extensive contributions were provided by Ada Core Technologies Inc. -- -+-- -- -+------------------------------------------------------------------------------ -+ -+package System is -+ pragma Pure; -+ -- Note that we take advantage of the implementation permission to make -+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -+ -- 2005, this is Pure in any case (AI-362). -+ -+ pragma No_Elaboration_Code_All; -+ -- Allow the use of that restriction in units that WITH this unit -+ -+ type Name is (SYSTEM_NAME_GNAT); -+ System_Name : constant Name := SYSTEM_NAME_GNAT; -+ -+ -- System-Dependent Named Numbers -+ -+ Min_Int : constant := Long_Long_Integer'First; -+ Max_Int : constant := Long_Long_Integer'Last; -+ -+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size; -+ Max_Nonbinary_Modulus : constant := Integer'Last; -+ -+ Max_Base_Digits : constant := Long_Long_Float'Digits; -+ Max_Digits : constant := Long_Long_Float'Digits; -+ -+ Max_Mantissa : constant := 63; -+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa); -+ -+ Tick : constant := 0.000_001; -+ -+ -- Storage-related Declarations -+ -+ type Address is private; -+ pragma Preelaborable_Initialization (Address); -+ Null_Address : constant Address; -+ -+ Storage_Unit : constant := 8; -+ Word_Size : constant := 64; -+ Memory_Size : constant := 2 ** 64; -+ -+ -- Address comparison -+ -+ function "<" (Left, Right : Address) return Boolean; -+ function "<=" (Left, Right : Address) return Boolean; -+ function ">" (Left, Right : Address) return Boolean; -+ function ">=" (Left, Right : Address) return Boolean; -+ function "=" (Left, Right : Address) return Boolean; -+ -+ pragma Import (Intrinsic, "<"); -+ pragma Import (Intrinsic, "<="); -+ pragma Import (Intrinsic, ">"); -+ pragma Import (Intrinsic, ">="); -+ pragma Import (Intrinsic, "="); -+ -+ -- Other System-Dependent Declarations -+ -+ type Bit_Order is (High_Order_First, Low_Order_First); -+ Default_Bit_Order : constant Bit_Order := High_Order_First; -+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning -+ -+ -- Priority-related Declarations (RM D.1) -+ -+ Max_Priority : constant Positive := 30; -+ Max_Interrupt_Priority : constant Positive := 31; -+ -+ subtype Any_Priority is Integer range 0 .. 31; -+ subtype Priority is Any_Priority range 0 .. 30; -+ subtype Interrupt_Priority is Any_Priority range 31 .. 31; -+ -+ Default_Priority : constant Priority := 15; -+ -+private -+ -+ type Address is mod Memory_Size; -+ Null_Address : constant Address := 0; -+ -+ -------------------------------------- -+ -- System Implementation Parameters -- -+ -------------------------------------- -+ -+ -- These parameters provide information about the target that is used -+ -- by the compiler. They are in the private part of System, where they -+ -- can be accessed using the special circuitry in the Targparm unit -+ -- whose source should be consulted for more detailed descriptions -+ -- of the individual switch values. -+ -+ Backend_Divide_Checks : constant Boolean := False; -+ Backend_Overflow_Checks : constant Boolean := True; -+ Command_Line_Args : constant Boolean := True; -+ Configurable_Run_Time : constant Boolean := False; -+ Denorm : constant Boolean := True; -+ Duration_32_Bits : constant Boolean := False; -+ Exit_Status_Supported : constant Boolean := True; -+ Fractional_Fixed_Ops : constant Boolean := False; -+ Frontend_Layout : constant Boolean := False; -+ Machine_Overflows : constant Boolean := False; -+ Machine_Rounds : constant Boolean := True; -+ Preallocated_Stacks : constant Boolean := False; -+ Signed_Zeros : constant Boolean := True; -+ Stack_Check_Default : constant Boolean := False; -+ Stack_Check_Probes : constant Boolean := True; -+ Stack_Check_Limits : constant Boolean := False; -+ Support_Aggregates : constant Boolean := True; -+ Support_Composite_Assign : constant Boolean := True; -+ Support_Composite_Compare : constant Boolean := True; -+ Support_Long_Shifts : constant Boolean := True; -+ Always_Compatible_Rep : constant Boolean := False; -+ Suppress_Standard_Library : constant Boolean := False; -+ Use_Ada_Main_Program_Name : constant Boolean := False; -+ Frontend_Exceptions : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := True; -+ -+end System; --- -2.15.1 - diff --git a/cross/gcc6-armhf/ada-musl.patch b/cross/gcc6-armhf/ada-musl.patch deleted file mode 100644 index 464c3d57d..000000000 --- a/cross/gcc6-armhf/ada-musl.patch +++ /dev/null @@ -1,137 +0,0 @@ -diff -rup gcc-5.1.0/gcc.orig/ada/adaint.c gcc-5.1.0/gcc/ada/adaint.c ---- gcc-5.1.0/gcc.orig/ada/adaint.c 2015-02-20 11:48:57.000000000 +0000 -+++ gcc-5.1.0/gcc/ada/adaint.c 2015-06-02 10:47:51.672767476 +0000 -@@ -70,6 +70,11 @@ - #include - #include - #endif -+ -+#if defined (linux) -+#define _GNU_SOURCE 1 -+#include -+#endif - - #ifdef __PikeOS__ - #define __BSD_VISIBLE 1 -@@ -3057,8 +3062,6 @@ __gnat_lwp_self (void) - return (void *) syscall (__NR_gettid); - } - --#include -- - /* glibc versions earlier than 2.7 do not define the routines to handle - dynamically allocated CPU sets. For these targets, we use the static - versions. */ -@@ -3067,7 +3070,7 @@ __gnat_lwp_self (void) - - /* Dynamic cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count) - { - return CPU_ALLOC (count); -@@ -3080,33 +3083,33 @@ __gnat_cpu_alloc_size (size_t count) - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { -- CPU_FREE (set); -+ CPU_FREE ((cpu_set_t *) set); - } - - void --__gnat_cpu_zero (size_t count, cpu_set_t *set) -+__gnat_cpu_zero (size_t count, void *set) - { -- CPU_ZERO_S (count, set); -+ CPU_ZERO_S (count, (cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET_S (cpu - 1, count, set); -+ CPU_SET_S (cpu - 1, count, (cpu_set_t *) set); - } - - #else /* !CPU_ALLOC */ - - /* Static cpu sets */ - --cpu_set_t * -+void * - __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED) - { -- return (cpu_set_t *) xmalloc (sizeof (cpu_set_t)); -+ return xmalloc (sizeof (cpu_set_t)); - } - - size_t -@@ -3116,23 +3119,23 @@ __gnat_cpu_alloc_size (size_t count ATTR - } - - void --__gnat_cpu_free (cpu_set_t *set) -+__gnat_cpu_free (void *set) - { - free (set); - } - - void --__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set) - { -- CPU_ZERO (set); -+ CPU_ZERO ((cpu_set_t *) set); - } - - void --__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set) -+__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set) - { - /* Ada handles CPU numbers starting from 1, while C identifies the first - CPU by a 0, so we need to adjust. */ -- CPU_SET (cpu - 1, set); -+ CPU_SET (cpu - 1, (cpu_set_t *) set); - } - #endif /* !CPU_ALLOC */ - #endif /* linux */ -diff -rup gcc-5.1.0/gcc.orig/ada/adaint.h gcc-5.1.0/gcc/ada/adaint.h ---- gcc-5.1.0/gcc.orig/ada/adaint.h 2015-01-27 17:20:27.000000000 +0000 -+++ gcc-5.1.0/gcc/ada/adaint.h 2015-06-02 10:47:23.188910894 +0000 -@@ -287,13 +287,11 @@ extern void *__gnat_lwp_self (voi - - /* Routines for interface to required CPU set primitives */ - --#include -- --extern cpu_set_t *__gnat_cpu_alloc (size_t); -+extern void * __gnat_cpu_alloc (size_t); - extern size_t __gnat_cpu_alloc_size (size_t); --extern void __gnat_cpu_free (cpu_set_t *); --extern void __gnat_cpu_zero (size_t, cpu_set_t *); --extern void __gnat_cpu_set (int, size_t, cpu_set_t *); -+extern void __gnat_cpu_free (void *); -+extern void __gnat_cpu_zero (size_t, void *); -+extern void __gnat_cpu_set (int, size_t, void *); - #endif - - #if defined (_WIN32) -diff -rup gcc-5.1.0/gcc.orig/ada/gcc-interface/Makefile.in gcc-5.1.0/gcc/ada/gcc-interface/Makefile.in ---- gcc-5.1.0/gcc.orig/ada/gcc-interface/Makefile.in 2015-04-09 20:29:28.000000000 +0000 -+++ gcc-5.1.0/gcc/ada/gcc-interface/Makefile.in 2015-06-02 10:47:23.188910894 +0000 -@@ -1910,7 +1910,7 @@ ifeq ($(strip $(filter-out powerpc% linu - endif - - # ARM linux, GNU eabi --ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),) -+ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),) - LIBGNAT_TARGET_PAIRS = \ - a-intnam.ads - # undef __KERNEL__ --# else -+# elif defined(__GLIBC__) - /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */ - /* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */ - /* prototypes, so we have to include the top-level sigcontext.h to */ ---- gcc-4.8.2/boehm-gc/dyn_load.c.orig 2014-02-17 14:13:09.519850231 +0200 -+++ gcc-4.8.2/boehm-gc/dyn_load.c 2014-02-17 14:14:27.906093514 +0200 -@@ -459,9 +459,7 @@ - /* For glibc 2.2.4+. Unfortunately, it doesn't work for older */ - /* versions. Thanks to Jakub Jelinek for most of the code. */ - --# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \ -- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ -- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) -+# if (defined(LINUX) || defined (__GLIBC__)) - - /* We have the header files for a glibc that includes dl_iterate_phdr. */ - /* It may still not be available in the library on the target system. */ ---- gcc-4.8.2/boehm-gc/include/private/gcconfig.h.orig 2014-02-17 14:14:36.026049422 +0200 -+++ gcc-4.8.2/boehm-gc/include/private/gcconfig.h 2014-02-17 14:17:11.345207887 +0200 -@@ -684,7 +684,7 @@ - # ifdef __ELF__ - # define DYNAMIC_LOADING - # include --# if defined(__GLIBC__)&& __GLIBC__>=2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else /* !GLIBC2 */ - extern char **__environ; -@@ -1147,7 +1147,7 @@ - # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff)) - # endif - # include --# if defined(__GLIBC__) && __GLIBC__ >= 2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else - extern char **__environ; -@@ -1367,7 +1367,7 @@ - # define HBLKSIZE 4096 - # endif - # define USE_GENERIC_PUSH_REGS --# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2 -+# if 1 - # define LINUX_STACKBOTTOM - # else - # define STACKBOTTOM 0x80000000 -@@ -1858,7 +1858,7 @@ - # ifdef __ELF__ - # define DYNAMIC_LOADING - # include --# if defined(__GLIBC__) && __GLIBC__ >= 2 -+# if 1 - # define SEARCH_FOR_DATA_START - # else - extern char **__environ; diff --git a/cross/gcc6-armhf/fix-cxxflags-passing.patch b/cross/gcc6-armhf/fix-cxxflags-passing.patch deleted file mode 100644 index 8eb1de77d..000000000 --- a/cross/gcc6-armhf/fix-cxxflags-passing.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- gcc-4.8.1/Makefile.in.orig -+++ gcc-4.8.1/Makefile.in -@@ -169,6 +169,7 @@ - # built for the build system to override those in BASE_FLAGS_TO_PASSS. - 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. diff --git a/cross/gcc6-armhf/fix-gcj-iconv-musl.patch b/cross/gcc6-armhf/fix-gcj-iconv-musl.patch deleted file mode 100644 index b0015751e..000000000 --- a/cross/gcc6-armhf/fix-gcj-iconv-musl.patch +++ /dev/null @@ -1,120 +0,0 @@ ---- gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc.orig 2014-02-18 18:46:14.897880526 +0200 -+++ gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc 2014-02-18 18:50:08.766613550 +0200 -@@ -24,6 +24,13 @@ - - #ifdef HAVE_ICONV - #include -+#include -+ -+#if __BYTE_ORDER == __BIG_ENDIAN -+#define UCS2_CHARSET "UCS-2BE" -+#else -+#define UCS2_CHARSET "UCS-2LE" -+#endif - - template - static inline size_t -@@ -45,7 +52,7 @@ - _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer); - buffer[len] = '\0'; - -- iconv_t h = iconv_open ("UCS-2", buffer); -+ iconv_t h = iconv_open (UCS2_CHARSET, buffer); - if (h == (iconv_t) -1) - throw new ::java::io::UnsupportedEncodingException (encoding); - -@@ -99,18 +106,6 @@ - throw new ::java::io::CharConversionException (); - } - -- if (iconv_byte_swap) -- { -- size_t max = (old_out - outavail) / sizeof (jchar); -- for (size_t i = 0; i < max; ++i) -- { -- // Byte swap. -- jchar c = (((out[outpos + i] & 0xff) << 8) -- | ((out[outpos + i] >> 8) & 0xff)); -- outbuf[i] = c; -- } -- } -- - inpos += old_in - inavail; - return (old_out - outavail) / sizeof (jchar); - #else /* HAVE_ICONV */ -@@ -145,7 +140,7 @@ - _Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer); - buffer[len] = '\0'; - -- iconv_t h = iconv_open (buffer, "UCS-2"); -+ iconv_t h = iconv_open (buffer, UCS2_CHARSET); - if (h == (iconv_t) -1) - throw new ::java::io::UnsupportedEncodingException (encoding); - -@@ -187,20 +182,6 @@ - char *inbuf = (char *) &chars[inpos]; - char *outbuf = (char *) &out[count]; - -- if (iconv_byte_swap) -- { -- // Ugly performance penalty -- don't use losing systems! -- temp_buffer = (jchar *) _Jv_Malloc (inlength * sizeof (jchar)); -- for (int i = 0; i < inlength; ++i) -- { -- // Byte swap. -- jchar c = (((chars[inpos + i] & 0xff) << 8) -- | ((chars[inpos + i] >> 8) & 0xff)); -- temp_buffer[i] = c; -- } -- inbuf = (char *) temp_buffer; -- } -- - size_t loop_old_in = old_in; - while (1) - { -@@ -252,44 +233,7 @@ - jboolean - gnu::gcj::convert::IOConverter::iconv_init (void) - { -- // Some versions of iconv() always return their UCS-2 results in -- // big-endian order, and they also require UCS-2 inputs to be in -- // big-endian order. For instance, glibc 2.1.3 does this. If the -- // UTF-8=>UCS-2 iconv converter has this feature, then we assume -- // that all UCS-2 converters do. (This might not be the best -- // heuristic, but is is all we've got.) -- jboolean result = false; --#ifdef HAVE_ICONV -- iconv_t handle = iconv_open ("UCS-2", "UTF-8"); -- if (handle != (iconv_t) -1) -- { -- jchar c; -- unsigned char in[4]; -- char *inp, *outp; -- size_t inc, outc, r; -- -- // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv -- // needs the trailing NUL byte, otherwise iconv fails with EINVAL. -- in[0] = 0xef; -- in[1] = 0xbb; -- in[2] = 0xbf; -- in[3] = 0x00; -- -- inp = (char *) in; -- inc = 4; -- outp = (char *) &c; -- outc = 2; -- -- r = iconv_adapter (iconv, handle, &inp, &inc, &outp, &outc); -- // Conversion must be complete for us to use the result. -- if (r != (size_t) -1 && inc == 0 && outc == 0) -- result = (c != 0xfeff); -- -- // Release iconv handle. -- iconv_close (handle); -- } --#endif /* HAVE_ICONV */ -- return result; -+ return false; - } - - void diff --git a/cross/gcc6-armhf/fix-gcj-musl.patch b/cross/gcc6-armhf/fix-gcj-musl.patch deleted file mode 100644 index d26f510c0..000000000 --- a/cross/gcc6-armhf/fix-gcj-musl.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc.orig 2014-02-18 10:55:08.617678779 +0200 -+++ gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc 2014-02-18 10:56:31.927227453 +0200 -@@ -289,7 +289,7 @@ - // just default to `en_US'. - setlocale (LC_ALL, ""); - char *locale = setlocale (LC_MESSAGES, ""); -- if (locale && strlen (locale) >= 2) -+ if (locale && strlen (locale) >= 2 && (locale[2] == '\0' || locale[2] == '_')) - { - char buf[3]; - buf[2] = '\0'; ---- gcc-4.8.2/libjava/posix-threads.cc.orig 2014-02-18 13:22:01.789933726 +0200 -+++ gcc-4.8.2/libjava/posix-threads.cc 2014-02-18 13:29:50.924058875 +0200 -@@ -657,6 +657,7 @@ - struct sched_param param; - pthread_attr_t attr; - struct starter *info; -+ size_t ss; - - if (data->flags & FLAG_START) - return; -@@ -675,8 +676,25 @@ - // Set stack size if -Xss option was given. - if (gcj::stack_size > 0) - { -- int e = pthread_attr_setstacksize (&attr, gcj::stack_size); -+ ss = gcj::stack_size; -+ } -+ else -+ { -+ int e = pthread_attr_getstacksize (&attr, &ss); -+ if (e != 0) -+ JvFail (strerror (e)); -+ -+ // Request at least 1meg of stack -+ if (ss >= 1024 * 1024) -+ ss = 0; -+ else -+ ss = 1024 * 1024; -+ } -+ -+ if (ss) -+ { -+ int e = pthread_attr_setstacksize (&attr, ss); - if (e != 0) - JvFail (strerror (e)); - } - - info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter)); diff --git a/cross/gcc6-armhf/fix-gcj-stdgnu14-link.patch b/cross/gcc6-armhf/fix-gcj-stdgnu14-link.patch deleted file mode 100644 index 2b2ce0fa5..000000000 --- a/cross/gcc6-armhf/fix-gcj-stdgnu14-link.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- gcc-6.1.0/libjava/Makefile.am -+++ gcc-6.1.0/libjava/Makefile.am -@@ -488,10 +488,14 @@ - nat_files = $(nat_source_files:.cc=.lo) - xlib_nat_files = $(xlib_nat_source_files:.cc=.lo) - -+libgcj_la_CPPFLAGS = \ -+ $(AM_CPPFLAGS) \ -+ $(LIBSTDCXX_RAW_CXX_CXXFLAGS) -+ - # Include THREADLIBS here to ensure that the correct version of - # certain linuxthread functions get linked: - ## The mysterious backslash in the grep pattern is consumed by make. --libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \ -+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \ - $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \ - -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL) ---- gcc-6.1.0/libjava/Makefile.in -+++ gcc-6.1.0/libjava/Makefile.in -@@ -1103,9 +1103,13 @@ - nat_files = $(nat_source_files:.cc=.lo) - xlib_nat_files = $(xlib_nat_source_files:.cc=.lo) - -+libgcj_la_CPPFLAGS = \ -+ $(AM_CPPFLAGS) \ -+ $(LIBSTDCXX_RAW_CXX_CXXFLAGS) -+ - # Include THREADLIBS here to ensure that the correct version of - # certain linuxthread functions get linked: --libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \ -+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \ - $(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \ - -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL) diff --git a/cross/gcc6-armhf/fix-linux-header-use-in-libgcc.patch b/cross/gcc6-armhf/fix-linux-header-use-in-libgcc.patch deleted file mode 100644 index 6dad1b2ca..000000000 --- a/cross/gcc6-armhf/fix-linux-header-use-in-libgcc.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9cd4503714c4e596818c4ea8e15905c249b7a319 Mon Sep 17 00:00:00 2001 -From: nsz -Date: Thu, 25 Aug 2016 14:08:27 +0000 -Subject: [PATCH] [mips] Fix linux header use in libgcc - -libgcc/ - * config/mips/linux-unwind.h: Use sys/syscall.h. - - - -git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239759 138bc75d-0d04-0410-961f-82ee72b054a4 ---- - libgcc/ChangeLog | 4 ++++ - libgcc/config/mips/linux-unwind.h | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog -index b78c4b2..99bd2f1 100644 ---- a/libgcc/ChangeLog -+++ b/libgcc/ChangeLog -@@ -1,3 +1,7 @@ -+2016-08-25 Szabolcs Nagy -+ -+ * config/mips/linux-unwind.h: Use sys/syscall.h. -+ - 2016-08-16 Joseph Myers - - PR libgcc/77265 -diff --git a/libgcc/config/mips/linux-unwind.h b/libgcc/config/mips/linux-unwind.h -index bf12de5..4035c121 100644 ---- a/libgcc/config/mips/linux-unwind.h -+++ b/libgcc/config/mips/linux-unwind.h -@@ -27,7 +27,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - state data appropriately. See unwind-dw2.c for the structs. */ - - #include --#include -+#include - - /* The third parameter to the signal handler points to something with - * this structure defined in asm/ucontext.h, but the name clashes with --- -2.9.3 - diff --git a/cross/gcc6-armhf/fix-rs6000-pie.patch b/cross/gcc6-armhf/fix-rs6000-pie.patch deleted file mode 100644 index 1fbc31a56..000000000 --- a/cross/gcc6-armhf/fix-rs6000-pie.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- gcc-6.3.0.orig/gcc/config/rs6000/sysv4.h -+++ gcc-6.3.0/gcc/config/rs6000/sysv4.h -@@ -753,23 +753,42 @@ - #endif - - #ifdef HAVE_LD_PIE --#define STARTFILE_LINUX_SPEC "\ --%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ --%{mnewlib:ecrti.o%s;:crti.o%s} \ --%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ --" CRTOFFLOADBEGIN -+#define STARTFILE_LINUX_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;: \ -+ %{" PIE_SPEC ":%{static:rcrt1.o%s;:Scrt1.o%s}} %{" NO_PIE_SPEC ":crt1.o%s}}} \ -+ crti.o%s %{shared:crtbeginS.o%s;: \ -+ %{" PIE_SPEC ":crtbeginS.o%s} \ -+ %{" NO_PIE_SPEC ":%{static:crtbeginT.o%s;:crtbegin.o%s}}} \ -+ %{fvtable-verify=none:%s; \ -+ fvtable-verify=preinit:vtv_start_preinit.o%s; \ -+ fvtable-verify=std:vtv_start.o%s} \ -+ " CRTOFFLOADBEGIN - #else --#define STARTFILE_LINUX_SPEC "\ --%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ --%{mnewlib:ecrti.o%s;:crti.o%s} \ --%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ --" CRTOFFLOADBEGIN -+#define STARTFILE_LINUX_SPEC \ -+ "%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ -+ crti.o%s %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s} \ -+ %{fvtable-verify=none:%s; \ -+ fvtable-verify=preinit:vtv_start_preinit.o%s; \ -+ fvtable-verify=std:vtv_start.o%s} \ -+ " CRTOFFLOADBEGIN - #endif - --#define ENDFILE_LINUX_SPEC "\ --%{shared|pie:crtendS.o%s;:crtend.o%s} \ --%{mnewlib:ecrtn.o%s;:crtn.o%s} \ --" CRTOFFLOADEND -+#ifdef HAVE_LD_PIE -+#define ENDFILE_LINUX_SPEC \ -+ "%{fvtable-verify=none:%s; \ -+ fvtable-verify=preinit:vtv_end_preinit.o%s; \ -+ fvtable-verify=std:vtv_end.o%s} \ -+ %{shared:crtendS.o%s;: %{" PIE_SPEC ":crtendS.o%s} \ -+ %{" NO_PIE_SPEC ":crtend.o%s}} crtn.o%s \ -+ " CRTOFFLOADEND -+#else -+#define ENDFILE_LINUX_SPEC \ -+ "%{fvtable-verify=none:%s; \ -+ fvtable-verify=preinit:vtv_end_preinit.o%s; \ -+ fvtable-verify=std:vtv_end.o%s} \ -+ %{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s \ -+ " CRTOFFLOADEND -+#endif - - #define LINK_START_LINUX_SPEC "" - diff --git a/cross/gcc6-armhf/gcc-4.8-build-args.patch b/cross/gcc6-armhf/gcc-4.8-build-args.patch deleted file mode 100644 index c27e00961..000000000 --- a/cross/gcc6-armhf/gcc-4.8-build-args.patch +++ /dev/null @@ -1,41 +0,0 @@ -When cross compiling a target gcc, target flags may be used on the host - -Configure identifies a number of warning flags (WARN_CFLAGS and -WARN_CXXFLAGS) from the $CC value. The cross compiler may be different -from the host compiler and may not support the same set of flags. This -leads to problems such as: - -cc1plus: error: unrecognized command line option "-Wno-narrowing" -cc1plus: error: unrecognized command line option "-Wno-overlength-strings" - -Work around this problem by removing the warning flags from the -BUILD_CXXFLAGS value, in a way similar to the BUILD_CFLAGS. - -Upstream-Status: Pending - -Signed-off-by: Mark Hatle - -Index: gcc-4.8.0/gcc/configure -=================================================================== ---- gcc-4.8.0.orig/gcc/configure -+++ gcc-4.8.0/gcc/configure -@@ -11720,6 +10581,7 @@ STMP_FIXINC=stmp-fixinc - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - -Index: gcc-4.8.0/gcc/configure.ac -=================================================================== ---- gcc-4.8.0.orig/gcc/configure.ac -+++ gcc-4.8.0/gcc/configure.ac -@@ -1901,6 +1901,7 @@ STMP_FIXINC=stmp-fixinc AC_SUBST(STMP_F - if test x$build != x$host || test "x$coverage_flags" != x - then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' -+ BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' - fi - diff --git a/cross/gcc6-armhf/gcc-6.1-musl-libssp.patch b/cross/gcc6-armhf/gcc-6.1-musl-libssp.patch deleted file mode 100644 index fe5c61434..000000000 --- a/cross/gcc6-armhf/gcc-6.1-musl-libssp.patch +++ /dev/null @@ -1,20 +0,0 @@ -Author: Timo Teräs - -Alpine musl package provides libssp_nonshared.a. We link to it unconditionally, -as otherwise we get link failures if some objects are -fstack-protector built -and final link happens with -fno-stack-protector. This seems to be the common -case when bootstrapping gcc, the piepatches do not seem to fully fix the -crosstoolchain and bootstrap sequence wrt. stack-protector flag usage. - ---- gcc-6.1.0/gcc/gcc.c.orig -+++ gcc-6.1.0/gcc/gcc.c -@@ -870,8 +870,7 @@ - - #ifndef LINK_SSP_SPEC - #ifdef TARGET_LIBC_PROVIDES_SSP --#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ -- "|fstack-protector-strong|fstack-protector-explicit:}" -+#define LINK_SSP_SPEC "-lssp_nonshared" - #else - #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ - "|fstack-protector-strong|fstack-protector-explicit" \ diff --git a/cross/gcc6-armhf/gcc-6.4-isl.patch b/cross/gcc6-armhf/gcc-6.4-isl.patch deleted file mode 100644 index 58a4aa054..000000000 --- a/cross/gcc6-armhf/gcc-6.4-isl.patch +++ /dev/null @@ -1,251 +0,0 @@ -From cc46a51d4ff8bc1c42b7e6ae472494733bed5c49 Mon Sep 17 00:00:00 2001 -From: Richard Biener -Date: Thu, 16 Feb 2017 07:53:53 +0000 -Subject: [PATCH] graphite.h: Do not include isl/isl_val_gmp.h, instead include - isl/isl_val.h. - -2017-02-16 Richard Biener - - * graphite.h: Do not include isl/isl_val_gmp.h, instead include - isl/isl_val.h. - * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. - (gcc_expression_from_isl_expr_int): Use generic isl_val interface. - * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. - (isl_val_int_from_wi): New function. - (extract_affine_gmp): Rename to ... - (extract_affine_wi): ... this, take a widest_int. - (extract_affine_int): Just wrap extract_affine_wi. - (add_param_constraints): Use isl_val_int_from_wi. - (add_loop_constraints): Likewise, and extract_affine_wi. - -From-SVN: r245501 ---- - gcc/ChangeLog | 14 ++++++++ - gcc/graphite-isl-ast-to-gimple.c | 30 +++++------------ - gcc/graphite-sese-to-poly.c | 58 ++++++++++++++------------------ - gcc/graphite.h | 2 +- - 4 files changed, 50 insertions(+), 54 deletions(-) - -diff --git a/gcc/ChangeLog b/gcc/ChangeLog -index 24d9c1589f456..5fc6142eaa03f 100644 ---- a/gcc/ChangeLog -+++ b/gcc/ChangeLog -@@ -1,3 +1,17 @@ -+2017-02-16 Richard Biener -+ -+ * graphite.h: Do not include isl/isl_val_gmp.h, instead include -+ isl/isl_val.h. -+ * graphite-isl-ast-to-gimple.c (gmp_cst_to_tree): Remove. -+ (gcc_expression_from_isl_expr_int): Use generic isl_val interface. -+ * graphite-sese-to-poly.c: Do not include isl/isl_val_gmp.h. -+ (isl_val_int_from_wi): New function. -+ (extract_affine_gmp): Rename to ... -+ (extract_affine_wi): ... this, take a widest_int. -+ (extract_affine_int): Just wrap extract_affine_wi. -+ (add_param_constraints): Use isl_val_int_from_wi. -+ (add_loop_constraints): Likewise, and extract_affine_wi. -+ - 2017-02-15 Jeff Law - - PR middle-end/79521 -diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c -index dbdae7a7c155d..ec5fb73d9b2bc 100644 ---- a/gcc/graphite-isl-ast-to-gimple.c -+++ b/gcc/graphite-isl-ast-to-gimple.c -@@ -73,22 +73,6 @@ struct ast_build_info - bool is_parallelizable; - }; - --/* Converts a GMP constant VAL to a tree and returns it. */ -- --static tree --gmp_cst_to_tree (tree type, mpz_t val) --{ -- tree t = type ? type : integer_type_node; -- mpz_t tmp; -- -- mpz_init (tmp); -- mpz_set (tmp, val); -- wide_int wi = wi::from_mpz (t, tmp, true); -- mpz_clear (tmp); -- -- return wide_int_to_tree (t, wi); --} -- - /* Verifies properties that GRAPHITE should maintain during translation. */ - - static inline void -@@ -325,16 +309,20 @@ gcc_expression_from_isl_expr_int (tree type, __isl_take isl_ast_expr *expr) - { - gcc_assert (isl_ast_expr_get_type (expr) == isl_ast_expr_int); - isl_val *val = isl_ast_expr_get_val (expr); -- mpz_t val_mpz_t; -- mpz_init (val_mpz_t); -+ size_t n = isl_val_n_abs_num_chunks (val, sizeof (HOST_WIDE_INT)); -+ HOST_WIDE_INT *chunks = XALLOCAVEC (HOST_WIDE_INT, n); - tree res; -- if (isl_val_get_num_gmp (val, val_mpz_t) == -1) -+ if (isl_val_get_abs_num_chunks (val, sizeof (HOST_WIDE_INT), chunks) == -1) - res = NULL_TREE; - else -- res = gmp_cst_to_tree (type, val_mpz_t); -+ { -+ widest_int wi = widest_int::from_array (chunks, n, true); -+ if (isl_val_is_neg (val)) -+ wi = -wi; -+ res = wide_int_to_tree (type, wi); -+ } - isl_val_free (val); - isl_ast_expr_free (expr); -- mpz_clear (val_mpz_t); - return res; - } - -diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c -index ede96e5a3c299..8ff9a22e12916 100644 ---- a/gcc/graphite-sese-to-poly.c -+++ b/gcc/graphite-sese-to-poly.c -@@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see - #include - #include - #include --#include - - #include "graphite.h" - -@@ -154,16 +153,32 @@ extract_affine_name (scop_p s, tree e, __isl_take isl_space *space) - return isl_pw_aff_alloc (dom, aff); - } - -+/* Convert WI to a isl_val with CTX. */ -+ -+static __isl_give isl_val * -+isl_val_int_from_wi (isl_ctx *ctx, const widest_int &wi) -+{ -+ if (wi::neg_p (wi, SIGNED)) -+ { -+ widest_int mwi = -wi; -+ return isl_val_neg (isl_val_int_from_chunks (ctx, mwi.get_len (), -+ sizeof (HOST_WIDE_INT), -+ mwi.get_val ())); -+ } -+ return isl_val_int_from_chunks (ctx, wi.get_len (), sizeof (HOST_WIDE_INT), -+ wi.get_val ()); -+} -+ - /* Extract an affine expression from the gmp constant G. */ - - static isl_pw_aff * --extract_affine_gmp (mpz_t g, __isl_take isl_space *space) -+extract_affine_wi (const widest_int &g, __isl_take isl_space *space) - { - isl_local_space *ls = isl_local_space_from_space (isl_space_copy (space)); - isl_aff *aff = isl_aff_zero_on_domain (ls); - isl_set *dom = isl_set_universe (space); - isl_ctx *ct = isl_aff_get_ctx (aff); -- isl_val *v = isl_val_int_from_gmp (ct, g); -+ isl_val *v = isl_val_int_from_wi (ct, g); - aff = isl_aff_add_constant_val (aff, v); - - return isl_pw_aff_alloc (dom, aff); -@@ -174,13 +189,7 @@ extract_affine_gmp (mpz_t g, __isl_take isl_space *space) - static isl_pw_aff * - extract_affine_int (tree e, __isl_take isl_space *space) - { -- mpz_t g; -- -- mpz_init (g); -- tree_int_to_gmp (e, g); -- isl_pw_aff *res = extract_affine_gmp (g, space); -- mpz_clear (g); -- -+ isl_pw_aff *res = extract_affine_wi (wi::to_widest (e), space); - return res; - } - -@@ -411,15 +420,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) - { - isl_space *space = isl_set_get_space (scop->param_context); - isl_constraint *c; -- mpz_t g; - isl_val *v; - - c = isl_inequality_alloc (isl_local_space_from_space (space)); -- mpz_init (g); -- tree_int_to_gmp (lb, g); -- v = isl_val_int_from_gmp (scop->isl_context, g); -+ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (lb)); - v = isl_val_neg (v); -- mpz_clear (g); - c = isl_constraint_set_constant_val (c, v); - c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, 1); - -@@ -431,15 +436,11 @@ add_param_constraints (scop_p scop, graphite_dim_t p) - { - isl_space *space = isl_set_get_space (scop->param_context); - isl_constraint *c; -- mpz_t g; - isl_val *v; - - c = isl_inequality_alloc (isl_local_space_from_space (space)); - -- mpz_init (g); -- tree_int_to_gmp (ub, g); -- v = isl_val_int_from_gmp (scop->isl_context, g); -- mpz_clear (g); -+ v = isl_val_int_from_wi (scop->isl_context, wi::to_widest (ub)); - c = isl_constraint_set_constant_val (c, v); - c = isl_constraint_set_coefficient_si (c, isl_dim_param, p, -1); - -@@ -773,11 +774,8 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, - isl_local_space *ls = isl_local_space_from_space (space); - isl_constraint *c = isl_inequality_alloc (ls); - c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); -- mpz_t g; -- mpz_init (g); -- tree_int_to_gmp (nb_iters, g); -- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); -- mpz_clear (g); -+ isl_val *v -+ = isl_val_int_from_wi (scop->isl_context, wi::to_widest (nb_iters)); - c = isl_constraint_set_constant_val (c, v); - return isl_set_add_constraint (domain, c); - } -@@ -817,12 +815,9 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, - - /* NIT is an upper bound to NB_ITERS: "NIT >= NB_ITERS", although we - do not know whether the loop executes at least once. */ -- mpz_t g; -- mpz_init (g); -- wi::to_mpz (nit, g, SIGNED); -- mpz_sub_ui (g, g, 1); -+ --nit; - -- isl_pw_aff *approx = extract_affine_gmp (g, isl_space_copy (space)); -+ isl_pw_aff *approx = extract_affine_wi (nit, isl_space_copy (space)); - isl_set *x = isl_pw_aff_ge_set (approx, aff_nb_iters); - x = isl_set_project_out (x, isl_dim_set, 0, - isl_set_dim (x, isl_dim_set)); -@@ -831,8 +826,7 @@ add_loop_constraints (scop_p scop, __isl_take isl_set *domain, loop_p loop, - ls = isl_local_space_from_space (space); - c = isl_inequality_alloc (ls); - c = isl_constraint_set_coefficient_si (c, isl_dim_set, loop_index, -1); -- isl_val *v = isl_val_int_from_gmp (scop->isl_context, g); -- mpz_clear (g); -+ isl_val *v = isl_val_int_from_wi (scop->isl_context, nit); - c = isl_constraint_set_constant_val (c, v); - - if (dump_file) -diff --git a/gcc/graphite.h b/gcc/graphite.h -index 5103c614ff140..d22c4f2693f52 100644 ---- a/gcc/graphite.h -+++ b/gcc/graphite.h -@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see - #include "sese.h" - #include - #include --#include -+#include - #include - #include - #include diff --git a/cross/gcc6-armhf/gcc-pure64-mips.patch b/cross/gcc6-armhf/gcc-pure64-mips.patch deleted file mode 100644 index d78f28381..000000000 --- a/cross/gcc6-armhf/gcc-pure64-mips.patch +++ /dev/null @@ -1,47 +0,0 @@ -From b8c4e45d052adc247341066f748421743704b481 Mon Sep 17 00:00:00 2001 -From: Nils Andreas Svee -Date: Thu, 21 Dec 2017 03:14:33 +0100 -Subject: [PATCH] Pure 64-bit MIPS - ---- - gcc/config/mips/mips.h | 8 ++++---- - gcc/config/mips/t-linux64 | 6 +++--- - 2 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h -index 803ab98e7..afd74752f 100644 ---- a/gcc/config/mips/mips.h -+++ b/gcc/config/mips/mips.h -@@ -3330,11 +3330,11 @@ struct GTY(()) machine_function { - /* If we are *not* using multilibs and the default ABI is not ABI_32 we - need to change these from /lib and /usr/lib. */ - #if MIPS_ABI_DEFAULT == ABI_N32 --#define STANDARD_STARTFILE_PREFIX_1 "/lib32/" --#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib32/" -+#define STANDARD_STARTFILE_PREFIX_1 "/lib/" -+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" - #elif MIPS_ABI_DEFAULT == ABI_64 --#define STANDARD_STARTFILE_PREFIX_1 "/lib64/" --#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib64/" -+#define STANDARD_STARTFILE_PREFIX_1 "/lib/" -+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/" - #endif - - /* Load store bonding is not supported by micromips and fix_24k. The -diff --git a/gcc/config/mips/t-linux64 b/gcc/config/mips/t-linux64 -index 16c8adf85..bb46204db 100644 ---- a/gcc/config/mips/t-linux64 -+++ b/gcc/config/mips/t-linux64 -@@ -21,6 +21,6 @@ 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)) -+ ../lib \ -+ ../lib32 \ -+ ../lib --- -2.15.1 - diff --git a/cross/gcc6-armhf/gcc-pure64.patch b/cross/gcc6-armhf/gcc-pure64.patch deleted file mode 100644 index 2c350fe5a..000000000 --- a/cross/gcc6-armhf/gcc-pure64.patch +++ /dev/null @@ -1,89 +0,0 @@ ---- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000 -+++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000 -@@ -34,6 +34,6 @@ - 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 = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32) ---- ./gcc/config/aarch64/t-aarch64-linux.orig -+++ ./gcc/config/aarch64/t-aarch64-linux -@@ -22,7 +22,7 @@ - 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) -+MULTILIB_OSDIRNAMES = mabi.lp64=../lib - MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu) - - MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32 ---- ./gcc/config/s390/t-linux64.orig -+++ ./gcc/config/s390/t-linux64 -@@ -7,5 +7,5 @@ - MULTILIB_OPTIONS = m64/m31 - MULTILIB_DIRNAMES = 64 32 --MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu) --MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - ---- ./gcc/config/rs6000/t-linux.orig -+++ ./gcc/config/rs6000/t-linux -@@ -2,7 +2,8 @@ - # or soft-float. - ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) - ifneq (,$(findstring powerpc64,$(target))) --MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - else - ifneq (,$(findstring spe,$(target))) - MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1) -@@ -14,7 +15,8 @@ - MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) - endif - ifneq (,$(findstring powerpc64le,$(target))) --MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - endif - endif - ---- ./gcc/config/rs6000/t-linux64.orig -+++ ./gcc/config/rs6000/t-linux64 -@@ -28,8 +28,8 @@ - MULTILIB_OPTIONS := m64/m32 - MULTILIB_DIRNAMES := 64 32 - 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 := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - - rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c - $(COMPILE) $< ---- ./gcc/config/rs6000/t-linux64bele.orig -+++ ./gcc/config/rs6000/t-linux64bele -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mlittle - MULTILIB_DIRNAMES += le --MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES = m64=../lib -+MULTILIB_OSDIRNAMES+= m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} ---- ./gcc/config/rs6000/t-linux64lebe.orig -+++ ./gcc/config/rs6000/t-linux64lebe -@@ -2,6 +2,6 @@ - - MULTILIB_OPTIONS += mbig - MULTILIB_DIRNAMES += be --MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES)))))) --MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES))) -+MULTILIB_OSDIRNAMES := m64=../lib -+MULTILIB_OSDIRNAMES += m32=../lib32 - MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN} diff --git a/cross/gcc6-armhf/libgcc-always-build-gcceh.a.patch b/cross/gcc6-armhf/libgcc-always-build-gcceh.a.patch deleted file mode 100644 index 74ae89730..000000000 --- a/cross/gcc6-armhf/libgcc-always-build-gcceh.a.patch +++ /dev/null @@ -1,39 +0,0 @@ -Highly inspired by: - http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch - -diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in ---- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100 -+++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200 -@@ -772,8 +772,9 @@ - libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) - endif - -+all: libgcc_eh.a - ifeq ($(enable_shared),yes) --all: libgcc_eh.a libgcc_s$(SHLIB_EXT) -+all: libgcc_s$(SHLIB_EXT) - ifneq ($(LIBUNWIND),) - all: libunwind$(SHLIB_EXT) - endif -@@ -950,10 +951,6 @@ - install-shared: - $(mkinstalldirs) $(DESTDIR)$(inst_libdir) - -- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -- - $(subst @multilib_dir@,$(MULTIDIR),$(subst \ - @shlib_base_name@,libgcc_s,$(subst \ - @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) -@@ -968,6 +965,10 @@ - chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a - $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a - -+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ -+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a -+ - parts="$(INSTALL_PARTS)"; \ - for file in $$parts; do \ - rm -f $(DESTDIR)$(inst_libdir)/$$file; \ diff --git a/cross/musl-armhf/APKBUILD b/cross/musl-armhf/APKBUILD deleted file mode 100644 index ea6c41ff2..000000000 --- a/cross/musl-armhf/APKBUILD +++ /dev/null @@ -1,63 +0,0 @@ -# Automatically generated aport, do not edit! -# Generator: pmbootstrap aportgen musl-armhf - -# Stub for apkbuild-lint -if [ -z "$(type -t arch_to_hostspec)" ]; then - arch_to_hostspec() { :; } -fi - -maintainer="" -pkgname=musl-armhf -pkgver=1.2.6 -pkgrel=2 -arch="aarch64 x86_64" -subpackages="musl-dev-armhf:package_dev" - -_arch="armhf" -_mirror="http://dl-4.alpinelinux.org/alpine/" - -url="https://musl-libc.org" -license="MIT" -options="!check !strip" -pkgdesc="the musl library (lib c) implementation for $_arch" - -_target="$(arch_to_hostspec $_arch)" - -source=" - musl-$pkgver-r$pkgrel-$_arch-edge.apk::$_mirror/edge/main/$_arch/musl-$pkgver-r$pkgrel.apk - musl-dev-$pkgver-r$pkgrel-$_arch-edge.apk::$_mirror/edge/main/$_arch/musl-dev-$pkgver-r$pkgrel.apk -" - -package() { - mkdir -p "$pkgdir/usr/$_target" - cd "$pkgdir/usr/$_target" - # Use 'busybox tar' to avoid 'tar: Child returned status 141' - # on some machines (builds.sr.ht, gitlab-ci). See pmaports#26. - busybox tar -xf $srcdir/musl-$pkgver-r$pkgrel-$_arch-edge.apk - rm .PKGINFO .SIGN.* -} -package_dev() { - mkdir -p "$subpkgdir/usr/$_target" - cd "$subpkgdir/usr/$_target" - # Use 'busybox tar' to avoid 'tar: Child returned status 141' - # on some machines (builds.sr.ht, gitlab-ci). See pmaports#26. - busybox tar -xf $srcdir/musl-dev-$pkgver-r$pkgrel-$_arch-edge.apk - rm .PKGINFO .SIGN.* - - # symlink everything from /usr/$_target/usr/* - # to /usr/$_target/* so the cross-compiler gcc does not fail - # to build. - for _dir in include lib; do - mkdir -p "$subpkgdir/usr/$_target/$_dir" - cd "$subpkgdir/usr/$_target/usr/$_dir" - for i in *; do - cd "$subpkgdir/usr/$_target/$_dir" - ln -s /usr/$_target/usr/$_dir/$i $i - done - done -} - -sha512sums=" -0f2a24ee0f23612adfb578ccda1b9dccd24a37f78c90d1ba655cdcf0e094dd95f4ec34288c87f98804714cb8fc0865bf0fe079c7a1902b39c4d992bb46e10e64 musl-1.2.6-r2-armhf-edge.apk -8b5175848776267bee95be058595e538eaa06cb63522d519b6760920faac40c16fa59a57a6be545c121f1e4d1c7cd2e4b2b8fdded57cbdb7e8585b08ca349d86 musl-dev-1.2.6-r2-armhf-edge.apk -"