[llvm] [llvm-objdump] Support --mcpu=help/--mattr=help without -d (PR #165661)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 01:11:23 PST 2025
================
@@ -3533,6 +3533,33 @@ commaSeparatedValues(const llvm::opt::InputArgList &InputArgs, int ID) {
return Values;
}
+static void mcpuHelp() {
+ std::string Error;
+ Triple TheTriple;
+
+ if (!TripleName.empty()) {
+ TheTriple.setTriple(TripleName);
+ } else {
+ // We can guarantee that InputFilenames won't be empty.
+ Expected<OwningBinary<Binary>> OBinary = createBinary(InputFilenames[0]);
+ // OwningBinary<Binary> OBinary =
+ if (!OBinary)
+ reportError(InputFilenames[0],
+ "A target triple was not specified and could "
+ " not be inferred from the input file.");
+
+ Binary *Bin = OBinary->getBinary();
+ if (ObjectFile *Obj = dyn_cast<ObjectFile>(Bin))
----------------
jh7370 wrote:
Oh that's an interesting case actually. llvm-objdump can normally handle archives, so it probably should here too, by finding the triple from the first member (related: if llvm-objdump ignores non-Object members of archives when dumping them, we should skip them when looking for the triple from an archive member).
I'd be tempted to add archive support separately. However, we should emit an error here for other cases that this might fail with.
https://github.com/llvm/llvm-project/pull/165661
More information about the llvm-commits
mailing list