Created attachment 193342 [details] patch: strip -mretpoline option /etc/make.conf: # Retpoline speculative execution vulnerability mitigation (CVE-2017-5715) CFLAGS+=-mretpoline CXXFLAGS+=-mretpoline COPTFLAGS+=-mretpoline ... checking for x86_64-portbld-freebsd11.2-gcc... /tmp/ports/usr/ports/lang/gcc6/work/.build/./gcc/xgcc -B/tmp/ports/usr/ports/lang/gcc6/work/.build/./gcc/ -B/usr/local/x86_64-portbld-freebsd11.2/bin/ -B/usr/local/x86_64-portbld-freebsd11.2/lib/ -isystem /usr/local/x86_64-portbld-freebsd11.2/include -isystem /usr/local/x86_64-portbld-freebsd11.2/sys-include checking for suffix of object files... configure: error: in `/tmp/ports/usr/ports/lang/gcc6/work/.build/x86_64-portbld-freebsd11.2/libgcc': configure: error: cannot compute suffix of object files: cannot compile See `config.log' for more details. gmake[4]: *** [Makefile:14944: configure-stage1-target-libgcc] Error 1 gmake[4]: Leaving directory '/tmp/ports/usr/ports/lang/gcc6/work/.build' gmake[3]: *** [Makefile:21516: stage1-bubble] Error 2 gmake[3]: Leaving directory '/tmp/ports/usr/ports/lang/gcc6/work/.build' gmake[2]: *** [Makefile:21848: bootstrap-lean] Error 2 gmake[2]: Leaving directory '/tmp/ports/usr/ports/lang/gcc6/work/.build' ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make[1]: stopped in /usr/ports/lang/gcc6
My first reaction was "Well, then don't build an old port with new options (designed for clang I assume", but that wouldn't be super helpful. Still, I recommend you switch to GCC 7, and you can do so simply adjusting Mk/bsd.default-versions.mk which should work for nearly everything. And thank you for the patch, that was very helpful! Do you see any drawbacks if I use +CFLAGS:= ${CFLAGS:N-mretpoline} +CXXFLAGS:= ${CXXFLAGS:N-mretpoline} instead (i.e, Npattern instead of S/^pattern$//)?
gcc6 required as sub dep for numpy, it is for work. gcc7 requires this patch too. > CFLAGS:= ${CFLAGS:N-mretpoline} - ok, I found it some where in sys/ports mk files.
A commit references this bug: Author: gerald Date: Sun May 13 12:17:59 UTC 2018 New revision: 469788 URL: https://svnweb.freebsd.org/changeset/ports/469788 Log: Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 228205 Submitted by: rozhuk.im@gmail.com Changes: head/lang/gcc6/Makefile
A commit references this bug: Author: gerald Date: Mon May 28 09:04:30 UTC 2018 New revision: 471032 URL: https://svnweb.freebsd.org/changeset/ports/471032 Log: Forward port r469788 from lang/gcc6: Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 228205 Submitted by: rozhuk.im@gmail.com Changes: head/lang/gcc7/Makefile
A commit references this bug: Author: gerald Date: Sun Jul 22 12:29:08 UTC 2018 New revision: 475105 URL: https://svnweb.freebsd.org/changeset/ports/475105 Log: Forward port r469788 from lang/gcc6: Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 228205 Submitted by: rozhuk.im@gmail.com Changes: head/lang/gcc8/Makefile
Now that I forward ported this to lang/gcc7 (soon to become the new default version of GCC in the ports tree) and lang/gcc8 we can close this.
A commit references this bug: Author: gerald Date: Fri Jan 11 19:26:42 UTC 2019 New revision: 489990 URL: https://svnweb.freebsd.org/changeset/ports/489990 Log: Update to the 20180104 snapshot of GCC 8.2.1. Forward port r469788 from lang/gcc6 = backport r475105 from lang/gcc8: Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 228205 Submitted by: rozhuk.im@gmail.com Changes: head/lang/gcc8-devel/Makefile head/lang/gcc8-devel/distinfo
A commit references this bug: Author: gerald Date: Mon Mar 11 12:11:41 UTC 2019 New revision: 495351 URL: https://svnweb.freebsd.org/changeset/ports/495351 Log: Update to the 20180310 snapshot of GCC 9.0.1. Forward port r469788 from lang/gcc6 since apparently people are still using the -mretpoline option that is specific to clang, and gcc9-devel is going to branch into gcc9 in a rew months and that one later the default version of GCC in use: Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 228205 Submitted by: rozhuk.im@gmail.com Changes: head/lang/gcc9-devel/Makefile head/lang/gcc9-devel/distinfo
A commit references this bug: Author: gerald Date: Sun Oct 18 09:07:44 UTC 2020 New revision: 552624 URL: https://svnweb.freebsd.org/changeset/ports/552624 Log: Remove -march=westmere from CFLAGS and CXXFLAGS if present since this old version of GCC (end of life for more than five years) does not yet support the Intel Westmere architecture. [1] This avoids breaking users who set a global CPUTYPE to westmere. While here, backport r469788 from lang/gcc6: [2] Filter the -mretpoline command-line option, which is understood by recent versions of clang (and used in the context of the Spectre security issues), but not GCC (which uses different options for the same) from CFLAGS and CXXFLAGS. This avoids the build of this port via bootstrap, which is the default and leverages both the system compiler (clang in most cases) plus a just built version GCC, to fail due to the latter not knowing -mretpoline. PR: 250263 [1], 228205 [2] Reported by: Patrick McMunn <doctorwhoguy@gmail.com> [1] Submitted by: rozhuk.im@gmail.com [2] Changes: head/lang/gcc48/Makefile