Gentoo Archives: gentoo-dev

From: Dan Douglas <ormaaj@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Add gcc-specs-stack-check() to toolchain-funcs.eclass
Date: Sun, 12 Oct 2014 18:03:26
Message-Id: CADVxHgMf00=7E6GADhu2jPMs+17uEonCu+0SnfJE8C1f516EaA@mail.gmail.com
In Reply to: [gentoo-dev] Add gcc-specs-stack-check() to toolchain-funcs.eclass by "Anthony G. Basile"
1 On Sun, Oct 12, 2014 at 11:22 AM, Anthony G. Basile <blueness@g.o> wrote:
2 > Hi everyone,
3 >
4 > I'd like to add the patch below to toolchain-funcs.eclass. I need it for
5 > bug #499996 and it helps to address a category of bugs which gcc-4.8
6 > uncovers. 4.8 and above introduces -fstack-check. This is code emitted by
7 > gcc to make sure you don't go past the beyond the boundary of the stack in a
8 > multithreaded environment. It requires one register on at least i686 and
9 > amd64, but I'm not sure about the others. In asm heavy code, such as vlc
10 > and ffmpeg, we hit the limit of useable registers pretty quickly and go over
11 > the top with either -fstack-check or pie. We have tests to check for pie in
12 > toolchain-funcs, but not for stack-check. The following adds that check. I
13 > tested it already. I'll 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 Am I missing something here? I don't see how any of the tests used in
32 gcc-specs-* functions could possibly produce an output. The fact that this
33 coincidentally works in Bash shouldn't be relied upon.
34
35 --
36 Dan Douglas

Replies