Index: lib/Driver/ToolChains/Clang.cpp =================================================================== --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -3671,6 +3671,9 @@ // Disable all llvm IR level optimizations. CmdArgs.push_back("-disable-llvm-passes"); + // Render target options such as -fuse-init-array on modern ELF platforms. + TC.addClangTargetOptions(Args, CmdArgs, JA.getOffloadingDeviceKind()); + // reject options that shouldn't be supported in bitcode // also reject kernel/kext static const constexpr unsigned kBitcodeOptionBlacklist[] = { Index: test/Driver/fembed-bitcode.c =================================================================== --- test/Driver/fembed-bitcode.c +++ test/Driver/fembed-bitcode.c @@ -26,3 +26,6 @@ // CHECK-AARCH64: "darwinpcs" // CHECK-AARCH64-NOT: "-fdebug-compilation-dir" +// RUN: %clang -target x86_64-pc-freebsd12 -fembed-bitcode=all -c %s -o /dev/null -### 2>&1 \ +// RUN: | FileCheck -check-prefix CHECK-INITARRAY %s +// CHECK-INITARRAY: "-fuse-init-array"