Displaying 2 results from an estimated 2 matches for "named_label".
Did you mean:
named_label_
2017 Feb 05
2
clang/llvm support for %= in inline assembly
I encountered this issue of unique asm label names just now, in https://bugs.freebsd.org/216771 . A very simple test case is this:
void foo(void)
{
asm volatile(
"named_label:\n"
"jnz named_label\n"
);
}
void bar(void)
{
foo();
}
Compiling this with any form of optimization gives an error, because clang is attempting to inline foo() into bar(), thereby cloning the inline asm part:
$ clang -O -c test.c
test.c:4:5: error: invali...
2017 Feb 05
2
clang/llvm support for %= in inline assembly
from https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
Under certain circumstances, GCC may duplicate (or remove duplicates of)
> your assembly code when optimizing. This can lead to unexpected duplicate
> symbol errors during compilation if your asm code defines symbols or
> labels. Using ‘%=’ (see AssemblerTemplate) may help resolve this problem.
‘%=’
> Outputs a number that is