Hi everyone,

I'd like to add the patch below to toolchain-funcs.eclass. I need it for bug #499996 and it helps to address a category of bugs which gcc-4.8 uncovers. 4.8 and above introduces -fstack-check. This is code emitted by gcc to make sure you don't go past the beyond the boundary of the stack in a multithreaded environment. It requires one register on at least i686 and amd64, but I'm not sure about the others. In asm heavy code, such as vlc and ffmpeg, we hit the limit of useable registers pretty quickly and go over the top with either -fstack-check or pie. We have tests to check for pie in toolchain-funcs, but not for stack-check. The following adds that check. I tested it already. I'll commit in a few days if there are no objections.

--- toolchain-funcs.eclass.orig    2014-10-12 11:23:41.585182742 -0400
+++ toolchain-funcs.eclass    2014-10-12 11:31:57.170205300 -0400
@@ -610,6 +610,12 @@
     directive=$(gcc-specs-directive cc1)
     return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]])
 }
+# Returns true if gcc builds with fstack-check
+gcc-specs-stack-check() {
+    local directive
+    directive=$(gcc-specs-directive cc1)
+    return $([[ "${directive/\{!fno-stack-check:}" != "${directive}" ]])
+}


 # @FUNCTION: gen_usr_ldscript

--
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : bluen...@gentoo.org
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA


Reply via email to