The Crystal Programming Language Forum

How to compile the assembly created by crystal

crystal build --no-debug --verbose --emit asm,obj hello.cr

But when i try
gcc hello.s
or
clang hello.s
i receive error i.e. the .asm is not understood ?

Try as hello.s. It’s been a while since I’ve used gcc or clang directly, but I don’t believe they’re assemblers, but as is.

Using as produces same errors i.e. assembly not understood.
Version : as -v
GNU assembler version 2.37 (x86_64-portbld-freebsd13.0) using BFD version (GNU Binutils) 2.37

Please share what the error message says.

as hello.s
hello.s: Assembler messages:
hello.s:3231: Error: unbalanced double quotes in operand 1.
hello.s:29335: Warning: stand-alone data16' prefix hello.s:29337: Warning: stand-alone data16’ prefix
hello.s:29338: Warning: stand-alone data16' prefix hello.s:39049: Error: junk @PLT’ after expression
hello.s:138130: Error: unrecognized symbol type “.L”
hello.s:138130: Error: junk at end of line, first unrecognized character is '' hello.s:138136: Error: expected comma after name .L’\"34,16
.type ’ in .size directive
hello.s:138910: Error: symbol `.L’\n’’ is already defined


clang hello.s
hello.s:3231:14: error: unexpected token in argument list
leaq “.L’\”’"(%rip), %rax
^
hello.s:138130:15: error: expected STT_<TYPE_IN_UPPER_CASE>, ‘#’, ‘@’, ‘%’ or “”
.type “.L’\”’",@object
^
hello.s:138132:1: error: unknown directive
“.L’\”’":
^
hello.s:138138:15: error: unexpected token in directive
.size “.L’\”’", 16
^
hello.s:138914:1: error: invalid symbol redefinition
“.L’\n’”:
^