summaryrefslogtreecommitdiffstats
path: root/lib/Driver/ToolChains/Gnu.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-05-30 18:57:51 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-05-30 18:57:51 +0000
commit282baa1df62acdab6961ce62659142be1d29b515 (patch)
treef0290c9817df6ec7c27ef5d01361f54b6af6dd32 /lib/Driver/ToolChains/Gnu.cpp
parenta841e133b362a1d46356fc58540bf9c2a5b36e14 (diff)
[OpenMP][Driver] Put target binary for each offload target into a
separate section, by Sergey Dmitriev Linker script that is generated by the clang driver for creating fat binary puts target binaries for all offload targets into a single ELF section .omp_offloading. This is not convenient because it greatly complicates operations with the final fat binary once it is linked. For example extracting target binary for a particular target from such fat executable would not be an easy task if you have more than one offload target. Attached patch changes clang driver to put target binary for each offload target into a separate ELF section .omp_offloading.<target triple>. Differential Revision: https://reviews.llvm.org/D33254 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Gnu.cpp')
-rw-r--r--lib/Driver/ToolChains/Gnu.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index 1a398fd8a7..d50f8e21f6 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -278,20 +278,20 @@ static void AddOpenMPLinkerScript(const ToolChain &TC, Compilation &C,
LksStream << "SECTIONS\n";
LksStream << "{\n";
- LksStream << " .omp_offloading :\n";
- LksStream << " ALIGN(0x10)\n";
- LksStream << " {\n";
- for (auto &BI : InputBinaryInfo) {
- LksStream << " . = ALIGN(0x10);\n";
+ // Put each target binary into a separate section.
+ for (const auto &BI : InputBinaryInfo) {
+ LksStream << " .omp_offloading." << BI.first << " :\n";
+ LksStream << " ALIGN(0x10)\n";
+ LksStream << " {\n";
LksStream << " PROVIDE_HIDDEN(.omp_offloading.img_start." << BI.first
<< " = .);\n";
LksStream << " " << BI.second << "\n";
LksStream << " PROVIDE_HIDDEN(.omp_offloading.img_end." << BI.first
<< " = .);\n";
+ LksStream << " }\n";
}
- LksStream << " }\n";
// Add commands to define host entries begin and end. We use 1-byte subalign
// so that the linker does not add any padding and the elements in this
// section form an array.