efriedma-quic wrote:

-ffreestanding currently has the following effects:
- Disables builtins recognition (-fno-builtins)
- Sets `__STDC_HOSTED__` to 0.
- Disables unwind tables (-fno-asynchronous-unwind-tables -fno-unwind-tables) 
(refer to df50259f9856ae98b5a1b34c4c955074aff3c566)

Maybe we should explicitly list this out in the documentation.

We might want to check existing uses of `__STDC_HOSTED__` to see if we need to 
modify the interaction if we have a libc.  A few of the headers in 
clang/lib/Headers/ make assumptions about the presence of libc based on 
`__STDC_HOSTED__`.  At first glance, we're probably fine, but we might want to 
come up with some sort of policy.

As a practical matter, nobody really cares what the C committee has to say 
about freestanding implementations; everyone makes different tradeoffs 
depending on the constraints of their environment.  Some "baremetal" 
environments have an extremely complete C library including I/O, and the usual 
"main" function.  Some have absolutely nothing (even less than what we say 
clang requires).  And everything in between.

I don't think we need to say anything about how startup works in a freestanding 
environment; I think we just refer people to their environment's documentation.

We say "memcpy, memmove, memset, memcmp" because that's what the corresponding 
gcc documentation says, but I don't think clang has ever generated calls to 
memcmp in -fno-builtins mode.

https://github.com/llvm/llvm-project/pull/132232
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to