[PATCH] D156505: [AArch64][ELF] Support R_AARCH64_AUTH_ABS64 static relocation

Daniil Kovalev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 8 05:15:05 PDT 2023


kovdan01 added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:7541
+  if (!isUInt<16>(Discriminator))
+    return TokError("too wide integer discriminator '" + Twine(Discriminator) +
+                    "'");
----------------
peter.smith wrote:
> Similar error messages use out of range. Ideally we should give the permitted range in the error message.
> `integer discriminator <Discrimator> is out of range, [0, 65535] expected` 
It makes sense, changed the message, thanks. I used hex values since they look nicer and more readable in this context.


================
Comment at: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:331
+          SymLoc == AArch64AuthMCExpr::VK_AUTHADDR) {
+        // TODO: implement test with rel relocations and non-zero wide addends
+        // By default, rela is used, and implicit addend is 0
----------------
peter.smith wrote:
> I'm not sure if MC can easily generate a REL relocation for AArch64. IIRC REL format may occur in the dynamic case, for RELATIVE compression and REL format dynamic relocations (lld -z rel).
> 
I added a TODO for checking if such case is even possible. I think that the if statement should be kept since the ABI explicitly says that those bits are used for addend on platforms with rel. 

Thanks for mentioning the dynamic case (`lld -z rel`). I'll check it, but it's out of scope of this patch so mark the comment as done. Feel free to re-open it if needed.


================
Comment at: llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:336
+                                          Twine(Value) +
+                                          "' in auth relocation");
+
----------------
peter.smith wrote:
> Worth saying what the range is in the error message? For example there are other error messages with `fixup value out of range [-0xFFFF, 0xFFFF]");` For example:
> "out of range addend <Value> in auth relocation. Permitted range [-2,147,483,648, -2,147,483,647]"
Fixed, thanks. I also used hex values here: although most people are familiar with decimal representation of these values, they are more messy than their hex variants.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156505



More information about the llvm-commits mailing list