[clang] [Docs] Document freestanding requirements (PR #132232)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 26 06:29:37 PDT 2025


================
@@ -1073,6 +1073,28 @@ inputs. Here is some example of ``$``-prefixed options:
 Language and Target-Independent Features
 ========================================
 
+Freestanding Builds
+-------------------
+Passing the ``-ffreestanding`` flag causes Clang to build for a freestanding
+(rather than a hosted) environment. The flag has the following effects:
+
+* the ``__STDC_HOSTED__`` predefined macro will expand to ``0``,
+* builtin functions are disabled (``-fno-builtins``),
+* unwind tables are disabled (``fno-asynchronous-unwind-tables -fno-unwind-tables``), and
+* allows ``main`` to be used as a regular symbol.
+
+A freestanding environment is not one which has no C standard library support.
----------------
AaronBallman wrote:

FWIW, I think that list will need to be expanded (in a future patch?). For example, we support `_Complex` in freestanding mode and that will emit a call to `__divsc3` on complex division, that sort of thing.

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


More information about the cfe-commits mailing list