[llvm] [llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants (PR #72713)

Daniil Kovalev via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 19:10:59 PST 2023


================
@@ -6208,6 +6263,13 @@ void ELFDumper<ELFT>::forEachRelocationDo(
       Warn(RangeOrErr.takeError());
     }
     break;
+  case ELF::SHT_AARCH64_AUTH_RELR:
+    if (Obj.getHeader().e_machine != EM_AARCH64) {
+      this->reportUniqueWarning(
----------------
kovdan01 wrote:

I suppose a slightly different approach would be better if we have concerns regarding other targets defining the same section type for unrelated purposes. `ELFDumper<ELFT>::forEachRelocationDo` should only be called on sections which pass the check `isRelocationSec<LEFT>(Sec)`. So, we can change this check and make it take the target into account - as for now, it returns true for `SHT_AARCH64_AUTH_RESULT` unconditionally. After such change, we can just use an `assert(Obj.getHeader().e_machine == EM_AARCH64)` under `case ELF::SHT_AARCH64_AUTH_RESULT` in `ELFDumper<ELFT>::forEachRelocationDo` to ensure the contract is satisfied.

@MaskRay Please let me know your thoughts on this.


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


More information about the llvm-commits mailing list