[libc-commits] [libc] [libc]: Add `-Wglobal-constructors` for libc tests (PR #131485)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Sun Mar 30 15:09:31 PDT 2025


https://github.com/jhuber6 requested changes to this pull request.

I don't think there's any utility in enabling this for the tests. The reason we pass `-Werror=global-constructors` is because `libc` itself should *never* use global objects. The tests, however, want to test the things that *implement* global constructors (like the integration tests). Also, sometimes a global constructor is the easiest way to initialize something for a test. There's no harm here because it's just a test that's not being shipped and any *functional* `crt1.o` should handle it.

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


More information about the libc-commits mailing list