[PATCH] D124525: [OpenMP][ClangLinkerWrapper] Extending linker wrapper to embed metadata for multi-arch fat binaries

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 13:47:17 PDT 2022


jhuber6 added inline comments.


================
Comment at: clang/tools/clang-linker-wrapper/OffloadWrapper.cpp:229-232
+    // store value of these variables (i.e. offload archs) into a custom
+    // section which will be used by "offload-arch -f". It won't be
+    // removed during binary stripping.
+    GV->setSection(".offload_arch_list");
----------------
saiislam wrote:
> jhuber6 wrote:
> > Why does this need a custom section? We should just use it like this, not sure why we need these to  be anything but some internal struct.
> > ```
> > for (auto *Image : BinDesc->Images) {
> >   if (Image->Info)
> >    // Use Info
> > }
> > ```
> Custom section is required so that it survives binary stripping done by various OSes. `Offload-arch` tool will look into this section of the binary to print list of supported architectures.
I see, I was also planning on making a tool that will extract these similar to `cuobjdump`, we could merge it into that as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124525/new/

https://reviews.llvm.org/D124525



More information about the cfe-commits mailing list