[libcxx-commits] [PATCH] D57624: Support tests in freestanding

JF Bastien via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 3 07:17:21 PST 2019


jfb added a comment.

In D57624#1382293 <https://reviews.llvm.org/D57624#1382293>, @EricWF wrote:

> This feels like a fix at the wrong level.


Here's a few alternatives which I don't think work:

- We can change LLVM but have no idea what changing `isMain`'s effects will be (this behavior has been there for 10 years).
- We can link in another `main` when in freestanding mode and call the mangled main, and hope we only ever write `int main()` so it's always the same mangled name. This doesn't fix falling off the end.
- We can add a header which every test includes (so add the include where missing) which declares main as `extern "C" int main()`. That again forbids using another main signature, and doesn't fix falling off the end.
- We can add a flag to LLVM which makes falling off the end in `int` functions return 0 automatically.

There's a bunch of other ways to fix this. It sounds like you have another idea in mind. At which level are you suggesting the responsibility to create valid freestanding source files lies, and how should that level address the issue?


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57624/new/

https://reviews.llvm.org/D57624





More information about the libcxx-commits mailing list