[PATCH] D62509: [Driver] Render -fuse-init-array for -fembed-bitcode

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 28 18:49:19 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:3675
+    // Render target options such as -fuse-init-array on modern ELF platforms.
+    TC.addClangTargetOptions(Args, CmdArgs, JA.getOffloadingDeviceKind());
+
----------------
compnerd wrote:
> Hmm, what other arguments will this render into the option handling that we weren't handling before?
`-fuse-init-array` is the only one on Linux x86. Other OSes/targets may have more, e.g. Hexagon has:

void HexagonToolChain::addClangTargetOptions(const ArgList &DriverArgs,
                                             ArgStringList &CC1Args,
                                             Action::OffloadKind) const {
  if (DriverArgs.hasArg(options::OPT_ffixed_r19)) {
    CC1Args.push_back("-target-feature");
    CC1Args.push_back("+reserved-r19");
  }
  if (isAutoHVXEnabled(DriverArgs)) {
    CC1Args.push_back("-mllvm");
    CC1Args.push_back("-hexagon-autohvx");
  }
}

NetBSD has a -D (it should not matter):

void NetBSD::addClangTargetOptions(const ArgList &,
                                   ArgStringList &CC1Args,
                                   Action::OffloadKind) const {
  const SanitizerArgs &SanArgs = getSanitizerArgs();
  if (SanArgs.hasAnySanitizer())
    CC1Args.push_back("-D_REENTRANT");
}



Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62509/new/

https://reviews.llvm.org/D62509





More information about the cfe-commits mailing list