aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-05-02 22:18:11 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-05-02 22:18:11 +0000
commitdaccad6dd9fc5fce8e89407c6af6a2244b04352e (patch)
treec1d159624825d693c1673e551e37788d6a49f86f
parentaefa216b7eb3e9b444bf1c81181a336e41d6150b (diff)
downloadgcc-daccad6dd9fc5fce8e89407c6af6a2244b04352e.zip
gcc-daccad6dd9fc5fce8e89407c6af6a2244b04352e.tar.gz
gcc-daccad6dd9fc5fce8e89407c6af6a2244b04352e.tar.bz2
vms.h (SUBTARGET_OVERRIDE_OPTIONS): For pic code, unset flag_jump_tables.
* config/alpha/vms.h (SUBTARGET_OVERRIDE_OPTIONS): For pic code, unset flag_jump_tables. * stmt.c (expand_case): Remove special flag_pic case conditional on ASM_OUTPUT_ADDR_DIFF_ELT not being defined. From-SVN: r187065
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/alpha/vms.h12
-rw-r--r--gcc/stmt.c3
3 files changed, 18 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4d945c4..a72cd97 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2012-05-02 Steven Bosscher <steven@gcc.gnu.org>
+
+ * config/alpha/vms.h (SUBTARGET_OVERRIDE_OPTIONS): For pic code,
+ unset flag_jump_tables.
+ * stmt.c (expand_case): Remove special flag_pic case conditional
+ on ASM_OUTPUT_ADDR_DIFF_ELT not being defined.
+
2012-05-02 Ulrich Weigand <ulrich.weigand@linaro.org>
* common/config/s390/s390-common.c (s390_option_optimization_table):
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index 8caec54..73e45a5 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -257,7 +257,15 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#undef ASM_FINAL_SPEC
/* The VMS convention is to always provide minimal debug info
- for a traceback unless specifically overridden. */
+ for a traceback unless specifically overridden.
+
+ Because ASM_OUTPUT_ADDR_DIFF_ELT is not defined for alpha-vms,
+ jump tables cannot be output for PIC code, because you can't put
+ an absolute address in a readonly section. Putting the table in
+ a writable section is a security hole. Therefore, we unset the
+ flag_jump_tables flag, forcing switch statements to be expanded
+ using decision trees. There are probably other ways to address
+ this issue, but using a decision tree is clearly safe. */
#undef SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS \
@@ -268,6 +276,8 @@ do { \
write_symbols = VMS_DEBUG; \
debug_info_level = DINFO_LEVEL_TERSE; \
} \
+ if (flag_pic) \
+ flag_jump_tables = 0; \
} while (0)
#undef LINK_SPEC
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 8f7b150..dd34890 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2198,9 +2198,6 @@ expand_case (gimple stmt)
/* RANGE may be signed, and really large ranges will show up
as negative numbers. */
|| compare_tree_int (range, 0) < 0
-#ifndef ASM_OUTPUT_ADDR_DIFF_ELT
- || flag_pic
-#endif
|| !flag_jump_tables
|| TREE_CONSTANT (index_expr)
/* If neither casesi or tablejump is available, we can