Ask HN: LLVM求助
16 分•作者: kvthweatt•6 个月前
我正在开发一门新语言,目前一切进展顺利。<p>我想知道是否有办法阻止 LLVM 完全链接 CRT 符号。我的目标是创建一个新的运行时。<p>我用我的语言写了一个桩库,当我编译成 .lib 格式时,我一直遇到一个问题,LLVM 强制引入 <i>_fltused</i>,导致我的定义被标记为错误,提示 _fltused 已经存在。<p>我的 .ll IR 文件中除了 _fltused 的定义之外,没有任何其他内容,而我希望这个定义最终出现在最终的 .lib 文件中。<p>我已经在谷歌上搜索并向 AI 咨询了好几天,想知道可以使用哪些编译器/链接器标志来让 LLVM 完全绕过 CRT,以便我可以开发自己的运行时,但无论我添加什么标志,Clang、MinGW 和 LLVM 都会积极地链接 CRT。<p>我快要抓狂了。我无法直接将我的 .ll 文件转换为 .as 文件,因为 LLVM 编译器从中作梗,否则我现在应该已经有我的库了。
查看原文
I'm developing a new language, and everything is pretty nice so far.<p>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.<p>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 <i>_fltused</i>, causing my definition to get flagged with an error saying _fltused already exists.<p>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.<p>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.<p>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.