[llvm] [bolt] Add cmake c,cxx,asm,linker flags (PR #68358)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 14:46:41 PDT 2023


aaupov wrote:

> > The issue is that we don't want arbitrary flags being passed to BOLT runtime library build – they are configured to be freestanding. Specifically, runtime library shouldn't depend on host libgcc_s.
> 
> Ah i see `-ffreestanding` in bolt/runtime/CMakeLists.txt. Do we also need `-nostdlib and -nodefaultlibs` flags? I wonder why i get ` -lgcc -lgcc_s` in the link line.

I think we need all of the flags per this answer: https://stackoverflow.com/questions/59612257/difference-between-ffreestanding-and-nostdlib-when-compiling-with-gcc

> The options control two parts of the process:

> [-freestanding](https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/C-Dialect-Options.html#index-ffreestanding-1) indicates to the compiler that it should be a freestanding one, AFAIK the only effect is disabling some built-in functions like memcpy;

> [-nostdlib](https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Link-Options.html#index-nostdlib) indicates that no libraries and no start up files should be linked by default.

> 
> > The proper solution would probably be along the lines of `LLVM_ENABLE_RUNTIMES`.
> 
> Makes sense. Do you have wip patches for this?

Unfortunately no, I'm not an expert in runtimes builds. @petrhosek – do you have any tips/starting points?

https://github.com/llvm/llvm-project/pull/68358


More information about the llvm-commits mailing list