The current compile options function hardcodes the -fpie and
-ffreestanding flags, which don't exist on Windows. This patch sets the
compilation flags conditionally based on the OS specifics.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
[libc] Fixing space and shifting set configuration
Moving outside the common flags outside the if.
[libc] Fixing flag overwrites
Previous amendment overwrote the output by not including the flags set outside
the if block
the commit title should be imperative, see https://chris.beams.io/posts/git-commit/ for good git commit tips
and I'd be clearer and say something like "Don't pass -fpie/-ffreestanding on Windows"
libc/cmake/modules/LLVMLibCObjectRules.cmake | ||
---|---|---|
6 | actually I don't see this available in clang-cl or msvc, where did you find this? |
libc/cmake/modules/LLVMLibCObjectRules.cmake | ||
---|---|---|
6 | This is the for the Intel compiler and since the Linux flag syntax was the same I figured I could use the Windows equivalent? Not sure (https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/advanced-optimization-options/ffreestanding-qfreestanding.html) |
libc/cmake/modules/LLVMLibCObjectRules.cmake | ||
---|---|---|
6 | But it seems like in this article (https://nullprogram.com/blog/2016/01/31/) -ffreestanding is available on MinGW so maybe that's where we'd have to build llvmlibc to ensure the freestanding environment? |
[libc] Don't include -ffreestanding equivalent on Windows
/Qfreestanding is only available on Intel C++ compiler, so it won't affect a
compilation in clang/msvc.
libc/cmake/modules/LLVMLibCObjectRules.cmake | ||
---|---|---|
6 | /Qfreestanding is only available on the intel C++ compiler for windows -ffreestanding is available on gcc/clang/intel for Linux mingw is similar to Linux (even it's on windows) and uses gcc, but we currently don't care about mingw, at least for llvm libc | |
6 | we should skip this if block since it's not doing anything |
[libc] Simplify conditional
Unecessary inclusion of an else case removed since Windows will not use any
flags outside the standard compiler flags.
missing a space