[llvm] Add --dump-offload-bundle option to llvm-objcopy (PR #143347)

David Salinas via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 10:17:58 PDT 2025


david-salinas wrote:


> Thanks, I see what you're saying. However, I think it's clear from what you've done that this shouldn't be an llvm-objcopy feature, as you're essentially introducing a second mode to the tool that is completely unrelated to the current mode and where there's no mixing of the two. The core of llvm-objcopy and its sibling tools like llvm-strip, is to call `executeObjcopy`, which when the new option you're adding is used, is never executed. That suggests to me that this functionality belongs in a different, potentially completely new, tool.

I see yoour point.  Though I still feel that llvm-objcopy is the right tool, because what this option is trying to do is a raw copy (or extraction) of part of a section in an object file.  Most of the functionality of llvm-objcopy seems to be based on copying whole sections; but also some fine grain control at the symbol level too.  This option is similar in that it is copying data from a section, though in this case a very specific section - the Clang fatbin bundle offload section.  The problem really is that the URI syntax contains/encapsulates all of the information needed to do the copy/extract, so we don't need an explicit input file.  I could remove the code to disable the need to specify an input file, then users would need to specify the URI for the option --dump-offload-bundle as well as the input file - so something like this "llvm-objcopy --dump-offload-bundle=file:://test.exe#offset=4096\&size=1024 test.exe".  This is doable, but not too pretty.


https://github.com/llvm/llvm-project/pull/143347


More information about the llvm-commits mailing list