[llvm-bugs] [Bug 45719] New: clang appends ".1"/... to asm()-specified symbol names
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Apr 28 10:03:59 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45719
Bug ID: 45719
Summary: clang appends ".1"/... to asm()-specified symbol names
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: unassignedclangbugs at nondot.org
Reporter: equinox-llvm at diac24.net
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
int testfn(void)
{
do {
extern int name_c1 asm("name_asm_a");
static __attribute__((used)) int *ptr = &name_c1;
static __attribute__((used)) int def_c asm("name_asm_a") =
0x1234;
} while (0);
do {
extern int name_c2 asm("name_asm_b");
static __attribute__((used)) int *ptr = &name_c2;
static __attribute__((used)) int def_c asm("name_asm_b") =
0x2345;
} while (0);
return 0;
}
compiles to (shortened):
testfn.ptr:
.quad name_asm_a
name_asm_a.1:
.long 4660 # 0x1234
testfn.ptr.2:
.quad name_asm_b
name_asm_b.3:
.long 9029 # 0x2345
- the "def_c" statements use assembler labels "name_asm_a.1" and "name_asm_b.3"
instead of expected "name_asm_a" and "name_asm_b".
- the initializer for "ptr" uses the asm name without the ".1" or ".3" suffix
This ultimately leads to the linker erroring out due to the symbols not
resolving correctly.
(The example above is extracted from a macro that is trying to create static
variables with cyclical pointers between two of them, hence the odd "extern"
declaration.)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200428/5c4f7b75/attachment.html>
More information about the llvm-bugs
mailing list