<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">This commit is causing test failures on darwin:<div class=""><br class=""></div><div class=""><a href="http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/1464/consoleFull#-18314650158254eaf0-7326-4999-85b0-388101f2d404" class="">http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/1464/consoleFull#-18314650158254eaf0-7326-4999-85b0-388101f2d404</a></div><div class=""><br class=""></div><div class="">Looks like you need to add a triple to the RUN line you added. Can you fix this?</div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">Erik<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 22, 2019, at 1:47 PM, Nick Desaulniers via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Author: nickdesaulniers<br class="">Date: Thu Aug 22 13:47:12 2019<br class="">New Revision: 369705<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=369705&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=369705&view=rev</a><br class="">Log:<br class="">[Clang][CodeGen] set alias linkage on QualType<br class=""><br class="">Summary:<br class="">It seems that CodeGen was always using ExternalLinkage when emitting a<br class="">GlobalDecl with __attribute__((alias)). This leads to symbol<br class="">redefinitions (ODR) that cause failures at link time for static aliases.<br class="">This is readily attempting to link an ARM (32b) allyesconfig Linux<br class="">kernel built with Clang.<br class=""><br class="">Reported-by: nathanchance<br class="">Suggested-by: ihalip<br class="">Link: <a href="https://bugs.llvm.org/show_bug.cgi?id=42377" class="">https://bugs.llvm.org/show_bug.cgi?id=42377</a><br class="">Link: <a href="https://github.com/ClangBuiltLinux/linux/issues/631" class="">https://github.com/ClangBuiltLinux/linux/issues/631</a><br class=""><br class="">Reviewers: rsmith, aaron.ballman, erichkeane<br class=""><br class="">Reviewed By: aaron.ballman<br class=""><br class="">Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance<br class=""><br class="">Tags: #clang<br class=""><br class="">Differential Revision: <a href="https://reviews.llvm.org/D66492" class="">https://reviews.llvm.org/D66492</a><br class=""><br class="">Modified:<br class=""> cfe/trunk/lib/CodeGen/CodeGenModule.cpp<br class=""> cfe/trunk/test/CodeGen/alias.c<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=369705&r1=369704&r2=369705&view=diff" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=369705&r1=369704&r2=369705&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Aug 22 13:47:12 2019<br class="">@@ -4363,17 +4363,22 @@ void CodeGenModule::EmitAliasDefinition(<br class=""> // Create a reference to the named value. This ensures that it is emitted<br class=""> // if a deferred decl.<br class=""> llvm::Constant *Aliasee;<br class="">- if (isa<llvm::FunctionType>(DeclTy))<br class="">+ llvm::GlobalValue::LinkageTypes LT;<br class="">+ if (isa<llvm::FunctionType>(DeclTy)) {<br class=""> Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GD,<br class=""> /*ForVTable=*/false);<br class="">- else<br class="">+ LT = getFunctionLinkage(GD);<br class="">+ } else {<br class=""> Aliasee = GetOrCreateLLVMGlobal(AA->getAliasee(),<br class=""> llvm::PointerType::getUnqual(DeclTy),<br class=""> /*D=*/nullptr);<br class="">+ LT = getLLVMLinkageVarDefinition(cast<VarDecl>(GD.getDecl()),<br class="">+ D->getType().isConstQualified());<br class="">+ }<br class=""><br class=""> // Create the new alias itself, but don't set a name yet.<br class="">- auto *GA = llvm::GlobalAlias::create(<br class="">- DeclTy, 0, llvm::Function::ExternalLinkage, "", Aliasee, &getModule());<br class="">+ auto *GA =<br class="">+ llvm::GlobalAlias::create(DeclTy, 0, LT, "", Aliasee, &getModule());<br class=""><br class=""> if (Entry) {<br class=""> if (GA->getAliasee() == Entry) {<br class=""><br class="">Modified: cfe/trunk/test/CodeGen/alias.c<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=369705&r1=369704&r2=369705&view=diff" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=369705&r1=369704&r2=369705&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/test/CodeGen/alias.c (original)<br class="">+++ cfe/trunk/test/CodeGen/alias.c Thu Aug 22 13:47:12 2019<br class="">@@ -2,6 +2,7 @@<br class=""> // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s<br class=""> // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s<br class=""> // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck -check-prefix=CHECKASM %s<br class="">+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck -check-prefix=CHECKGLOBALS %s<br class=""><br class=""> int g0;<br class=""> // CHECKBASIC-DAG: @g0 = common global i32 0<br class="">@@ -88,3 +89,13 @@ void test8_zed() __attribute__((alias("t<br class=""> void test9_bar(void) { }<br class=""> void test9_zed(void) __attribute__((section("test")));<br class=""> void test9_zed(void) __attribute__((alias("test9_bar")));<br class="">+<br class="">+// Test that the alias gets its linkage from its declared qual type.<br class="">+// CHECKGLOBALS: @test10_foo = internal<br class="">+// CHECKGLOBALS-NOT: @test10_foo = dso_local<br class="">+int test10;<br class="">+static int test10_foo __attribute__((alias("test10")));<br class="">+// CHECKGLOBALS: @test11_foo = internal<br class="">+// CHECKGLOBALS-NOT: @test11_foo = dso_local<br class="">+void test11(void) {}<br class="">+static void test11_foo(void) __attribute__((alias("test11")));<br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<br class=""></div></div></blockquote></div><br class=""></div></body></html>