[dragonegg] r175524 - If we can't find an aliasee with a given name, maybe that's because the name
Duncan Sands
baldrick at free.fr
Tue Feb 19 08:27:35 PST 2013
Author: baldrick
Date: Tue Feb 19 10:27:35 2013
New Revision: 175524
URL: http://llvm.org/viewvc/llvm-project?rev=175524&view=rev
Log:
If we can't find an aliasee with a given name, maybe that's because the name
got a \1 in front of it. Note that this is only useful for gcc-4.6 and earlier,
as gcc-4.7 has a more sensible system for aliases. Fixes PR15090.
Added:
dragonegg/trunk/test/compilator/local/AliasOfRename.c
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=175524&r1=175523&r2=175524&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Tue Feb 19 10:27:35 2013
@@ -905,6 +905,8 @@ static void emit_alias(tree decl, tree t
StringRef AliaseeName(IDENTIFIER_POINTER(target), IDENTIFIER_LENGTH(target));
if (!lookup_attribute("weakref", DECL_ATTRIBUTES(decl))) {
Aliasee = TheModule->getNamedValue(AliaseeName);
+ if (!Aliasee)
+ Aliasee = TheModule->getNamedValue(("\1" + AliaseeName).str());
if (!Aliasee || Aliasee->hasLocalLinkage()) {
error("%q+D aliased to undefined symbol %qs", decl,
AliaseeName.str().c_str());
Added: dragonegg/trunk/test/compilator/local/AliasOfRename.c
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/test/compilator/local/AliasOfRename.c?rev=175524&view=auto
==============================================================================
--- dragonegg/trunk/test/compilator/local/AliasOfRename.c (added)
+++ dragonegg/trunk/test/compilator/local/AliasOfRename.c Tue Feb 19 10:27:35 2013
@@ -0,0 +1,21 @@
+// PR15090
+
+extern int *A (); extern __typeof (A) A __asm__ ("AA");
+// A -> AA (extern), renaming.
+
+
+extern __typeof (A) B; extern __typeof (B) B __asm__ ("BB");
+// B -> BB (extern), renaming.
+
+int *B () { return 0; }
+// BB defined.
+
+
+extern __typeof (B) C __asm__ ("B");
+// C -> B (extern), renaming.
+
+extern __typeof (B) C __attribute__ ((alias ("BB")));
+// B an alias for BB.
+
+extern __typeof (B) A __attribute__ ((weak, alias ("B")));
+// AA a weak alias for B.
More information about the llvm-commits
mailing list