[all-commits] [llvm/llvm-project] b2b5ca: Default to -fuse-init-array
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Dec 12 10:34:03 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: b2b5cac3ec07782b917b2816f175da682723cd49
https://github.com/llvm/llvm-project/commit/b2b5cac3ec07782b917b2816f175da682723cd49
Author: Fangrui Song <maskray at google.com>
Date: 2019-12-12 (Thu, 12 Dec 2019)
Changed paths:
M clang/lib/Driver/ToolChains/Clang.cpp
M clang/lib/Driver/ToolChains/Fuchsia.cpp
M clang/lib/Driver/ToolChains/Gnu.cpp
M clang/lib/Driver/ToolChains/NetBSD.cpp
M clang/lib/Driver/ToolChains/OpenBSD.cpp
M clang/lib/Driver/ToolChains/OpenBSD.h
M clang/lib/Driver/ToolChains/RISCVToolchain.cpp
M clang/lib/Driver/ToolChains/WebAssembly.cpp
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/test/CodeGenObjC/gnu-init.m
M clang/test/Driver/constructors.c
M clang/test/Driver/fembed-bitcode.c
M clang/test/Driver/fuchsia.c
M clang/test/Driver/fuchsia.cpp
M clang/test/Driver/mips-mti-linux.c
M clang/test/Driver/nacl-direct.c
M clang/test/Driver/netbsd.c
M clang/test/Driver/openbsd.c
M clang/test/Driver/riscv32-toolchain-extra.c
M clang/test/Driver/riscv32-toolchain.c
M clang/test/Driver/riscv64-toolchain-extra.c
M clang/test/Driver/riscv64-toolchain.c
Log Message:
-----------
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
More information about the All-commits
mailing list