aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/nvptx
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/nvptx')
-rw-r--r--gcc/config/nvptx/nvptx.c7
-rw-r--r--gcc/config/nvptx/nvptx.h1
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 "//"