lacc
lacc copied to clipboard
Cannot compile from assembly
When compiling https://musl.libc.org, I get the following:
/usr/local/bin/lacc -std=c99 -nostdinc -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -O2 -pipe -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers -Werror=discarded-array-qualifiers -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable -DCRT -c -o obj/crt/x86_64/crti.o crt/x86_64/crti.s
/usr/local/bin/lacc -std=c99 -nostdinc -Wa,--noexecstack -D_XOPEN_SOURCE=700 -I./arch/x86_64 -I./arch/generic -Iobj/src/internal -I./src/include -I./src/internal -Iobj/include -I./include -O2 -pipe -Wno-pointer-to-int-cast -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith -Werror=int-conversion -Werror=incompatible-pointer-types -Werror=discarded-qualifiers -Werror=discarded-array-qualifiers -Waddress -Warray-bounds -Wchar-subscripts -Wduplicate-decl-specifier -Winit-self -Wreturn-type -Wsequence-point -Wstrict-aliasing -Wunused-function -Wunused-label -Wunused-variable -DCRT -c -o obj/crt/x86_64/crtn.o crt/x86_64/crtn.s
Unrecognized input file crt/x86_64/crti.s.
Unrecognized input file crt/x86_64/crtn.s.
I tried to compile a simple hello world from C to to assembly and then from assembly to a Linux binary, lacc -S main.c -o main.s
, lacc main.s -o main
, but it shows this on the second command:
file format not recognized; treating as linker script
I'm not sure if I should report it here or at musl
If you could implement compiling from assembly, that would be appreciated, thanks
Although lacc can understand some inline assembly, it is not a complete assembler, and compiling .s input files is not supported. You should rather use an actual assembler to compile those files.
usually the compiler driver automatically invokes the assembler when it detects an assembly file being passed to it. just like it calls the linker when the input is object files.
Does lacc have it's own linker or does it use the system one? I'm working on a distro which uses lacc and musl, lacc is the first thing that is compiled and it can link binaries somehow.
There is no linker, only a very crude implementation of a driver invoking the system linker (see src/backend/linker.c). I guess it is reasonable to assume that lacc would also know how to invoke the assembler, so I may implement something like that. Otherwise what I would prefer was to actually be able to assemble, so perhaps some time in the future it will work. I will keep this bug open as a reminder :=)
Is the system linker part of the kernel or part of something else? (side note: lacc doesn't have -dumpmachine
so it can't compile itself without manually specifying the machine name e.g x86_64-linux-musl
.)