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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 21 10:21:13 PDT 2025


================
@@ -1076,13 +1076,11 @@ Language and Target-Independent Features
 Freestanding Builds
 -------------------
 Passing the ``-ffreestanding`` flag causes Clang to build for a freestanding
-(rather than a hosted) environment. The ``__STDC_HOSTED__`` predefined macro
-will expand to ``0`` in a freestanding environment. In such an environment,
-execution of the program may happen without an operating system and so a
-startup function (e.g., ``main``) may not be automatically called, though file
-scope objects which need to run startup code (constructors in C++,
-``__attribute__((constructor))``, etc) are executed via implementation-defined
-means such as ``__cxx_global_var_init``.
+(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``), and
+* unwind tables are disabled (``fno-asynchronous-unwind-tables -fno-unwind-tables``)
----------------
AaronBallman wrote:

Yup, I just added that because I missed your comments. :-)

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


More information about the cfe-commits mailing list