Skip to content

[PAC][readobj] Display signing schema for AUTH relocs #111482

Open
@kovdan01

Description

@kovdan01

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.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions