Hello, Everyone

Please find patch for llvm-gcc4 attached. It fixes linkage setup at
least for mingw32 platform as target. However, I'm worrying it's no so
correct :)

-- 
With best regards, Anton Korobeynikov.

Faculty of Mathematics & Mechanics, Saint Petersburg State University.
diff -r 1b4eb5588133 gcc/llvm-convert.cpp
--- a/gcc/llvm-convert.cpp	Fri Oct 20 18:07:37 2006 +0000
+++ b/gcc/llvm-convert.cpp	Mon Oct 23 01:28:02 2006 +0400
@@ -311,16 +311,18 @@ void TreeToLLVM::StartFunctionBody() {
   // Compute the linkage that the function should get.
   if (!TREE_PUBLIC(FnDecl) /*|| lang_hooks.llvm_is_in_anon(subr)*/) {
     Fn->setLinkage(Function::InternalLinkage);
+  } else if (DECL_DECLARED_INLINE_P(FnDecl)) {
+    if (DECL_EXTERNAL(FnDecl)) {
+      Fn->setLinkage(Function::LinkOnceLinkage);
+    } else {
+      Fn->setLinkage(Function::WeakLinkage);
+    }
+  } else if (DECL_WEAK(FnDecl) || DECL_ONE_ONLY(FnDecl)) {
+    Fn->setLinkage(Function::WeakLinkage);
   } else if (DECL_COMDAT(FnDecl)) {
     Fn->setLinkage(Function::LinkOnceLinkage);
-  } else if (DECL_DECLARED_INLINE_P(FnDecl)) {
-    if (DECL_EXTERNAL(FnDecl) || DECL_ONE_ONLY(FnDecl))
-      Fn->setLinkage(Function::LinkOnceLinkage);
-    else
-      Fn->setLinkage(Function::WeakLinkage);
-  } else if (DECL_WEAK(FnDecl) || DECL_ONE_ONLY(FnDecl)) {
-    Fn->setLinkage(Function::WeakLinkage);
-  }
+  }
+  
 
 #ifdef TARGET_ADJUST_LLVM_LINKAGE
   TARGET_ADJUST_LLVM_LINKAGE(Fn,FnDecl);
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to