diff options
author | 2005-02-06 10:39:31 +0000 | |
---|---|---|
committer | 2005-02-06 10:39:31 +0000 | |
commit | dc2758741738940fd33e00f8648d852012484337 (patch) | |
tree | 8a43d817c5d1a9eb9b6094696dccadb43bccc6a2 | |
parent | Remove some uneeded code to reduce delta to NetBSD. (diff) | |
download | wireguard-openbsd-dc2758741738940fd33e00f8648d852012484337.tar.xz wireguard-openbsd-dc2758741738940fd33e00f8648d852012484337.zip |
disallow trampolines by default. okay miod@, jmc@
-rw-r--r-- | gnu/usr.bin/gcc/gcc/expr.c | 12 | ||||
-rw-r--r-- | gnu/usr.bin/gcc/gcc/toplev.c | 9 | ||||
-rw-r--r-- | share/man/man1/gcc-local.1 | 13 |
3 files changed, 32 insertions, 2 deletions
diff --git a/gnu/usr.bin/gcc/gcc/expr.c b/gnu/usr.bin/gcc/gcc/expr.c index d20df2deaf0..743d4b9aca3 100644 --- a/gnu/usr.bin/gcc/gcc/expr.c +++ b/gnu/usr.bin/gcc/gcc/expr.c @@ -6500,6 +6500,9 @@ find_placeholder (exp, plist) return 0; } +extern int flag_trampolines; +extern int warn_trampolines; + /* expand_expr: generate code for computing expression EXP. An rtx for the computed value is returned. The value is never null. @@ -9140,6 +9143,15 @@ expand_expr (exp, target, tmode, modifier) && ! DECL_NO_STATIC_CHAIN (TREE_OPERAND (exp, 0)) && ! TREE_STATIC (exp)) { + if (!flag_trampolines) + { + error_with_decl(exp, "trampoline code generation is not allowed without -ftrampoline"); + return const0_rtx; + } + if (warn_trampolines) + { + warning_with_decl(exp, "local function address taken, needing trampoline generation"); + } op0 = trampoline_address (TREE_OPERAND (exp, 0)); op0 = force_operand (op0, target); } diff --git a/gnu/usr.bin/gcc/gcc/toplev.c b/gnu/usr.bin/gcc/gcc/toplev.c index fc59a7c571c..8148dbc215f 100644 --- a/gnu/usr.bin/gcc/gcc/toplev.c +++ b/gnu/usr.bin/gcc/gcc/toplev.c @@ -921,6 +921,9 @@ int flag_propolice_protection = 0; int flag_stack_protection = 0; #endif +int flag_trampolines = 0; +int warn_trampolines = 0; + /* Table of supported debugging formats. */ static const struct { @@ -1209,6 +1212,8 @@ static const lang_independent_options f_options[] = N_("Enables stack protection") }, {"stack-protector-all", &flag_stack_protection, 1, N_("Enables stack protection of every function") } , + {"trampolines", &flag_trampolines, 1, + N_("Allows trampolines") }, }; /* Table of language-specific options. */ @@ -1573,7 +1578,9 @@ static const lang_independent_options W_options[] = {"strict-aliasing", &warn_strict_aliasing, 1, N_ ("Warn about code which might break the strict aliasing rules") }, {"stack-protector", &warn_stack_protector, 1, - N_("Warn when disabling stack protector for some reason")} + N_("Warn when disabling stack protector for some reason")}, + {"trampolines", &warn_trampolines, 1, + N_("Warn when trampolines are emitted")}, }; void diff --git a/share/man/man1/gcc-local.1 b/share/man/man1/gcc-local.1 index e5e88093075..6e363176903 100644 --- a/share/man/man1/gcc-local.1 +++ b/share/man/man1/gcc-local.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: gcc-local.1,v 1.9 2005/01/18 03:37:46 david Exp $ +.\" $OpenBSD: gcc-local.1,v 1.10 2005/02/06 10:39:31 espie Exp $ .\" .\" Copyright (c) 2002 Marc Espie .\" Copyright (c) 2003 Anil Madhavapeddy @@ -64,6 +64,17 @@ executable using .Xr mprotect 2 , since the stack area is by default non-executable. .It +On +.Ox , +by default, trampoline code generation is disabled in +.Nm gcc 3.3.5 . +Code requiring trampolines will not compile without +.Fl ftrampolines . +The warning flag +.Fl Wtrampolines +can be used to locate trampoline instances if trampoline generation +is re-enabled. +.It The .Fl O2 option does not include |