[PATCH] D62509: [Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 19:25:19 PDT 2019


MaskRay updated this revision to Diff 202103.
MaskRay retitled this revision from "[Driver] Render -fuse-init-array for -fembed-bitcode" to "[Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcode".
MaskRay edited the summary of this revision.
MaskRay added a comment.

Add hexagon test


Repository:
  rC Clang

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

https://reviews.llvm.org/D62509

Files:
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/fembed-bitcode.c


Index: test/Driver/fembed-bitcode.c
===================================================================
--- test/Driver/fembed-bitcode.c
+++ test/Driver/fembed-bitcode.c
@@ -26,3 +26,11 @@
 // 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"
+
+// RUN: %clang -target hexagon-unknown-elf -ffixed-r19 -fembed-bitcode=all -c %s -o /dev/null -### 2>&1 \
+// RUN:     | FileCheck --check-prefix=CHECK-HEXAGON %s
+// CHECK-HEXAGON: "-target-feature"
+// CHECK-HEXAGON: "+reserved-r19"
Index: lib/Driver/ToolChains/Clang.cpp
===================================================================
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -3666,6 +3666,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[] = {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62509.202103.patch
Type: text/x-patch
Size: 1322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190530/6b10adbe/attachment.bin>


More information about the cfe-commits mailing list