https://bugs.llvm.org/show_bug.cgi?id=43187
Bug ID: 43187
Summary: Crash given weak symbol in C, normal symbol in inline
assembly
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedb...@nondot.org
Reporter: jonathanchesterfi...@gmail.com
CC: craig.top...@gmail.com, llvm-bugs@lists.llvm.org,
llvm-...@redking.me.uk, spatel+l...@rotateright.com
For example,
__attribute__((weak)) int x = 4;
__asm__(".type x,@object\n"
".data\n"
".p2align 2\n"
"x:\n"
".long 42\n");
=> fatal error: error in backend: symbol 'x' is already defined
or, equivalently:
module asm ".type x,@object"
module asm ".data"
module asm ".p2align 2"
module asm "x:"
module asm ".long 42"
@x = weak dso_local global i32 4, align 4
=> same error
Expected behaviour is for x to have the initial value 42, replacing the weak
symbol. Observed behaviour is the fatal error.
Using non-inline assembly works as expected. Symbol overridden, no error.
Weak on either (or both) symbol(s) shows the same behaviour.
Non-reduced case has inline assembly in one translation unit and the weak
symbol in another. Compiling each separately to an elf and linking works fine,
llvm-link then llc fails as above.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs