HomePhabricator

Default to -fuse-init-array

Authored by MaskRay on Dec 11 2019, 9:48 PM.

Description

Default to -fuse-init-array

Very few ELF platforms still use .ctors/.dtors now. Linux (glibc: 1999-07),
DragonFlyBSD, FreeBSD (2012-03) and Solaris have supported .init_array
for many years. Some architectures like AArch64/RISC-V default to
.init_array . GNU ld and gold can even convert .ctors to .init_array .

It makes more sense to flip the CC1 default, and only uses
-fno-use-init-array on platforms that don't support .init_array .
For example, OpenBSD did not support DT_INIT_ARRAY before Aug 2016
(https://github.com/openbsd/src/commit/86fa57a2792c6374b0849dd7b818a11e676e60ba)

I may miss some ELF platforms that still use .ctors, but their
maintainers can easily diagnose such problems.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D71393

Details

Committed
MaskRayDec 12 2019, 10:32 AM
Reviewer
rnk
Differential Revision
D71393: Default to -fuse-init-array
Parents
rG61f5ba5c32fa: [SystemZ] Implement the packed stack layout
Branches
Unknown
Tags
Unknown