[all-commits] [llvm/llvm-project] 32ee66: [PAC][CodeGen][ELF][AArch64] Support signed GOT

Daniil Kovalev via All-commits all-commits at lists.llvm.org
Wed Aug 21 00:44:25 PDT 2024


  Branch: refs/heads/users/kovdan01/fix-buildbot-pr96164
  Home:   https://github.com/llvm/llvm-project
  Commit: 32ee6647b56411e253618cb978f8c3018d4190a7
      https://github.com/llvm/llvm-project/commit/32ee6647b56411e253618cb978f8c3018d4190a7
  Author: Daniil Kovalev <dkovalev at accesssoftek.com>
  Date:   2024-08-21 (Wed, 21 Aug 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/lib/Target/AArch64/AArch64FastISel.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    M llvm/lib/Target/AArch64/AArch64MCInstLower.cpp
    M llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
    M llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
    M llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
    M llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
    M llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
    A llvm/test/CodeGen/AArch64/ptrauth-basic-pic.ll
    A llvm/test/CodeGen/AArch64/ptrauth-elf-globals-pic.ll
    A llvm/test/CodeGen/AArch64/ptrauth-extern-weak.ll
    A llvm/test/CodeGen/AArch64/ptrauth-got-abuse.ll
    A llvm/test/CodeGen/AArch64/ptrauth-tagged-globals-pic.ll
    A llvm/test/MC/AArch64/adrp-auth-relocation.s
    M llvm/test/MC/AArch64/arm64-elf-relocs.s
    M llvm/test/MC/AArch64/ilp32-diagnostics.s

  Log Message:
  -----------
  [PAC][CodeGen][ELF][AArch64] Support signed GOT

Support the following relocations and assembly operators:

- `R_AARCH64_AUTH_ADR_GOT_PAGE` (`:got_auth:` for `adrp`)
- `R_AARCH64_AUTH_LD64_GOT_LO12_NC` (`:got_auth_lo12:` for `ldr`)
- `R_AARCH64_AUTH_GOT_ADD_LO12_NC` (`:got_auth_lo12:` for `add`)

`LOADgotAUTH` pseudo-instruction is introduced which is later expanded to
actual instruction sequence like the following.

```
adrp x16, :got_auth:sym
add x16, x16, :got_auth_lo12:sym
ldr x0, [x16]
autia x0, x16
```

If a resign is requested, like below, `LOADgotPAC` pseudo is used, and GOT
load is lowered similarly to `LOADgotAUTH`.

```
@var = global i32 0
define ptr @resign_globalvar() {
  ret ptr ptrauth (ptr @var, i32 3, i64 43)
}
```

If FPAC bit is not set and resign is requested, a check+trap sequence similar
to one used for `AUT` pseudo is emitted.

Both SelectionDAG and GlobalISel are suppported.
For FastISel, we fall back to SelectionDAG.

Tests starting with 'ptrauth-' have corresponding variants w/o this prefix.

See also specification
https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#appendix-signed-got



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list