diff options
Diffstat (limited to 'gcc/config/gcn')
-rw-r--r-- | gcc/config/gcn/gcn-hsa.h | 4 | ||||
-rw-r--r-- | gcc/config/gcn/gcn-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/gcn/gcn.cc | 14 | ||||
-rw-r--r-- | gcc/config/gcn/gcn.md | 4 | ||||
-rw-r--r-- | gcc/config/gcn/gcn.opt | 8 | ||||
-rw-r--r-- | gcc/config/gcn/mkoffload.cc | 3 |
6 files changed, 34 insertions, 1 deletions
diff --git a/gcc/config/gcn/gcn-hsa.h b/gcc/config/gcn/gcn-hsa.h index 658deac..6904aaa 100644 --- a/gcc/config/gcn/gcn-hsa.h +++ b/gcc/config/gcn/gcn-hsa.h @@ -46,6 +46,10 @@ #define ASM_OUTPUT_LABEL(FILE,NAME) \ do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0) +/* Used in lieu of '../elfos.h:ASM_WEAKEN_LABEL'. */ +#define ASM_WEAKEN_DECL(STREAM, DECL, NAME, VALUE) \ + gcn_asm_weaken_decl ((STREAM), (DECL), (NAME), (VALUE)) + #define ASM_OUTPUT_LABELREF(FILE, NAME) \ asm_fprintf (FILE, "%U%s", default_strip_name_encoding (NAME)) diff --git a/gcc/config/gcn/gcn-protos.h b/gcc/config/gcn/gcn-protos.h index 87d9092..1e513ba 100644 --- a/gcc/config/gcn/gcn-protos.h +++ b/gcc/config/gcn/gcn-protos.h @@ -18,6 +18,8 @@ #define _GCN_PROTOS_ extern void gcn_asm_output_symbol_ref (FILE *file, rtx x); +extern void gcn_asm_weaken_decl (FILE *stream, tree decl, const char *name, + const char *value); extern tree gcn_builtin_decl (unsigned code, bool initialize_p); extern bool gcn_can_split_p (machine_mode, rtx); extern bool gcn_constant64_p (rtx); diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc index 48691c3..d59e87b 100644 --- a/gcc/config/gcn/gcn.cc +++ b/gcc/config/gcn/gcn.cc @@ -6927,6 +6927,20 @@ gcn_asm_output_symbol_ref (FILE *file, rtx x) } } +void +gcn_asm_weaken_decl (FILE *stream, tree decl, const char *name, + const char *value) +{ + if (!value + && DECL_EXTERNAL (decl)) + /* Don't emit weak undefined symbols; see PR119369. */ + return; + if (value) + ASM_OUTPUT_WEAK_ALIAS (stream, name, value); + else + ASM_WEAKEN_LABEL (stream, name); +} + /* Implement TARGET_CONSTANT_ALIGNMENT. Returns the alignment in bits of a constant that is being placed in memory. diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md index 695656f..e0fb735 100644 --- a/gcc/config/gcn/gcn.md +++ b/gcc/config/gcn/gcn.md @@ -1018,7 +1018,9 @@ [(const_int 0)] "" { - sorry ("exception handling not supported"); + if (!fake_exceptions) + sorry ("exception handling not supported"); + DONE; }) ;; }}} diff --git a/gcc/config/gcn/gcn.opt b/gcc/config/gcn/gcn.opt index 142b439..99d6aeb 100644 --- a/gcc/config/gcn/gcn.opt +++ b/gcc/config/gcn/gcn.opt @@ -101,3 +101,11 @@ Enum(gcn_preferred_vectorization_factor) String(32) Value(32) EnumValue Enum(gcn_preferred_vectorization_factor) String(64) Value(64) + +mfake-exceptions +Target Var(fake_exceptions) Init(0) Undocumented +; With '-mfake-exceptions' enabled, the user-visible behavior in presence of +; exception handling constructs changes such that the compile-time +; 'sorry, unimplemented: exception handling not supported' is skipped, code +; generation proceeds, and instead, exception handling constructs 'abort' at +; run time. (..., or don't, if they're in dead code.) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index f5b89c9..b284ff4 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -1160,6 +1160,9 @@ main (int argc, char **argv) obstack_ptr_grow (&cc_argv_obstack, "-xlto"); if (fopenmp) obstack_ptr_grow (&cc_argv_obstack, "-mgomp"); + /* The host code may contain exception handling constructs. + Handle these as good as we can. */ + obstack_ptr_grow (&cc_argv_obstack, "-mfake-exceptions"); for (int ix = 1; ix != argc; ix++) { |