1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s 2*f4a2713aSLionel Sambuc x()3*f4a2713aSLionel Sambucint x() { return 1; } 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc // CHECK: ret i32 1 6*f4a2713aSLionel Sambuc 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc int f() __attribute__((weak, alias("x"))); 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc /* Test that we link to the alias correctly instead of making a new 11*f4a2713aSLionel Sambuc forward definition. */ 12*f4a2713aSLionel Sambuc int f(); h()13*f4a2713aSLionel Sambucint h() { 14*f4a2713aSLionel Sambuc return f(); 15*f4a2713aSLionel Sambuc } 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc // CHECK: [[call:%.*]] = call i32 (...)* @f() 18*f4a2713aSLionel Sambuc // CHECK: ret i32 [[call]] 19*f4a2713aSLionel Sambuc 20