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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 07:48:19 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:

I was aiming to let users know what Clang does & expects of you when `-ffreestanding` is passed. The primary thing is: freestanding does not mean "I don't need any C standard library", it means "I need a freestanding-compatible C standard library that includes a few functions that are expected to be available even in older language modes where they weren't in freestanding before."

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


More information about the cfe-commits mailing list