* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2016-05-18 11:09 Anthony G. Basile
0 siblings, 0 replies; 9+ messages in thread
From: Anthony G. Basile @ 2016-05-18 11:09 UTC (permalink / raw
To: gentoo-commits
commit: cabbb3a81cd2196cc4cc519a9ab165d8e0f08d0a
Author: Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Mon May 16 11:36:36 2016 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Wed May 18 11:04:16 2016 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=cabbb3a8
sys-devel/gcc-6.1.0 fix undefined reference to __cpu_*
Add a hack to work around musl's lack of symbol versioning. C.f.
https://archives.gentoo.org/gentoo-musl/message/428886314d159f7139e638e824dab91f
sys-devel/gcc/Manifest | 3 ++-
sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch | 32 ++++++++++++++++++++++++++++
sys-devel/gcc/gcc-6.1.0.ebuild | 3 +++
3 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 35eb463..b677f3a 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -14,6 +14,7 @@ AUX gcc-4.8.5-posix_memalign.patch 1114 SHA256 87370f7854063bcf5f57bff931684c228
AUX gcc-4.9.3-musl-linker-path.patch 3556 SHA256 22228421551806b81a1d3aff438eecf4202f64844141863fb8e665ef3b5eb5fb SHA512 cf58b49311c1a7a4cbb04a2ffeccdaa278872512e67b72ebe292fa155f419dc6025d158b67d58265de67edbd18c6af67f28c6f6806b581a8fdb9015ad2ee0aa3 WHIRLPOOL c3d5e9c7fc64cd8a8bacca714da5881ee8d94585e0064f5e3965b20bfe23c48bbe8b0bc886cf291d616e51786e80d032c19bdce59a15fdb310546b61a0ab0886
AUX gcc-4.9.3-musl-res_state.patch 699 SHA256 822990f5075b65dc2d1c03722daa5a215301f9ec2c4323c10e80fff2fbd04e71 SHA512 93f59d16e026672051b5a65110f78ace0c91a4f1365b861e22741fbc42b92c4490e55068ae845bbcbb5af9221fb874e0b855a763189528a646e757b133117e28 WHIRLPOOL 98438e82aa8d387b5a96bc58d3a137766661cc53d7396165338448394c14996687626f46e9c93bcb6b2a2e422b97445f5097489616a0aff619cca01c8243a56a
AUX gcc-4.9.3-secure-plt.patch 1478 SHA256 b9435e19c3193e872bfdce8f635755655cf6e88889c57d21c7afa118d7068e95 SHA512 95f04716bad41fe3f290d44d21d1dad35548b801b56de331acac8bdf56019583a04681418a805a0b4dbfe19e9b51cecceff984cea257be58d3e7780c6cfc58a5 WHIRLPOOL 8af1f0cfaf0e8197754d841d1cd2b25615968cc503344574cd9ec6b644804e029687a4ded18f6e1efd584c8c99277eceb6f1012c6519a2747bddc400d8909c1e
+AUX gcc-6.1.0-musl-cpu.patch 1277 SHA256 6c7a28ccc5edc226fc6f3f6b9b0562fb873a9c88dfb25b608b5acd827f239c08 SHA512 b11c5933c02dda63b40273f6cee394d52c68265931817cfeea3645e971b9c822cc841242a7c74fcd07729171bc0723c2af0db21743bf92dd3dba3430ee6627a1 WHIRLPOOL e0f6068a8028052f88cef840026baa459ae77a43d9144258fe7739a80b5dade852a2aa640feb5bce51dd54d6d35e0c8df99a8c9bdc140f9ae473f16ffb2e9af7
AUX gcc-configure-LANG.patch 2052 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b SHA512 a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129 WHIRLPOOL 3cc1ec912fb192ff1058de5b93e49a994ba30d1501a932290dd5b3df1cd783875621cda56edeb41894cd5fa10c04917e693a40a60be8d742ddd7992bf5d8afeb
AUX gcc-configure-texinfo.patch 337 SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98 SHA512 a15fba8bf2ff02bdeca54d6f186bfa08c1079c6a8ba0a3beef154483ce5c1b8c497e7ffeec32371968f0037e0ff8384609eb0c367d0155a4e5a7eef8aad084d5 WHIRLPOOL 39d008aad06f7621e4e5db15f5e85a59e583b43f8d247029bd4944466bb60a9795bda157d185c45c329294078e282703a243aad5c468d90c77665dd6336870d4
AUX gcc-spec-env-r1.patch 3148 SHA256 da0a6442eb42bce58cbdc7858b110a2e65fc5bd5b4b780b9b491033de6e302fa SHA512 ecae71577543772cfe1711f1b4a8815c0b5d706ebd01edacd1f07586637d4805e25771f970a6e6d1bb696d4b1b5ef3e0036088a96a9f6beff7ddaee704175d16 WHIRLPOOL 3535605998eabccdee71ba396ed5cefbb8b0a8cb073101f6444c7d01233f3b3904c1b29f4daf0a3417c68de8dbd62a0b7dc367cacfcbfa0c4ee1b69b7df8c6fb
@@ -57,5 +58,5 @@ EBUILD gcc-4.8.5-r99.ebuild 2139 SHA256 0b762e2fb8c2bf92488b598c01977b07a3786afe
EBUILD gcc-4.8.5-r999.ebuild 2185 SHA256 7b8b261c0d3ea2e34a2f099b4f0a23a5bfd61e814dead44aeb4e45071be2c3f1 SHA512 e8f6e8bba4fd7818c30a555adcf25acbe818919c98204f91e27be04566aa267b9394547045e05e5486437853ceb1b75229d86089f69409a626a9e81e363c12db WHIRLPOOL 872e4f0e40e2b9a0a51002c64e682eca1990c2b968c8917b9a1a7c309075a048ceffd7925bf7f67cb3f304badbf29ee5e94772f5a86503e1e5e42fa7682fb87e
EBUILD gcc-4.9.3-r99.ebuild 2195 SHA256 3f5be66ffc6fb064e14a24cb9005d1835685573f245ed1aa5143c5f5e7ba1a90 SHA512 c49043c69947bc37ab31142f51060ebc8d922bb13d4aae17957c60bb45e2494cba4724e8af3ac2f0d4f09ca4b3676645657a08b4893ca01175917bc07ce827d9 WHIRLPOOL 9b1bec2a6fe2ae003a94ba73bcf4b207db0f5a2988288820581508de7649d3e46a163852514755f49051be00fc43846844cd24cd1a8fe2462315ddeb53faf0a6
EBUILD gcc-4.9.3-r999.ebuild 1794 SHA256 514b9f6cddb5e6a43c53f866aa501812319bfccf7fb7713316563d55cb139aff SHA512 c7f4aad21658d6acb99f14b3b51707a74387206b9fc3629d962c755a7eb8a963b3df844ba60172305fc2e753fc7178d4723f02a487aeae643c85ff00062b4bd3 WHIRLPOOL c6372f1014c5b8d22023f04b7223db4ae5d898f450f3d5cf286ccd82553f916978fba8d0910dc72fd5cdd1d92ecce9749597b09e252a58ff898d3616221af685
-EBUILD gcc-6.1.0.ebuild 968 SHA256 876c7b22e5f1e087522310e091d31f3f51ad05bc55dc13bc86408c1eef2cd7fc SHA512 a340bc7f463a882ac1786ec25f90b49eca97a7707fcfc80cb05dc2c29e923809cac02161fb63207179036ff48530cd6a4fd34fc6b12c66a6edeb55b838cc0183 WHIRLPOOL f08659c53cb48bdc3d8f0b2c4fd6f2894f037d931216892143dc3927f56124655d7dccde6b8c7664af2329b4e8dc9d919789080063e6b73f725dc385bd7de2a5
+EBUILD gcc-6.1.0.ebuild 1076 SHA256 6d5acd2030e949af48922a3da83541c0720037212c71c1867e5de8373e8bc0b0 SHA512 7f4c657c930a7cb0cfdd34ff8fa811eb2e62834ed0ec094db6bbc5123ea8c86b72df1cf32d6660c0ef2dc3863276081665b95af0a1c47a1ba14802a5559e776d WHIRLPOOL 73f9a4277585013050291df58b6d0c7db7fa65baed51c0a1b9462c212281de9d98d50c63be9d703fd45efb61e596fb74861aa41e17f4ac1917adb4f44961c18a
MISC metadata.xml 2039 SHA256 b200834baf1ac8adf966540ee7e50dbf1397248f08eeff35a8bde6bb16dbcc50 SHA512 b8fe281c88017b4d5d2ac05ea4e074d740b3943bc0d4cd361ec4f161f2549fb6401a2fa7881c06a4eae33ffd9755b6ebc4fa608654ec04838bff49ff22ee74a8 WHIRLPOOL e063f7657a00a1e675a57000fed2fac1c05e986488f3a705c95909ac7a2e74ca8f97c6fb8bfffdb81388a967228a78adbcfa93b166d4095aade5875aaf350fa0
diff --git a/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch b/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch
new file mode 100644
index 0000000..c11afb5
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-6.1.0-musl-cpu.patch
@@ -0,0 +1,32 @@
+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/sys-devel/gcc/gcc-6.1.0.ebuild b/sys-devel/gcc/gcc-6.1.0.ebuild
index e23afe3..837ef48 100644
--- a/sys-devel/gcc/gcc-6.1.0.ebuild
+++ b/sys-devel/gcc/gcc-6.1.0.ebuild
@@ -38,4 +38,7 @@ fi
src_prepare() {
toolchain_src_prepare
+ if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
+ epatch "${FILESDIR}"/${P}-musl-cpu.patch
+ fi
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2016-09-19 20:12 Anthony G. Basile
0 siblings, 0 replies; 9+ messages in thread
From: Anthony G. Basile @ 2016-09-19 20:12 UTC (permalink / raw
To: gentoo-commits
commit: e133e716042047ea1a0cea2469121e82f064d4c2
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 19 20:11:40 2016 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 19 20:11:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=e133e716
sys-devel/gcc: bump to gcc-4.9.4, address bug #590098
Package-Manager: portage-2.2.28
sys-devel/gcc/Manifest | 6 ++
...gcc-4.9.3-tree-vect-data-refs-correctness.patch | 11 ++++
sys-devel/gcc/gcc-4.9.4-r99.ebuild | 66 ++++++++++++++++++++++
3 files changed, 83 insertions(+)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index b677f3a..bb092a9 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -14,6 +14,7 @@ AUX gcc-4.8.5-posix_memalign.patch 1114 SHA256 87370f7854063bcf5f57bff931684c228
AUX gcc-4.9.3-musl-linker-path.patch 3556 SHA256 22228421551806b81a1d3aff438eecf4202f64844141863fb8e665ef3b5eb5fb SHA512 cf58b49311c1a7a4cbb04a2ffeccdaa278872512e67b72ebe292fa155f419dc6025d158b67d58265de67edbd18c6af67f28c6f6806b581a8fdb9015ad2ee0aa3 WHIRLPOOL c3d5e9c7fc64cd8a8bacca714da5881ee8d94585e0064f5e3965b20bfe23c48bbe8b0bc886cf291d616e51786e80d032c19bdce59a15fdb310546b61a0ab0886
AUX gcc-4.9.3-musl-res_state.patch 699 SHA256 822990f5075b65dc2d1c03722daa5a215301f9ec2c4323c10e80fff2fbd04e71 SHA512 93f59d16e026672051b5a65110f78ace0c91a4f1365b861e22741fbc42b92c4490e55068ae845bbcbb5af9221fb874e0b855a763189528a646e757b133117e28 WHIRLPOOL 98438e82aa8d387b5a96bc58d3a137766661cc53d7396165338448394c14996687626f46e9c93bcb6b2a2e422b97445f5097489616a0aff619cca01c8243a56a
AUX gcc-4.9.3-secure-plt.patch 1478 SHA256 b9435e19c3193e872bfdce8f635755655cf6e88889c57d21c7afa118d7068e95 SHA512 95f04716bad41fe3f290d44d21d1dad35548b801b56de331acac8bdf56019583a04681418a805a0b4dbfe19e9b51cecceff984cea257be58d3e7780c6cfc58a5 WHIRLPOOL 8af1f0cfaf0e8197754d841d1cd2b25615968cc503344574cd9ec6b644804e029687a4ded18f6e1efd584c8c99277eceb6f1012c6519a2747bddc400d8909c1e
+AUX gcc-4.9.3-tree-vect-data-refs-correctness.patch 315 SHA256 904ae5ce2ecd5a2f7786c54d148a7562d0bb6f51fe60761038c2f57b8cf70356 SHA512 88d93c061ef72035522270ab60c8c2ec04e2fa2d69763f45b9eab0c37b19c23920484358d7556ad885775071ac04cf94684a2cd8ed93418d5f0c54ac3a045c9d WHIRLPOOL 2b9c281401abc111d53467c51b6238c6f4c430a73d8833f161766f973138ffe3b4fa1ffe5cc5813b5e2f8a81dee2cdcaaff2b9a8f8e13089f993f3ab3d69ccbd
AUX gcc-6.1.0-musl-cpu.patch 1277 SHA256 6c7a28ccc5edc226fc6f3f6b9b0562fb873a9c88dfb25b608b5acd827f239c08 SHA512 b11c5933c02dda63b40273f6cee394d52c68265931817cfeea3645e971b9c822cc841242a7c74fcd07729171bc0723c2af0db21743bf92dd3dba3430ee6627a1 WHIRLPOOL e0f6068a8028052f88cef840026baa459ae77a43d9144258fe7739a80b5dade852a2aa640feb5bce51dd54d6d35e0c8df99a8c9bdc140f9ae473f16ffb2e9af7
AUX gcc-configure-LANG.patch 2052 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b SHA512 a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129 WHIRLPOOL 3cc1ec912fb192ff1058de5b93e49a994ba30d1501a932290dd5b3df1cd783875621cda56edeb41894cd5fa10c04917e693a40a60be8d742ddd7992bf5d8afeb
AUX gcc-configure-texinfo.patch 337 SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98 SHA512 a15fba8bf2ff02bdeca54d6f186bfa08c1079c6a8ba0a3beef154483ce5c1b8c497e7ffeec32371968f0037e0ff8384609eb0c367d0155a4e5a7eef8aad084d5 WHIRLPOOL 39d008aad06f7621e4e5db15f5e85a59e583b43f8d247029bd4944466bb60a9795bda157d185c45c329294078e282703a243aad5c468d90c77665dd6336870d4
@@ -51,6 +52,10 @@ DIST gcc-4.9.3-patches-1.5.tar.bz2 25384 SHA256 e1c43125fab5a4db1997a01b362b3611
DIST gcc-4.9.3-piepatches-v0.6.4.tar.bz2 14431 SHA256 012c3025ac2e14781ff25028c0b1d42a07f510b125006116e268bcd90fb6c9db SHA512 3bbeacbca5e8ef6ab0b1d58add42f5e8e82328afe024666f9585b5398c8722e7d012abfd2009a98ad47b1f1b26afaf421402a9e7719a5662516b32dcbe5608be WHIRLPOOL 9e68d981aed42ece2f481f62efc078ad370ac780e96ba39c4273c8675d552b845cd52c588bd41839868f430b0a532789858914f4ef32a1bc187e2983264ebfd3
DIST gcc-4.9.3-uclibc-patches-1.0.tar.bz2 2515 SHA256 dd19904d4ab005ef142056228f326e75b3d4d79b8056189a505129b5940a575c SHA512 825092620a3c554ef06219fd1152c3677f1456315563b9e65282a73096e75600389e93298ed76cad41ce3eeecc6a7009ca722585b93c04095bd2d0a06c4404e6 WHIRLPOOL 0c184a5cc74f80a61f354ee85bc5a0f5b44d93bc9fa2e1892fbfe899958cfa5263b8b72cc4f905bc69bd1cc90cf870a6056c4003ec493b815646a72a0fe2e44e
DIST gcc-4.9.3.tar.bz2 90006707 SHA256 2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e SHA512 9ac57377a6975fc7adac704ec81355262b9f537def6955576753b87715470a20ee6a2a3144a79cc8fcba3443f7b44c7337d79d704b522d053f54f79aa6b442df WHIRLPOOL 085e4cc1825b031652cbe9e098671f761acfeca64c6cc9b8ad2a8961c13fcac9e02b4538b44dc38181a355266f2c55c99ce5a1bff3f2860b870285cf3f0e84a5
+DIST gcc-4.9.4-patches-1.0.tar.bz2 22266 SHA256 1a394abb77c75e2212896ad3a62ae1f6bfd3660b1c176c608298733c740a00e4 SHA512 cc2407221f858bad38b57d31f635314f91794293695e23d255685d8bec20b9db19c7dc76bbf5e8184c2ba0ccb530958b09bae4d8a402ca27cadf463f46bfb995 WHIRLPOOL c74e5273c718020b591911d589d8eff5e366c902c479e566f966577efcbf424b19669a54843b2ddd60c51c81fd2851bc86aec1c647482b4789a518f01dd62561
+DIST gcc-4.9.4-piepatches-v0.6.4.tar.bz2 14414 SHA256 c67b56f04c653e6a19e36abed8391f8b6bed426bfcfc907237cc37f02dbb5015 SHA512 243fa272ea0e49f700a76508bab3e03bbb353bcb930581b2f87f9a47df5cd3880e29f20b71612b21190adc463849e1e6ac2a38a49c0002b562d93d436f538285 WHIRLPOOL 1e5959441210af6f690398efab96444ab11d136238a9428912e8441eaf0509fe6db359a8aca92a446fce0c75777385475af73b20165a8593f9969e3a25fd0b0f
+DIST gcc-4.9.4-uclibc-patches-1.0.tar.bz2 2618 SHA256 95f290d0b68114d835515afc424d6096476a45665671784aa71a7a506296e465 SHA512 5a1f44caa9261f4947101379628143869b31dec67fa28605e8e1f3894d4b7120c3f68ba6deb59da7a74fa906e27ab32cd3767761837dc3dfebc37865d349d6db WHIRLPOOL e46b08737cfdc235bfb80117e0389f3969167adf59bcba2a0a1094a20eab2b62f0c952dac44781e43957cb1507cd4e80f37bd8aecbc55dbda6382d93b3a4cf94
+DIST gcc-4.9.4.tar.bz2 90097606 SHA256 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092 SHA512 93abb78e16277454f41a8e9810f41f66c0fdffdc539a762ff6b67d3037f78db971378683fd2ebf707d1d51c059fad2161fe42d110c330027f40214b7db0f3efe WHIRLPOOL e20045126c21a3edea1fa4a2185ec2bc5feec77ddf967ab9d1e8c33322ad4eafe013bfcaab1ed4e35971d3b70ef373ea3585ebb089c9bbf91bbfca1f1da71236
DIST gcc-6.1.0-patches-1.0.tar.bz2 4193 SHA256 48882d00b3327fe6578e421d4d90d5f03c22fe30ee80542fc828432ba505dc77 SHA512 ff3fc21bdbc5391058759d7e61e9636665d0cbeb3f3fdb724e1bd09e4d6ae778f7c836e59e8b21540458bde99b503428b190736d3ee7a3764f56ddc1da754d39 WHIRLPOOL 4b648a92aadbdb4bf72652ba83cdd8352ef992449b089311c8e20760317dc0fd008dcc2f797880c869dd1b79cf1162943a323681954dea490f09e7682f28b3cb
DIST gcc-6.1.0.tar.bz2 99267556 SHA256 09c4c85cabebb971b1de732a0219609f93fc0af5f86f6e437fd8d7f832f1a351 SHA512 eeed3e2018b8c012aabce419e8d718fde701e5c3c179b4486c61ba46e5736eecc8fccdd18b01fcd973a42c6ad3116dbbe2ee247fe3757d622d373f93ebaf8d2e WHIRLPOOL fa11fca6c85a31f7c896f0ded40a9208a8588c2b3fddd2cca51f440c712ff83374528b7d1571f8d98dad96e24cb5b14b6af624ef42aff2a85ae99e8621c9b479
EBUILD gcc-4.7.4-r99.ebuild 2071 SHA256 67b45e6941cd3d7b4b075884295da5ed7cae18f4a0ab4630ac8e64cda70c3aab SHA512 383a1986e74a1ef333a666f298200d7ab9423f30c25da9cf460986fe5bf95f6c43ecf829f90313076108508b2f64f06e188dda8fec9f014f861adca27d876e9b WHIRLPOOL 9dbe06a64f35a0d5f12a968274152e95cf332b87c9e8b689d70a99db6a93a097960604c363dc608932c96250cd634ce65dc544368b4e361ed5bfef535243f3c7
@@ -58,5 +63,6 @@ EBUILD gcc-4.8.5-r99.ebuild 2139 SHA256 0b762e2fb8c2bf92488b598c01977b07a3786afe
EBUILD gcc-4.8.5-r999.ebuild 2185 SHA256 7b8b261c0d3ea2e34a2f099b4f0a23a5bfd61e814dead44aeb4e45071be2c3f1 SHA512 e8f6e8bba4fd7818c30a555adcf25acbe818919c98204f91e27be04566aa267b9394547045e05e5486437853ceb1b75229d86089f69409a626a9e81e363c12db WHIRLPOOL 872e4f0e40e2b9a0a51002c64e682eca1990c2b968c8917b9a1a7c309075a048ceffd7925bf7f67cb3f304badbf29ee5e94772f5a86503e1e5e42fa7682fb87e
EBUILD gcc-4.9.3-r99.ebuild 2195 SHA256 3f5be66ffc6fb064e14a24cb9005d1835685573f245ed1aa5143c5f5e7ba1a90 SHA512 c49043c69947bc37ab31142f51060ebc8d922bb13d4aae17957c60bb45e2494cba4724e8af3ac2f0d4f09ca4b3676645657a08b4893ca01175917bc07ce827d9 WHIRLPOOL 9b1bec2a6fe2ae003a94ba73bcf4b207db0f5a2988288820581508de7649d3e46a163852514755f49051be00fc43846844cd24cd1a8fe2462315ddeb53faf0a6
EBUILD gcc-4.9.3-r999.ebuild 1794 SHA256 514b9f6cddb5e6a43c53f866aa501812319bfccf7fb7713316563d55cb139aff SHA512 c7f4aad21658d6acb99f14b3b51707a74387206b9fc3629d962c755a7eb8a963b3df844ba60172305fc2e753fc7178d4723f02a487aeae643c85ff00062b4bd3 WHIRLPOOL c6372f1014c5b8d22023f04b7223db4ae5d898f450f3d5cf286ccd82553f916978fba8d0910dc72fd5cdd1d92ecce9749597b09e252a58ff898d3616221af685
+EBUILD gcc-4.9.4-r99.ebuild 2271 SHA256 d1736950223f5d3a8e9f19f4305eadf850c089cb37b5110191b0153c9f464a5a SHA512 02591b3bcf781a07c7283b9901ad789f7f57e7493d7d965da9b1b0a97ef8ad0041524eb65c46ead9eb3abdc562544f92c3b448f8264c8a4a3ff4fd9a4f7468f3 WHIRLPOOL de255e364c4003f4bbc3b6090a361621abe794cca1bb80e0af9b7db32a084a852e70397de9c3f5fb3d9216a56410da0c7817bc5d246817633a33951eec21889c
EBUILD gcc-6.1.0.ebuild 1076 SHA256 6d5acd2030e949af48922a3da83541c0720037212c71c1867e5de8373e8bc0b0 SHA512 7f4c657c930a7cb0cfdd34ff8fa811eb2e62834ed0ec094db6bbc5123ea8c86b72df1cf32d6660c0ef2dc3863276081665b95af0a1c47a1ba14802a5559e776d WHIRLPOOL 73f9a4277585013050291df58b6d0c7db7fa65baed51c0a1b9462c212281de9d98d50c63be9d703fd45efb61e596fb74861aa41e17f4ac1917adb4f44961c18a
MISC metadata.xml 2039 SHA256 b200834baf1ac8adf966540ee7e50dbf1397248f08eeff35a8bde6bb16dbcc50 SHA512 b8fe281c88017b4d5d2ac05ea4e074d740b3943bc0d4cd361ec4f161f2549fb6401a2fa7881c06a4eae33ffd9755b6ebc4fa608654ec04838bff49ff22ee74a8 WHIRLPOOL e063f7657a00a1e675a57000fed2fac1c05e986488f3a705c95909ac7a2e74ca8f97c6fb8bfffdb81388a967228a78adbcfa93b166d4095aade5875aaf350fa0
diff --git a/sys-devel/gcc/files/gcc-4.9.3-tree-vect-data-refs-correctness.patch b/sys-devel/gcc/files/gcc-4.9.3-tree-vect-data-refs-correctness.patch
new file mode 100644
index 0000000..d865e25
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.9.3-tree-vect-data-refs-correctness.patch
@@ -0,0 +1,11 @@
+--- trunk/gcc/tree-vect-data-refs.c 2015/11/20 16:15:57 230666
++++ trunk/gcc/tree-vect-data-refs.c 2015/11/20 16:27:17
+@@ -2545,6 +2545,8 @@
+ if (t2 == NULL)
+ return 1;
+
++ STRIP_NOPS (t1);
++ STRIP_NOPS (t2);
+
+ if (TREE_CODE (t1) != TREE_CODE (t2))
+ return TREE_CODE (t1) < TREE_CODE (t2) ? -1 : 1;
diff --git a/sys-devel/gcc/gcc-4.9.4-r99.ebuild b/sys-devel/gcc/gcc-4.9.4-r99.ebuild
new file mode 100644
index 0000000..4d9e5ae
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.4-r99.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.4"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+PIE_MUSL_STABLE="amd64 arm ppc mips x86"
+SSP_MUSL_STABLE="amd64 arm ppc mips"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~amd64 ~arm ~mips ~x86"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
+ cd "${S}"
+ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+ mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
+ cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
+ cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
+ mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
+ cp -r libitm/config/generic libitm/config/linux/x86
+ epatch "${FILESDIR}"/${PN}-4.9.3-musl-linker-path.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-secure-plt.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-musl-res_state.patch
+ epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
+ epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-tree-vect-data-refs-correctness.patch
+ fi
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2016-09-22 6:48 Anthony G. Basile
0 siblings, 0 replies; 9+ messages in thread
From: Anthony G. Basile @ 2016-09-22 6:48 UTC (permalink / raw
To: gentoo-commits
commit: 54b01724ac24fd743f7fa38552dd9f94672c8c45
Author: stefson <herrtimson <AT> yahoo <DOT> de>
AuthorDate: Thu Sep 22 06:28:47 2016 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 06:47:18 2016 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=54b01724
sys-devel/gcc: bump to gcc-4.9.4-r100, fixes bug #583266
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
sys-devel/gcc/Manifest | 2 +
sys-devel/gcc/files/gcc-4.9.3-pr68470.patch | 58 +++++++++++++++++++++++++
sys-devel/gcc/gcc-4.9.4-r100.ebuild | 67 +++++++++++++++++++++++++++++
3 files changed, 127 insertions(+)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index c733638..8ab3bd7 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -13,6 +13,7 @@ AUX gcc-4.8.3-secure-plt.patch 1866 SHA256 65c60adf4a4fcf4707e8acc51e4062124b742
AUX gcc-4.8.5-posix_memalign.patch 1114 SHA256 87370f7854063bcf5f57bff931684c228370668ccf5ecd8e36ea9cf7c7455b16 SHA512 27e1a29e039dcc4c5190416702d1d95d48fbaeaac6440d81584989fe71a12f7bf5a484241ced9aa82b9f050eb3be8786d9584ba5299d304e7ed30506755880bc WHIRLPOOL e5bfe16163580f1fba8d80fa80f1aed6c3d4f22e32e3eaf0234181c214b7885c40f20d9e794d76225ca2449c6c138f051ed14fdeaa7132f05c6ba6c786ada7e9
AUX gcc-4.9.3-musl-linker-path.patch 3556 SHA256 22228421551806b81a1d3aff438eecf4202f64844141863fb8e665ef3b5eb5fb SHA512 cf58b49311c1a7a4cbb04a2ffeccdaa278872512e67b72ebe292fa155f419dc6025d158b67d58265de67edbd18c6af67f28c6f6806b581a8fdb9015ad2ee0aa3 WHIRLPOOL c3d5e9c7fc64cd8a8bacca714da5881ee8d94585e0064f5e3965b20bfe23c48bbe8b0bc886cf291d616e51786e80d032c19bdce59a15fdb310546b61a0ab0886
AUX gcc-4.9.3-musl-res_state.patch 699 SHA256 822990f5075b65dc2d1c03722daa5a215301f9ec2c4323c10e80fff2fbd04e71 SHA512 93f59d16e026672051b5a65110f78ace0c91a4f1365b861e22741fbc42b92c4490e55068ae845bbcbb5af9221fb874e0b855a763189528a646e757b133117e28 WHIRLPOOL 98438e82aa8d387b5a96bc58d3a137766661cc53d7396165338448394c14996687626f46e9c93bcb6b2a2e422b97445f5097489616a0aff619cca01c8243a56a
+AUX gcc-4.9.3-pr68470.patch 2053 SHA256 9ca76f063735fb87ee01aa9321f714a04db2dd394381c5a659f7081eec9b45e3 SHA512 5950b4782034add9ded16ab4b6d7b2d5e2bbda1a3ae7f465d50c6a95469359d287126c1a57ac9d8c6ea2c61d7b18ff880b2ac2b25eec48f038452f87f0e24393 WHIRLPOOL f216b046bfe55003af384b573ca0be977d310064f31fb9d8cc15badd6e4b4922b761004c02b44fe04460ece1f82d55eb5c35f09c006015b97cb7968347877dcf
AUX gcc-4.9.3-secure-plt.patch 1478 SHA256 b9435e19c3193e872bfdce8f635755655cf6e88889c57d21c7afa118d7068e95 SHA512 95f04716bad41fe3f290d44d21d1dad35548b801b56de331acac8bdf56019583a04681418a805a0b4dbfe19e9b51cecceff984cea257be58d3e7780c6cfc58a5 WHIRLPOOL 8af1f0cfaf0e8197754d841d1cd2b25615968cc503344574cd9ec6b644804e029687a4ded18f6e1efd584c8c99277eceb6f1012c6519a2747bddc400d8909c1e
AUX gcc-4.9.3-tree-vect-data-refs-correctness.patch 315 SHA256 904ae5ce2ecd5a2f7786c54d148a7562d0bb6f51fe60761038c2f57b8cf70356 SHA512 88d93c061ef72035522270ab60c8c2ec04e2fa2d69763f45b9eab0c37b19c23920484358d7556ad885775071ac04cf94684a2cd8ed93418d5f0c54ac3a045c9d WHIRLPOOL 2b9c281401abc111d53467c51b6238c6f4c430a73d8833f161766f973138ffe3b4fa1ffe5cc5813b5e2f8a81dee2cdcaaff2b9a8f8e13089f993f3ab3d69ccbd
AUX gcc-6.1.0-musl-cpu.patch 1277 SHA256 6c7a28ccc5edc226fc6f3f6b9b0562fb873a9c88dfb25b608b5acd827f239c08 SHA512 b11c5933c02dda63b40273f6cee394d52c68265931817cfeea3645e971b9c822cc841242a7c74fcd07729171bc0723c2af0db21743bf92dd3dba3430ee6627a1 WHIRLPOOL e0f6068a8028052f88cef840026baa459ae77a43d9144258fe7739a80b5dade852a2aa640feb5bce51dd54d6d35e0c8df99a8c9bdc140f9ae473f16ffb2e9af7
@@ -63,6 +64,7 @@ EBUILD gcc-4.8.5-r99.ebuild 2139 SHA256 0b762e2fb8c2bf92488b598c01977b07a3786afe
EBUILD gcc-4.8.5-r999.ebuild 2185 SHA256 7b8b261c0d3ea2e34a2f099b4f0a23a5bfd61e814dead44aeb4e45071be2c3f1 SHA512 e8f6e8bba4fd7818c30a555adcf25acbe818919c98204f91e27be04566aa267b9394547045e05e5486437853ceb1b75229d86089f69409a626a9e81e363c12db WHIRLPOOL 872e4f0e40e2b9a0a51002c64e682eca1990c2b968c8917b9a1a7c309075a048ceffd7925bf7f67cb3f304badbf29ee5e94772f5a86503e1e5e42fa7682fb87e
EBUILD gcc-4.9.3-r99.ebuild 2195 SHA256 3f5be66ffc6fb064e14a24cb9005d1835685573f245ed1aa5143c5f5e7ba1a90 SHA512 c49043c69947bc37ab31142f51060ebc8d922bb13d4aae17957c60bb45e2494cba4724e8af3ac2f0d4f09ca4b3676645657a08b4893ca01175917bc07ce827d9 WHIRLPOOL 9b1bec2a6fe2ae003a94ba73bcf4b207db0f5a2988288820581508de7649d3e46a163852514755f49051be00fc43846844cd24cd1a8fe2462315ddeb53faf0a6
EBUILD gcc-4.9.3-r999.ebuild 1794 SHA256 514b9f6cddb5e6a43c53f866aa501812319bfccf7fb7713316563d55cb139aff SHA512 c7f4aad21658d6acb99f14b3b51707a74387206b9fc3629d962c755a7eb8a963b3df844ba60172305fc2e753fc7178d4723f02a487aeae643c85ff00062b4bd3 WHIRLPOOL c6372f1014c5b8d22023f04b7223db4ae5d898f450f3d5cf286ccd82553f916978fba8d0910dc72fd5cdd1d92ecce9749597b09e252a58ff898d3616221af685
+EBUILD gcc-4.9.4-r100.ebuild 2320 SHA256 62a7b580317230c294b8103b2acbfb5ca49afdaf1fd6f2fedbb778a02be65d13 SHA512 fcbc99e45c09a77a4869328df5136c9530297ea810baad10d28faaaab5ec15dcde2b105fe3b30a5190b86740b7bd962a302d9b4c8e65551f226fb2fd00eb4c2e WHIRLPOOL 6b73fa54aa7edc1e44a2b1bbb76f13e8135a21301a7203343e226b2112437749e12f5503a71f3cacc221ebda2d99c8db45b882d1cd014b8731acf3433f5c7c7b
EBUILD gcc-4.9.4-r99.ebuild 2268 SHA256 fdb60343669f5a03820920f9ee06d54e42def02475613f3c0221e4234f7cfcc6 SHA512 3b8df38d0600b5e006293e69265f3e9603dab01e40ba5391fc8e517d185388c3fcbcff571a7babb729e19a86ea37fca5b45f800fbf856c4d2c01d3506c5c32b5 WHIRLPOOL 2ae8860e5106d4e4b3680a7a885bdb80e5c5381e9cd608a6f55f6fcb69c9407b675ea2d18a2e8960be4408dea35228c5bc80f14d27a68e1d53f2e4fbfefed0fd
EBUILD gcc-6.1.0.ebuild 1076 SHA256 6d5acd2030e949af48922a3da83541c0720037212c71c1867e5de8373e8bc0b0 SHA512 7f4c657c930a7cb0cfdd34ff8fa811eb2e62834ed0ec094db6bbc5123ea8c86b72df1cf32d6660c0ef2dc3863276081665b95af0a1c47a1ba14802a5559e776d WHIRLPOOL 73f9a4277585013050291df58b6d0c7db7fa65baed51c0a1b9462c212281de9d98d50c63be9d703fd45efb61e596fb74861aa41e17f4ac1917adb4f44961c18a
MISC metadata.xml 2039 SHA256 b200834baf1ac8adf966540ee7e50dbf1397248f08eeff35a8bde6bb16dbcc50 SHA512 b8fe281c88017b4d5d2ac05ea4e074d740b3943bc0d4cd361ec4f161f2549fb6401a2fa7881c06a4eae33ffd9755b6ebc4fa608654ec04838bff49ff22ee74a8 WHIRLPOOL e063f7657a00a1e675a57000fed2fac1c05e986488f3a705c95909ac7a2e74ca8f97c6fb8bfffdb81388a967228a78adbcfa93b166d4095aade5875aaf350fa0
diff --git a/sys-devel/gcc/files/gcc-4.9.3-pr68470.patch b/sys-devel/gcc/files/gcc-4.9.3-pr68470.patch
new file mode 100644
index 0000000..f1a7464
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-4.9.3-pr68470.patch
@@ -0,0 +1,58 @@
+diff --git a/gcc-4.9.3.orig/gcc/ipa-split.c b/gcc-4.9.3/gcc/ipa-split.c
+index 0d1495d..688c954 100644
+--- a/gcc-4.9.3.orig/gcc/ipa-split.c
++++ b/gcc-4.9.3/gcc/ipa-split.c
+@@ -1122,7 +1122,6 @@ split_function (struct split_point *split_point)
+ edge e;
+ edge_iterator ei;
+ tree retval = NULL, real_retval = NULL;
+- bool split_part_return_p = false;
+ gimple last_stmt = NULL;
+ unsigned int i;
+ tree arg, ddef;
+@@ -1162,12 +1161,28 @@ split_function (struct split_point *split_point)
+ args_to_pass.safe_push (arg);
+ }
+
+- /* See if the split function will return. */
++ /* See if the split function or the main part will return. */
++ bool main_part_return_p = false;
++ bool split_part_return_p = false;
+ FOR_EACH_EDGE (e, ei, return_bb->preds)
+- if (bitmap_bit_p (split_point->split_bbs, e->src->index))
+- break;
+- if (e)
+- split_part_return_p = true;
++ {
++ if (bitmap_bit_p (split_point->split_bbs, e->src->index))
++ split_part_return_p = true;
++ else
++ main_part_return_p = true;
++ }
++ /* The main part also returns if we we split on a fallthru edge
++ and the split part returns. */
++ if (split_part_return_p)
++ FOR_EACH_EDGE (e, ei, split_point->entry_bb->preds)
++ {
++ if (! bitmap_bit_p (split_point->split_bbs, e->src->index)
++ && single_succ_p (e->src))
++ {
++ main_part_return_p = true;
++ break;
++ }
++ }
+
+ /* Add return block to what will become the split function.
+ We do not return; no return block is needed. */
+@@ -1212,6 +1227,11 @@ split_function (struct split_point *split_point)
+ else
+ bitmap_set_bit (split_point->split_bbs, return_bb->index);
+
++ /* If the main part doesn't return pretend the return block wasn't
++ found for all of the following. */
++ if (! main_part_return_p)
++ return_bb = EXIT_BLOCK_PTR_FOR_FN (cfun);
++
+ /* If RETURN_BB has virtual operand PHIs, they must be removed and the
+ virtual operand marked for renaming as we change the CFG in a way that
+ tree-inline is not able to compensate for.
diff --git a/sys-devel/gcc/gcc-4.9.4-r100.ebuild b/sys-devel/gcc/gcc-4.9.4-r100.ebuild
new file mode 100644
index 0000000..902eceb
--- /dev/null
+++ b/sys-devel/gcc/gcc-4.9.4-r100.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PATCH_VER="1.0"
+UCLIBC_VER="1.0"
+
+# Hardened gcc 4 stuff
+PIE_VER="0.6.4"
+SPECS_VER="0.2.0"
+SPECS_GCC_VER="4.4.3"
+# arch/libc configurations known to be stable with {PIE,SSP}-by-default
+PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
+PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
+SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
+# uclibc need tls and nptl support for SSP support
+# uclibc need to be >= 0.9.33
+SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
+PIE_MUSL_STABLE="amd64 arm ppc mips x86"
+SSP_MUSL_STABLE="amd64 arm ppc mips"
+#end Hardened stuff
+
+inherit eutils toolchain
+
+KEYWORDS="~amd64 ~arm ~mips ~x86"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ elibc_glibc? ( >=sys-libs/glibc-2.8 )
+ >=${CATEGORY}/binutils-2.20"
+
+if [[ ${CATEGORY} != cross-* ]] ; then
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+fi
+
+src_prepare() {
+ if has_version '<sys-libs/glibc-2.12' ; then
+ ewarn "Your host glibc is too old; disabling automatic fortify."
+ ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
+ EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
+ fi
+
+ toolchain_src_prepare
+
+ if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
+ cd "${S}"
+ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+ mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
+ cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
+ cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
+ mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
+ cp -r libitm/config/generic libitm/config/linux/x86
+ epatch "${FILESDIR}"/${PN}-4.9.3-musl-linker-path.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-secure-plt.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-musl-res_state.patch
+ epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
+ epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-tree-vect-data-refs-correctness.patch
+ epatch "${FILESDIR}"/${PN}-4.9.3-pr68470.patch
+ fi
+
+ use vanilla && return 0
+ #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
+ [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2017-07-02 14:47 Anthony G. Basile
0 siblings, 0 replies; 9+ messages in thread
From: Anthony G. Basile @ 2017-07-02 14:47 UTC (permalink / raw
To: gentoo-commits
commit: 157237ea22668f6eb6b06dc385c21aa3a2c6e64c
Author: stefson <herrtimson <AT> yahoo <DOT> de>
AuthorDate: Sat Jul 1 15:53:25 2017 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul 2 14:18:05 2017 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=157237ea
sys-devel/gcc: fix memory consumption on arm
sys-devel/gcc/Manifest | 5 ++--
sys-devel/gcc/files/gcc-5.4.0-pr70473.patch | 43 +++++++++++++++++++++++++++++
sys-devel/gcc/gcc-5.4.0-r3.ebuild | 1 +
sys-devel/gcc/gcc-6.3.0.ebuild | 3 ++
4 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index b0fa435..1aab307 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -27,6 +27,7 @@ AUX gcc-4.9.3-pr68470.patch 2053 SHA256 9ca76f063735fb87ee01aa9321f714a04db2dd39
AUX gcc-4.9.3-secure-plt.patch 1478 SHA256 b9435e19c3193e872bfdce8f635755655cf6e88889c57d21c7afa118d7068e95 SHA512 95f04716bad41fe3f290d44d21d1dad35548b801b56de331acac8bdf56019583a04681418a805a0b4dbfe19e9b51cecceff984cea257be58d3e7780c6cfc58a5 WHIRLPOOL 8af1f0cfaf0e8197754d841d1cd2b25615968cc503344574cd9ec6b644804e029687a4ded18f6e1efd584c8c99277eceb6f1012c6519a2747bddc400d8909c1e
AUX gcc-4.9.3-tree-vect-data-refs-correctness.patch 315 SHA256 904ae5ce2ecd5a2f7786c54d148a7562d0bb6f51fe60761038c2f57b8cf70356 SHA512 88d93c061ef72035522270ab60c8c2ec04e2fa2d69763f45b9eab0c37b19c23920484358d7556ad885775071ac04cf94684a2cd8ed93418d5f0c54ac3a045c9d WHIRLPOOL 2b9c281401abc111d53467c51b6238c6f4c430a73d8833f161766f973138ffe3b4fa1ffe5cc5813b5e2f8a81dee2cdcaaff2b9a8f8e13089f993f3ab3d69ccbd
AUX gcc-5.4.0-pr68470.patch 2012 SHA256 f8949e1d35bf7bba80aec50bdcd5d6b008f731679b06f3d89e6d8a4eb98e492e SHA512 dea9ab12a37b88308424af2882b4755366745c204cd74e6892374d4aeb0981487f9fa1d44ab4d4e6184c83547c3ea30ed731719fa074bea62bdf8bfcf1dfbca0 WHIRLPOOL 2f66cd0d2dcaf237fd730eefe6f477970db14c237a8309925f799984a010f5470f6fc0f6a735316c7eab4de9dc958d773a4ffa14eea7093158690e9ff8f1847e
+AUX gcc-5.4.0-pr70473.patch 1665 SHA256 d674821a34356e78c4aa8405fc27f30effd5a7ab4f5929892e23a4c53023e137 SHA512 6fc8f70a1e34ae475d15fb20e198b63f00a11eff3bd09f1518b76d9622d32c9500beb49065bb1a32dc40119146f009bbda21fd0e74bc200771384b547f282680 WHIRLPOOL d22f1daec32b91bd29d6b87481681c86f405b4f5567468339b9f25e0e5ad6818d171db1692be588a0174767f9fcdf21a28d895932a8ef7a2ecc910a1984075db
AUX gcc-configure-LANG.patch 2052 SHA256 63de6d2dcfe14f21d147abeb1390405b9220c03f8e968f482d4b4c1cf279c88b SHA512 a694c7ac2f45cc657097ff5b0cf1356ac88a9c06035c9ba15167e9d444844d0d8a478eb1b9b62195dd063774f79697b9148b9cdb6c261640b472c291061b2129 WHIRLPOOL 3cc1ec912fb192ff1058de5b93e49a994ba30d1501a932290dd5b3df1cd783875621cda56edeb41894cd5fa10c04917e693a40a60be8d742ddd7992bf5d8afeb
AUX gcc-configure-texinfo.patch 337 SHA256 74b73a7ecec2d88889876b4db480cd173632f49d5396bb8e5b3c93673f9b5b98 SHA512 a15fba8bf2ff02bdeca54d6f186bfa08c1079c6a8ba0a3beef154483ce5c1b8c497e7ffeec32371968f0037e0ff8384609eb0c367d0155a4e5a7eef8aad084d5 WHIRLPOOL 39d008aad06f7621e4e5db15f5e85a59e583b43f8d247029bd4944466bb60a9795bda157d185c45c329294078e282703a243aad5c468d90c77665dd6336870d4
AUX gcc-spec-env-r1.patch 3148 SHA256 da0a6442eb42bce58cbdc7858b110a2e65fc5bd5b4b780b9b491033de6e302fa SHA512 ecae71577543772cfe1711f1b4a8815c0b5d706ebd01edacd1f07586637d4805e25771f970a6e6d1bb696d4b1b5ef3e0036088a96a9f6beff7ddaee704175d16 WHIRLPOOL 3535605998eabccdee71ba396ed5cefbb8b0a8cb073101f6444c7d01233f3b3904c1b29f4daf0a3417c68de8dbd62a0b7dc367cacfcbfa0c4ee1b69b7df8c6fb
@@ -81,7 +82,7 @@ EBUILD gcc-4.9.3-r99.ebuild 2188 SHA256 42d68fd38f9bbfe9ed5cd38502bcf55159d00271
EBUILD gcc-4.9.3-r999.ebuild 1787 SHA256 f2620bf8ff9ebd84e298e3e433ee427398e63811de61bee0cb7f453077d7c50e SHA512 70e4a98a2da45798d426d29f92191bfcf3415b99c13f32b0195ad157b556af308061e7d35309d64882d92d3be95fd3b4b1f58383abb9e2483c7c433caac7c5a3 WHIRLPOOL 01cb5b7819d7ac3508cc01fc6d5058c8b301e75d530155d571a198aed92d50a055899bcd56dc399081f02eb7d26698543e84e6dc348e5829e43d920ee0341e3b
EBUILD gcc-4.9.4-r100.ebuild 2313 SHA256 08ca3c854dc7fdf863a659f0c745bbe92a094a60b71beb12aca2bcef8a555c1c SHA512 780400349b18484bfa253091bc0d9f17319fb892d202b226f72f114ee48d843665bf1ec00e08ef9ea0bf77ea72e13c4f1e2b732d63a252528e6d4ffcf92e151f WHIRLPOOL 9333b35db26f056416975313e4510d775b23844c2c4c8a3847b9ccb8b010fa983adf940ba2a1577d4de45c522de26d56d638115a814bde44084d3b3bcb06ce07
EBUILD gcc-4.9.4-r99.ebuild 2261 SHA256 770df64ec98bcc6071a482abfa68b3b38a0187b6e13d58ad8b26ef8495e7ec07 SHA512 ba472cc558a94e3ed8632681c7678287fadc0303f1ff88b575e5b41e9087f9efff7332621523618eabc2fac85f71dad6a16194b9b8d55d023f77af2fe2d235b8 WHIRLPOOL d0bbcf867f789e469171f30d8188264ee66426fba8662f26b47bb0befe91fea2d9d2ac50e640816e5c746648b478414ac62ff5db2d97452becc4d1863159a725
-EBUILD gcc-5.4.0-r3.ebuild 1887 SHA256 b3861f388bdcf6bb307c9011f2b2f11b9b6fe86a5ccd7ff2f4674a57796d932c SHA512 0b337cfa74dd246d702b5cb4aa64d8cd452f2ae17f9fb988f18318c871f51f0fa718c297e6904193f0499ec7184e9f4d7b503b47d6bd971091e65d53235645d6 WHIRLPOOL 0cc9f48d5a78d3f602a44be4e9a29df2c8c3bac70616c426f8cdd7b730b19f05d567901a993335e04c326230d6717737a6c78dd9d9ea05a2470b0441224aed1c
-EBUILD gcc-6.3.0.ebuild 835 SHA256 e66794320f8ab7bfc19a9c9f79abe20e4b18a12d84ccdb1fc7df3bf02cb6a224 SHA512 c1d09cab9b39f7ae68db577b30acadd9011794e7d92ee6a80edb0e4508eecb46903f53474743c5832e97a3361821a803b14010c98f8e6358cc0d3c44046c5fbb WHIRLPOOL 51ed759e2686e217fc4b4983b2c26c7843150df8cc1fddf0379e9a973bacd4e242a17a02fdff3f8b71ca762e670d8c63fc2c073d193b74218eecee353db50216
+EBUILD gcc-5.4.0-r3.ebuild 1935 SHA256 82eb647e6cc5cb335983b40e78ebf3671e22835d34b6332ee671d20d6f318158 SHA512 bdf56782fe2845fe05ad2206d420ab65f6ebad06de997c713bf8f34d97d8bb4a1be97462846d9b31f033abf6ee4bbddd24d493433273b33ba3e772557d2a90b2 WHIRLPOOL d24118954a322666913fdfa496c226f24e66811f1074fa6120525be891a4a057086fc898a237b6b570c9bad70e0407dcbe12ec54aad25deea856f9d2b11509a1
+EBUILD gcc-6.3.0.ebuild 902 SHA256 f75f2d455bd332ab08dcb12ef5101319b9117ea48d773e782d7ec9e9bd017738 SHA512 2cb339bd2003d2e6c0e649377c693a5c6874583ac27d1b60ffa3bc9723f83c26554dd385154133e8384a92e85c0c134bbb787c7ba34e1ca174f05e23758d1bb2 WHIRLPOOL 88a7ef0e56136cb610f16aa92be0967f40d59d7ee1877bddc213035fd8007745beb2743b5016acfa6bf6a3f334e002e311c0e457aea2b68d4f7a9e311f6f1d4b
EBUILD gcc-7.1.0-r1.ebuild 603 SHA256 9cbff0ffd838af811cde3103906c146eaf17517caf48c8ad62a9216bbc435c8b SHA512 6dd72ba363429342fd12de1fcb677556b17d97cc98af1ac9c1feac76fd219d9e4fdc37b8838d28025d16a0179e85b21b159e24471d6ec1643d2c32fe09689543 WHIRLPOOL a8718baf8b73fff11bc7f8bdcad69df6060e96838ca7e6b64651990084777dba9d9d59c6391518622981161495bbbcadc395138472b9551d69fed47d2897f65f
MISC metadata.xml 2370 SHA256 88c4368c971e8bd943882901a833afcd03a541677a755310556470268b9024b2 SHA512 a5e8c2f8524f37881f422ef39d4a2ad74802f6e99bb7224cd48482f5b80964292ae6c760f8c39551b150875e721e654d29138cfb4b68b305dba181ce959265ff WHIRLPOOL a4b9abcf4cbd0e4c6a42cce373df9edf1cfd6fcd66efc7c04d7fd3748d5e82126e94bac5b25335aadb3c7ef379358e3402adc0a19c200d9c68ebb2773d0d323e
diff --git a/sys-devel/gcc/files/gcc-5.4.0-pr70473.patch b/sys-devel/gcc/files/gcc-5.4.0-pr70473.patch
new file mode 100644
index 0000000..798a457
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-5.4.0-pr70473.patch
@@ -0,0 +1,43 @@
+--- a/gcc/config/arm/cortex-a8-neon.md 2016/08/26 10:22:08 239771
++++ b/gcc/config/arm/cortex-a8-neon.md 2016/08/26 10:23:20 239772
+@@ -357,30 +357,34 @@
+ (eq_attr "type" "fmuls"))
+ "cortex_a8_vfp,cortex_a8_vfplite*11")
+
++;; Don't model a reservation for more than 15 cycles as this explodes the
++;; state space of the automaton for little gain. It is unlikely that the
++;; scheduler will find enough instructions to hide the full latency of the
++;; instructions.
+ (define_insn_reservation "cortex_a8_vfp_muld" 17
+ (and (eq_attr "tune" "cortexa8")
+ (eq_attr "type" "fmuld"))
+- "cortex_a8_vfp,cortex_a8_vfplite*16")
++ "cortex_a8_vfp,cortex_a8_vfplite*15")
+
+ (define_insn_reservation "cortex_a8_vfp_macs" 21
+ (and (eq_attr "tune" "cortexa8")
+ (eq_attr "type" "fmacs,ffmas"))
+- "cortex_a8_vfp,cortex_a8_vfplite*20")
++ "cortex_a8_vfp,cortex_a8_vfplite*15")
+
+ (define_insn_reservation "cortex_a8_vfp_macd" 26
+ (and (eq_attr "tune" "cortexa8")
+ (eq_attr "type" "fmacd,ffmad"))
+- "cortex_a8_vfp,cortex_a8_vfplite*25")
++ "cortex_a8_vfp,cortex_a8_vfplite*15")
+
+ (define_insn_reservation "cortex_a8_vfp_divs" 37
+ (and (eq_attr "tune" "cortexa8")
+ (eq_attr "type" "fdivs, fsqrts"))
+- "cortex_a8_vfp,cortex_a8_vfplite*36")
++ "cortex_a8_vfp,cortex_a8_vfplite*15")
+
+ (define_insn_reservation "cortex_a8_vfp_divd" 65
+ (and (eq_attr "tune" "cortexa8")
+ (eq_attr "type" "fdivd, fsqrtd"))
+- "cortex_a8_vfp,cortex_a8_vfplite*64")
++ "cortex_a8_vfp,cortex_a8_vfplite*15")
+
+ ;; Comparisons can actually take 7 cycles sometimes instead of four,
+ ;; but given all the other instructions lumped into type=ffarith that
+
diff --git a/sys-devel/gcc/gcc-5.4.0-r3.ebuild b/sys-devel/gcc/gcc-5.4.0-r3.ebuild
index 04ed1f0..c283487 100644
--- a/sys-devel/gcc/gcc-5.4.0-r3.ebuild
+++ b/sys-devel/gcc/gcc-5.4.0-r3.ebuild
@@ -47,6 +47,7 @@ src_prepare() {
# Upstream Patch
epatch "${FILESDIR}"/${PN}-4.9.3-tree-vect-data-refs-correctness.patch
epatch "${FILESDIR}"/${PN}-5.4.0-pr68470.patch
+ epatch "${FILESDIR}"/${PN}-5.4.0-pr70473.patch
if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
epatch "${FILESDIR}"/4.9.4/gthread.patch
diff --git a/sys-devel/gcc/gcc-6.3.0.ebuild b/sys-devel/gcc/gcc-6.3.0.ebuild
index f7e78f9..2dc3d1f 100644
--- a/sys-devel/gcc/gcc-6.3.0.ebuild
+++ b/sys-devel/gcc/gcc-6.3.0.ebuild
@@ -22,6 +22,9 @@ fi
src_prepare() {
toolchain_src_prepare
+ # Upstream Patch
+ epatch "${FILESDIR}"/${PN}-5.4.0-pr70473.patch
+
if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
epatch "${FILESDIR}"/4.9.4/boehm_gc.patch
epatch "${FILESDIR}"/4.9.4/posix_memalign.patch
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2017-07-02 14:47 Anthony G. Basile
0 siblings, 0 replies; 9+ messages in thread
From: Anthony G. Basile @ 2017-07-02 14:47 UTC (permalink / raw
To: gentoo-commits
commit: 42ad472e03cd46f4f8aab1ea357856f84810b990
Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 2 14:43:09 2017 +0000
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul 2 14:46:07 2017 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=42ad472e
sys-devel/gcc: clean up older versions
Package-Manager: Portage-2.3.6, Repoman-2.3.1
sys-devel/gcc/Manifest | 25 +--
.../gcc/files/gcc-4.7.3-musl-linker-path.patch | 61 --------
.../files/gcc-4.7.3-powerpc-libc-stack-end.patch | 171 ---------------------
sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch | 51 ------
.../gcc/files/gcc-4.8.3-musl-linker-path.patch | 70 ---------
sys-devel/gcc/files/gcc-4.8.3-musl-res_state.patch | 12 --
sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch | 43 ------
sys-devel/gcc/gcc-4.7.4-r99.ebuild | 65 --------
sys-devel/gcc/gcc-4.8.5-r99.ebuild | 63 --------
sys-devel/gcc/gcc-4.8.5-r999.ebuild | 64 --------
sys-devel/gcc/gcc-4.9.3-r99.ebuild | 64 --------
sys-devel/gcc/gcc-4.9.3-r999.ebuild | 60 --------
sys-devel/gcc/metadata.xml | 1 -
13 files changed, 1 insertion(+), 749 deletions(-)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
index 1aab307..92953bb 100644
--- a/sys-devel/gcc/Manifest
+++ b/sys-devel/gcc/Manifest
@@ -13,13 +13,7 @@ AUX awk/fixlafiles.awk-no_gcc_la 8480 SHA256 9697196d45cc47d3846021c0dfd0a24208a
AUX c89 412 SHA256 29ad5dd697135c2892067e780447894dc1cd071708157e46d21773ab99c5022c SHA512 71d33a147339d8d70a62aa22a95d3e70e445d8435d6ac05893f7da19ae851b89bea851f6ce213fbd22470f13572ae13b83cf02f0621333f07d7b0c68a79b7924 WHIRLPOOL d9707a2be8da7a709b54fcb1154cfa05e479f8c3bdd6173822ee1f1bc265b2a0d04741c0685bfb0db68e1e4297fb032d2f8ff94da88014575d947054474d8295
AUX c99 446 SHA256 057b348cf5be9b4fb9db99a4549f6433c89d21e5f91dc5e46b0b4dc6b70432f5 SHA512 bf3b0eb1125d5e89b433954fcbf805cd86dec5a6eeb23df685ebf3ff83a610573f2ffcec65d893244c845936a73918387cba026710c65c854b2c94a78b007989 WHIRLPOOL b888038b96615c7a0363555b407a3de2c1f17e34428fa16dfbf56fcf68875d6bcdecbc61b545d7f71842ff1909a3ffeff17165fa7f56b48f95adae22f5f8bff1
AUX fix_libtool_files.sh 1528 SHA256 ed1fd90b31c2865fa78e24166f5523dfd8a79baa932ba9b2e1b34031dd17ac82 SHA512 c0698e7af969a701d7a2fa68cabb728d6271aeb7cca4d53bbb306906dc1b6a30a756ec01df2eae03712fd21865ff2779a0cd92e44c15774a812f935e7fb308ae WHIRLPOOL 5ffa5cbb84edc4e7ecac0bcb6a1d375a9a5ce0369a609f32d7136dccb08f2a82c9baaef8e360c3ccd5e2d3ae7e2bf62ad24ad258c3d16091aaa7cd0ad29f0fea
-AUX gcc-4.7.3-musl-linker-path.patch 3097 SHA256 dbc140267f3ccaf7dce4dbb153920d90018c453ffbc531864cc73a2dc5f002a2 SHA512 2c33899aa8bb8a8b1ad974c3da9039984aa52fe2d2f52d0f6ddf3aa6386419ee32907f40f60db552abcd0e1dee04cae91a029e37fe531938614f9c66e9518cd7 WHIRLPOOL d4f8a1a6abb083566d4ceb5deed31c2c35bd06f4b786ecd365d19606413c5e7f8579fac05a990a12157a139c243286ebcb7c61108ed69ae6477ef20f579cec86
-AUX gcc-4.7.3-powerpc-libc-stack-end.patch 5374 SHA256 880028136d6a3352e74664d0fccda293fe078a5adb58ddb84cbf4d301aee01c7 SHA512 c66b561cb8db68f86b9c001625fb5599db268e576ac163eb47226976e81dc97b3d4ad3cd9f9b0ef44cac0ca9d353be3ae4709e75ed319ff08175ff4e1b1aa174 WHIRLPOOL c7ae1a535410ca5c7d5a8e3b2f8f2bcaeaceaf1cc9c20b3426efd09422b3a957cca7527842f720655a94b5bc8c82642eef0d693003071bd7f80a381d58be848b
-AUX gcc-4.7.4-secure-plt.patch 1915 SHA256 668c57298064abf6d58857126cdbcefab6d3117726198185ca4f24855c3f7180 SHA512 0e23385b9e654acc296e5b3f333b5859174dea852f38bc5acb182ce15d6ac568dc588c69407b066dc0b91ffb48a1f1c0d8d25720d3ab268da8a56d1c6c40492a WHIRLPOOL 9e061026ea0f87416ea0cd39dc64c074d79001f26d513ec2a6777b42caf47b6bf250bedebcace52c351cf95710318012039da58fdc7d2ef59e51fffc445e3edf
AUX gcc-4.8.3-musl-fix-libc5-assumption.patch 529 SHA256 74cdaebe0e376c05f64808f9ec61682b5dc6f29fd36883af8e54dfcc261d68f8 SHA512 7fac0b48acf187d4a56f63148af51a17fff75d97fbe2b8256efbb51ba26d74ea06e11e0834f04f5d1f4b492cfd5860b52252428b9c87d7dfbe813d4601e782d5 WHIRLPOOL 6b830b5fcc56ae2cfe96ce17278063004a0aaa80db022daf6199d5c8cb49764ed7e2d9863d0d16e9b5e29ae031c4326ad940fa816d64f0ae257899c392fe9d18
-AUX gcc-4.8.3-musl-linker-path.patch 3425 SHA256 d5415e1ae64dfb0e2b9e164806884441c62e5261e3d253437afd8e885529d2c5 SHA512 c2d62fb4e7e636c95ed013910b84ea46b09e7af8dc03ca7b7018f9623ebfdb3aadf277a3248a9e01a913445cb03dc1a91e46152198d02c272f35c559ea6b825f WHIRLPOOL 02666002615a49f45b3c977e90053de399d88664c6332c886e6aded8faa73abcdda7374e67f7848a40f05ed2a13bef0ef5725f237a1a9b971e467790176b0f35
-AUX gcc-4.8.3-musl-res_state.patch 668 SHA256 ff5948712855a10f4b65750b9fa3fb188adf69ff5612161aeff5e6674cf292ba SHA512 bf30a772b5858210ac8ed46c50146655df98809c1daeb755fad9de592e7339c2e25b0870efd6351067f12e93a2270774a0e7bfbf0dfe8e0301c145c0dd966b30 WHIRLPOOL 457a548a900536024d722a2ff27f757a167c2ac9f1c4b3f38b0bbd29836b80938ad977617a1dfb71d81e063b2dc7213e8332ef4f9ad2a36eb402b8f97727b427
-AUX gcc-4.8.3-secure-plt.patch 1866 SHA256 65c60adf4a4fcf4707e8acc51e4062124b742601ed7f7ae049e69790cb051658 SHA512 5a4ab263be1e10aa1d7685c0dcd2537e0ff1d50b3f9687064988ae04f18f995fc608e76644ba657a28bb1217c96dfef7b64da7e6fa3ed522001140a51a67a8a3 WHIRLPOOL 2a60dcea7de6e2706370ed66f3b7f99c250bce96021e1c7ee16cd9d3358bea4bcbbd1a893662e8027dc59a9e58f95c890c81ee2070e83170b9a83b6d5a9d8ac7
AUX gcc-4.8.5-posix_memalign.patch 1114 SHA256 87370f7854063bcf5f57bff931684c228370668ccf5ecd8e36ea9cf7c7455b16 SHA512 27e1a29e039dcc4c5190416702d1d95d48fbaeaac6440d81584989fe71a12f7bf5a484241ced9aa82b9f050eb3be8786d9584ba5299d304e7ed30506755880bc WHIRLPOOL e5bfe16163580f1fba8d80fa80f1aed6c3d4f22e32e3eaf0234181c214b7885c40f20d9e794d76225ca2449c6c138f051ed14fdeaa7132f05c6ba6c786ada7e9
AUX gcc-4.9.3-musl-linker-path.patch 3556 SHA256 22228421551806b81a1d3aff438eecf4202f64844141863fb8e665ef3b5eb5fb SHA512 cf58b49311c1a7a4cbb04a2ffeccdaa278872512e67b72ebe292fa155f419dc6025d158b67d58265de67edbd18c6af67f28c6f6806b581a8fdb9015ad2ee0aa3 WHIRLPOOL c3d5e9c7fc64cd8a8bacca714da5881ee8d94585e0064f5e3965b20bfe23c48bbe8b0bc886cf291d616e51786e80d032c19bdce59a15fdb310546b61a0ab0886
AUX gcc-4.9.3-musl-res_state.patch 699 SHA256 822990f5075b65dc2d1c03722daa5a215301f9ec2c4323c10e80fff2fbd04e71 SHA512 93f59d16e026672051b5a65110f78ace0c91a4f1365b861e22741fbc42b92c4490e55068ae845bbcbb5af9221fb874e0b855a763189528a646e757b133117e28 WHIRLPOOL 98438e82aa8d387b5a96bc58d3a137766661cc53d7396165338448394c14996687626f46e9c93bcb6b2a2e422b97445f5097489616a0aff619cca01c8243a56a
@@ -51,18 +45,6 @@ AUX musl-gcc-patches-4.9.3/vis_hide.diff 578 SHA256 0c315644cfc4802c01ac60dab08c
AUX musl-gcc-patches-4.9.3/x86.diff 1869 SHA256 35363d0f34d81a4071abc88d0652b64b284c5dcbcd79eefe5c304be1a3b3327b SHA512 d7c3efcf9debc2f45bf5332f90da5a0dd1ed8c937326410d9f7537c8f19f7fab054d9a5e6023dd0cc2d3851a440f28e1243c9ef827f98953186b3eba64fdf3f6 WHIRLPOOL fad408e204b8afefec4dad0ba646b91bca143b8ddf3ed173376c959ddf47db9473879f42bf5fcd346a4a6b06610addafa64ae6b565f2b1df689acba539164e52
DIST ecj-4.5.jar 1470676 SHA256 98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781 SHA512 d4e1bf7538ace56e3d69fa91da5bbd16c272923b4de0a9d8dee23ea2b75f9f38c603de72fc4061df49285c450b63f3df211cee5270e9fffc5447445d1a9c9e4e WHIRLPOOL db54206cfd5eba935e707b8d36ebac40f3c4ed3c1f06ede794288cbdd9c7da9d90c0898e8c98b383af276ea4c1b40c861ebd9e1fc1dce712946184321339d3ad
DIST gcc-4.4.3-specs-0.2.0.tar.bz2 2004 SHA256 f6c7cb99beead66dd4d06f7004c5731a9360330cbe878ce79792c618e008eed2 SHA512 779ecb0a064d2138b54569c8ae501975b8a6b72e5a3acbf8597619a8db77ee42ef9b0e62608d5192a15e4393e7dfc009bb50b994782236faa744b2c46b5fe517 WHIRLPOOL 8a1e45aad9d306cb19de93c63b5854a97e629d90852feb6861dcfca042b6257705304fc13ad65655a4cb227d36b83fc6063648c94f270821574ee0e85307094e
-DIST gcc-4.7.4-patches-1.4.tar.bz2 18072 SHA256 cef0f9d5624fd583eddffe060fb882e2e3b7ed43e517e03df7b3472189237327 SHA512 9f5d68ba62aee909023542dcece81e4e448ea750254258107d4f70291d8ae99469c4518e42ffddbe6b622b258f463127be6e6ef7eaaeeeb0f59b3b719f3eadca WHIRLPOOL a5d76b577615de7a472f591bc031552f7b3e4dec7fb58385709235d763d416f47c2fa8ff4c73531ad023ee50dfd25b1e0c1752dbdca4ae19f736cc79428d63bd
-DIST gcc-4.7.4-piepatches-v0.5.5.tar.bz2 15358 SHA256 6b568bd204e3ffb177df1830e5a888be3987491b4183bdb6ad75ad83c642a348 SHA512 f5e078bf4c17f7b5be102f1e3358d91c72e80363b5e055a92461f78399a1bf27bf6cb690d41900719bb260b6529f5d1aac999e613fda6ac5e4efa27f622510e6 WHIRLPOOL 42e348d5925cf4d43697a6dc06c911cc617f89037949ce1d8f7aa0fa93405f460e7416d6cd00e8fb2aac54c6f26fcae00691917f1517fcfb6891925efa3d3400
-DIST gcc-4.7.4-uclibc-patches-1.0.tar.bz2 3019 SHA256 cbdfe2947f653e11ac391dded461416e5cef1ff8900cf8fe92672de797b4018b SHA512 c2e6c96b74365f8233f6106fa03d94075b60f6f77c683aa2e27aceb007da723243f8e3ddea8b178e6a0f7939b8e35615165534dc74e5050f87680ab261a31c52 WHIRLPOOL 53c8bd64336eb55d8e3d62a33267d3d99c0239d5c818985a9830fd776d766aabf4b0bce630949c5b522580566e2eeba1b59bfc1b8388dee7ec6c990512d2c499
-DIST gcc-4.7.4.tar.bz2 82935453 SHA256 92e61c6dc3a0a449e62d72a38185fda550168a86702dea07125ebd3ec3996282 SHA512 dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189 WHIRLPOOL df8408e80634ce28f105f9abcdcf38fba5c130795cbe48428527a68819abebc3bc7152bb6ad714e40c71450a08986b48ddd630c887e1b2faf07c3babfe720969
-DIST gcc-4.8.5-patches-1.3.tar.bz2 26025 SHA256 4a165e6a387421f581f49c742243bf013c9fb7c91f44514be7b38292178ebbb4 SHA512 8d190f81ca0d25281250dbf0a670fcf12334b0811a5bf664e6450942a2996d02b979c6e8f8760b287edad06df3d1f8e2fe5cb0c3dcf9677c3420457d841d9506 WHIRLPOOL d31b3f48e13e5a9292b704afc745cbea038e61eedc4dba0d659558b56feeafec118043f3430457f71dc938760d72860e4318b2238b3bee9fba069c740327b78a
-DIST gcc-4.8.5-piepatches-v0.6.2.tar.bz2 14265 SHA256 3a823af1b4c590076b95790614d49448dc0ee6ff0ace221f2dacd9033b58eac7 SHA512 cd6af4047d4719dae9dbe86ce5342c7d8ddec38aad032486713b08e1b0cb711f5ca017e08d583137d51b8d4ef673366ba310e71bca7b49b82e9314781d6e9d99 WHIRLPOOL ca1d0a9cb9abdfddd95d433b2f0424fd7cc9d514cf4c91fb266af4c43e26e0b3084adfae0eb5c998dbee83551e916dba3cf438b338f7e4ac1a133f06018e398d
-DIST gcc-4.8.5-uclibc-patches-1.0.tar.bz2 2976 SHA256 3654cc2bb47173b9d40650374c465a0798faab53be5ee4446389af1acd610a27 SHA512 5469128eab06525915c75241797ad9ec4b63072ebfd5e110319bf810633cf3fbed39bbda4f6a0c74e537b248e7642780ecbe2086ad10be6e66b7dd289fa6534f WHIRLPOOL d5e11a7d83d11455d84deaa464b8cde0865c730cc140daa5d7b0e700a79f188c6efba88b1c5704b20ede2dca701fb88cf581bada2f4352fbd0e0a5571c436612
-DIST gcc-4.8.5.tar.bz2 86165587 SHA256 22fb1e7e0f68a63cee631d85b20461d1ea6bda162f03096350e38c8d427ecf23 SHA512 47fdfeca0c0a624cdec9c4ae47137d056c918d5c386d4b96985bb3c8172aba377cb66cbcc30e80832fd244a7d98f562c20198056915c70cfef0977545073a8ea WHIRLPOOL 026253cd2f3706871dfe2525c0302b38b3f513f6a62666d0ba0ca2e62d6513f09ad5c1177f2a63ae3bad660fe60e7909b6930d26df2b367b9ec68e14552c6e11
-DIST gcc-4.9.3-patches-1.5.tar.bz2 25384 SHA256 e1c43125fab5a4db1997a01b362b3611907c9020e41a591e5eb2f5669f216538 SHA512 d266790b1f537c7c3de459cc67f9151b77b16b1e36780c3d2a02f2e4627d5a0f8f6430d7092bbfa6f9a4667c02170d3ce75b0453b6facc94998d414e58f4a1e1 WHIRLPOOL 31b4d54f0858f5673d76590ac822e097ddf799d4eafba81c1378af7cbaadd7be8634297ca9f900a78f7382ebfa9626a40e12ca7c06eff88431de04ddd4d2cec0
-DIST gcc-4.9.3-piepatches-v0.6.4.tar.bz2 14431 SHA256 012c3025ac2e14781ff25028c0b1d42a07f510b125006116e268bcd90fb6c9db SHA512 3bbeacbca5e8ef6ab0b1d58add42f5e8e82328afe024666f9585b5398c8722e7d012abfd2009a98ad47b1f1b26afaf421402a9e7719a5662516b32dcbe5608be WHIRLPOOL 9e68d981aed42ece2f481f62efc078ad370ac780e96ba39c4273c8675d552b845cd52c588bd41839868f430b0a532789858914f4ef32a1bc187e2983264ebfd3
-DIST gcc-4.9.3-uclibc-patches-1.0.tar.bz2 2515 SHA256 dd19904d4ab005ef142056228f326e75b3d4d79b8056189a505129b5940a575c SHA512 825092620a3c554ef06219fd1152c3677f1456315563b9e65282a73096e75600389e93298ed76cad41ce3eeecc6a7009ca722585b93c04095bd2d0a06c4404e6 WHIRLPOOL 0c184a5cc74f80a61f354ee85bc5a0f5b44d93bc9fa2e1892fbfe899958cfa5263b8b72cc4f905bc69bd1cc90cf870a6056c4003ec493b815646a72a0fe2e44e
-DIST gcc-4.9.3.tar.bz2 90006707 SHA256 2332b2a5a321b57508b9031354a8503af6fdfb868b8c1748d33028d100a8b67e SHA512 9ac57377a6975fc7adac704ec81355262b9f537def6955576753b87715470a20ee6a2a3144a79cc8fcba3443f7b44c7337d79d704b522d053f54f79aa6b442df WHIRLPOOL 085e4cc1825b031652cbe9e098671f761acfeca64c6cc9b8ad2a8961c13fcac9e02b4538b44dc38181a355266f2c55c99ce5a1bff3f2860b870285cf3f0e84a5
DIST gcc-4.9.4-patches-1.0.tar.bz2 22266 SHA256 1a394abb77c75e2212896ad3a62ae1f6bfd3660b1c176c608298733c740a00e4 SHA512 cc2407221f858bad38b57d31f635314f91794293695e23d255685d8bec20b9db19c7dc76bbf5e8184c2ba0ccb530958b09bae4d8a402ca27cadf463f46bfb995 WHIRLPOOL c74e5273c718020b591911d589d8eff5e366c902c479e566f966577efcbf424b19669a54843b2ddd60c51c81fd2851bc86aec1c647482b4789a518f01dd62561
DIST gcc-4.9.4-piepatches-v0.6.4.tar.bz2 14414 SHA256 c67b56f04c653e6a19e36abed8391f8b6bed426bfcfc907237cc37f02dbb5015 SHA512 243fa272ea0e49f700a76508bab3e03bbb353bcb930581b2f87f9a47df5cd3880e29f20b71612b21190adc463849e1e6ac2a38a49c0002b562d93d436f538285 WHIRLPOOL 1e5959441210af6f690398efab96444ab11d136238a9428912e8441eaf0509fe6db359a8aca92a446fce0c75777385475af73b20165a8593f9969e3a25fd0b0f
DIST gcc-4.9.4-uclibc-patches-1.0.tar.bz2 2618 SHA256 95f290d0b68114d835515afc424d6096476a45665671784aa71a7a506296e465 SHA512 5a1f44caa9261f4947101379628143869b31dec67fa28605e8e1f3894d4b7120c3f68ba6deb59da7a74fa906e27ab32cd3767761837dc3dfebc37865d349d6db WHIRLPOOL e46b08737cfdc235bfb80117e0389f3969167adf59bcba2a0a1094a20eab2b62f0c952dac44781e43957cb1507cd4e80f37bd8aecbc55dbda6382d93b3a4cf94
@@ -75,14 +57,9 @@ DIST gcc-6.3.0-patches-1.0.tar.bz2 7596 SHA256 6c880468ffa4ad2b324fd18c762dbdf10
DIST gcc-6.3.0.tar.bz2 99903185 SHA256 f06ae7f3f790fbf0f018f6d40e844451e6bc3b7bc96e128e63b09825c1f8b29f SHA512 234dd9b1bdc9a9c6e352216a7ef4ccadc6c07f156006a59759c5e0e6a69f0abcdc14630eff11e3826dd6ba5933a8faa43043f3d1d62df6bd5ab1e82862f9bf78 WHIRLPOOL e79a2d6ad199396b6efd835c1129d049a367174ea33dd3b6247d72461f117c2dd81e5a66f3dd6427ce500e768d3a4453efd0debcb56966d00c7df79d05d54b7d
DIST gcc-7.1.0-patches-1.1.tar.bz2 6746 SHA256 39d4a0c659cc361bd3c71fdc9b793bccfa2bce06ede65ac49b805d1e236fcc8e SHA512 1bf95a505dc6c37bf6924bb69fd0670c8f3355b6690c94edf4a4248649accbd426575b40cb7a473dfb0ae09a924b05619e5c633384bae0293edb670cfd0d3a30 WHIRLPOOL 9682649fff62b56683637d25a58d11928342d99e52b2269f42369fd1d691208a7645802cb0d609ac30e20593ecdceb8cb1ab9b216963afe14db1b17ed43d5eb7
DIST gcc-7.1.0.tar.bz2 84303533 SHA256 8a8136c235f64c6fef69cac0d73a46a1a09bb250776a050aec8f9fc880bebc17 SHA512 b5d952be9a10f0e0926bb2868877d10544039d6d2f35ba0a08f51231dd622a007650764a03e173194701467547789ad7d2d9cbc10adcdf118d619cdedbd14aec WHIRLPOOL 1dce5f89d4110bacd7f65140a1dee7b1a4898682e2ae8621832bda6f101354d226743acf77974b5e97d861c6eb6c47637138987dfb6ba222ad81b751e80ff6e6
-EBUILD gcc-4.7.4-r99.ebuild 2064 SHA256 d44222e1b4b6a51fbe8bd021b1fdcb240be7c040c5cd91b06984a355fe598bb4 SHA512 53897fb9053f884f7f0bdd55bcfdf426c853ebde2a9b64502b9b203f77ad90f4bad5f91ef01752c212b96ea97546ad1400b85617d518063c9753eca0fb75d64e WHIRLPOOL f16b4623e8d6ef21d996637966d3597674bab87eff1a43ca4099ad8d643d6026f9c1c14197d2a7e312bd6d47033fae383c0f7f10cda34da1f0446a7237e01f9a
-EBUILD gcc-4.8.5-r99.ebuild 2132 SHA256 7177fbd399c4a21ad5d310a8fdc6eb763e4fcbef8c6fe633d842a9dfa2aa18e3 SHA512 14bb56b2d1990966f557c1c7e40479c9b02084dacfe5f0c92053f323ac455f269ee5caf9c5b43aeac10bf7d399d74060b4ba366e71f65d4a3276a7f93cb0a4e1 WHIRLPOOL f2d7b275cc318a4e1447c82ad73fae92a18ebfe0abccd0d1ac7842e8633f9173ba0fef1d8fd5c7b9cfb54ff3d7b9501d65778fcf7ab4c328a161b2dd6d999b8e
-EBUILD gcc-4.8.5-r999.ebuild 2178 SHA256 baba9e2473b253749175d4a34a8e578dd4a4b0159609a8090404348442ad1af2 SHA512 ff78ae0c4079757c0920f9167283296e8456d123d2746ab80558da7274a082f3a481083668c66c2aac7b3a981a6215cfc2cc3d219e21d602ebd4e8bfd579a664 WHIRLPOOL 9b428343bd1d1e57030445f8fe67d5c4f72e8415c516de600271993937b61ba311d66b412911667ae52f1a776c4b6c1d331dbdea2e643581660c7824dc766b45
-EBUILD gcc-4.9.3-r99.ebuild 2188 SHA256 42d68fd38f9bbfe9ed5cd38502bcf55159d00271b38b291bd38e1939b7bfef99 SHA512 33a38beaa4a3310ad2d026e69cfd04e772e69a59810147ace86e0a03d21cdc72b7346ec09d721de2da02f71faf9ff4d97a836eab4a1a0e6615a73c20dfb536fd WHIRLPOOL 9f98a84ded69b94492405f1f0bdb719d2d67e2b65b21843ad691f7823e85dfff6426b7756a538ba520efbddfece502d2ffe654ae9e8f2e30f6cba3449893820d
-EBUILD gcc-4.9.3-r999.ebuild 1787 SHA256 f2620bf8ff9ebd84e298e3e433ee427398e63811de61bee0cb7f453077d7c50e SHA512 70e4a98a2da45798d426d29f92191bfcf3415b99c13f32b0195ad157b556af308061e7d35309d64882d92d3be95fd3b4b1f58383abb9e2483c7c433caac7c5a3 WHIRLPOOL 01cb5b7819d7ac3508cc01fc6d5058c8b301e75d530155d571a198aed92d50a055899bcd56dc399081f02eb7d26698543e84e6dc348e5829e43d920ee0341e3b
EBUILD gcc-4.9.4-r100.ebuild 2313 SHA256 08ca3c854dc7fdf863a659f0c745bbe92a094a60b71beb12aca2bcef8a555c1c SHA512 780400349b18484bfa253091bc0d9f17319fb892d202b226f72f114ee48d843665bf1ec00e08ef9ea0bf77ea72e13c4f1e2b732d63a252528e6d4ffcf92e151f WHIRLPOOL 9333b35db26f056416975313e4510d775b23844c2c4c8a3847b9ccb8b010fa983adf940ba2a1577d4de45c522de26d56d638115a814bde44084d3b3bcb06ce07
EBUILD gcc-4.9.4-r99.ebuild 2261 SHA256 770df64ec98bcc6071a482abfa68b3b38a0187b6e13d58ad8b26ef8495e7ec07 SHA512 ba472cc558a94e3ed8632681c7678287fadc0303f1ff88b575e5b41e9087f9efff7332621523618eabc2fac85f71dad6a16194b9b8d55d023f77af2fe2d235b8 WHIRLPOOL d0bbcf867f789e469171f30d8188264ee66426fba8662f26b47bb0befe91fea2d9d2ac50e640816e5c746648b478414ac62ff5db2d97452becc4d1863159a725
EBUILD gcc-5.4.0-r3.ebuild 1935 SHA256 82eb647e6cc5cb335983b40e78ebf3671e22835d34b6332ee671d20d6f318158 SHA512 bdf56782fe2845fe05ad2206d420ab65f6ebad06de997c713bf8f34d97d8bb4a1be97462846d9b31f033abf6ee4bbddd24d493433273b33ba3e772557d2a90b2 WHIRLPOOL d24118954a322666913fdfa496c226f24e66811f1074fa6120525be891a4a057086fc898a237b6b570c9bad70e0407dcbe12ec54aad25deea856f9d2b11509a1
EBUILD gcc-6.3.0.ebuild 902 SHA256 f75f2d455bd332ab08dcb12ef5101319b9117ea48d773e782d7ec9e9bd017738 SHA512 2cb339bd2003d2e6c0e649377c693a5c6874583ac27d1b60ffa3bc9723f83c26554dd385154133e8384a92e85c0c134bbb787c7ba34e1ca174f05e23758d1bb2 WHIRLPOOL 88a7ef0e56136cb610f16aa92be0967f40d59d7ee1877bddc213035fd8007745beb2743b5016acfa6bf6a3f334e002e311c0e457aea2b68d4f7a9e311f6f1d4b
EBUILD gcc-7.1.0-r1.ebuild 603 SHA256 9cbff0ffd838af811cde3103906c146eaf17517caf48c8ad62a9216bbc435c8b SHA512 6dd72ba363429342fd12de1fcb677556b17d97cc98af1ac9c1feac76fd219d9e4fdc37b8838d28025d16a0179e85b21b159e24471d6ec1643d2c32fe09689543 WHIRLPOOL a8718baf8b73fff11bc7f8bdcad69df6060e96838ca7e6b64651990084777dba9d9d59c6391518622981161495bbbcadc395138472b9551d69fed47d2897f65f
-MISC metadata.xml 2370 SHA256 88c4368c971e8bd943882901a833afcd03a541677a755310556470268b9024b2 SHA512 a5e8c2f8524f37881f422ef39d4a2ad74802f6e99bb7224cd48482f5b80964292ae6c760f8c39551b150875e721e654d29138cfb4b68b305dba181ce959265ff WHIRLPOOL a4b9abcf4cbd0e4c6a42cce373df9edf1cfd6fcd66efc7c04d7fd3748d5e82126e94bac5b25335aadb3c7ef379358e3402adc0a19c200d9c68ebb2773d0d323e
+MISC metadata.xml 2282 SHA256 afee9279279d988491f12e47d474f13431cd28c871c5d78df367b6d3cac7e58c SHA512 a6b3c24ddf715f9c2db299a6d0f9caeabf2f3223b3d7ea61773cb53b4f2db2c470dbd18860532cad719409f91b9f438847f52cdb3b0d396e38e024f504a16940 WHIRLPOOL f6d3f8a22a6e52290ffd7bc46b7e4a66519aa4dcc83d787024b636e9f5832dfd7eef891f2904c64fccdb10f33c87b8b18430e656a32a291ba2f928221c6e67cc
diff --git a/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch b/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch
deleted file mode 100644
index d454053..0000000
--- a/sys-devel/gcc/files/gcc-4.7.3-musl-linker-path.patch
+++ /dev/null
@@ -1,61 +0,0 @@
-diff -Naur gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h gcc-4.7.3/gcc/config/arm/linux-eabi.h
---- gcc-4.7.3.orig/gcc/config/arm/linux-eabi.h 2014-04-06 14:15:03.000000000 +0000
-+++ gcc-4.7.3/gcc/config/arm/linux-eabi.h 2014-04-06 12:12:42.000000000 +0000
-@@ -69,8 +69,8 @@
- GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
-
- #undef GLIBC_DYNAMIC_LINKER
--#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
--#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
-+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
-+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
- #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
-
- #define GLIBC_DYNAMIC_LINKER \
-diff -Naur gcc-4.7.3.orig/gcc/config/i386/linux64.h gcc-4.7.3/gcc/config/i386/linux64.h
---- gcc-4.7.3.orig/gcc/config/i386/linux64.h 2014-04-06 14:15:03.000000000 +0000
-+++ gcc-4.7.3/gcc/config/i386/linux64.h 2014-04-06 12:12:42.000000000 +0000
-@@ -28,6 +28,6 @@
- #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
- #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
-
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
--#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
- #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
-diff -Naur gcc-4.7.3.orig/gcc/config/mips/linux.h gcc-4.7.3/gcc/config/mips/linux.h
---- gcc-4.7.3.orig/gcc/config/mips/linux.h 2011-07-19 18:00:27.000000000 +0000
-+++ gcc-4.7.3/gcc/config/mips/linux.h 2014-04-06 14:12:48.000000000 +0000
-@@ -18,4 +18,4 @@
- along with GCC; see the file COPYING3. If not see
- <http://www.gnu.org/licenses/>. */
-
--#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-+#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-mipsel.so.1"
-diff -Naur gcc-4.7.3.orig/gcc/config/rs6000/linux64.h gcc-4.7.3/gcc/config/rs6000/linux64.h
---- gcc-4.7.3/gcc/config/rs6000/linux64.h 2014-10-11 18:59:07.479279989 -0200
-+++ gcc-4.7.3/gcc/config/rs6000/linux64.h 2014-10-11 18:59:45.777801191 -0200
-@@ -358,8 +358,8 @@
- #undef LINK_OS_DEFAULT_SPEC
- #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
-
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
--#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
-+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
-+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
- #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
- #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
- #if DEFAULT_LIBC == LIBC_UCLIBC
-diff -Naur gcc-4.7.3/gcc/config/rs6000/sysv4.h gcc-4.7.3/gcc/config/rs6000/sysv4.h
---- gcc-4.7.3/gcc/config/rs6000/sysv4.h 2014-10-11 19:00:03.079584889 -0200
-+++ gcc-4.7.3/gcc/config/rs6000/sysv4.h 2014-10-11 19:00:28.476267387 -0200
-@@ -802,7 +802,7 @@
-
- #define LINK_START_LINUX_SPEC ""
-
--#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-+#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
- #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
- #if DEFAULT_LIBC == LIBC_UCLIBC
- #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
diff --git a/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch b/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch
deleted file mode 100644
index 91c1b34..0000000
--- a/sys-devel/gcc/files/gcc-4.7.3-powerpc-libc-stack-end.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-From: amodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>
-Date: Fri, 15 Feb 2013 13:53:40 +0000 (+0000)
-Subject: PR target/55431
-X-Git-Tag: gcc-4_8_0-release~416
-X-Git-Url: http://repo.or.cz/w/official-gcc.git/commitdiff_plain/2a0bfd56d1b6a8ece8fb852691ea32713c7891b3
-
- PR target/55431
- * config/rs6000/linux-unwind.h (ppc_linux_aux_vector): Delete.
- (ppc_fallback_frame_state): Always set up save locations for fp
- and altivec. Don't bother with non-callee-saved regs, r0-r13
- except for r2 on ppc64, fr0-fr13, v0-v19, vscr.
-
-
-
-git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196077 138bc75d-0d04-0410-961f-82ee72b054a4
-diff --git a/libgcc/config/rs6000/linux-unwind.h b/libgcc/config/rs6000/linux-unwind.h
-index 3a2da6e..c9273c4 100644
---- a/libgcc/config/rs6000/linux-unwind.h
-+++ b/libgcc/config/rs6000/linux-unwind.h
-@@ -26,7 +26,6 @@
- #define R_CR2 70
- #define R_VR0 77
- #define R_VRSAVE 109
--#define R_VSCR 110
-
- struct gcc_vregs
- {
-@@ -175,38 +174,6 @@ get_regs (struct _Unwind_Context *context)
- }
- #endif
-
--/* Find an entry in the process auxiliary vector. The canonical way to
-- test for VMX is to look at AT_HWCAP. */
--
--static long
--ppc_linux_aux_vector (long which)
--{
-- /* __libc_stack_end holds the original stack passed to a process. */
-- extern long *__libc_stack_end;
-- long argc;
-- char **argv;
-- char **envp;
-- struct auxv
-- {
-- long a_type;
-- long a_val;
-- } *auxp;
--
-- /* The Linux kernel puts argc first on the stack. */
-- argc = __libc_stack_end[0];
-- /* Followed by argv, NULL terminated. */
-- argv = (char **) __libc_stack_end + 1;
-- /* Followed by environment string pointers, NULL terminated. */
-- envp = argv + argc + 1;
-- while (*envp++)
-- continue;
-- /* Followed by the aux vector, zero terminated. */
-- for (auxp = (struct auxv *) envp; auxp->a_type != 0; ++auxp)
-- if (auxp->a_type == which)
-- return auxp->a_val;
-- return 0;
--}
--
- /* Do code reading to identify a signal frame, and set the frame
- state data appropriately. See unwind-dw2.c for the structs. */
-
-@@ -216,8 +183,8 @@ static _Unwind_Reason_Code
- ppc_fallback_frame_state (struct _Unwind_Context *context,
- _Unwind_FrameState *fs)
- {
-- static long hwcap = 0;
- struct gcc_regs *regs = get_regs (context);
-+ struct gcc_vregs *vregs;
- long new_cfa;
- int i;
-
-@@ -229,12 +196,15 @@ ppc_fallback_frame_state (struct _Unwind_Context *context,
- fs->regs.cfa_reg = STACK_POINTER_REGNUM;
- fs->regs.cfa_offset = new_cfa - (long) context->cfa;
-
-- for (i = 0; i < 32; i++)
-- if (i != STACK_POINTER_REGNUM)
-- {
-- fs->regs.reg[i].how = REG_SAVED_OFFSET;
-- fs->regs.reg[i].loc.offset = (long) ®s->gpr[i] - new_cfa;
-- }
-+#ifdef __powerpc64__
-+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[2].loc.offset = (long) ®s->gpr[2] - new_cfa;
-+#endif
-+ for (i = 14; i < 32; i++)
-+ {
-+ fs->regs.reg[i].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i].loc.offset = (long) ®s->gpr[i] - new_cfa;
-+ }
-
- fs->regs.reg[R_CR2].how = REG_SAVED_OFFSET;
- /* CR? regs are always 32-bit and PPC is big-endian, so in 64-bit
-@@ -250,57 +220,35 @@ ppc_fallback_frame_state (struct _Unwind_Context *context,
- fs->retaddr_column = ARG_POINTER_REGNUM;
- fs->signal_frame = 1;
-
-- if (hwcap == 0)
-+ /* If we have a FPU... */
-+ for (i = 14; i < 32; i++)
- {
-- hwcap = ppc_linux_aux_vector (16);
-- /* These will already be set if we found AT_HWCAP. A nonzero
-- value stops us looking again if for some reason we couldn't
-- find AT_HWCAP. */
--#ifdef __powerpc64__
-- hwcap |= 0xc0000000;
--#else
-- hwcap |= 0x80000000;
--#endif
-+ fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i + 32].loc.offset = (long) ®s->fpr[i] - new_cfa;
- }
-
-- /* If we have a FPU... */
-- if (hwcap & 0x08000000)
-- for (i = 0; i < 32; i++)
-- {
-- fs->regs.reg[i + 32].how = REG_SAVED_OFFSET;
-- fs->regs.reg[i + 32].loc.offset = (long) ®s->fpr[i] - new_cfa;
-- }
--
- /* If we have a VMX unit... */
-- if (hwcap & 0x10000000)
-- {
-- struct gcc_vregs *vregs;
- #ifdef __powerpc64__
-- vregs = regs->vp;
-+ vregs = regs->vp;
- #else
-- vregs = ®s->vregs;
-+ vregs = ®s->vregs;
- #endif
-- if (regs->msr & (1 << 25))
-+ if (regs->msr & (1 << 25))
-+ {
-+ for (i = 20; i < 32; i++)
- {
-- for (i = 0; i < 32; i++)
-- {
-- fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
-- fs->regs.reg[i + R_VR0].loc.offset
-- = (long) &vregs->vr[i] - new_cfa;
-- }
--
-- fs->regs.reg[R_VSCR].how = REG_SAVED_OFFSET;
-- fs->regs.reg[R_VSCR].loc.offset = (long) &vregs->vscr - new_cfa;
-+ fs->regs.reg[i + R_VR0].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[i + R_VR0].loc.offset = (long) &vregs->vr[i] - new_cfa;
- }
--
-- fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
-- fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
- }
-
-+ fs->regs.reg[R_VRSAVE].how = REG_SAVED_OFFSET;
-+ fs->regs.reg[R_VRSAVE].loc.offset = (long) &vregs->vsave - new_cfa;
-+
- /* If we have SPE register high-parts... we check at compile-time to
- avoid expanding the code for all other PowerPC. */
- #ifdef __SPE__
-- for (i = 0; i < 32; i++)
-+ for (i = 14; i < 32; i++)
- {
- fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].how = REG_SAVED_OFFSET;
- fs->regs.reg[i + FIRST_PSEUDO_REGISTER - 1].loc.offset
diff --git a/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch b/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch
deleted file mode 100644
index 1cc395f..0000000
--- a/sys-devel/gcc/files/gcc-4.7.4-secure-plt.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-adapted from musl-cross gcc-patches
-diff -ur a/gcc/config.gcc b/gcc/config.gcc
---- a/gcc/config.gcc 2013-10-03 02:52:23.000000000 -0200
-+++ b/gcc/config.gcc 2015-05-03 22:05:10.855150177 -0200
-@@ -2091,6 +2091,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/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 @@
- <http://www.gnu.org/licenses/>. */
-
- #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
-+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
---- a/gcc/config/rs6000/sysv4.h 2012-04-30 19:39:01.000000000 -0200
-+++ b/gcc/config/rs6000/sysv4.h 2014-10-21 10:24:03.631956578 -0200
-@@ -537,6 +537,9 @@
- } \
- while (0)
- #endif
-+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
-+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
-+#endif
-
- #undef ASM_SPEC
- #define ASM_SPEC "%(asm_cpu) \
-@@ -624,6 +627,7 @@
- /* Override the default target of the linker. */
- #define LINK_TARGET_SPEC "\
- %{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
-+%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}} \
- %{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-i960-old: --oformat elf32-powerpcle} \
- }}}}"
-@@ -938,6 +942,7 @@
- { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
- { "cc1_endian_default", CC1_ENDIAN_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 --git a/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch b/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch
deleted file mode 100644
index a22fb80..0000000
--- a/sys-devel/gcc/files/gcc-4.8.3-musl-linker-path.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-diff -ur a/gcc-4.8.3/gcc/config/arm/linux-eabi.h b/gcc-4.8.3/gcc/config/arm/linux-eabi.h
---- a/gcc-4.8.3/gcc/config/arm/linux-eabi.h 2013-01-10 21:38:27.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/arm/linux-eabi.h 2014-11-26 21:09:34.162787397 -0100
-@@ -68,8 +68,8 @@
- GLIBC_DYNAMIC_LINKER_DEFAULT and TARGET_DEFAULT_FLOAT_ABI. */
-
- #undef GLIBC_DYNAMIC_LINKER
--#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
--#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
-+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-musl-arm.so.1"
-+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-musl-armhf.so.1"
- #define GLIBC_DYNAMIC_LINKER_DEFAULT GLIBC_DYNAMIC_LINKER_SOFT_FLOAT
-
- #define GLIBC_DYNAMIC_LINKER \
-diff -ur a/gcc-4.8.3/gcc/config/i386/linux64.h b/gcc-4.8.3/gcc/config/i386/linux64.h
---- a/gcc-4.8.3/gcc/config/i386/linux64.h 2013-01-10 21:38:27.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/i386/linux64.h 2014-11-26 21:09:34.162787397 -0100
-@@ -27,6 +27,6 @@
- #define GNU_USER_LINK_EMULATION64 "elf_x86_64"
- #define GNU_USER_LINK_EMULATIONX32 "elf32_x86_64"
-
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
--#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
-+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
-+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
- #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
-diff -ur a/gcc-4.8.3/gcc/config/mips/linux.h b/gcc-4.8.3/gcc/config/mips/linux.h
---- a/gcc-4.8.3/gcc/config/mips/linux.h 2013-01-10 21:38:27.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/mips/linux.h 2014-11-26 21:11:28.772354580 -0100
-@@ -17,4 +17,9 @@
- along with GCC; see the file COPYING3. If not see
- <http://www.gnu.org/licenses/>. */
-
--#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-+#if TARGET_ENDIAN_DEFAULT == 0 /* LE */
-+#define GLIBC_DYNAMIC_LINKER_E "%{EB:;:el}"
-+#else
-+#define GLIBC_DYNAMIC_LINKER_E "%{EL:el}"
-+#endif
-+#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-mips" GLIBC_DYNAMIC_LINKER_E ".so.1"
-diff -ur a/gcc-4.8.3/gcc/config/rs6000/linux64.h b/gcc-4.8.3/gcc/config/rs6000/linux64.h
---- a/gcc-4.8.3/gcc/config/rs6000/linux64.h 2014-04-04 16:10:24.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/rs6000/linux64.h 2014-11-26 21:09:34.164787372 -0100
-@@ -366,12 +366,8 @@
- #undef LINK_OS_DEFAULT_SPEC
- #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
-
--#define GLIBC_DYNAMIC_LINKER32 "/lib/ld.so.1"
--#ifdef LINUX64_DEFAULT_ABI_ELFv2
--#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv1:/lib64/ld64.so.1;:/lib64/ld64.so.2}"
--#else
--#define GLIBC_DYNAMIC_LINKER64 "%{mabi=elfv2:/lib64/ld64.so.2;:/lib64/ld64.so.1}"
--#endif
-+#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
-+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
- #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
- #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
- #if DEFAULT_LIBC == LIBC_UCLIBC
-diff -ur a/gcc-4.8.3/gcc/config/rs6000/sysv4.h b/gcc-4.8.3/gcc/config/rs6000/sysv4.h
---- a/gcc-4.8.3/gcc/config/rs6000/sysv4.h 2014-04-04 15:50:31.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/rs6000/sysv4.h 2014-11-26 21:09:34.164787372 -0100
-@@ -761,7 +761,7 @@
-
- #define LINK_START_LINUX_SPEC ""
-
--#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-+#define GLIBC_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
- #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
- #if DEFAULT_LIBC == LIBC_UCLIBC
- #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
diff --git a/sys-devel/gcc/files/gcc-4.8.3-musl-res_state.patch b/sys-devel/gcc/files/gcc-4.8.3-musl-res_state.patch
deleted file mode 100644
index 7757c38..0000000
--- a/sys-devel/gcc/files/gcc-4.8.3-musl-res_state.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ENwbur gcc-4.8.3.orig/libsanitizer/tsan/tsan_platform_linux.cc gcc-4.8.3/libsanitizer/tsan/tsan_platform_linux.cc
---- gcc-4.8.3.orig/libsanitizer/tsan/tsan_platform_linux.cc 2014-08-31 12:50:18.381689906 +0000
-+++ gcc-4.8.3/libsanitizer/tsan/tsan_platform_linux.cc 2014-08-31 13:12:19.838446253 +0000
-@@ -292,7 +292,7 @@
- #ifndef TSAN_GO
- int ExtractResolvFDs(void *state, int *fds, int nfd) {
- int cnt = 0;
-- __res_state *statp = (__res_state*)state;
-+ res_state statp = (res_state)state;
- for (int i = 0; i < MAXNS && cnt < nfd; i++) {
- if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
- fds[cnt++] = statp->_u._ext.nssocks[i];
diff --git a/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch b/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch
deleted file mode 100644
index fc367ae..0000000
--- a/sys-devel/gcc/files/gcc-4.8.3-secure-plt.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -ur a/gcc-4.8.3/gcc/config/rs6000/secureplt.h b/gcc-4.8.3/gcc/config/rs6000/secureplt.h
---- a/gcc-4.8.3/gcc/config/rs6000/secureplt.h 2013-01-10 21:38:27.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/rs6000/secureplt.h 2014-11-03 20:41:01.696584962 -0100
-@@ -18,3 +18,4 @@
- <http://www.gnu.org/licenses/>. */
-
- #define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
-+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
-diff -ur a/gcc-4.8.3/gcc/config/rs6000/sysv4.h b/gcc-4.8.3/gcc/config/rs6000/sysv4.h
---- a/gcc-4.8.3/gcc/config/rs6000/sysv4.h 2014-04-04 15:50:31.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config/rs6000/sysv4.h 2014-11-03 20:42:30.098479787 -0100
-@@ -585,7 +585,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 "\
-@@ -894,6 +895,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 -ur a/gcc-4.8.3/gcc/config.gcc b/gcc-4.8.3/gcc/config.gcc
---- a/gcc-4.8.3/gcc/config.gcc 2014-05-06 16:29:04.000000000 -0100
-+++ b/gcc-4.8.3/gcc/config.gcc 2014-11-03 20:40:13.135192063 -0100
-@@ -2135,6 +2135,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 --git a/sys-devel/gcc/gcc-4.7.4-r99.ebuild b/sys-devel/gcc/gcc-4.7.4-r99.ebuild
deleted file mode 100644
index 75b012d..0000000
--- a/sys-devel/gcc/gcc-4.7.4-r99.ebuild
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-PATCH_VER="1.4"
-UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-PIE_VER="0.5.5"
-SPECS_VER="0.2.0"
-SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-PIE_GLIBC_STABLE="x86 amd64 ppc ppc64 arm ia64"
-PIE_UCLIBC_STABLE="x86 arm amd64 ppc ppc64"
-SSP_STABLE="amd64 x86 ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-SSP_UCLIBC_STABLE="x86 amd64 ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc x86"
-SSP_MUSL_STABLE="amd64 arm ppc x86"
-#end Hardened stuff
-
-inherit eutils toolchain
-
-KEYWORDS="amd64 arm ~mips ppc x86"
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- elibc_glibc? ( >=sys-libs/glibc-2.8 )
- >=${CATEGORY}/binutils-2.18"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
- PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
- if has_version '<sys-libs/glibc-2.12' ; then
- ewarn "Your host glibc is too old; disabling automatic fortify."
- ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
- EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
- fi
-
- # drop the x32 stuff in the next patchset #543578
- EPATCH_EXCLUDE+=" 90_all_gcc-4.7-x32.patch"
-
- toolchain_src_prepare
-
- if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
- cd "${S}"
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
- mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
- cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
- cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
- mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
- cp -r libitm/config/generic libitm/config/linux/x86
- epatch "${FILESDIR}"/${PN}-4.7.3-musl-linker-path.patch
- epatch "${FILESDIR}"/${PN}-4.7.3-powerpc-libc-stack-end.patch
- epatch "${FILESDIR}"/${PN}-4.7.4-secure-plt.patch
- fi
-
- use vanilla && return 0
-
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
-}
diff --git a/sys-devel/gcc/gcc-4.8.5-r99.ebuild b/sys-devel/gcc/gcc-4.8.5-r99.ebuild
deleted file mode 100644
index 5847ae2..0000000
--- a/sys-devel/gcc/gcc-4.8.5-r99.ebuild
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-PATCH_VER="1.3"
-UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-PIE_VER="0.6.2"
-SPECS_VER="0.2.0"
-SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc mips x86"
-SSP_MUSL_STABLE="amd64 arm ppc mips"
-#end Hardened stuff
-
-inherit eutils toolchain
-
-KEYWORDS="amd64 arm ~mips x86"
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- elibc_glibc? ( >=sys-libs/glibc-2.8 )
- >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
- PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
- if has_version '<sys-libs/glibc-2.12' ; then
- ewarn "Your host glibc is too old; disabling automatic fortify."
- ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
- EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
- fi
-
- toolchain_src_prepare
-
- if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
- cd "${S}"
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
- mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
- cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
- cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
- mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
- cp -r libitm/config/generic libitm/config/linux/x86
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-linker-path.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-secure-plt.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-res_state.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
- fi
-
- use vanilla && return 0
- #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
-}
diff --git a/sys-devel/gcc/gcc-4.8.5-r999.ebuild b/sys-devel/gcc/gcc-4.8.5-r999.ebuild
deleted file mode 100644
index 5ec98d9..0000000
--- a/sys-devel/gcc/gcc-4.8.5-r999.ebuild
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-PATCH_VER="1.3"
-UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-PIE_VER="0.6.2"
-SPECS_VER="0.2.0"
-SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc mips x86"
-SSP_MUSL_STABLE="amd64 arm ppc mips"
-#end Hardened stuff
-
-inherit eutils toolchain
-
-KEYWORDS="amd64 x86"
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- elibc_glibc? ( >=sys-libs/glibc-2.8 )
- >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
- PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
- if has_version '<sys-libs/glibc-2.12' ; then
- ewarn "Your host glibc is too old; disabling automatic fortify."
- ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
- EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
- fi
-
- toolchain_src_prepare
-
- if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
- cd "${S}"
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
- mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
- cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
- cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
- mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
- cp -r libitm/config/generic libitm/config/linux/x86
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-linker-path.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-secure-plt.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-res_state.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
- epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
- fi
-
- use vanilla && return 0
- #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
-}
diff --git a/sys-devel/gcc/gcc-4.9.3-r99.ebuild b/sys-devel/gcc/gcc-4.9.3-r99.ebuild
deleted file mode 100644
index f2e71dc..0000000
--- a/sys-devel/gcc/gcc-4.9.3-r99.ebuild
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-PATCH_VER="1.5"
-UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-PIE_VER="0.6.4"
-SPECS_VER="0.2.0"
-SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc mips x86"
-SSP_MUSL_STABLE="amd64 arm ppc mips"
-#end Hardened stuff
-
-inherit eutils toolchain
-
-KEYWORDS="amd64 arm ~mips x86"
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- elibc_glibc? ( >=sys-libs/glibc-2.8 )
- >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
- PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
- if has_version '<sys-libs/glibc-2.12' ; then
- ewarn "Your host glibc is too old; disabling automatic fortify."
- ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
- EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
- fi
-
- toolchain_src_prepare
-
- if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
- cd "${S}"
- sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
- mv libstdc\+\+-v3/config/os/gnu-linux libstdc\+\+-v3/config/os/gnu-linux.org
- cp -r libstdc\+\+-v3/config/os/generic libstdc\+\+-v3/config/os/gnu-linux
- cp libstdc++-v3/config/os/gnu-linux.org/arm-eabi-extra.ver libstdc++-v3/config/os/gnu-linux/
- mv libitm/config/linux/x86 libitm/config/linux/x86_glibc
- cp -r libitm/config/generic libitm/config/linux/x86
- epatch "${FILESDIR}"/${PN}-4.9.3-musl-linker-path.patch
- epatch "${FILESDIR}"/${PN}-4.9.3-secure-plt.patch
- epatch "${FILESDIR}"/${PN}-4.9.3-musl-res_state.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
- epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
- fi
-
- use vanilla && return 0
- #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
-}
diff --git a/sys-devel/gcc/gcc-4.9.3-r999.ebuild b/sys-devel/gcc/gcc-4.9.3-r999.ebuild
deleted file mode 100644
index 2ca026f..0000000
--- a/sys-devel/gcc/gcc-4.9.3-r999.ebuild
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="4"
-
-PATCH_VER="1.5"
-UCLIBC_VER="1.0"
-
-# Hardened gcc 4 stuff
-PIE_VER="0.6.4"
-SPECS_VER="0.2.0"
-SPECS_GCC_VER="4.4.3"
-# arch/libc configurations known to be stable with {PIE,SSP}-by-default
-PIE_GLIBC_STABLE="x86 amd64 mips ppc ppc64 arm ia64"
-PIE_UCLIBC_STABLE="x86 arm amd64 mips ppc ppc64"
-SSP_STABLE="amd64 x86 mips ppc ppc64 arm"
-# uclibc need tls and nptl support for SSP support
-# uclibc need to be >= 0.9.33
-SSP_UCLIBC_STABLE="x86 amd64 mips ppc ppc64 arm"
-PIE_MUSL_STABLE="amd64 arm ppc mips x86"
-SSP_MUSL_STABLE="amd64 arm ppc mips"
-#end Hardened stuff
-
-inherit eutils toolchain
-
-KEYWORDS=""
-
-RDEPEND=""
-DEPEND="${RDEPEND}
- elibc_glibc? ( >=sys-libs/glibc-2.8 )
- >=${CATEGORY}/binutils-2.20"
-
-if [[ ${CATEGORY} != cross-* ]] ; then
- PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
-fi
-
-src_prepare() {
- if has_version '<sys-libs/glibc-2.12' ; then
- ewarn "Your host glibc is too old; disabling automatic fortify."
- ewarn "Please rebuild gcc after upgrading to >=glibc-2.12 #362315"
- EPATCH_EXCLUDE+=" 10_all_default-fortify-source.patch"
- fi
-
- toolchain_src_prepare
-
- if use elibc_musl || [[ ${CATEGORY} = cross-*-musl ]]; then
- epatch "${FILESDIR}"/${PN}-4.9.3-musl-res_state.patch
- epatch "${FILESDIR}"/${PN}-4.8.3-musl-fix-libc5-assumption.patch
- epatch "${FILESDIR}"/${PN}-4.8.5-posix_memalign.patch
-
- local EPATCH_EXCLUDE="gcc-ssp.diff vis_hide.diff"
- local EPATCH_SUFFIX="diff"
- local EPATCH_FORCE="yes"
- epatch "${FILESDIR}"/musl-gcc-patches-${PV}
- fi
-
- use vanilla && return 0
- #Use -r1 for newer piepatchet that use DRIVER_SELF_SPECS for the hardened specs.
- [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
-}
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
index 6b198c7..e6743ce 100644
--- a/sys-devel/gcc/metadata.xml
+++ b/sys-devel/gcc/metadata.xml
@@ -19,7 +19,6 @@
<flag name="libssp">Build SSP support into a dedicated library rather than use the
code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag>
<flag name="mpx">Enable support for Intel Memory Protection Extensions (MPX)</flag>
- <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag>
<flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag>
<flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag>
<flag name="objc">Build support for the Objective C code language</flag>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2018-01-16 4:51 Aric Belsito
0 siblings, 0 replies; 9+ messages in thread
From: Aric Belsito @ 2018-01-16 4:51 UTC (permalink / raw
To: gentoo-commits
commit: 280308c77f05895c44d9eadd35ca8e505e9be30c
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Tue Jan 16 04:49:39 2018 +0000
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Tue Jan 16 04:49:39 2018 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=280308c7
sys-devel/gcc: sync 7.2.0-r1 with upstream
Add patches for spectre *WARNING, EXPERIMENTAL PORT*
The gcc-7.2.0-move-struct-ix86_frame-to-machine-function patches are
designed for gcc 7, but the spectre patches are taken from the final
version of the gcc 8 patchset, adapted for gcc 7.
...ove-struct-ix86_frame-to-machine-function.patch | 237 +++
...ove-struct-ix86_frame-to-machine-function.patch | 68 +
...ove-struct-ix86_frame-to-machine-function.patch | 53 +
.../gcc/files/spectre-0001-mindirect-branch.patch | 2111 ++++++++++++++++++++
.../gcc/files/spectre-0002-mfunction-return.patch | 1200 +++++++++++
.../spectre-0003-mindirect-branch-register.patch | 887 ++++++++
.../files/spectre-0004-v-register-modifier.patch | 128 ++
.../gcc/files/spectre-0005-mcmodel-large.patch | 292 +++
sys-devel/gcc/gcc-7.2.0-r1.ebuild | 14 +-
9 files changed, 4988 insertions(+), 2 deletions(-)
diff --git a/sys-devel/gcc/files/0001-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch b/sys-devel/gcc/files/0001-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
new file mode 100644
index 0000000..d85ed2c
--- /dev/null
+++ b/sys-devel/gcc/files/0001-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
@@ -0,0 +1,237 @@
+From: "H.J. Lu" <hjl.tools@gmail.com>
+To: gcc-patches@gcc.gnu.org
+Subject: [1/3] GCC 7: i386: Move struct ix86_frame to machine_function
+Date: Sun, 14 Jan 2018 07:02:35 -0800
+
+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
+ * 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 8a3782c0298..813337242d8 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -2444,53 +2444,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;
+
+@@ -2582,7 +2535,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, HOST_WIDE_INT);
+@@ -11903,7 +11856,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);
+ }
+@@ -12389,8 +12343,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;
+@@ -12429,8 +12383,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;
+@@ -13737,7 +13692,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))
+ {
+@@ -14405,7 +14361,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
+@@ -14915,7 +14872,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 9c776dc5172..f9b91286a01 100644
+--- a/gcc/config/i386/i386.h
++++ b/gcc/config/i386/i386.h
+@@ -2451,9 +2451,56 @@ enum avx_u128_state
+ \f
+ #define FASTCALL_PREFIX '@'
+ \f
++#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
+@@ -2512,6 +2559,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;
+@@ -2594,6 +2644,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
+
diff --git a/sys-devel/gcc/files/0002-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch b/sys-devel/gcc/files/0002-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
new file mode 100644
index 0000000..a086d03
--- /dev/null
+++ b/sys-devel/gcc/files/0002-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
@@ -0,0 +1,68 @@
+From: "H.J. Lu" <hjl.tools@gmail.com>
+To: gcc-patches@gcc.gnu.org
+Subject: [2/3] GCC 7: i386: Use reference of struct ix86_frame to avoid copy
+Date: Sun, 14 Jan 2018 07:02:36 -0800
+
+When there is no need to make a copy of ix86_frame, we can use reference
+of struct ix86_frame to avoid copy.
+
+Tested on x86-64.
+
+ Backport from mainline
+ * 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 | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 813337242d8..397ef7cac26 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -11843,8 +11843,6 @@ symbolic_reference_mentioned_p (rtx op)
+ bool
+ ix86_can_use_return_insn_p (void)
+ {
+- struct ix86_frame frame;
+-
+ /* Don't use `ret' instruction in interrupt handler. */
+ if (! reload_completed
+ || frame_pointer_needed
+@@ -11857,7 +11855,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);
+ }
+@@ -12344,7 +12342,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;
+@@ -14860,7 +14858,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;
+@@ -14873,7 +14870,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
+
diff --git a/sys-devel/gcc/files/0003-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch b/sys-devel/gcc/files/0003-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
new file mode 100644
index 0000000..2f27301
--- /dev/null
+++ b/sys-devel/gcc/files/0003-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
@@ -0,0 +1,53 @@
+From: "H.J. Lu" <hjl.tools@gmail.com>
+To: gcc-patches@gcc.gnu.org
+Subject: [3/3] GCC 7: i386: More use reference of struct ix86_frame to avoid
+ copy
+Date: Sun, 14 Jan 2018 07:02:37 -0800
+
+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
+ * config/i386/i386.c (ix86_expand_prologue): Use reference of
+ struct ix86_frame.
+ (ix86_expand_epilogue): Likewise.
+---
+ gcc/config/i386/i386.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 397ef7cac26..986e6d79584 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -13667,7 +13667,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;
+@@ -13691,7 +13690,7 @@ ix86_expand_prologue (void)
+ m->fs.sp_valid = true;
+
+ ix86_compute_frame_layout ();
+- frame = m->frame;
++ struct ix86_frame &frame = cfun->machine->frame;
+
+ if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
+ {
+@@ -14354,13 +14353,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;
++ struct ix86_frame &frame = cfun->machine->frame;
+
+ m->fs.sp_valid = (!frame_pointer_needed
+ || (crtl->sp_is_unchanging
diff --git a/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch b/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch
new file mode 100644
index 0000000..2e03cee
--- /dev/null
+++ b/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch
@@ -0,0 +1,2111 @@
+From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
+To: gcc-patches at gcc dot gnu dot org
+Subject: [PATCH 1/4] x86: Add -mindirect-branch=
+Date: Fri, 12 Jan 2018 05:15:46 -0800
+
+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
+ 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
+ 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/
+
+ * 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): 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/
+
+ * 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 | 8 +
+ gcc/config/i386/i386-protos.h | 1 +
+ gcc/config/i386/i386.c | 512 ++++++++++++++++++++-
+ gcc/config/i386/i386.h | 7 +
+ gcc/config/i386/i386.md | 8 +-
+ gcc/config/i386/i386.opt | 20 +
+ gcc/doc/extend.texi | 10 +
+ gcc/doc/invoke.texi | 14 +-
+ gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 19 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 19 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 20 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 20 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 16 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 17 +
+ gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 43 ++
+ .../gcc.target/i386/indirect-thunk-attr-1.c | 22 +
+ .../gcc.target/i386/indirect-thunk-attr-2.c | 20 +
+ .../gcc.target/i386/indirect-thunk-attr-3.c | 21 +
+ .../gcc.target/i386/indirect-thunk-attr-4.c | 20 +
+ .../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 | 41 ++
+ .../gcc.target/i386/indirect-thunk-bnd-1.c | 19 +
+ .../gcc.target/i386/indirect-thunk-bnd-2.c | 20 +
+ .../gcc.target/i386/indirect-thunk-bnd-3.c | 18 +
+ .../gcc.target/i386/indirect-thunk-bnd-4.c | 19 +
+ .../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 | 18 +
+ .../gcc.target/i386/indirect-thunk-inline-2.c | 18 +
+ .../gcc.target/i386/indirect-thunk-inline-3.c | 19 +
+ .../gcc.target/i386/indirect-thunk-inline-4.c | 19 +
+ .../gcc.target/i386/indirect-thunk-inline-5.c | 15 +
+ .../gcc.target/i386/indirect-thunk-inline-6.c | 16 +
+ .../gcc.target/i386/indirect-thunk-inline-7.c | 42 ++
+ 41 files changed, 1306 insertions(+), 16 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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386-opts.h gcc-7.2.0/gcc/config/i386/i386-opts.h
+--- gcc-7.2.0.orig/gcc/config/i386/i386-opts.h 2018-01-15 17:52:48.888745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386-opts.h 2018-01-15 17:54:02.363744368 -0800
+@@ -99,4 +99,17 @@
+ 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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i386/i386-protos.h
+--- gcc-7.2.0.orig/gcc/config/i386/i386-protos.h 2018-01-15 17:52:48.894745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386-protos.h 2018-01-15 17:54:28.538743900 -0800
+@@ -315,6 +315,7 @@
+ #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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.c
+--- gcc-7.2.0.orig/gcc/config/i386/i386.c 2018-01-15 17:52:48.896745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.c 2018-01-15 18:13:56.240722988 -0800
+@@ -4209,12 +4209,23 @@
+ 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));
+ }
+ \f
+ /* Return a string that documents the current -m options. The caller is
+@@ -7137,6 +7144,37 @@
+ }
+ }
+
++/* 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. */
+@@ -7152,7 +7190,10 @@
+ one is extern inline and one isn't. Call ix86_set_func_type
+ to set the func_type field. */
+ if (fndecl != NULL_TREE)
+- ix86_set_func_type (fndecl);
++ {
++ ix86_set_func_type (fndecl);
++ ix86_set_indirect_branch_type (fndecl);
++ }
+ return;
+ }
+
+@@ -7172,6 +7213,7 @@
+ }
+
+ ix86_set_func_type (fndecl);
++ ix86_set_indirect_branch_type (fndecl);
+
+ tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
+ if (new_tree == NULL_TREE)
+@@ -11909,6 +11951,220 @@
+ # 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 . */
++ fprintf (asm_out_file, "\tpause\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
+@@ -11935,11 +12162,32 @@
+ 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 + SP_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;
+
+@@ -28452,12 +28700,292 @@
+ 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 - SP_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;
+
+@@ -28467,10 +28892,21 @@
+ {
+ if (ix86_nopic_noplt_attribute_p (call_op))
+ {
++ direct_p = false;
+ if (TARGET_64BIT)
+- xasm = "%!jmp\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
++ {
++ 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@GOT|[DWORD PTR %p0@GOT]}";
++ {
++ if (output_indirect_p)
++ xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
++ else
++ xasm = "%!jmp\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
++ }
+ }
+ else
+ xasm = "%!jmp\t%P0";
+@@ -28480,9 +28916,17 @@
+ 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 "";
+ }
+
+@@ -28520,18 +28964,37 @@
+ {
+ if (ix86_nopic_noplt_attribute_p (call_op))
+ {
++ direct_p = false;
+ if (TARGET_64BIT)
+- xasm = "%!call\t{*%p0@GOTPCREL(%%rip)|[QWORD PTR %p0@GOTPCREL[rip]]}";
++ {
++ 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@GOT|[DWORD PTR %p0@GOT]}";
++ {
++ if (output_indirect_p)
++ xasm = "{%p0@GOT|[DWORD PTR %p0@GOT]}";
++ else
++ xasm = "%!call\t{*%p0@GOT|[DWORD PTR %p0@GOT]}";
++ }
+ }
+ 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";
+@@ -41435,7 +41898,7 @@
+ }
+
+ 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)
+@@ -41444,6 +41907,29 @@
+ 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;
+ }
+
+@@ -45738,6 +46224,8 @@
+ ix86_handle_interrupt_attribute, false },
+ { "no_caller_saved_registers", 0, 0, false, true, true,
+ ix86_handle_no_caller_saved_registers_attribute, false },
++ { "indirect_branch", 1, 1, true, false, false,
++ ix86_handle_fndecl_attribute, NULL },
+
+ /* End element. */
+ { NULL, 0, 0, false, false, false, NULL, false }
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.h
+--- gcc-7.2.0.orig/gcc/config/i386/i386.h 2018-01-15 17:52:48.895745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.h 2018-01-15 18:14:15.055722651 -0800
+@@ -2604,6 +2604,13 @@
+ /* Function type. */
+ ENUM_BITFIELD(function_type) func_type : 2;
+
++ /* 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, the current function is a function specified with
+ the "interrupt" or "no_caller_saved_registers" attribute. */
+ BOOL_BITFIELD no_caller_saved_registers : 1;
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
+--- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 17:52:48.888745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 18:16:32.476720190 -0800
+@@ -11610,12 +11610,17 @@
+ {
+ 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")])
+@@ -11659,13 +11660,18 @@
+
+ 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")])
+@@ -12337,7 +12339,11 @@
+ [(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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
+--- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 17:52:48.890745684 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 18:17:13.972719447 -0800
+@@ -927,3 +927,23 @@
+ mgeneral-regs-only
+ Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Var(ix86_target_flags) Save
+ Generate code which uses only the general registers.
++
++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 -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
+--- gcc-7.2.0.orig/gcc/doc/extend.texi 2018-01-15 17:52:47.196745715 -0800
++++ gcc-7.2.0/gcc/doc/extend.texi 2018-01-15 18:17:49.790718806 -0800
+@@ -5540,6 +5540,16 @@
+ @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 -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
+--- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 17:52:47.197745715 -0800
++++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 18:20:56.174715468 -0800
+@@ -1210,7 +1210,8 @@
+ -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 -mgeneral-regs-only}
++-mmitigate-rop -mgeneral-regs-only @gol
++-mindirect-branch=@var{choice}}
+
+ @emph{x86 Windows Options}
+ @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
+@@ -25648,6 +25649,17 @@
+ prevents the compiler from using floating-point, vector, mask and bound
+ registers.
+
++@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..d1d2ee78797
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
+@@ -0,0 +1,19 @@
++/* { 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} } } */
+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..08646c6b823
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
+@@ -0,0 +1,19 @@
++/* { 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} } } */
+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..af244de2238
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.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;
++
++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} } } */
+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..b8aedd5a4e6
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.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];
++
++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} } } */
+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..6ffb9235f94
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
+@@ -0,0 +1,16 @@
++/* { 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} } } */
+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..e6d9d148cd2
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
+@@ -0,0 +1,17 @@
++/* { 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} } } */
+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..d892d8f5992
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
+@@ -0,0 +1,43 @@
++/* { 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} } } */
+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..24188d0b62d
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
+@@ -0,0 +1,22 @@
++/* { 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} } } */
+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..03184b90cda
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
+@@ -0,0 +1,20 @@
++/* { 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} } } */
+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..af167840b81
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
+@@ -0,0 +1,21 @@
++/* { 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-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..146124894a0
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
+@@ -0,0 +1,20 @@
++/* { 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-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..568327cd8e7
+--- /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(pause|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..bd8a99e7828
+--- /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(pause|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..356015c9799
+--- /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(pause|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..6960fa0bbfb
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
+@@ -0,0 +1,41 @@
++/* { 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 "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..febf32d76ea
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
+@@ -0,0 +1,19 @@
++/* { 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} } } */
+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..319ba30b78b
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.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];
++
++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} } } */
+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..9168b3146f5
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
+@@ -0,0 +1,18 @@
++/* { 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} } } */
+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..d3b36d44c7c
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.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];
++
++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} } } */
+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..9e50b282f77
+--- /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(pause|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..f897d1c0497
+--- /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(pause|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..25905cd0016
+--- /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(pause|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..a7fa12183af
+--- /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(pause|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..48a49760be6
+--- /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(pause|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..a1c662f7d23
+--- /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(pause|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..40a665ea640
+--- /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(pause|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..3ace8d1b031
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
+@@ -0,0 +1,18 @@
++/* { 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-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..6c97b96f1f2
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
+@@ -0,0 +1,18 @@
++/* { 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-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..8f6759cbf06
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
+@@ -0,0 +1,19 @@
++/* { 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-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..b07d08cab0f
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
+@@ -0,0 +1,19 @@
++/* { 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-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..10794886b1b
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
+@@ -0,0 +1,15 @@
++/* { 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-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..a26ec4b06ed
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
+@@ -0,0 +1,16 @@
++/* { 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-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..77253af17c6
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
+@@ -0,0 +1,42 @@
++/* { 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-not "__x86_indirect_thunk" } } */
+--
+2.14.3
+
diff --git a/sys-devel/gcc/files/spectre-0002-mfunction-return.patch b/sys-devel/gcc/files/spectre-0002-mfunction-return.patch
new file mode 100644
index 0000000..d3fa601
--- /dev/null
+++ b/sys-devel/gcc/files/spectre-0002-mfunction-return.patch
@@ -0,0 +1,1200 @@
+From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
+To: gcc-patches at gcc dot gnu dot org
+Subject: [PATCH 2/4] x86: Add -mfunction-return=
+Date: Fri, 12 Jan 2018 05:15:47 -0800
+
+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
+ 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/
+
+ * 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): 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/
+
+ * 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.
+---
+ gcc/config/i386/i386-protos.h | 1 +
+ gcc/config/i386/i386.c | 149 ++++++++++++++++++++-
+ 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 | 13 +-
+ 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-attr-8.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/testsuite/gcc.target/i386/ret-thunk-1.c | 12 ++
+ gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 22 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 22 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 21 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 21 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 21 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 21 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-16.c | 18 +++
+ gcc/testsuite/gcc.target/i386/ret-thunk-2.c | 12 ++
+ 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 | 14 ++
+ gcc/testsuite/gcc.target/i386/ret-thunk-6.c | 13 ++
+ 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 | 23 ++++
+ 56 files changed, 478 insertions(+), 49 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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i386/i386-protos.h
+--- gcc-7.2.0.orig/gcc/config/i386/i386-protos.h 2018-01-15 19:51:30.252618154 -0800
++++ gcc-7.2.0/gcc/config/i386/i386-protos.h 2018-01-15 19:51:44.370617901 -0800
+@@ -316,6 +316,7 @@
+
+ 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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.c
+--- gcc-7.2.0.orig/gcc/config/i386/i386.c 2018-01-15 19:51:30.252618154 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.c 2018-01-15 19:54:59.663614404 -0800
+@@ -7177,6 +7177,31 @@
+ 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
+@@ -11979,8 +12004,12 @@
+ /* 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" : "";
+@@ -11995,7 +12024,10 @@
+ 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
+ {
+@@ -12008,10 +12040,20 @@
+ }
+ 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);
++ }
+ }
+ }
+ }
+@@ -12106,7 +12148,7 @@
+ 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));
+@@ -12149,6 +12191,35 @@
+ 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);
++ ASM_OUTPUT_DEF (asm_out_file, alias, name);
++#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);
++ }
++#else
++ 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);
+@@ -28766,7 +28837,7 @@
+ 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
+@@ -28875,7 +28946,7 @@
+ 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
+@@ -29010,6 +29081,46 @@
+ 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 *
+@@ -42066,6 +42177,28 @@
+ }
+ }
+
++ 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;
+ }
+
+@@ -46362,6 +46495,8 @@
+ ix86_handle_no_caller_saved_registers_attribute, false },
+ { "indirect_branch", 1, 1, true, false, false,
+ ix86_handle_fndecl_attribute, NULL },
++ { "function_return", 1, 1, true, false, false,
++ ix86_handle_fndecl_attribute, NULL },
+
+ /* End element. */
+ { NULL, 0, 0, false, false, false, NULL, false }
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.h
+--- gcc-7.2.0.orig/gcc/config/i386/i386.h 2018-01-15 19:51:30.252618154 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.h 2018-01-15 19:51:44.381617901 -0800
+@@ -2611,6 +2611,9 @@
+ "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, the current function is a function specified with
+ the "interrupt" or "no_caller_saved_registers" attribute. */
+ BOOL_BITFIELD no_caller_saved_registers : 1;
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
+--- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 19:51:30.252618154 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 19:51:44.385617901 -0800
+@@ -12298,7 +12298,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")
+@@ -12320,12 +12320,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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
+--- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 19:51:30.252618154 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 19:51:44.386617901 -0800
+@@ -932,9 +932,13 @@
+ 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 -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
+--- gcc-7.2.0.orig/gcc/doc/extend.texi 2018-01-15 19:51:28.536618185 -0800
++++ gcc-7.2.0/gcc/doc/extend.texi 2018-01-15 19:51:44.392617901 -0800
+@@ -5550,6 +5550,15 @@
+ 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 -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
+--- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 19:51:28.537618185 -0800
++++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 19:51:44.397617901 -0800
+@@ -1211,7 +1211,7 @@
+ -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
+ -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
+ -mmitigate-rop -mgeneral-regs-only @gol
+--mindirect-branch=@var{choice}}
++-mindirect-branch=@var{choice} -mfunction-return==@var{choice}}
+
+ @emph{x86 Windows Options}
+ @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
+@@ -25660,6 +25660,17 @@
+ 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c 2018-01-15 19:51:44.398617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c 2018-01-15 19:51:28.901618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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);
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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];
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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];
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c 2018-01-15 19:51:44.399617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c 2018-01-15 19:51:44.400617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c 2018-01-15 19:51:44.401617901 -0800
+@@ -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);
+
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c 2018-01-15 19:51:44.401617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c 2018-01-15 19:51:44.401617901 -0800
+@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c 2018-01-15 19:51:28.902618178 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c 2018-01-15 19:51:44.401617901 -0800
+@@ -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);
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-1.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-1.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,12 @@
++/* { 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} } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-10.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-10.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-10.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,22 @@
++/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
++/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-11.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-11.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-11.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,22 @@
++/* { 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 "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
++/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-12.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-12.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-12.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,21 @@
++/* { 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 "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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-13.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-13.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-13.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,21 @@
++/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
++/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-14.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-14.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-14.c 2018-01-15 19:51:44.401617901 -0800
+@@ -0,0 +1,21 @@
++/* { 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-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 } } } } */
++/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-15.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-15.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-15.c 2018-01-15 19:51:44.402617901 -0800
+@@ -0,0 +1,21 @@
++/* { 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 "push(?:l|q)\[ \t\]*_?bar" { 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 "pushq\[ \t\]%rax" { target x32 } } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-16.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-16.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-16.c 2018-01-15 19:51:44.402617901 -0800
+@@ -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 {\tpause} } } */
++/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-2.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-2.c 2018-01-15 19:51:44.402617901 -0800
+@@ -0,0 +1,12 @@
++/* { 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-not "jmp\[ \t\]*__x86_return_thunk" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-3.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-3.c 2018-01-15 19:51:44.402617901 -0800
+@@ -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 {\tpause} } } */
++/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-4.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-4.c 2018-01-15 19:51:44.402617901 -0800
+@@ -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 {\tpause} } } */
++/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-5.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-5.c 2018-01-15 19:51:44.402617901 -0800
+@@ -0,0 +1,14 @@
++/* { 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} } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-6.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-6.c 2018-01-15 19:51:44.403617901 -0800
+@@ -0,0 +1,13 @@
++/* { 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-not "jmp\[ \t\]*__x86_return_thunk" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-7.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-7.c 2018-01-15 19:51:44.403617901 -0800
+@@ -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 {\tpause} } } */
++/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-8.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-8.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-8.c 2018-01-15 19:51:44.403617901 -0800
+@@ -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 {\tpause} } } */
++/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
++/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
+diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-9.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
+--- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-9.c 1969-12-31 16:00:00.000000000 -0800
++++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-9.c 2018-01-15 19:51:44.403617901 -0800
+@@ -0,0 +1,23 @@
++/* { 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-not "__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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
++/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
++/* { dg-final { scan-assembler-times {\tpause} 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 } } } */
diff --git a/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch b/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch
new file mode 100644
index 0000000..50aff5a
--- /dev/null
+++ b/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch
@@ -0,0 +1,887 @@
+From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
+To: gcc-patches at gcc dot gnu dot org
+Subject: [PATCH 3/4] x86: Add -mindirect-branch-register
+Date: Fri, 12 Jan 2018 05:15:48 -0800
+
+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/
+
+ * 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/
+
+ * 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.
+---
+ gcc/config/i386/constraints.md | 12 +++++---
+ gcc/config/i386/i386.md | 34 ++++++++++++++--------
+ gcc/config/i386/i386.opt | 4 +++
+ gcc/config/i386/predicates.md | 21 ++++++++-----
+ gcc/doc/invoke.texi | 7 ++++-
+ 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, 154 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 -Naur gcc-7.2.0.orig/gcc/config/i386/constraints.md gcc-7.2.0/gcc/config/i386/constraints.md
+--- gcc-7.2.0.orig/gcc/config/i386/constraints.md 2018-01-15 18:36:46.557698449 -0800
++++ gcc-7.2.0/gcc/config/i386/constraints.md 2018-01-15 18:39:17.685695742 -0800
+@@ -198,16 +198,20 @@
+
+ (define_constraint "Bs"
+ "@internal Sibcall memory operand."
+- (ior (and (not (match_test "TARGET_X32"))
++ (ior (and (not (match_test "TARGET_X32
++ || ix86_indirect_branch_thunk_register"))
+ (match_operand 0 "sibcall_memory_operand"))
+- (and (match_test "TARGET_X32 && Pmode == DImode")
++ (and (match_test "TARGET_X32 && Pmode == DImode
++ && !ix86_indirect_branch_thunk_register")
+ (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 "TARGET_X32
++ || ix86_indirect_branch_thunk_register"))
+ (match_operand 0 "memory_operand"))
+- (and (match_test "TARGET_X32 && Pmode == DImode")
++ (and (match_test "TARGET_X32 && Pmode == DImode
++ && !ix86_indirect_branch_thunk_register")
+ (match_operand 0 "GOT_memory_operand"))))
+
+ (define_constraint "Bz"
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
+--- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 18:36:46.571698448 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 18:44:19.035690346 -0800
+@@ -11608,7 +11608,7 @@
+ [(set (pc) (match_operand 0 "indirect_branch_operand"))]
+ ""
+ {
+- if (TARGET_X32)
++ if (TARGET_X32 || ix86_indirect_branch_thunk_register)
+ operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
+ })
+@@ -11658,7 +11658,7 @@
+ OPTAB_DIRECT);
+ }
+
+- if (TARGET_X32)
++ if (TARGET_X32 || ix86_indirect_branch_thunk_register)
+ operands[0] = convert_memory_address (word_mode, operands[0]);
+ cfun->machine->has_local_indirect_jump = true;
+ })
+@@ -11846,7 +11846,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_thunk_register"
+ "* return ix86_output_call_insn (insn, operands[0]);"
+ [(set_attr "type" "call")])
+
+@@ -11855,7 +11855,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_thunk_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))
+@@ -11868,7 +11870,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_thunk_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)
+@@ -11890,7 +11894,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)
+@@ -11910,7 +11914,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)
+@@ -11964,7 +11968,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_thunk_register
++ && peep2_reg_dead_p (2, operands[0])"
+ [(set (pc) (match_dup 1))])
+
+ ;; Call subroutine, returning value in operand 0
+@@ -12045,7 +12051,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_thunk_register"
+ "* return ix86_output_call_insn (insn, operands[1]);"
+ [(set_attr "type" "callv")])
+
+@@ -12055,7 +12061,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_thunk_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)
+@@ -12070,7 +12078,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_thunk_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)
+@@ -12095,7 +12105,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 -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
+--- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 18:36:46.572698448 -0800
++++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 18:44:35.515690050 -0800
+@@ -951,3 +951,7 @@
+
+ EnumValue
+ Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
++
++mindirect-branch-register
++Target Report Var(ix86_indirect_branch_thunk_register) Init(0)
++Force indirect call and jump via register.
+diff -Naur gcc-7.2.0.orig/gcc/config/i386/predicates.md gcc-7.2.0/gcc/config/i386/predicates.md
+--- gcc-7.2.0.orig/gcc/config/i386/predicates.md 2018-01-15 18:36:46.564698448 -0800
++++ gcc-7.2.0/gcc/config/i386/predicates.md 2018-01-15 18:46:50.757687629 -0800
+@@ -635,7 +635,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 "TARGET_X32
++ || ix86_indirect_branch_thunk_register"))
+ (match_operand 0 "memory_operand"))))
+
+ ;; Return true if OP is a memory operands that can be used in sibcalls.
+@@ -664,7 +665,8 @@
+
+ ;; Return true if OP is a GOT memory operand.
+ (define_predicate "GOT_memory_operand"
+- (match_operand 0 "memory_operand")
++ (and (match_test "!ix86_indirect_branch_thunk_register")
++ (match_operand 0 "memory_operand"))
+ {
+ op = XEXP (op, 0);
+ return (GET_CODE (op) == CONST
+@@ -678,9 +680,11 @@
+ (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"))
++ (ior (and (not (match_test "TARGET_X32
++ || ix86_indirect_branch_thunk_register"))
+ (match_operand 0 "memory_operand"))
+- (and (match_test "TARGET_X32 && Pmode == DImode")
++ (and (match_test "TARGET_X32 && Pmode == DImode
++ && !ix86_indirect_branch_thunk_register")
+ (match_operand 0 "GOT_memory_operand")))))
+
+ ;; Similarly, but for tail calls, in which we cannot allow memory references.
+@@ -688,14 +692,17 @@
+ (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"))
++ (ior (and (not (match_test "TARGET_X32
++ || ix86_indirect_branch_thunk_register"))
+ (match_operand 0 "sibcall_memory_operand"))
+- (and (match_test "TARGET_X32 && Pmode == DImode")
++ (and (match_test "TARGET_X32 && Pmode == DImode
++ && !ix86_indirect_branch_thunk_register")
+ (match_operand 0 "GOT_memory_operand")))))
+
+ ;; Return true if OP is a 32-bit GOT symbol operand.
+ (define_predicate "GOT32_symbol_operand"
+- (match_test "GET_CODE (op) == CONST
++ (match_test "!ix86_indirect_branch_thunk_register
++ && GET_CODE (op) == CONST
+ && GET_CODE (XEXP (op, 0)) == UNSPEC
+ && XINT (XEXP (op, 0), 1) == UNSPEC_GOT"))
+
+diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
+--- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 18:36:44.485698486 -0800
++++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 18:47:25.682687003 -0800
+@@ -1211,7 +1211,8 @@
+ -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
+ -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
+ -mmitigate-rop -mgeneral-regs-only @gol
+--mindirect-branch=@var{choice} -mfunction-return==@var{choice}}
++-mindirect-branch=@var{choice} -mfunction-return==@var{choice} @gol
++-mindirect-branch-register}
+
+ @emph{x86 Windows Options}
+ @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
+@@ -25671,6 +25672,10 @@
+ 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 527e447aea5..3f9b5f58ecc 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 7dbc7607e2e..19f4d5e3a1e 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 c085b21582c..304a641db28 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 f92968bf616..c4eabadea7d 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 4d19fac21d8..defe4389354 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 5cbdd85303e..5b202526968 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 c59dd049883..d5aa68f52ca 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 61b9c80de33..09c35e73443 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 dcd2381c514..246300e8d71 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 21b69728796..02223f8d0f4 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 0bd6aab2fd6..a80b46af934 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 99226dbdd1f..e85057bc098 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 aceb4041275..50a2d72ae16 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 43d19bbe876..eac9b3dee22 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 bbfaf6ba7e7..58285f6ee6c 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 6c82a236c1b..d3dec5623eb 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 299940de399..c2e07d59ca4 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 77ee84b938b..16b64a46dbd 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 782960375af..cf499879513 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 240c15be8a6..54c6e300295 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 6e49707875e..925c7943662 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 e1d8891380c..0f7e39f914a 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 6ad05b70604..1d34cb197a7 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 cfb0894ae49..8d591d562a5 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 205b9b405bf..a288e3d61b9 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 efa0096e1e0..f7fad345ca4 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 775d0b8c53e..91388544a20 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 788271f049f..69f03e6472e 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 ef8a2c746a7..226b776abcf 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 848ceefca02..b9120017c10 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 64608100782..fbd6f9ec457 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 3c2758360f5..2553c56f97f 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 b5164bfc5ad..c440d68ec0d 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 a26ac963ea5..674a6bf96e8 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 d0106da38ee..3f37e4375de 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 185ad366190..f96e6847f13 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 cce8b20b5f1..4c47b28691e 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 0316d301d9c..43d84743851 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 92298c362ec..a56a4849f76 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.14.3
+
diff --git a/sys-devel/gcc/files/spectre-0004-v-register-modifier.patch b/sys-devel/gcc/files/spectre-0004-v-register-modifier.patch
new file mode 100644
index 0000000..afbccca
--- /dev/null
+++ b/sys-devel/gcc/files/spectre-0004-v-register-modifier.patch
@@ -0,0 +1,128 @@
+From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
+To: gcc-patches at gcc dot gnu dot org
+Subject: [PATCH 4/4] x86: Add 'V' register operand modifier
+Date: Fri, 12 Jan 2018 05:15:49 -0800
+
+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/
+
+ * 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/
+
+ * 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 9ffcb69d6d7..e69135d7191 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -17617,6 +17617,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
+@@ -17627,7 +17628,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)
+@@ -17679,6 +17680,14 @@ print_reg (rtx x, int code, FILE *file)
+ return;
+ }
+
++ 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)
+@@ -17798,6 +17807,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.
+@@ -18021,6 +18031,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 f120b2a1429..dce808f1eab 100644
+--- a/gcc/doc/extend.texi
++++ b/gcc/doc/extend.texi
+@@ -9292,6 +9292,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.14.3
+
diff --git a/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch b/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch
new file mode 100644
index 0000000..51c56c9
--- /dev/null
+++ b/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch
@@ -0,0 +1,292 @@
+From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
+To: gcc-patches at gcc dot gnu dot org
+Subject: [PATCH 5/5] x86: Disallow -mindirect-branch=/-mfunction-return= with -mcmodel=large
+Date: Sat, 13 Jan 2018 19:37:07 -0800
+
+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/
+
+ * 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/
+
+ * 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 9807de0c117..92b328ebfc2 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -5836,6 +5836,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)
+@@ -5861,6 +5874,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 d16006e653a..2495a45c957 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -26851,6 +26851,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},
+@@ -26862,6 +26867,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..5623f162dea
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..d6c1437bcf1
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..6914dac27ce
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..87c7684aa92
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
+@@ -0,0 +1,9 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..0499c1d7d27
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
+@@ -0,0 +1,9 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..3f1d4f54884
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
+@@ -0,0 +1,9 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..930f72713ae
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
+@@ -0,0 +1,7 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..5763fde84b1
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
+@@ -0,0 +1,8 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..ff710d4c1fe
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
+@@ -0,0 +1,8 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..eeffbd2289a
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
+@@ -0,0 +1,9 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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..49ab118e04f
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
+@@ -0,0 +1,9 @@
++/* { dg-do compile { target { ! ia32 } } } */
++/* { 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.14.3
+
diff --git a/sys-devel/gcc/gcc-7.2.0-r1.ebuild b/sys-devel/gcc/gcc-7.2.0-r1.ebuild
index 1ef1af3..c6f78df 100644
--- a/sys-devel/gcc/gcc-7.2.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-7.2.0-r1.ebuild
@@ -8,8 +8,7 @@ PATCH_VER="1.1"
inherit epatch toolchain
-# unkeyworded for testing bug #641474
-#KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
RDEPEND=""
DEPEND="${RDEPEND}
@@ -25,6 +24,17 @@ src_prepare() {
epatch "${FILESDIR}"/gcc-7.2.0-pr69728.patch
+ # Meltdown/Spectre
+ epatch "${FILESDIR}"/0001-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
+ epatch "${FILESDIR}"/0002-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
+ epatch "${FILESDIR}"/0003-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
+
+ epatch "${FILESDIR}"/spectre-0001-mindirect-branch.patch
+ epatch "${FILESDIR}"/spectre-0002-mfunction-return.patch
+ epatch "${FILESDIR}"/spectre-0003-mindirect-branch-register.patch
+ epatch "${FILESDIR}"/spectre-0004-v-register-modifier.patch
+ epatch "${FILESDIR}"/spectre-0005-mcmodel-large.patch
+
if use elibc_musl || [[ ${CATEGORY} = cross-*-musl* ]]; then
epatch "${FILESDIR}"/6.3.0/cpu_indicator.patch
epatch "${FILESDIR}"/7.1.0/posix_memalign.patch
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2018-01-18 2:41 Aric Belsito
0 siblings, 0 replies; 9+ messages in thread
From: Aric Belsito @ 2018-01-18 2:41 UTC (permalink / raw
To: gentoo-commits
commit: d3a28f37f79a474ffd89f1e4b9b5daf980c6d4a2
Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Thu Jan 18 02:40:20 2018 +0000
Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Thu Jan 18 02:40:20 2018 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=d3a28f37
sys-devel/gcc: update spectre patches
Use the officially merged ones from the gcc-7-branch, remove testsuite
stuff so we can hopefully shrink the filesize down to appease repoman..
...ove-struct-ix86_frame-to-machine-function.patch | 62 +
.../gcc/files/spectre-0001-mindirect-branch.patch | 1181 ++------------------
.../gcc/files/spectre-0002-mfunction-return.patch | 917 ++-------------
.../spectre-0003-mindirect-branch-register.patch | 843 +++-----------
.../gcc/files/spectre-0005-mcmodel-large.patch | 219 +---
sys-devel/gcc/gcc-7.2.0-r2.ebuild | 1 +
6 files changed, 386 insertions(+), 2837 deletions(-)
diff --git a/sys-devel/gcc/files/0004-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch b/sys-devel/gcc/files/0004-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
new file mode 100644
index 0000000..dc12402
--- /dev/null
+++ b/sys-devel/gcc/files/0004-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
@@ -0,0 +1,62 @@
+From c25b81ba01fa9ac0c1baa3aabd64190c47928f03 Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 16 Jan 2018 12:49:29 +0000
+Subject: [PATCH 1/1] i386: Don't use reference of struct ix86_frame
+
+Use reference of struct ix86_frame in ix86_expand_prologue and
+ix86_expand_epilogue caused:
+
+raised STORAGE_ERROR : stack overflow or erroneous memory access
+make[5]: *** [/export/gnu/import/git/sources/gcc/gcc/ada/Make-generated.in:45: ada/sinfo.h] Error 1
+
+on trunk when bootstrapping GCC with ada on x86-64.
+
+ * config/i386/i386.c (ix86_expand_prologue): Don't use reference
+ of struct ix86_frame.
+ (ix86_expand_epilogue): Likewise.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256742 138bc75d-0d04-0410-961f-82ee72b054a4
+---
+ gcc/config/i386/i386.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index e758387..ba2abc5 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -14061,6 +14061,7 @@ 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;
+@@ -14084,7 +14085,7 @@ ix86_expand_prologue (void)
+ m->fs.sp_valid = true;
+
+ ix86_compute_frame_layout ();
+- struct ix86_frame &frame = cfun->machine->frame;
++ frame = m->frame;
+
+ if (!TARGET_64BIT && ix86_function_ms_hook_prologue (current_function_decl))
+ {
+@@ -14747,12 +14748,13 @@ 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 ();
+- struct ix86_frame &frame = cfun->machine->frame;
++ frame = m->frame;
+
+ m->fs.sp_valid = (!frame_pointer_needed
+ || (crtl->sp_is_unchanging
+--
+2.9.3
+
diff --git a/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch b/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch
index 2e03cee..c0267fa 100644
--- a/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch
+++ b/sys-devel/gcc/files/spectre-0001-mindirect-branch.patch
@@ -1,7 +1,7 @@
-From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
-To: gcc-patches at gcc dot gnu dot org
-Subject: [PATCH 1/4] x86: Add -mindirect-branch=
-Date: Fri, 12 Jan 2018 05:15:46 -0800
+From c6b72be421ded17e0c156070ba6e90aa6c335ed6 Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 16 Jan 2018 10:59:42 +0000
+Subject: [PATCH] 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
@@ -19,6 +19,7 @@ __x86_indirect_thunk:
call L2
L1:
pause
+ lfence
jmp L1
L2:
lea 8(%rsp), %rsp|lea 4(%esp), %esp
@@ -44,6 +45,7 @@ __x86_indirect_thunk_reg:
call L2
L1:
pause
+ lfence
jmp L1
L2:
movq %reg, (%rsp)|movl %reg, (%esp)
@@ -62,6 +64,7 @@ Indirect call via register, "call reg", is converted to
gcc/
+ Backport from mainline
* 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
@@ -77,6 +80,8 @@ gcc/
(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.
@@ -101,122 +106,23 @@ gcc/
* doc/extend.texi: Document indirect_branch function attribute.
* doc/invoke.texi: Document -mindirect-branch= option.
-gcc/testsuite/
-
- * 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.
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256732 138bc75d-0d04-0410-961f-82ee72b054a4
---
- gcc/config/i386/i386-opts.h | 8 +
+ gcc/config/i386/i386-opts.h | 13 +
gcc/config/i386/i386-protos.h | 1 +
- gcc/config/i386/i386.c | 512 ++++++++++++++++++++-
+ gcc/config/i386/i386.c | 648 ++++++++++++++++++++-
gcc/config/i386/i386.h | 7 +
- gcc/config/i386/i386.md | 8 +-
+ gcc/config/i386/i386.md | 26 +-
gcc/config/i386/i386.opt | 20 +
gcc/doc/extend.texi | 10 +
gcc/doc/invoke.texi | 14 +-
- gcc/testsuite/gcc.target/i386/indirect-thunk-1.c | 19 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-2.c | 19 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-3.c | 20 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-4.c | 20 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-5.c | 16 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-6.c | 17 +
- gcc/testsuite/gcc.target/i386/indirect-thunk-7.c | 43 ++
- .../gcc.target/i386/indirect-thunk-attr-1.c | 22 +
- .../gcc.target/i386/indirect-thunk-attr-2.c | 20 +
- .../gcc.target/i386/indirect-thunk-attr-3.c | 21 +
- .../gcc.target/i386/indirect-thunk-attr-4.c | 20 +
- .../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 | 41 ++
- .../gcc.target/i386/indirect-thunk-bnd-1.c | 19 +
- .../gcc.target/i386/indirect-thunk-bnd-2.c | 20 +
- .../gcc.target/i386/indirect-thunk-bnd-3.c | 18 +
- .../gcc.target/i386/indirect-thunk-bnd-4.c | 19 +
- .../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 | 18 +
- .../gcc.target/i386/indirect-thunk-inline-2.c | 18 +
- .../gcc.target/i386/indirect-thunk-inline-3.c | 19 +
- .../gcc.target/i386/indirect-thunk-inline-4.c | 19 +
- .../gcc.target/i386/indirect-thunk-inline-5.c | 15 +
- .../gcc.target/i386/indirect-thunk-inline-6.c | 16 +
- .../gcc.target/i386/indirect-thunk-inline-7.c | 42 ++
- 41 files changed, 1306 insertions(+), 16 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
+ 43 files changed, 1575 insertions(+), 19 deletions(-)
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-opts.h gcc-7.2.0/gcc/config/i386/i386-opts.h
---- gcc-7.2.0.orig/gcc/config/i386/i386-opts.h 2018-01-15 17:52:48.888745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386-opts.h 2018-01-15 17:54:02.363744368 -0800
-@@ -99,4 +99,17 @@
+diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
+index 542cd0f..efcdc3b 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 */
};
@@ -234,10 +140,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-opts.h gcc-7.2.0/gcc/config/i386/
+};
+
#endif
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i386/i386-protos.h
---- gcc-7.2.0.orig/gcc/config/i386/i386-protos.h 2018-01-15 17:52:48.894745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386-protos.h 2018-01-15 17:54:28.538743900 -0800
-@@ -315,6 +315,7 @@
+diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
+index d2cccf1..bcdd987 100644
+--- a/gcc/config/i386/i386-protos.h
++++ b/gcc/config/i386/i386-protos.h
+@@ -313,6 +313,7 @@ extern enum attr_cpu ix86_schedule;
#endif
extern const char * ix86_output_call_insn (rtx_insn *insn, rtx call_op);
@@ -245,10 +152,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i38
extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
enum machine_mode mode);
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.c
---- gcc-7.2.0.orig/gcc/config/i386/i386.c 2018-01-15 17:52:48.896745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.c 2018-01-15 18:13:56.240722988 -0800
-@@ -4209,12 +4209,23 @@
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 1786640..7e779c1 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -4212,12 +4212,23 @@ make_pass_stv (gcc::context *ctxt)
return new pass_stv (ctxt);
}
@@ -274,7 +182,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
}
\f
/* Return a string that documents the current -m options. The caller is
-@@ -7137,6 +7144,37 @@
+@@ -7148,6 +7159,37 @@ ix86_set_func_type (tree fndecl)
}
}
@@ -312,7 +220,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
/* 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. */
-@@ -7152,7 +7190,10 @@
+@@ -7163,7 +7205,10 @@ ix86_set_current_function (tree fndecl)
one is extern inline and one isn't. Call ix86_set_func_type
to set the func_type field. */
if (fndecl != NULL_TREE)
@@ -324,7 +232,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
return;
}
-@@ -7172,6 +7213,7 @@
+@@ -7183,6 +7228,7 @@ ix86_set_current_function (tree fndecl)
}
ix86_set_func_type (fndecl);
@@ -332,7 +240,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
if (new_tree == NULL_TREE)
-@@ -11909,6 +11951,220 @@
+@@ -11930,6 +11976,220 @@ ix86_setup_frame_addresses (void)
# endif
#endif
@@ -442,8 +350,8 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
+
+ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel1);
+
-+ /* Pause . */
-+ fprintf (asm_out_file, "\tpause\n");
++ /* Pause + lfence. */
++ fprintf (asm_out_file, "\tpause\n\tlfence\n");
+
+ /* Jump. */
+ fputs ("\tjmp\t", asm_out_file);
@@ -553,7 +461,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
static int pic_labels_used;
/* Fills in the label name that should be used for a pc thunk for
-@@ -11935,11 +12162,32 @@
+@@ -11956,11 +12216,32 @@ ix86_code_end (void)
rtx xops[2];
int regno;
@@ -564,7 +472,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
+
+ for (regno = FIRST_REX_INT_REG; regno <= LAST_REX_INT_REG; regno++)
+ {
-+ int i = regno - FIRST_REX_INT_REG + SP_REG + 1;
++ int i = regno - FIRST_REX_INT_REG + LAST_INT_REG + 1;
+ if ((indirect_thunks_used & (1 << i)))
+ output_indirect_thunk_function (false, regno);
+
@@ -586,7 +494,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
if (!(pic_labels_used & (1 << regno)))
continue;
-@@ -28452,12 +28700,292 @@
+@@ -28461,12 +28742,292 @@ ix86_nopic_noplt_attribute_p (rtx call_op)
return false;
}
@@ -617,7 +525,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
+ {
+ int i = regno;
+ if (i >= FIRST_REX_INT_REG)
-+ i -= (FIRST_REX_INT_REG - SP_REG - 1);
++ i -= (FIRST_REX_INT_REG - LAST_INT_REG - 1);
+ if (need_bnd_p)
+ indirect_thunks_bnd_used |= 1 << i;
+ else
@@ -879,7 +787,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
bool seh_nop_p = false;
const char *xasm;
-@@ -28467,10 +28892,21 @@
+@@ -28476,10 +29037,21 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
{
if (ix86_nopic_noplt_attribute_p (call_op))
{
@@ -903,7 +811,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
}
else
xasm = "%!jmp\t%P0";
-@@ -28480,9 +28916,17 @@
+@@ -28489,9 +29061,17 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
else if (TARGET_SEH)
xasm = "%!rex.W jmp\t%A0";
else
@@ -923,7 +831,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
return "";
}
-@@ -28520,18 +28964,37 @@
+@@ -28529,18 +29109,37 @@ ix86_output_call_insn (rtx_insn *insn, rtx call_op)
{
if (ix86_nopic_noplt_attribute_p (call_op))
{
@@ -965,7 +873,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
if (seh_nop_p)
return "nop";
-@@ -41435,7 +41898,7 @@
+@@ -41459,7 +42058,7 @@ ix86_handle_struct_attribute (tree *node, tree name, tree, int,
}
static tree
@@ -974,7 +882,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_DECL)
-@@ -41444,6 +41907,29 @@
+@@ -41468,6 +42067,29 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
name);
*no_add_attrs = true;
}
@@ -1004,19 +912,20 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
return NULL_TREE;
}
-@@ -45738,6 +46224,8 @@
+@@ -45776,6 +46398,8 @@ static const struct attribute_spec ix86_attribute_table[] =
ix86_handle_interrupt_attribute, false },
{ "no_caller_saved_registers", 0, 0, false, true, true,
ix86_handle_no_caller_saved_registers_attribute, false },
+ { "indirect_branch", 1, 1, true, false, false,
-+ ix86_handle_fndecl_attribute, NULL },
++ ix86_handle_fndecl_attribute, false },
/* End element. */
{ NULL, 0, 0, false, false, false, NULL, false }
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.h
---- gcc-7.2.0.orig/gcc/config/i386/i386.h 2018-01-15 17:52:48.895745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.h 2018-01-15 18:14:15.055722651 -0800
-@@ -2604,6 +2604,13 @@
+diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
+index 11727e5..d8370ae 100644
+--- a/gcc/config/i386/i386.h
++++ b/gcc/config/i386/i386.h
+@@ -2609,6 +2609,13 @@ struct GTY(()) machine_function {
/* Function type. */
ENUM_BITFIELD(function_type) func_type : 2;
@@ -1030,10 +939,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.
/* If true, the current function is a function specified with
the "interrupt" or "no_caller_saved_registers" attribute. */
BOOL_BITFIELD no_caller_saved_registers : 1;
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
---- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 17:52:48.888745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 18:16:32.476720190 -0800
-@@ -11610,12 +11610,17 @@
+diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
+index dbe88f4..cd2e73c 100644
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -11627,13 +11627,18 @@
{
if (TARGET_X32)
operands[0] = convert_memory_address (word_mode, operands[0]);
@@ -1053,7 +963,8 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
-@@ -11659,13 +11660,18 @@
+
+@@ -11676,14 +11681,19 @@
if (TARGET_X32)
operands[0] = convert_memory_address (word_mode, operands[0]);
@@ -1074,7 +985,8 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
-@@ -12337,7 +12339,11 @@
+ \f
+@@ -12354,8 +12364,12 @@
[(simple_return)
(use (match_operand:SI 0 "register_operand" "r"))]
"reload_completed"
@@ -1088,10 +1000,12 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
+ (const_string "ibr")))
(set_attr "length_immediate" "0")
(set_attr "maybe_prefix_bnd" "1")])
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
---- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 17:52:48.890745684 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 18:17:13.972719447 -0800
-@@ -927,3 +927,23 @@
+
+diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
+index 9384e29..c076d9c 100644
+--- a/gcc/config/i386/i386.opt
++++ b/gcc/config/i386/i386.opt
+@@ -927,3 +927,23 @@ Attempt to avoid generating instruction sequences containing ret bytes.
mgeneral-regs-only
Target Report RejectNegative Mask(GENERAL_REGS_ONLY) Var(ix86_target_flags) Save
Generate code which uses only the general registers.
@@ -1115,10 +1029,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i38
+
+EnumValue
+Enum(indirect_branch) String(thunk-extern) Value(indirect_branch_thunk_extern)
-diff -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
---- gcc-7.2.0.orig/gcc/doc/extend.texi 2018-01-15 17:52:47.196745715 -0800
-+++ gcc-7.2.0/gcc/doc/extend.texi 2018-01-15 18:17:49.790718806 -0800
-@@ -5540,6 +5540,16 @@
+diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
+index ba309d0..935381d 100644
+--- a/gcc/doc/extend.texi
++++ b/gcc/doc/extend.texi
+@@ -5540,6 +5540,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.
@@ -1135,10 +1050,11 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
@end table
On the x86, the inliner does not inline a
-diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
---- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 17:52:47.197745715 -0800
-+++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 18:20:56.174715468 -0800
-@@ -1210,7 +1210,8 @@
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 7311c10..4979c8c 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -1210,7 +1210,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
@@ -1148,7 +1064,7 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@emph{x86 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -25648,6 +25649,17 @@
+@@ -25686,6 +25687,17 @@ Generate code that uses only the general-purpose registers. This
prevents the compiler from using floating-point, vector, mask and bound
registers.
@@ -1166,946 +1082,3 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@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..d1d2ee78797
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
-@@ -0,0 +1,19 @@
-+/* { 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} } } */
-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..08646c6b823
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
-@@ -0,0 +1,19 @@
-+/* { 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} } } */
-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..af244de2238
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-3.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;
-+
-+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} } } */
-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..b8aedd5a4e6
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-4.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];
-+
-+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} } } */
-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..6ffb9235f94
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
-@@ -0,0 +1,16 @@
-+/* { 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} } } */
-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..e6d9d148cd2
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
-@@ -0,0 +1,17 @@
-+/* { 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} } } */
-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..d892d8f5992
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
-@@ -0,0 +1,43 @@
-+/* { 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} } } */
-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..24188d0b62d
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
-@@ -0,0 +1,22 @@
-+/* { 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} } } */
-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..03184b90cda
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
-@@ -0,0 +1,20 @@
-+/* { 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} } } */
-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..af167840b81
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
-@@ -0,0 +1,21 @@
-+/* { 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-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..146124894a0
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
-@@ -0,0 +1,20 @@
-+/* { 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-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..568327cd8e7
---- /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(pause|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..bd8a99e7828
---- /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(pause|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..356015c9799
---- /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(pause|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..6960fa0bbfb
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
-@@ -0,0 +1,41 @@
-+/* { 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 "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..febf32d76ea
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
-@@ -0,0 +1,19 @@
-+/* { 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} } } */
-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..319ba30b78b
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.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];
-+
-+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} } } */
-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..9168b3146f5
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
-@@ -0,0 +1,18 @@
-+/* { 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} } } */
-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..d3b36d44c7c
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.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];
-+
-+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} } } */
-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..9e50b282f77
---- /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(pause|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..f897d1c0497
---- /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(pause|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..25905cd0016
---- /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(pause|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..a7fa12183af
---- /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(pause|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..48a49760be6
---- /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(pause|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..a1c662f7d23
---- /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(pause|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..40a665ea640
---- /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(pause|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..3ace8d1b031
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
-@@ -0,0 +1,18 @@
-+/* { 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-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..6c97b96f1f2
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
-@@ -0,0 +1,18 @@
-+/* { 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-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..8f6759cbf06
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
-@@ -0,0 +1,19 @@
-+/* { 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-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..b07d08cab0f
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
-@@ -0,0 +1,19 @@
-+/* { 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-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..10794886b1b
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
-@@ -0,0 +1,15 @@
-+/* { 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-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..a26ec4b06ed
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
-@@ -0,0 +1,16 @@
-+/* { 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-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..77253af17c6
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
-@@ -0,0 +1,42 @@
-+/* { 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-not "__x86_indirect_thunk" } } */
---
-2.14.3
-
diff --git a/sys-devel/gcc/files/spectre-0002-mfunction-return.patch b/sys-devel/gcc/files/spectre-0002-mfunction-return.patch
index d3fa601..391e89d 100644
--- a/sys-devel/gcc/files/spectre-0002-mfunction-return.patch
+++ b/sys-devel/gcc/files/spectre-0002-mfunction-return.patch
@@ -1,7 +1,7 @@
-From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
-To: gcc-patches at gcc dot gnu dot org
-Subject: [PATCH 2/4] x86: Add -mfunction-return=
-Date: Fri, 12 Jan 2018 05:15:47 -0800
+From 357311dd400f7f72d2132f2f94161ece39bf08c6 Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 16 Jan 2018 11:10:44 +0000
+Subject: [PATCH] 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
@@ -18,6 +18,7 @@ __x86_return_thunk:
call L2
L1:
pause
+ lfence
jmp L1
L2:
lea 8(%rsp), %rsp|lea 4(%esp), %esp
@@ -27,12 +28,11 @@ 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 <hongjiu.lu@intel.com>
+
* config/i386/i386-protos.h (ix86_output_function_return): New.
* config/i386/i386.c (ix86_set_indirect_branch_type): Also
set function_return_type.
@@ -40,7 +40,8 @@ gcc/
return.
(output_indirect_thunk_function): Pass false to
indirect_thunk_name.
- (ix86_output_indirect_branch): Likewise.
+ (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.
@@ -56,137 +57,41 @@ gcc/
* doc/extend.texi: Document function_return function attribute.
* doc/invoke.texi: Document -mfunction-return= option.
-gcc/testsuite/
+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/
- * 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.
+ Backport from mainline
+ 2018-01-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ 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.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256734 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/config/i386/i386-protos.h | 1 +
- gcc/config/i386/i386.c | 149 ++++++++++++++++++++-
+ 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 | 13 +-
- 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-attr-8.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/testsuite/gcc.target/i386/ret-thunk-1.c | 12 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-10.c | 22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-11.c | 22 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-12.c | 21 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-13.c | 21 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-14.c | 21 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-15.c | 21 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-16.c | 18 +++
- gcc/testsuite/gcc.target/i386/ret-thunk-2.c | 12 ++
- 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 | 14 ++
- gcc/testsuite/gcc.target/i386/ret-thunk-6.c | 13 ++
- 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 | 23 ++++
- 56 files changed, 478 insertions(+), 49 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
+ 58 files changed, 641 insertions(+), 74 deletions(-)
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i386/i386-protos.h
---- gcc-7.2.0.orig/gcc/config/i386/i386-protos.h 2018-01-15 19:51:30.252618154 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386-protos.h 2018-01-15 19:51:44.370617901 -0800
-@@ -316,6 +316,7 @@
+diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
+index bcdd987..42eece3 100644
+--- a/gcc/config/i386/i386-protos.h
++++ b/gcc/config/i386/i386-protos.h
+@@ -314,6 +314,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);
@@ -194,10 +99,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386-protos.h gcc-7.2.0/gcc/config/i38
extern bool ix86_operands_ok_for_move_multiple (rtx *operands, bool load,
enum machine_mode mode);
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.c
---- gcc-7.2.0.orig/gcc/config/i386/i386.c 2018-01-15 19:51:30.252618154 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.c 2018-01-15 19:54:59.663614404 -0800
-@@ -7177,6 +7177,31 @@
+diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
+index 7e779c1..8fb8902 100644
+--- a/gcc/config/i386/i386.c
++++ b/gcc/config/i386/i386.c
+@@ -7188,6 +7188,31 @@ ix86_set_indirect_branch_type (tree fndecl)
else
cfun->machine->indirect_branch_type = ix86_indirect_branch;
}
@@ -229,7 +135,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
}
/* Establish appropriate back-end context for processing the function
-@@ -11979,8 +12004,12 @@
+@@ -12000,8 +12025,12 @@ static int indirect_thunks_bnd_used;
/* Fills in the label name that should be used for the indirect thunk. */
static void
@@ -243,7 +149,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
if (USE_HIDDEN_LINKONCE)
{
const char *bnd = need_bnd_p ? "_bnd" : "";
-@@ -11995,7 +12024,10 @@
+@@ -12016,7 +12045,10 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
bnd, reg_prefix, reg_names[regno]);
}
else
@@ -255,7 +161,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
}
else
{
-@@ -12008,10 +12040,20 @@
+@@ -12029,10 +12061,20 @@ indirect_thunk_name (char name[32], int regno, bool need_bnd_p)
}
else
{
@@ -279,7 +185,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
}
}
}
-@@ -12106,7 +12148,7 @@
+@@ -12127,7 +12169,7 @@ output_indirect_thunk_function (bool need_bnd_p, int regno)
tree decl;
/* Create __x86_indirect_thunk/__x86_indirect_thunk_bnd. */
@@ -288,7 +194,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
get_identifier (name),
build_function_type_list (void_type_node, NULL_TREE));
-@@ -12149,6 +12191,35 @@
+@@ -12170,6 +12212,36 @@ output_indirect_thunk_function (bool need_bnd_p, int regno)
ASM_OUTPUT_LABEL (asm_out_file, name);
}
@@ -298,7 +204,6 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
+ char alias[32];
+
+ indirect_thunk_name (alias, regno, need_bnd_p, true);
-+ ASM_OUTPUT_DEF (asm_out_file, alias, name);
+#if TARGET_MACHO
+ if (TARGET_MACHO)
+ {
@@ -307,8 +212,10 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
+ 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);
@@ -324,7 +231,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
DECL_INITIAL (decl) = make_node (BLOCK);
current_function_decl = decl;
allocate_struct_function (decl, false);
-@@ -28766,7 +28837,7 @@
+@@ -28775,7 +28847,7 @@ ix86_output_indirect_branch_via_reg (rtx call_op, bool sibcall_p)
else
indirect_thunks_used |= 1 << i;
}
@@ -333,7 +240,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
thunk_name = thunk_name_buf;
}
else
-@@ -28875,7 +28946,7 @@
+@@ -28884,7 +28956,7 @@ ix86_output_indirect_branch_via_push (rtx call_op, const char *xasm,
else
indirect_thunk_needed = true;
}
@@ -342,7 +249,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
thunk_name = thunk_name_buf;
}
else
-@@ -29010,6 +29081,46 @@
+@@ -29019,6 +29091,46 @@ ix86_output_indirect_jmp (rtx call_op, bool ret_p)
return "%!jmp\t%A0";
}
@@ -389,7 +296,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
/* Output the assembly for a call instruction. */
const char *
-@@ -42066,6 +42177,28 @@
+@@ -42090,6 +42202,28 @@ ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int,
}
}
@@ -418,19 +325,20 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.c gcc-7.2.0/gcc/config/i386/i386.
return NULL_TREE;
}
-@@ -46362,6 +46495,8 @@
+@@ -46400,6 +46534,8 @@ static const struct attribute_spec ix86_attribute_table[] =
ix86_handle_no_caller_saved_registers_attribute, false },
{ "indirect_branch", 1, 1, true, false, false,
- ix86_handle_fndecl_attribute, NULL },
+ ix86_handle_fndecl_attribute, false },
+ { "function_return", 1, 1, true, false, false,
-+ ix86_handle_fndecl_attribute, NULL },
++ ix86_handle_fndecl_attribute, false },
/* End element. */
{ NULL, 0, 0, false, false, false, NULL, false }
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.h
---- gcc-7.2.0.orig/gcc/config/i386/i386.h 2018-01-15 19:51:30.252618154 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.h 2018-01-15 19:51:44.381617901 -0800
-@@ -2611,6 +2611,9 @@
+diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
+index d8370ae..e7da790 100644
+--- a/gcc/config/i386/i386.h
++++ b/gcc/config/i386/i386.h
+@@ -2616,6 +2616,9 @@ struct GTY(()) machine_function {
"indirect_jump" or "tablejump". */
BOOL_BITFIELD has_local_indirect_jump : 1;
@@ -440,10 +348,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.h gcc-7.2.0/gcc/config/i386/i386.
/* If true, the current function is a function specified with
the "interrupt" or "no_caller_saved_registers" attribute. */
BOOL_BITFIELD no_caller_saved_registers : 1;
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
---- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 19:51:30.252618154 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 19:51:44.385617901 -0800
-@@ -12298,7 +12298,7 @@
+diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
+index cd2e73c..d112bdb 100644
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -12315,7 +12315,7 @@
(define_insn "simple_return_internal"
[(simple_return)]
"reload_completed"
@@ -452,7 +361,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
[(set_attr "length" "1")
(set_attr "atom_unit" "jeu")
(set_attr "length_immediate" "0")
-@@ -12320,12 +12320,7 @@
+@@ -12337,12 +12337,7 @@
[(simple_return)
(unspec [(const_int 0)] UNSPEC_REP)]
"reload_completed"
@@ -466,10 +375,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
[(set_attr "length" "2")
(set_attr "atom_unit" "jeu")
(set_attr "length_immediate" "0")
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
---- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 19:51:30.252618154 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 19:51:44.386617901 -0800
-@@ -932,9 +932,13 @@
+diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
+index c076d9c..b07388d 100644
+--- a/gcc/config/i386/i386.opt
++++ b/gcc/config/i386/i386.opt
+@@ -932,9 +932,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.
@@ -484,10 +394,11 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i38
EnumValue
Enum(indirect_branch) String(keep) Value(indirect_branch_keep)
-diff -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
---- gcc-7.2.0.orig/gcc/doc/extend.texi 2018-01-15 19:51:28.536618185 -0800
-+++ gcc-7.2.0/gcc/doc/extend.texi 2018-01-15 19:51:44.392617901 -0800
-@@ -5550,6 +5550,15 @@
+diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
+index 935381d..46e0a36 100644
+--- a/gcc/doc/extend.texi
++++ b/gcc/doc/extend.texi
+@@ -5550,6 +5550,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.
@@ -503,10 +414,11 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/extend.texi gcc-7.2.0/gcc/doc/extend.texi
@end table
On the x86, the inliner does not inline a
-diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
---- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 19:51:28.537618185 -0800
-+++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 19:51:44.397617901 -0800
-@@ -1211,7 +1211,7 @@
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index 4979c8c..f3eb54b 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -1211,7 +1211,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 -mgeneral-regs-only @gol
@@ -515,7 +427,7 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@emph{x86 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -25660,6 +25660,17 @@
+@@ -25698,6 +25698,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}.
@@ -533,668 +445,3 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@end table
These @samp{-m} switches are supported in addition to the above
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-1.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-2.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-3.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-4.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-5.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-6.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-7.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-1.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-2.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-3.c 2018-01-15 19:51:44.398617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-4.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-5.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c 2018-01-15 19:51:28.901618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-6.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-7.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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);
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-8.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-1.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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];
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-2.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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];
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-3.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-bnd-4.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-1.c 2018-01-15 19:51:44.399617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-2.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-3.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-4.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-5.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-6.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-extern-7.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-1.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-2.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-3.c 2018-01-15 19:51:44.400617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-4.c 2018-01-15 19:51:44.401617901 -0800
-@@ -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);
-
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-5.c 2018-01-15 19:51:44.401617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-6.c 2018-01-15 19:51:44.401617901 -0800
-@@ -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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c 2018-01-15 19:51:28.902618178 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/indirect-thunk-inline-7.c 2018-01-15 19:51:44.401617901 -0800
-@@ -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);
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-1.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-1.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-1.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-1.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,12 @@
-+/* { 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} } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-10.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-10.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-10.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-10.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,22 @@
-+/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
-+/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-11.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-11.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-11.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-11.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,22 @@
-+/* { 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 "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "call\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
-+/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-12.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-12.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-12.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-12.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,21 @@
-+/* { 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 "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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-13.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-13.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-13.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-13.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,21 @@
-+/* { 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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
-+/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-14.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-14.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-14.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-14.c 2018-01-15 19:51:44.401617901 -0800
-@@ -0,0 +1,21 @@
-+/* { 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-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 } } } } */
-+/* { 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 -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-15.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-15.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-15.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-15.c 2018-01-15 19:51:44.402617901 -0800
-@@ -0,0 +1,21 @@
-+/* { 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 "push(?:l|q)\[ \t\]*_?bar" { 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 "pushq\[ \t\]%rax" { target x32 } } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-16.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-16.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-16.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-16.c 2018-01-15 19:51:44.402617901 -0800
-@@ -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 {\tpause} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-2.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-2.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-2.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-2.c 2018-01-15 19:51:44.402617901 -0800
-@@ -0,0 +1,12 @@
-+/* { 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-not "jmp\[ \t\]*__x86_return_thunk" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-3.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-3.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-3.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-3.c 2018-01-15 19:51:44.402617901 -0800
-@@ -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 {\tpause} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-4.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-4.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-4.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-4.c 2018-01-15 19:51:44.402617901 -0800
-@@ -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 {\tpause} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-5.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-5.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-5.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-5.c 2018-01-15 19:51:44.402617901 -0800
-@@ -0,0 +1,14 @@
-+/* { 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} } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-6.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-6.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-6.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-6.c 2018-01-15 19:51:44.403617901 -0800
-@@ -0,0 +1,13 @@
-+/* { 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-not "jmp\[ \t\]*__x86_return_thunk" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-7.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-7.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-7.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-7.c 2018-01-15 19:51:44.403617901 -0800
-@@ -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 {\tpause} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-8.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-8.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-8.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-8.c 2018-01-15 19:51:44.403617901 -0800
-@@ -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 {\tpause} } } */
-+/* { dg-final { scan-assembler-not "jmp\[ \t\]*\.LIND" } } */
-+/* { dg-final { scan-assembler-not "call\[ \t\]*\.LIND" } } */
-diff -Naur gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-9.c gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-9.c
---- gcc-7.2.0.orig/gcc/testsuite/gcc.target/i386/ret-thunk-9.c 1969-12-31 16:00:00.000000000 -0800
-+++ gcc-7.2.0/gcc/testsuite/gcc.target/i386/ret-thunk-9.c 2018-01-15 19:51:44.403617901 -0800
-@@ -0,0 +1,23 @@
-+/* { 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-not "__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 "push(?:l|q)\[ \t\]*_?bar" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler "jmp\[ \t\]*__x86_indirect_thunk" { target { ! x32 } } } } */
-+/* { dg-final { scan-assembler-times {\tpause} 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 } } } */
diff --git a/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch b/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch
index 50aff5a..2e5e779 100644
--- a/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch
+++ b/sys-devel/gcc/files/spectre-0003-mindirect-branch-register.patch
@@ -1,7 +1,7 @@
-From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
-To: gcc-patches at gcc dot gnu dot org
-Subject: [PATCH 3/4] x86: Add -mindirect-branch-register
-Date: Fri, 12 Jan 2018 05:15:48 -0800
+From 86118fbdbafe6af54b2da467e1073c49e1742116 Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 16 Jan 2018 11:17:49 +0000
+Subject: [PATCH] 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,
@@ -13,6 +13,9 @@ similar to TARGET_X32.
gcc/
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
* config/i386/constraints.md (Bs): Disallow memory operand for
-mindirect-branch-register.
(Bw): Likewise.
@@ -34,185 +37,157 @@ gcc/
* config/i386/i386.opt (mindirect-branch-register): New option.
* doc/invoke.texi: Document -mindirect-branch-register option.
-gcc/testsuite/
+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 <hongjiu.lu@intel.com>
+
+ * 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 <hongjiu.lu@intel.com>
+
+ * 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 <hongjiu.lu@intel.com>
+
+ * 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 <hongjiu.lu@intel.com>
+
+ * config/i386/predicates.md (indirect_branch_operand): Rewrite
+ ix86_indirect_branch_register logic.
+
- * 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.
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256735 138bc75d-0d04-0410-961f-82ee72b054a4
---
- gcc/config/i386/constraints.md | 12 +++++---
- gcc/config/i386/i386.md | 34 ++++++++++++++--------
- gcc/config/i386/i386.opt | 4 +++
- gcc/config/i386/predicates.md | 21 ++++++++-----
- gcc/doc/invoke.texi | 7 ++++-
- 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, 154 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
+ 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 | 7 ++-
+ 49 files changed, 266 insertions(+), 63 deletions(-)
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/constraints.md gcc-7.2.0/gcc/config/i386/constraints.md
---- gcc-7.2.0.orig/gcc/config/i386/constraints.md 2018-01-15 18:36:46.557698449 -0800
-+++ gcc-7.2.0/gcc/config/i386/constraints.md 2018-01-15 18:39:17.685695742 -0800
-@@ -198,16 +198,20 @@
+diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
+index 38d604f..a0a632a 100644
+--- a/gcc/config/i386/constraints.md
++++ b/gcc/config/i386/constraints.md
+@@ -198,14 +198,16 @@
(define_constraint "Bs"
"@internal Sibcall memory operand."
- (ior (and (not (match_test "TARGET_X32"))
-+ (ior (and (not (match_test "TARGET_X32
-+ || ix86_indirect_branch_thunk_register"))
++ (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")
-+ (and (match_test "TARGET_X32 && Pmode == DImode
-+ && !ix86_indirect_branch_thunk_register")
+ (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 "TARGET_X32
-+ || ix86_indirect_branch_thunk_register"))
++ (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")
-+ (and (match_test "TARGET_X32 && Pmode == DImode
-+ && !ix86_indirect_branch_thunk_register")
+ (and (match_test "TARGET_X32 && Pmode == DImode")
(match_operand 0 "GOT_memory_operand"))))
-
- (define_constraint "Bz"
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386.md
---- gcc-7.2.0.orig/gcc/config/i386/i386.md 2018-01-15 18:36:46.571698448 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.md 2018-01-15 18:44:19.035690346 -0800
-@@ -11608,7 +11608,7 @@
+diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
+index d112bdb..d074c2f 100644
+--- a/gcc/config/i386/i386.md
++++ b/gcc/config/i386/i386.md
+@@ -11625,7 +11625,7 @@
[(set (pc) (match_operand 0 "indirect_branch_operand"))]
""
{
- if (TARGET_X32)
-+ if (TARGET_X32 || ix86_indirect_branch_thunk_register)
++ if (TARGET_X32 || ix86_indirect_branch_register)
operands[0] = convert_memory_address (word_mode, operands[0]);
cfun->machine->has_local_indirect_jump = true;
})
-@@ -11658,7 +11658,7 @@
+@@ -11679,7 +11679,7 @@
OPTAB_DIRECT);
}
- if (TARGET_X32)
-+ if (TARGET_X32 || ix86_indirect_branch_thunk_register)
++ if (TARGET_X32 || ix86_indirect_branch_register)
operands[0] = convert_memory_address (word_mode, operands[0]);
cfun->machine->has_local_indirect_jump = true;
})
-@@ -11846,7 +11846,7 @@
+@@ -11871,7 +11871,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_thunk_register"
++ "!TARGET_X32 && !ix86_indirect_branch_register"
"* return ix86_output_call_insn (insn, operands[0]);"
[(set_attr "type" "call")])
-@@ -11855,7 +11855,9 @@
+@@ -11880,7 +11880,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_thunk_register
++ && !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))
-@@ -11868,7 +11870,9 @@
+@@ -11893,7 +11895,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_thunk_register
++ && !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)
-@@ -11890,7 +11894,7 @@
+@@ -11915,7 +11919,7 @@
})
(define_insn "*call_pop"
@@ -221,7 +196,7 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
(match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
-@@ -11910,7 +11914,7 @@
+@@ -11935,7 +11939,7 @@
[(set_attr "type" "call")])
(define_insn "*sibcall_pop_memory"
@@ -230,49 +205,49 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
(match_operand 1))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
-@@ -11964,7 +11968,9 @@
+@@ -11989,7 +11993,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_thunk_register
++ && !ix86_indirect_branch_register
+ && peep2_reg_dead_p (2, operands[0])"
[(set (pc) (match_dup 1))])
;; Call subroutine, returning value in operand 0
-@@ -12045,7 +12051,7 @@
+@@ -12070,7 +12076,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_thunk_register"
++ "!TARGET_X32 && !ix86_indirect_branch_register"
"* return ix86_output_call_insn (insn, operands[1]);"
[(set_attr "type" "callv")])
-@@ -12055,7 +12061,9 @@
+@@ -12080,7 +12086,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_thunk_register
++ && !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)
-@@ -12070,7 +12078,9 @@
+@@ -12095,7 +12103,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_thunk_register
++ && !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)
-@@ -12095,7 +12105,7 @@
+@@ -12120,7 +12130,7 @@
(define_insn "*call_value_pop"
[(set (match_operand 0)
@@ -281,79 +256,68 @@ diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.md gcc-7.2.0/gcc/config/i386/i386
(match_operand 2)))
(set (reg:SI SP_REG)
(plus:SI (reg:SI SP_REG)
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/i386.opt gcc-7.2.0/gcc/config/i386/i386.opt
---- gcc-7.2.0.orig/gcc/config/i386/i386.opt 2018-01-15 18:36:46.572698448 -0800
-+++ gcc-7.2.0/gcc/config/i386/i386.opt 2018-01-15 18:44:35.515690050 -0800
-@@ -951,3 +951,7 @@
+diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
+index b07388d..b90da9f 100644
+--- a/gcc/config/i386/i386.opt
++++ b/gcc/config/i386/i386.opt
+@@ -951,3 +951,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_thunk_register) Init(0)
++Target Report Var(ix86_indirect_branch_register) Init(0)
+Force indirect call and jump via register.
-diff -Naur gcc-7.2.0.orig/gcc/config/i386/predicates.md gcc-7.2.0/gcc/config/i386/predicates.md
---- gcc-7.2.0.orig/gcc/config/i386/predicates.md 2018-01-15 18:36:46.564698448 -0800
-+++ gcc-7.2.0/gcc/config/i386/predicates.md 2018-01-15 18:46:50.757687629 -0800
+diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
+index 2fc2c60..e4da309 100644
+--- a/gcc/config/i386/predicates.md
++++ b/gcc/config/i386/predicates.md
@@ -635,7 +635,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 "TARGET_X32
-+ || ix86_indirect_branch_thunk_register"))
++ (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.
-@@ -664,7 +665,8 @@
-
- ;; Return true if OP is a GOT memory operand.
- (define_predicate "GOT_memory_operand"
-- (match_operand 0 "memory_operand")
-+ (and (match_test "!ix86_indirect_branch_thunk_register")
-+ (match_operand 0 "memory_operand"))
- {
- op = XEXP (op, 0);
- return (GET_CODE (op) == CONST
-@@ -678,9 +680,11 @@
+@@ -678,20 +679,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"))
-+ (ior (and (not (match_test "TARGET_X32
-+ || ix86_indirect_branch_thunk_register"))
- (match_operand 0 "memory_operand"))
+- (match_operand 0 "memory_operand"))
- (and (match_test "TARGET_X32 && Pmode == DImode")
-+ (and (match_test "TARGET_X32 && Pmode == DImode
-+ && !ix86_indirect_branch_thunk_register")
- (match_operand 0 "GOT_memory_operand")))))
+- (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.
-@@ -688,14 +692,17 @@
+ (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"))
-+ (ior (and (not (match_test "TARGET_X32
-+ || ix86_indirect_branch_thunk_register"))
- (match_operand 0 "sibcall_memory_operand"))
+- (match_operand 0 "sibcall_memory_operand"))
- (and (match_test "TARGET_X32 && Pmode == DImode")
-+ (and (match_test "TARGET_X32 && Pmode == DImode
-+ && !ix86_indirect_branch_thunk_register")
- (match_operand 0 "GOT_memory_operand")))))
+- (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"
-- (match_test "GET_CODE (op) == CONST
-+ (match_test "!ix86_indirect_branch_thunk_register
-+ && GET_CODE (op) == CONST
- && GET_CODE (XEXP (op, 0)) == UNSPEC
- && XINT (XEXP (op, 0), 1) == UNSPEC_GOT"))
-
-diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
---- gcc-7.2.0.orig/gcc/doc/invoke.texi 2018-01-15 18:36:44.485698486 -0800
-+++ gcc-7.2.0/gcc/doc/invoke.texi 2018-01-15 18:47:25.682687003 -0800
-@@ -1211,7 +1211,8 @@
+diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
+index f3eb54b..1e572b1 100644
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -1211,7 +1211,8 @@ 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 -mgeneral-regs-only @gol
@@ -363,7 +327,7 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@emph{x86 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
-@@ -25671,6 +25672,10 @@
+@@ -25709,6 +25710,10 @@ object file. You can control this behavior for a specific function by
using the function attribute @code{function_return}.
@xref{Function Attributes}.
@@ -374,514 +338,3 @@ diff -Naur gcc-7.2.0.orig/gcc/doc/invoke.texi gcc-7.2.0/gcc/doc/invoke.texi
@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 527e447aea5..3f9b5f58ecc 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 7dbc7607e2e..19f4d5e3a1e 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 c085b21582c..304a641db28 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 f92968bf616..c4eabadea7d 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 4d19fac21d8..defe4389354 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 5cbdd85303e..5b202526968 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 c59dd049883..d5aa68f52ca 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 61b9c80de33..09c35e73443 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 dcd2381c514..246300e8d71 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 21b69728796..02223f8d0f4 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 0bd6aab2fd6..a80b46af934 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 99226dbdd1f..e85057bc098 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 aceb4041275..50a2d72ae16 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 43d19bbe876..eac9b3dee22 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 bbfaf6ba7e7..58285f6ee6c 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 6c82a236c1b..d3dec5623eb 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 299940de399..c2e07d59ca4 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 77ee84b938b..16b64a46dbd 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 782960375af..cf499879513 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 240c15be8a6..54c6e300295 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 6e49707875e..925c7943662 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 e1d8891380c..0f7e39f914a 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 6ad05b70604..1d34cb197a7 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 cfb0894ae49..8d591d562a5 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 205b9b405bf..a288e3d61b9 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 efa0096e1e0..f7fad345ca4 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 775d0b8c53e..91388544a20 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 788271f049f..69f03e6472e 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 ef8a2c746a7..226b776abcf 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 848ceefca02..b9120017c10 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 64608100782..fbd6f9ec457 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 3c2758360f5..2553c56f97f 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 b5164bfc5ad..c440d68ec0d 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 a26ac963ea5..674a6bf96e8 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 d0106da38ee..3f37e4375de 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 185ad366190..f96e6847f13 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 cce8b20b5f1..4c47b28691e 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 0316d301d9c..43d84743851 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 92298c362ec..a56a4849f76 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.14.3
-
diff --git a/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch b/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch
index 51c56c9..25574d4 100644
--- a/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch
+++ b/sys-devel/gcc/files/spectre-0005-mcmodel-large.patch
@@ -1,7 +1,8 @@
-From: "H dot J dot Lu" <hjl dot tools at gmail dot com>
-To: gcc-patches at gcc dot gnu dot org
-Subject: [PATCH 5/5] x86: Disallow -mindirect-branch=/-mfunction-return= with -mcmodel=large
-Date: Sat, 13 Jan 2018 19:37:07 -0800
+From 5d1c53c6fd593de2360c1a2ae44ebf5fa3c5263b Mon Sep 17 00:00:00 2001
+From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 16 Jan 2018 11:22:01 +0000
+Subject: [PATCH] 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,
@@ -11,6 +12,9 @@ Since the thunk function may not be reachable in large code model,
gcc/
+ Backport from mainline
+ 2018-01-14 H.J. Lu <hongjiu.lu@intel.com>
+
* config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
-mcmodel=large with -mindirect-branch=thunk,
-mindirect-branch=thunk-extern, -mfunction-return=thunk and
@@ -19,51 +23,18 @@ gcc/
-mindirect-branch=thunk, -mindirect-branch=thunk-extern,
-mfunction-return=thunk and -mfunction-return=thunk-extern.
-gcc/testsuite/
- * 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.
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@256737 138bc75d-0d04-0410-961f-82ee72b054a4
---
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
+ 15 files changed, 156 insertions(+)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
-index 9807de0c117..92b328ebfc2 100644
+index 1bbdd0c..e758387 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
-@@ -5836,6 +5836,19 @@ ix86_set_indirect_branch_type (tree fndecl)
+@@ -7187,6 +7187,19 @@ ix86_set_indirect_branch_type (tree fndecl)
}
else
cfun->machine->indirect_branch_type = ix86_indirect_branch;
@@ -83,7 +54,7 @@ index 9807de0c117..92b328ebfc2 100644
}
if (cfun->machine->function_return_type == indirect_branch_unset)
-@@ -5861,6 +5874,19 @@ ix86_set_indirect_branch_type (tree fndecl)
+@@ -7212,6 +7225,19 @@ ix86_set_indirect_branch_type (tree fndecl)
}
else
cfun->machine->function_return_type = ix86_function_return;
@@ -104,10 +75,10 @@ index 9807de0c117..92b328ebfc2 100644
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index d16006e653a..2495a45c957 100644
+index 1e572b1..6f3c344 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
-@@ -26851,6 +26851,11 @@ to external call and return thunk provided in a separate object file.
+@@ -25699,6 +25699,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}.
@@ -119,7 +90,7 @@ index d16006e653a..2495a45c957 100644
@item -mfunction-return=@var{choice}
@opindex -mfunction-return
Convert function return with @var{choice}. The default is @samp{keep},
-@@ -26862,6 +26867,12 @@ object file. You can control this behavior for a specific function by
+@@ -25710,6 +25715,12 @@ object file. You can control this behavior for a specific function by
using the function attribute @code{function_return}.
@xref{Function Attributes}.
@@ -132,161 +103,3 @@ index d16006e653a..2495a45c957 100644
@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..5623f162dea
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-10.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..d6c1437bcf1
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-8.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..6914dac27ce
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-9.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..87c7684aa92
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..0499c1d7d27
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..3f1d4f54884
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..930f72713ae
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-17.c
-@@ -0,0 +1,7 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..5763fde84b1
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-18.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..ff710d4c1fe
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-19.c
-@@ -0,0 +1,8 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..eeffbd2289a
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-20.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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..49ab118e04f
---- /dev/null
-+++ b/gcc/testsuite/gcc.target/i386/ret-thunk-21.c
-@@ -0,0 +1,9 @@
-+/* { dg-do compile { target { ! ia32 } } } */
-+/* { 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.14.3
-
diff --git a/sys-devel/gcc/gcc-7.2.0-r2.ebuild b/sys-devel/gcc/gcc-7.2.0-r2.ebuild
index 2862d12..138a077 100644
--- a/sys-devel/gcc/gcc-7.2.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-7.2.0-r2.ebuild
@@ -28,6 +28,7 @@ src_prepare() {
epatch "${FILESDIR}"/0001-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
epatch "${FILESDIR}"/0002-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
epatch "${FILESDIR}"/0003-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
+ epatch "${FILESDIR}"/0004-gcc-7.2.0-move-struct-ix86_frame-to-machine-function.patch
epatch "${FILESDIR}"/spectre-0001-mindirect-branch.patch
epatch "${FILESDIR}"/spectre-0002-mfunction-return.patch
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2021-09-13 2:01 Jory Pratt
0 siblings, 0 replies; 9+ messages in thread
From: Jory Pratt @ 2021-09-13 2:01 UTC (permalink / raw
To: gentoo-commits
commit: e5b037865b4a7264c27c7fc64466de1012d4b29c
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 13 02:01:35 2021 +0000
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Mon Sep 13 02:01:35 2021 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=e5b03786
sys-devel/gcc: use libssp_nonshared.a for ssp
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
sys-devel/gcc/files/gcc-6.1-musl-libssp.patch | 20 ++++++++++++++++++++
sys-devel/gcc/gcc-10.3.0-r2.ebuild | 4 ++++
sys-devel/gcc/gcc-11.1.0-r1.ebuild | 4 ++++
sys-devel/gcc/gcc-11.2.0.ebuild | 4 ++++
4 files changed, 32 insertions(+)
diff --git a/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch b/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch
new file mode 100644
index 0000000..fe5c614
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-6.1-musl-libssp.patch
@@ -0,0 +1,20 @@
+Author: Timo Teräs <timo.teras@iki.fi>
+
+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/sys-devel/gcc/gcc-10.3.0-r2.ebuild b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
index 52430b9..7dec59f 100644
--- a/sys-devel/gcc/gcc-10.3.0-r2.ebuild
+++ b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
@@ -23,5 +23,9 @@ src_prepare() {
esac
fi
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+ fi
+
eapply_user
}
diff --git a/sys-devel/gcc/gcc-11.1.0-r1.ebuild b/sys-devel/gcc/gcc-11.1.0-r1.ebuild
index f60c567..5b6db15 100644
--- a/sys-devel/gcc/gcc-11.1.0-r1.ebuild
+++ b/sys-devel/gcc/gcc-11.1.0-r1.ebuild
@@ -27,5 +27,9 @@ src_prepare() {
esac
fi
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+ fi
+
eapply_user
}
diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
index 3f91080..ccb6c1c 100644
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ b/sys-devel/gcc/gcc-11.2.0.ebuild
@@ -23,5 +23,9 @@ src_prepare() {
esac
fi
+ if [[ ${CATEGORY} != cross-* ]] ; then
+ eapply "${FILESDIR}"/gcc-6.1-musl-libssp.patch
+ fi
+
eapply_user
}
\ No newline at end of file
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/
@ 2021-11-20 23:24 Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2021-11-20 23:24 UTC (permalink / raw
To: gentoo-commits
commit: 705fa69940aa50422a3fe98729d5a8bfc4a011f9
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 20 23:24:07 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 20 23:24:10 2021 +0000
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=705fa699
sys-devel/gcc: treeclean (now in ::gentoo!)
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-devel/gcc/Manifest | 9 ---
.../files/gcc-11.2.0-cross-compile-include.patch | 26 ---------
sys-devel/gcc/files/gcc-configure-LANG.patch | 64 ----------------------
sys-devel/gcc/files/gcc-configure-texinfo.patch | 16 ------
sys-devel/gcc/gcc-10.3.0-r2.ebuild | 19 -------
sys-devel/gcc/gcc-10.3.0-r3.ebuild | 19 -------
sys-devel/gcc/gcc-11.1.0-r1.ebuild | 23 --------
sys-devel/gcc/gcc-11.2.0.ebuild | 24 --------
sys-devel/gcc/metadata.xml | 37 -------------
9 files changed, 237 deletions(-)
diff --git a/sys-devel/gcc/Manifest b/sys-devel/gcc/Manifest
deleted file mode 100644
index 2abd45e1..00000000
--- a/sys-devel/gcc/Manifest
+++ /dev/null
@@ -1,9 +0,0 @@
-DIST gcc-10.3.0-musl-patches-1.tar.bz2 2999 BLAKE2B 3e36bbf2f93fdce15e20f807fa262f7a7abbde85b6f6b4e1383f6eccd8a53d876687d56cde83a80cde8a50e15bec407a1212aa0c85520892563e3d5ef7aaca98 SHA512 21483912a7b152f27db82d837a4cf91f2552d5fe238702aeca0c0dd8c7d3695bc70d8794c94a19106df28e053baf14c38433ca8e38e849082b76273cb51f2384
-DIST gcc-10.3.0-patches-3.tar.bz2 18935 BLAKE2B 13eaf1e055b5b63069aed1575ed93f6bc822b5e3f2181ddfc88f4e7ff801f58997cd131b2efd79b90469b1f861db994feb2adcaecacf165442078f76e233fd9a SHA512 c3d6a6f32863cc0ff7c877314ff0c00a892e473f64d16b82d46b4a77aa97c3e7a575492d27f0d423acb2621c86c9a49bca0e26e45bda9e697495444fcac85084
-DIST gcc-10.3.0.tar.xz 76692288 BLAKE2B ac7898f5eb8a7c5f151a526d1bb38913a68b50a65e4d010ac09fa20b6c801c671c790d780f23ccb8e4ecdfc686f4aa588082ccc9eb5c80c7b0e30788f824c1eb SHA512 2b2dd7453d48a398c29eaebd1422b70341001b8c90a62aee51e83344e7fdd8a8e45f82a4a9165bd7edc76dada912c932f4b6632c5636760fec4c5d7e402b3f86
-DIST gcc-11.1.0-musl-patches-1.tar.bz2 2999 BLAKE2B 3e36bbf2f93fdce15e20f807fa262f7a7abbde85b6f6b4e1383f6eccd8a53d876687d56cde83a80cde8a50e15bec407a1212aa0c85520892563e3d5ef7aaca98 SHA512 21483912a7b152f27db82d837a4cf91f2552d5fe238702aeca0c0dd8c7d3695bc70d8794c94a19106df28e053baf14c38433ca8e38e849082b76273cb51f2384
-DIST gcc-11.1.0-patches-2.tar.bz2 18492 BLAKE2B 37ffb2b2a92287c434d3730772b73b88926788db8b609611447318a28fd43963fa04ee664bb1c83815ee80742457ab703f7bc2d1e6d700e342760b1d9cd13867 SHA512 62297a37b0f1ff48858c59f761291f0fc4efe14bd471d53763899c2f272cc21764d4521682219a57857118e846766dcb9e24646f749d735acd58bb2d7b8b05d6
-DIST gcc-11.1.0.tar.xz 78877216 BLAKE2B fe617e776b0270d11adea21b5c37d889de90865c19ab82d1c37bbd5c5b9c583a98c174606c4f893ca4950a4233e2a58aae93ad6aa7ad33d4e78a31c72371c1ed SHA512 fd6bba0f67ff48069d03073d1a9b5e896383b1cfc9dde008e868e60a9ec5014a837d56af0ecbf467b3fb9b37ec74a676e819a18b44393a0a3c4280175b5d7ad8
-DIST gcc-11.2.0-musl-patches-1.tar.bz2 2999 BLAKE2B 3e36bbf2f93fdce15e20f807fa262f7a7abbde85b6f6b4e1383f6eccd8a53d876687d56cde83a80cde8a50e15bec407a1212aa0c85520892563e3d5ef7aaca98 SHA512 21483912a7b152f27db82d837a4cf91f2552d5fe238702aeca0c0dd8c7d3695bc70d8794c94a19106df28e053baf14c38433ca8e38e849082b76273cb51f2384
-DIST gcc-11.2.0-patches-1.tar.bz2 11537 BLAKE2B 9dd791ada244c9b70b8b99f9f305a688c248134715ed1b26d406e53b114983faae6873cdc521497164388d24d5f61c199e98df146bc02f5578e877295bcf5c82 SHA512 6539efc60c656d0798a5896dc1b944ed69914b815102c7a1c10bdba4ef935abd326b01309f38316e121f1ed90ceb2abcaf65df6af116892daad829ac2623cefc
-DIST gcc-11.2.0.tar.xz 80888824 BLAKE2B 69b61234ac436edfea2933df68c434a2ce7aa4454ef4da573e82587e1a42dc420189e949cfdadaf4cb37fc0de9674822210a95b77ff03aca0dbedfe67df19cc6 SHA512 d53a0a966230895c54f01aea38696f818817b505f1e2bfa65e508753fcd01b2aedb4a61434f41f3a2ddbbd9f41384b96153c684ded3f0fa97c82758d9de5c7cf
diff --git a/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch b/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
deleted file mode 100644
index d0641065..00000000
--- a/sys-devel/gcc/files/gcc-11.2.0-cross-compile-include.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-https://bugs.gentoo.org/803371
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80196
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017
---- a/configure
-+++ b/configure
-@@ -17044,7 +17044,7 @@ else
- fi
-
-
--RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
-+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ar" >&5
- $as_echo_n "checking where to find the target ar... " >&6; }
---- a/configure.ac
-+++ b/configure.ac
-@@ -3529,7 +3529,7 @@ ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
- ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
- ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
-
--RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
-+RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET -nostdinc++"
-
- GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
- GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
-
diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch
deleted file mode 100644
index d1b1b035..00000000
--- a/sys-devel/gcc/files/gcc-configure-LANG.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in
-option parsing, it may break.
-
-http://bugs.gentoo.org/103483
-
---- configure
-+++ configure
-@@ -54,6 +54,19 @@
- infodir='${prefix}/info'
- mandir='${prefix}/man'
-
-+# NLS nuisances.
-+for as_var in \
-+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-+ LC_TELEPHONE LC_TIME
-+do
-+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-+ eval $as_var=C; export $as_var
-+ else
-+ unset $as_var
-+ fi
-+done
-+
- # Initialize some other variables.
- subdirs=
- MFLAGS= MAKEFLAGS=
-@@ -452,16 +463,6 @@
- esac
- done
-
--# NLS nuisances.
--# Only set these to C if already set. These must not be set unconditionally
--# because not all systems understand e.g. LANG=C (notably SCO).
--# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
--# Non-C LC_CTYPE values break the ctype check.
--if test "${LANG+set}" = set; then LANG=C; export LANG; fi
--if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
--if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
--if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
--
- # confdefs.h avoids OS command line length limits that DEFS can exceed.
- rm -rf conftest* confdefs.h
- # AIX cpp loses on an empty file, so make sure it contains at least a newline.
-@@ -1850,6 +1850,19 @@
- # Compiler output produced by configure, useful for debugging
- # configure, is in ./config.log if it exists.
-
-+# NLS nuisances.
-+for as_var in \
-+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-+ LC_TELEPHONE LC_TIME
-+do
-+ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then
-+ eval \$as_var=C; export \$as_var
-+ else
-+ unset \$as_var
-+ fi
-+done
-+
- ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
- for ac_option
- do
diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch
deleted file mode 100644
index 99e90998..00000000
--- a/sys-devel/gcc/files/gcc-configure-texinfo.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Chances are quite good that the installed makeinfo is sufficient.
-So ignore false positives where the makeinfo installed is so new
-that it violates the cheesy version grep.
-
-http://bugs.gentoo.org/198182
-
---- a/configure
-+++ b/configure
-@@ -3573,6 +3573,6 @@
- :
- else
-- MAKEINFO="$MISSING makeinfo"
-+ :
- fi
- ;;
-
diff --git a/sys-devel/gcc/gcc-10.3.0-r2.ebuild b/sys-devel/gcc/gcc-10.3.0-r2.ebuild
deleted file mode 100644
index 42fc9c2b..00000000
--- a/sys-devel/gcc/gcc-10.3.0-r2.ebuild
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PATCH_VER="3"
-MUSL_VER="1"
-inherit toolchain
-
-KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86"
-
-RDEPEND=""
-BDEPEND="${CATEGORY}/binutils"
-
-src_prepare() {
- toolchain_src_prepare
-
- eapply_user
-}
diff --git a/sys-devel/gcc/gcc-10.3.0-r3.ebuild b/sys-devel/gcc/gcc-10.3.0-r3.ebuild
deleted file mode 100644
index 308d4525..00000000
--- a/sys-devel/gcc/gcc-10.3.0-r3.ebuild
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PATCH_VER="3"
-MUSL_VER="1"
-inherit toolchain
-
-KEYWORDS="ppc x86"
-
-RDEPEND=""
-BDEPEND="${CATEGORY}/binutils"
-
-src_prepare() {
- toolchain_src_prepare
-
- eapply_user
-}
diff --git a/sys-devel/gcc/gcc-11.1.0-r1.ebuild b/sys-devel/gcc/gcc-11.1.0-r1.ebuild
deleted file mode 100644
index a35a711d..00000000
--- a/sys-devel/gcc/gcc-11.1.0-r1.ebuild
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PATCH_VER="2"
-MUSL_VER="1"
-inherit toolchain
-
-KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86"
-
-RDEPEND=""
-BDEPEND="${CATEGORY}/binutils"
-
-src_prepare() {
- if has_version '>=sys-libs/glibc-2.32-r1'; then
- rm -v "${WORKDIR}/patch/21_all_disable-riscv32-ABIs.patch" || die
- fi
-
- toolchain_src_prepare
-
- eapply_user
-}
diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
deleted file mode 100644
index 84e32720..00000000
--- a/sys-devel/gcc/gcc-11.2.0.ebuild
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PATCH_VER="1"
-MUSL_VER="1"
-inherit toolchain
-
-KEYWORDS="amd64 arm arm64 ~mips ppc ppc64 x86"
-
-RDEPEND=""
-BDEPEND="${CATEGORY}/binutils"
-
-src_prepare() {
- toolchain_src_prepare
-
- if is_crosscompile ; then
- # bug #803371
- eapply "${FILESDIR}"/gcc-11.2.0-cross-compile-include.patch
- fi
-
- eapply_user
-}
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml
deleted file mode 100644
index b6cdb6ab..00000000
--- a/sys-devel/gcc/metadata.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
-<pkgmetadata>
- <maintainer type="project">
- <email>toolchain@gentoo.org</email>
- <name>Gentoo Toolchain Project</name>
- </maintainer>
- <use>
- <flag name="ada">Build the ADA language (GNAT) frontend</flag>
- <flag name="d">Enable support for the D programming language</flag>
- <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets
- in gcc (Warning: significantly increases compile time!)</flag>
- <flag name="go">Build the GCC Go language frontend.</flag>
- <flag name="graphite">Add support for the framework for loop
- optimizations based on a polyhedral intermediate representation</flag>
- <flag name="jit">Enable libgccjit so other applications can embed gcc for Just-In-Time compilation.
- This will slow down the compiler a bit as it forces all of the toolchain to be shared libs.</flag>
- <flag name="libssp">Build SSP support into a dedicated library rather than use the
- code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag>
- <flag name="lto">Build using Link Time Optimizations (LTO)</flag>
- <flag name="nptl">Enable support for Native POSIX Threads Library, the new threading module (requires linux-2.6 or better usually)</flag>
- <flag name="objc">Build support for the Objective C code language</flag>
- <flag name="objc++">Build support for the Objective C++ language</flag>
- <flag name="objc-gc">Build support for the Objective C code language Garbage
- Collector</flag>
- <flag name="pgo">Build GCC using Profile Guided Optimization (PGO)</flag>
- <flag name="sanitize">Build support for various sanitizer functions (ASAN/TSAN/etc...)</flag>
- <flag name="ssp">Build packages with stack smashing protector on by default</flag>
- <flag name="systemtap">enable systemtap static probe points</flag>
- <flag name="valgrind">Enable valgrind annotations for gcc internals (useful for gcc debugging).</flag>
- <flag name="vtv">Build support for virtual table verification (a C++ hardening feature)</flag>
- </use>
- <upstream>
- <remote-id type="cpe">cpe:/a:gnu:gcc</remote-id>
- <remote-id type="sourceforge">dgcc</remote-id>
- </upstream>
-</pkgmetadata>
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-11-20 23:24 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-16 4:51 [gentoo-commits] proj/musl:master commit in: sys-devel/gcc/files/, sys-devel/gcc/ Aric Belsito
-- strict thread matches above, loose matches on Subject: below --
2021-11-20 23:24 Sam James
2021-09-13 2:01 Jory Pratt
2018-01-18 2:41 Aric Belsito
2017-07-02 14:47 Anthony G. Basile
2017-07-02 14:47 Anthony G. Basile
2016-09-22 6:48 Anthony G. Basile
2016-09-19 20:12 Anthony G. Basile
2016-05-18 11:09 Anthony G. Basile
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox