jyn514 / saltwater

A C compiler written in Rust, with a focus on good error messages.
BSD 3-Clause "New" or "Revised" License
293 stars 27 forks source link

Link object files when passed in instead of source files #499

Open hdamron17 opened 4 years ago

hdamron17 commented 4 years ago

I know this is silly, but if we receive object files instead of source files we should link them immediately (still using cc) instead of complaining that they are not UTF-8. This will make working with CMake and Make much easier because they expect the compiler to handle the full compilation pipeline and allow separating into multiple stages.

Example

$ swcc -o sample.o -c sample.c $ swcc -o sample sample.o // second command currently tries to parse sample.o as source code and gives 'invalid UTF-8 error' // should link sample.o into the sample executable