summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorYaxun Liu <Yaxun.Liu@amd.com>2018-11-09 18:52:05 +0000
committerYaxun Liu <Yaxun.Liu@amd.com>2018-11-09 18:52:05 +0000
commit92a04835e4795ed9b8daf125a1ed5a982b6ccd65 (patch)
tree65a140f11e9bf9bd753ecba94045a5624f9d8b6e /clang
parent4955066366b1e5e4fbb12feb6abf12e9f43b5242 (diff)
downloadbcm5719-llvm-92a04835e4795ed9b8daf125a1ed5a982b6ccd65.tar.gz
bcm5719-llvm-92a04835e4795ed9b8daf125a1ed5a982b6ccd65.zip
[HIP] Remove useless sections in linked files
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. Differential Revision: https://reviews.llvm.org/D54275 llvm-svn: 346536
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Driver/ToolChains/CommonArgs.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index a2db515310c..3803dde8daf 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1436,6 +1436,10 @@ void tools::AddHIPLinkerScript(const ToolChain &TC, Compilation &C,
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();
OpenPOWER on IntegriCloud