summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/WebAssembly.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-12-11 21:48:59 -0800
committerFangrui Song <maskray@google.com>2019-12-12 10:32:56 -0800
commitb2b5cac3ec07782b917b2816f175da682723cd49 (patch)
treea724b239b5dd0e06305faecf206023363f04a82b /clang/lib/Driver/ToolChains/WebAssembly.cpp
parent61f5ba5c32fae2726d3ead5e7360c084720f4692 (diff)
downloadbcm5719-llvm-b2b5cac3ec07782b917b2816f175da682723cd49.tar.gz
bcm5719-llvm-b2b5cac3ec07782b917b2816f175da682723cd49.zip
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
Diffstat (limited to 'clang/lib/Driver/ToolChains/WebAssembly.cpp')
-rw-r--r--clang/lib/Driver/ToolChains/WebAssembly.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp
index 1bb7c35d0c5..907f86b8233 100644
--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -179,9 +179,9 @@ bool WebAssembly::HasNativeLLVMSupport() const { return true; }
void WebAssembly::addClangTargetOptions(const ArgList &DriverArgs,
ArgStringList &CC1Args,
Action::OffloadKind) const {
- if (DriverArgs.hasFlag(clang::driver::options::OPT_fuse_init_array,
- options::OPT_fno_use_init_array, true))
- CC1Args.push_back("-fuse-init-array");
+ if (!DriverArgs.hasFlag(clang::driver::options::OPT_fuse_init_array,
+ options::OPT_fno_use_init_array, true))
+ CC1Args.push_back("-fno-use-init-array");
// '-pthread' implies atomics, bulk-memory, mutable-globals, and sign-ext
if (DriverArgs.hasFlag(options::OPT_pthread, options::OPT_no_pthread,
OpenPOWER on IntegriCloud