Page MenuHomePhabricator

[Driver] Use .init_array for all gcc installations and simplify Generic_ELF -fno-use-init-array rules
ClosedPublic

Authored by MaskRay on Dec 12 2019, 1:28 PM.

Details

Summary

D39317 made clang use .init_array when no gcc installations is found.
This change changes all gcc installations to use .init_array .

GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files,
and stopped emitting .ctors for attribute((constructor)).
.init_array should always work.

FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean.

Diff Detail

Event Timeline

MaskRay created this revision.Dec 12 2019, 1:28 PM
rnk added a comment.Dec 12 2019, 2:45 PM

I think we should do this, but let's add a release note for it. There's a flag, so users always have a workaround if clang starts doing the wrong thing for them.

MaskRay updated this revision to Diff 233721.Dec 12 2019, 5:14 PM

Add release note

rnk accepted this revision.Dec 13 2019, 1:56 PM

lgtm

Macro shipit:

This revision is now accepted and ready to land.Dec 13 2019, 1:56 PM
This revision was automatically updated to reflect the committed changes.