Skip to content

clang gets confused with alias and asm labels #9549

@llvmbot

Description

@llvmbot
Bugzilla Link 9177
Resolution FIXED
Resolved on Feb 15, 2011 19:41
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

Given


int attribute((visibility("hidden"))) foo (void);
extern __typeof (foo) foo asm ("INT_foo") attribute((visibility("hidden"))) ;
int foo (void) {
}
extern __typeof (foo) EXT_foo asm("foo") attribute((alias("INT_foo")));

Clang will produce


@"\01foo" = alias i32 ()* @​INT_foo
define hidden i32 @"\01INT_foo"() nounwind {
entry:
%retval = alloca i32, align 4
%0 = load i32* %retval
ret i32 %0
}
declare i32 @​INT_foo()

Note how we have a declaration for INT_foo and a definition for "\01INT_foo". This gets resolved by LLVM's codegen, but causes problems to LTO because the alias foo is pointing to a declaration.

Producing

@"\01foo" = alias i32 ()* @"\01INT_foo"
define hidden i32 @"\01INT_foo"() nounwind {
entry:
%retval = alloca i32, align 4
%0 = load i32* %retval
ret i32 %0
}

would fix the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions