summaryrefslogtreecommitdiffstats
path: root/patches/gcc-4.7.2/0300-gcc-trampolinewarn.patch
blob: e14193806781d94e05f0c38853062ed1b72ef1ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: "Kevin F. Quinn" <kevquinn@gentoo.org>
Date: Tue, 1 Nov 2011 18:25:08 +0100
Subject: [PATCH] gcc trampolinewarn

Taken from gentoo, original description:

This trivial patch causes gcc to emit a warning whenever it generates a
trampoline. These are otherwise hard to locate. It is rigged to default
ON - to have it default to OFF remove the text 'Init(1)' from the
common.opt patch, leaving just 'Common Var(warn_trampolines)'.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
 gcc/builtins.c |    3 +++
 gcc/common.opt |    4 ++++
 2 files changed, 7 insertions(+)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 04980cc..fb3c837 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4535,6 +4535,9 @@ expand_builtin_va_copy (tree exp)
       emit_block_move (dstb, srcb, size, BLOCK_OP_NORMAL);
     }
 
+  if (warn_trampolines)
+    warning (OPT_Wtrampolines, "generating trampoline in object (requires executable stack)");
+
   return const0_rtx;
 }
 
diff --git a/gcc/common.opt b/gcc/common.opt
index 033fbe0..2946022 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -646,6 +646,10 @@ Wtype-limits
 Common Var(warn_type_limits) Init(-1) Warning
 Warn if a comparison is always true or always false due to the limited range of the data type
 
+Wtrampolines
+Common Var(warn_trampolines) Init(1)
+Warn whenever a trampoline is generated
+
 Wuninitialized
 Common Var(warn_uninitialized) Init(-1) Warning
 Warn about uninitialized automatic variables