[cfe-commits] r66038 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/2008-07-31-asm-labels.c
Daniel Dunbar
daniel at zuster.org
Wed Mar 4 09:31:20 PST 2009
Author: ddunbar
Date: Wed Mar 4 11:31:19 2009
New Revision: 66038
URL: http://llvm.org/viewvc/llvm-project?rev=66038&view=rev
Log:
Support "asm" renaming of external symbols.
- PR3698.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGen/2008-07-31-asm-labels.c
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=66038&r1=66037&r2=66038&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Mar 4 11:31:19 2009
@@ -605,6 +605,12 @@
if (D->getAttr<WeakAttr>())
GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage);
+
+ if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) {
+ // Prefaced with special LLVM marker to indicate that the name
+ // should not be munged.
+ GV->setName("\01" + ALA->getLabel());
+ }
}
// Make sure the result is of the correct type.
Modified: cfe/trunk/test/CodeGen/2008-07-31-asm-labels.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-07-31-asm-labels.c?rev=66038&r1=66037&r2=66038&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/2008-07-31-asm-labels.c (original)
+++ cfe/trunk/test/CodeGen/2008-07-31-asm-labels.c Wed Mar 4 11:31:19 2009
@@ -1,6 +1,8 @@
// RUN: clang -emit-llvm -o %t %s &&
// RUN: grep "@pipe()" %t | count 0 &&
// RUN: grep '_thisIsNotAPipe' %t | count 3 &&
+// RUN: grep 'g0' %t | count 0 &&
+// RUN: grep '_renamed' %t | count 2 &&
// RUN: clang -DUSE_DEF -emit-llvm -o %t %s &&
// RUN: grep "@pipe()" %t | count 0 &&
// RUN: grep '_thisIsNotAPipe' %t | count 3
@@ -23,3 +25,9 @@
int x = 10;
}
#endif
+
+// PR3698
+extern int g0 asm("_renamed");
+int f2() {
+ return g0;
+}
More information about the cfe-commits
mailing list