This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Do not emit .weak symbols for NVPTX
ClosedPublic

Authored by jingyue on Nov 28 2014, 10:56 AM.

Details

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.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 16743.Nov 28 2014, 10:56 AM
jingyue retitled this revision from to [NVPTX] Do not emit .weak symbols for NVPTX.
jingyue updated this object.
jingyue edited the test plan for this revision. (Show Details)
jingyue added a reviewer: jholewinski.
jingyue added a subscriber: Unknown Object (MLST).
majnemer added inline comments.
include/llvm/MC/MCAsmInfo.h
273

Does it default to .weak?

jingyue updated this revision to Diff 16745.Nov 28 2014, 8:16 PM

David, you are right. I believe the comment on GlobalDirective needs updated too.

+ justin@nvidia

jholewinski accepted this revision.Dec 1 2014, 12:33 PM
jholewinski edited edge metadata.

This looks fine for now, considering the same approach is taken for the .globl directive. That said, we really need a better way to handle this. Ptxas supports just enough GNU-style syntax to let us get by without a custom AsmStreamer in most cases, but not enough to avoid these annoying issues.

This revision is now accepted and ready to land.Dec 1 2014, 12:33 PM
jingyue closed this revision.Dec 1 2014, 1:16 PM

Thanks Justin. Closed in r223077.

I totally agree with you. What do you think is a good long-term solution? I'm thinking of overriding EmitFunctionHeader to emit the format ptxas can consume.