Gentoo Archives: gentoo-dev

From: "Anthony G. Basile" <blueness@g.o>
To: Gentoo Development <gentoo-dev@l.g.o>
Subject: [gentoo-dev] Add gcc-specs-stack-check() to toolchain-funcs.eclass
Date: Sun, 12 Oct 2014 16:22:01
Message-Id: 543AAAD6.8090506@gentoo.org
1 Hi everyone,
2
3 I'd like to add the patch below to toolchain-funcs.eclass. I need it
4 for bug #499996 and it helps to address a category of bugs which gcc-4.8
5 uncovers. 4.8 and above introduces -fstack-check. This is code emitted
6 by gcc to make sure you don't go past the beyond the boundary of the
7 stack in a multithreaded environment. It requires one register on at
8 least i686 and amd64, but I'm not sure about the others. In asm heavy
9 code, such as vlc and ffmpeg, we hit the limit of useable registers
10 pretty quickly and go over the top with either -fstack-check or pie. We
11 have tests to check for pie in toolchain-funcs, but not for
12 stack-check. The following adds that check. I tested it already. I'll
13 commit in a few days if there are no objections.
14
15 --- toolchain-funcs.eclass.orig 2014-10-12 11:23:41.585182742 -0400
16 +++ toolchain-funcs.eclass 2014-10-12 11:31:57.170205300 -0400
17 @@ -610,6 +610,12 @@
18 directive=$(gcc-specs-directive cc1)
19 return $([[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]])
20 }
21 +# Returns true if gcc builds with fstack-check
22 +gcc-specs-stack-check() {
23 + local directive
24 + directive=$(gcc-specs-directive cc1)
25 + return $([[ "${directive/\{!fno-stack-check:}" != "${directive}" ]])
26 +}
27
28
29 # @FUNCTION: gen_usr_ldscript
30
31 --
32 Anthony G. Basile, Ph.D.
33 Gentoo Linux Developer [Hardened]
34 E-Mail : blueness@g.o
35 GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA
36 GnuPG ID : F52D4BBA

Replies

Subject Author
Re: [gentoo-dev] Add gcc-specs-stack-check() to toolchain-funcs.eclass Dan Douglas <ormaaj@×××××.com>