[NVPTX] Do not emit .weak symbols for NVPTX

Summary:
".weak" symbols cannot be consumed by ptxas (PR21685). This patch makes the
weak directive in MCAsmPrinter customizable, and disables emitting ".weak"
symbols for NVPTX.

Test Plan: weak-linkage.ll

Reviewers: jholewinski

Reviewed By: jholewinski

Subscribers: majnemer, jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D6455

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223077 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jingyue Wu
2014-12-01 21:16:17 +00:00
parent 03c735b42c
commit b043278834
5 changed files with 16 additions and 3 deletions

View File

@@ -215,7 +215,8 @@ protected:
//===--- Global Variable Emission Directives --------------------------===//
/// This is the directive used to declare a global entity. Defaults to NULL.
/// This is the directive used to declare a global entity. Defaults to
/// ".globl".
const char *GlobalDirective;
/// True if the expression
@@ -264,6 +265,9 @@ protected:
/// to false.
bool HasNoDeadStrip;
/// Used to declare a global as being a weak symbol. Defaults to ".weak".
const char *WeakDirective;
/// This directive, if non-null, is used to declare a global as being a weak
/// undefined symbol. Defaults to NULL.
const char *WeakRefDirective;
@@ -452,6 +456,7 @@ public:
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
bool hasIdentDirective() const { return HasIdentDirective; }
bool hasNoDeadStrip() const { return HasNoDeadStrip; }
const char *getWeakDirective() const { return WeakDirective; }
const char *getWeakRefDirective() const { return WeakRefDirective; }
bool hasWeakDefDirective() const { return HasWeakDefDirective; }
bool hasWeakDefCanBeHiddenDirective() const {