[PATCH] D21851: [Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host binary format.

Samuel Antao via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 8 09:02:53 PDT 2016


sfantao added a comment.

In http://reviews.llvm.org/D21851#477905, @Hahnfeld wrote:

> Another overall question: Back in February you said that it would be possible to have a "default" object that can be taken without knowledge of the bundler (see http://lists.llvm.org/pipermail/cfe-dev/2016-February/047555.html).
>
> In my tests with the patch, this has not worked yet - am I missing something or is this not yet implemented?


What I have proposed in the patch should be able to produce a bundled object file that can be read by other tools (the device image is embedded in designated sections, so these other tools may just ignore these sections). Also, if you feed the bundled an object file that does not have device sections, it should produce empty device files instead of just failing. That's what I was proposing there. Did you have something different in mind?

That's actually tested in the regression tests that goes with the patch. It won't work for you as is because of the ppc64le specific problem that I have to fix, but if you change that to x86_64 you may be able to test it.


================
Comment at: tools/clang-offload-bundler/ClangOffloadBundler.cpp:477-490
@@ +476,16 @@
+
+    // Do the incremental linking. We write to the output file directly. So, we
+    // close it and use the name to pass down to clang.
+    OS.close();
+    SmallString<128> TargetName = getTriple(TargetNames.front());
+    const char *ClangArgs[] = {"clang",
+                               "-r",
+                               "-target",
+                               TargetName.c_str(),
+                               "-o",
+                               OutputFileNames.front().c_str(),
+                               InputFileNames.front().c_str(),
+                               BitcodeFileName.c_str(),
+                               "-nostdlib",
+                               nullptr};
+
----------------
Hahnfeld wrote:
> sfantao wrote:
> > Hahnfeld wrote:
> > > `test/Driver/clang-offload-bundler.c` gives me
> > > ```
> > > /..//bin/ld: unrecognised emulation mode: elf64lppc
> > > Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
> > > ```
> > > and therefore fails.
> > > 
> > > I'm on an x86_64 Linux and obviously my `GNU ld version 2.23.52.0.1-55.el7 20130226` doesn't support Power :-(
> > Oh, right... I cannot run the bundler in the regression tests to tests the bundler. I guess I need some sort of dry run option to check the commands are correct without actually running them.
> > 
> > I'll fix that.
> Yes, comparable to `-###` in `clang`?
> 
> Another option (that I don't really prefer, just for completeness) would be to have separate tests that have appropriate `REQUIRES`...
Yes, `-###` is exactly what I was aiming at.


http://reviews.llvm.org/D21851





More information about the cfe-commits mailing list