[llvm] [llvm-objdump][AVR] Detect AVR architecture from ELF flags for disassembling (PR #174731)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 21 20:25:37 PST 2026


MaskRay wrote:

> I have added a test case to verify the default `"avr0"`. Do you think it is necessary to include tests for other cases as well?
> 
> > the explanation about +all, which I think he wanted in actual code comments
> 
> @MaskRay Given that the code now defaults to avr0, do we still need to explain within the comments why "all" is incompatible with AVR?

Yes, worth a comment around the following block why we cannot use something like `+all`.

```
-    Features.AddFeature("+special");
+    if (const auto *ELFFile = dyn_cast<ELFObjectFileBase>(Obj)) {
+      unsigned AVRVersion = ELFFile->getPlatformFlags() & ELF::EF_AVR_ARCH_MASK;
+      Features.AddFeature(getAVRFeature(AVRVersion));
+    }
```

Anyhow the current code looks good to me.


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


More information about the llvm-commits mailing list