diff options
author | Nathan Sidwell <nathan@acm.org> | 2015-11-19 22:05:03 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2015-11-19 22:05:03 +0000 |
commit | 0766660bf94087754e89959cb4b1f27660f30afe (patch) | |
tree | 9b58207fedab59f51a80435e8b38056177fd0b25 /gcc/config/nvptx | |
parent | 433068ccab80943a0b1dac0fff62d0cfc5c50acb (diff) | |
download | gcc-0766660bf94087754e89959cb4b1f27660f30afe.zip gcc-0766660bf94087754e89959cb4b1f27660f30afe.tar.gz gcc-0766660bf94087754e89959cb4b1f27660f30afe.tar.bz2 |
nvptx.h (SUPPORTS_WEAK): Define.
gcc/
* config/nvptx/nvptx.h (SUPPORTS_WEAK): Define.
* config/nvptx/nvptx.c (nvptx_write_function_decl): Support
DECL_WEAK.
(nvptx_declare_objec_name): Likewise.
gcc/testsuite/
* lib/target-supports.exp (check_weak_available): Add nvptx-*-*.
* gcc.dg/attr-weakref-1.c: Skip for nvptx-*-*
* gcc.dg/special/weak-2.c: Likewise.
* gcc.dg/weak/weak-12.c: Likewise.
* gcc.dg/weak/weak-15.c: Likewise.
* gcc.dg/weak/weak-16.c: Likewise.
* gcc.dg/weak/weak-1.c: Likewise.
* gcc.dg/weak/weak-2.c: Likewise.
* gcc.dg/weak/weak-4.c: Likewise.
* gcc.dg/torture/pr53922.c: Likewise.
* gcc.dg/torture/pr60092.c: Likewise.
From-SVN: r230628
Diffstat (limited to 'gcc/config/nvptx')
-rw-r--r-- | gcc/config/nvptx/nvptx.c | 7 | ||||
-rw-r--r-- | gcc/config/nvptx/nvptx.h | 1 |
2 files changed, 5 insertions, 3 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 62c6faa..044f545 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -379,7 +379,7 @@ nvptx_write_function_decl (std::stringstream &s, const char *name, const_tree de if (DECL_EXTERNAL (decl)) s << ".extern "; else if (TREE_PUBLIC (decl)) - s << ".visible "; + s << (DECL_WEAK (decl) ? ".weak " : ".visible "); if (kernel) s << ".entry "; @@ -1780,8 +1780,9 @@ nvptx_declare_object_name (FILE *file, const char *name, const_tree decl) size = tree_to_uhwi (DECL_SIZE_UNIT (decl)); const char *section = nvptx_section_for_decl (decl); fprintf (file, "\t%s%s .align %d .u%d ", - TREE_PUBLIC (decl) ? " .visible" : "", section, - DECL_ALIGN (decl) / BITS_PER_UNIT, + !TREE_PUBLIC (decl) ? "" + : DECL_WEAK (decl) ? ".weak" : ".visible", + section, DECL_ALIGN (decl) / BITS_PER_UNIT, decl_chunk_size * BITS_PER_UNIT); assemble_name (file, name); if (size > 0) diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h index 018b844..1a497be 100644 --- a/gcc/config/nvptx/nvptx.h +++ b/gcc/config/nvptx/nvptx.h @@ -349,6 +349,7 @@ struct GTY(()) machine_function #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \ ((VALUE) = GET_MODE_BITSIZE ((MODE)), 2) +#define SUPPORTS_WEAK 1 #define NO_DOT_IN_LABEL #define ASM_COMMENT_START "//" |