I need to know if there's a way to prevent LLVM from linking in CRT symbols entirely. The goal is to make a new runtime.
I have a stub library written in my language, when I go to compile the library in .lib form, I keep running into a wall where LLVM forcefully brings in _fltused, causing my definition to get flagged with an error saying _fltused already exists.
There is nothing in the .ll IR file other than the _fltused definition, the one that I want to have end up in the final .lib.
I have Googled and asked AI for days now what compiler/linker flags I can use to get LLVM to bypass the CRT entirely so I can develop my own runtime, and Clang, MinGW, and LLVM are all aggressively linking in the CRT no matter what flags I add.
I'm pulling my hair out over here. I can't convert my .ll file directly to .as because the LLVM compiler is getting in the way, otherwise I'd have my library by now.
i_don_t_know•2h ago
These references do not appear in the .ll file. They are injected when the .ll file is compiled to object files.
I think something in your code triggers a reference to one of the other injected functions and that pulls in the CRT.
Try compiling your test file into an .o or .obj, that is, without linking. Then dump the symbols in the object file to see what symbols are referenced. I suspect you'll see other references to symbols in CRT and you will have to replace those as well with stubs.
Unfortunately, I don't remember the linker flags to replace/suppress the default CRT libs. Well, actually, you might compile to .o / .obj and then manually link on your system. If you're using MSVC check the options to its "link" executable (I don't remember the exact name of the MSVC linker).
sir-nochill•1h ago
One other thing you may want to try is writing a linker script manually. If you could provide the linker flags as mentioned elsewhere, that would be useful.
coldcity_again•1h ago
On x86 only, if you need to cast floats, try /QIfist (deprecated) to avoid hitting _ftol. Doesn't work for x64 or ARM.