<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111482>111482</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[PAC][readobj] Display signing schema for AUTH relocs
</td>
</tr>
<tr>
<th>Labels</th>
<td>
tools:llvm-readobj/readelf
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
kovdan01
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kovdan01
</td>
</tr>
</table>
<pre>
The signing schema is stored in the place to be relocated: https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#encoding-the-signing-schema
Currently, to view the schema, we need to output the hex dump of that place and manually search for particular interesting bits - see, for example, this piece from llvm/test/CodeGen/AArch64/ptrauth-init-fini.ll:
```
; RUN: llc -mtriple aarch64-elf -mattr=+pauth -filetype=asm -o - nodisc.ll | \
; RUN: FileCheck %s --check-prefix=ASM
; RUN: llc -mtriple aarch64-elf -mattr=+pauth -filetype=obj -o - nodisc.ll | \
; RUN: llvm-readelf -r -x .init_array -x .fini_array - | FileCheck %s --check-prefix=OBJ
; ASM: .section .init_array,"aw",@init_array
; ASM-NEXT: .p2align 3, 0x0
; ASM-NEXT: .xword foo@AUTH(ia,55764)
; ASM-NEXT: .section .fini_array,"aw",@fini_array
; ASM-NEXT: .p2align 3, 0x0
; ASM-NEXT: .xword bar@AUTH(ia,55764)
; OBJ: Relocation section '.rela.init_array' at offset 0x{{.*}} contains 1 entries:
; OBJ-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
; OBJ-NEXT: 0000000000000000 0000000700000244 R_AARCH64_AUTH_ABS64 0000000000000000 foo + 0
; OBJ: Relocation section '.rela.fini_array' at offset 0x{{.*}} contains 1 entries:
; OBJ-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
; OBJ-NEXT: 0000000000000000 0000000800000244 R_AARCH64_AUTH_ABS64 0000000000000004 bar + 0
; OBJ: Hex dump of section '.init_array':
; OBJ-NEXT: 0x00000000 00000000 d4d90000
; OBJ: Hex dump of section '.fini_array':
; OBJ-NEXT: 0x00000000 00000000 d4d90000
;; ^^^^ 0xD9D4: constant discriminator = 55764
;; ^^ 0x80: bits 61..60 key = IA; bit 63 addr disc = false
```
This is confusing and might also be pretty hard for non-trivial cases. We should somehow display signing schema for AUTH relocs when relocation table is requested by user.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVt2S2jgTfRpx02WXkW0MF1wYCF_yVSXZmkx2926qbbWxElnySvIAb78lAxNmkplNKqNyGfTX5_RRy93onNxpoiXLV4zzr-ZeoE6mjHOWbyY4-NbY5WV0UhlxXN62BGGT1DtwdUsdgnTgvLEkQGrwLUGvsCbwBioCS8rU6EmwtITW-96xtGR8y_h2J307VHFtOsa35c37yJnG79ES41usZITI-LZSpmJ826HUjG_7wAkrSaqZZU_7sXWe8ZR0bYTUu8i3FJ2pRieqLNmwpDy914O1pL06Mr4OXO8l7Uf256V8DXsCTSTCrBl8P_hxvqUDiKHrwTTgW_Rnd1EL6FAPqNQRHKGtW2iMhR6tl_Wg0ILUniw5H7SrpHcQgSMKSGEhHbDr1dj1rXTQS6oJGms6UOo-aOQpOLhdG0H_oyBHWdq6PQnhbZAiklr6qJFaxkoFoa8cZrPk_Jy66QpuPn8Ix6JUDVHnrewVAeJoMyLVQNSh95alG8ZXo9QQNVKRP_bE0g26DiIDEWgjpKtjpYAVa2D5-jsEgK1UtG6p_gqM5w6iqA6dqLfUyANLN-Wn96_Fy1Rffp5XkDayhGK0ayE6QBxEvENr8Th2g5yX7mjpv3z5uPr_I-HTFQT3RjwAiB3VXhp9DcT4mnGO-3D1-JplydXUtZHow5u_b4OluOeo5E5DGgImOSTPLDvsjRUA0BjDsqT8fPuW8bkM4Z3nRQidxTMbH0h-c_87kldTr0KyQvsyyYftQeKLnjenT0wgeyHNeBFbUvhI4QLQg2kaRx6SAytWrFjFjJes2LBiA7XRHqV2MAXS3kpy3y7QCfGB8MeTkev2Tjfm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