Unable to write strings with curly braces inside inline assembler code
Issue
- Writing inline assembler code as below:
void f()
{
asm ( ".pushsection \".foo\"; .asciz \"div { width : 50%% | height = 10px } \"; .long %c0; .popsection" : : "i"(42) );
}
results in invalid output after compilation with gcc:
.file "asm-curly.c"
.text
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
#APP
# 3 "asm-curly.c" 1
.pushsection ".data";foo1:; .asciz "div width : 50% "; .long 42; .popsection
# 0 "" 2
#NO_APP
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (GNU) 4.6.3 20120306 (Red Hat 4.6.3-2)"
.section .note.GNU-stack,"",@progbits
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
