Index: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp @@ -278,20 +278,20 @@ 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. Index: cfe/trunk/test/Driver/openmp-offload.c =================================================================== --- cfe/trunk/test/Driver/openmp-offload.c +++ cfe/trunk/test/Driver/openmp-offload.c @@ -210,14 +210,16 @@ // CHK-LKS-ST: INPUT([[T2BIN:.+\.out-openmp-x86_64-pc-linux-gnu]]) // CHK-LKS: SECTIONS // CHK-LKS: { -// CHK-LKS: .omp_offloading : +// CHK-LKS: .omp_offloading.powerpc64le-ibm-linux-gnu : // CHK-LKS: ALIGN(0x10) // CHK-LKS: { -// CHK-LKS: . = ALIGN(0x10); // CHK-LKS: PROVIDE_HIDDEN(.omp_offloading.img_start.powerpc64le-ibm-linux-gnu = .); // CHK-LKS: [[T1BIN]] // CHK-LKS: PROVIDE_HIDDEN(.omp_offloading.img_end.powerpc64le-ibm-linux-gnu = .); -// CHK-LKS: . = ALIGN(0x10); +// CHK-LKS: } +// CHK-LKS: .omp_offloading.x86_64-pc-linux-gnu : +// CHK-LKS: ALIGN(0x10) +// CHK-LKS: { // CHK-LKS: PROVIDE_HIDDEN(.omp_offloading.img_start.x86_64-pc-linux-gnu = .); // CHK-LKS: [[T2BIN]] // CHK-LKS: PROVIDE_HIDDEN(.omp_offloading.img_end.x86_64-pc-linux-gnu = .);