[PATCH] D54275: [HIP] Remove useless sections in linked files

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 8 14:04:20 PST 2018


yaxunl created this revision.
yaxunl added a reviewer: tra.

clang-offload-bundler creates `__CLANG_OFFLOAD_BUNDLE__*` sections in the bundles,
which get into the linked files. These sections are useless after linking. They waste disk
space and cause confusion for clang when directly linked with other object files, therefore
should be removed.


https://reviews.llvm.org/D54275

Files:
  lib/Driver/ToolChains/CommonArgs.cpp


Index: lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -1436,6 +1436,10 @@
   LksStream << "    PROVIDE_HIDDEN(__hip_fatbin = .);\n";
   LksStream << "    " << BundleFileName << "\n";
   LksStream << "  }\n";
+  LksStream << "  /DISCARD/ :\n";
+  LksStream << "  {\n";
+  LksStream << "    * ( __CLANG_OFFLOAD_BUNDLE__* )\n";
+  LksStream << "  }\n";
   LksStream << "}\n";
   LksStream << "INSERT BEFORE .data\n";
   LksStream.flush();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54275.173222.patch
Type: text/x-patch
Size: 579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181108/bbddf954/attachment-0001.bin>


More information about the cfe-commits mailing list