Skip to content

Revert "[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants" #74816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions llvm/include/llvm/BinaryFormat/DynamicTags.def
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_STACK, 0x7000000c)
AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_GLOBALS, 0x7000000d)
AARCH64_DYNAMIC_TAG(AARCH64_MEMTAG_GLOBALSSZ, 0x7000000f)

// AArch64 specific dynamic table entries for RELR auth relocations as described here:
// https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#dynamic-section
AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELRSZ, 0x70000011)
AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELR, 0x70000012)
AARCH64_DYNAMIC_TAG(AARCH64_AUTH_RELRENT, 0x70000013)

// Hexagon specific dynamic table entries
HEXAGON_DYNAMIC_TAG(HEXAGON_SYMSZ, 0x70000000)
HEXAGON_DYNAMIC_TAG(HEXAGON_VER, 0x70000001)
Expand Down
8 changes: 0 additions & 8 deletions llvm/include/llvm/BinaryFormat/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,6 @@ enum : unsigned {
SHT_ARM_ATTRIBUTES = 0x70000003U,
SHT_ARM_DEBUGOVERLAY = 0x70000004U,
SHT_ARM_OVERLAYSECTION = 0x70000005U,
// Special aarch64-specific section for MTE support, as described in:
// https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#section-types
SHT_AARCH64_AUTH_RELR = 0x70000004U,
// Special aarch64-specific sections for MTE support, as described in:
// https://github.com/ARM-software/abi-aa/blob/main/memtagabielf64/memtagabielf64.rst#7section-types
SHT_AARCH64_MEMTAG_GLOBALS_STATIC = 0x70000007U,
Expand Down Expand Up @@ -1650,11 +1647,6 @@ enum {
NT_ANDROID_TYPE_MEMTAG = 4,
};

// ARM note types.
enum {
NT_ARM_TYPE_PAUTH_ABI_TAG = 1,
};

// Memory tagging values used in NT_ANDROID_TYPE_MEMTAG notes.
enum {
// Enumeration to determine the tagging mode. In Android-land, 'SYNC' means
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ ELF_RELOC(R_AARCH64_TLS_TPREL64, 0x406)
ELF_RELOC(R_AARCH64_TLSDESC, 0x407)
ELF_RELOC(R_AARCH64_IRELATIVE, 0x408)
ELF_RELOC(R_AARCH64_AUTH_ABS64, 0xe100)
ELF_RELOC(R_AARCH64_AUTH_RELATIVE, 0xe200)

// ELF_RELOC(R_AARCH64_P32_NONE, 0)
ELF_RELOC(R_AARCH64_P32_ABS32, 0x001)
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Object/ELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ StringRef llvm::object::getELFSectionTypeName(uint32_t Machine, unsigned Type) {
break;
case ELF::EM_AARCH64:
switch (Type) {
STRINGIFY_ENUM_CASE(ELF, SHT_AARCH64_AUTH_RELR);
STRINGIFY_ENUM_CASE(ELF, SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC);
STRINGIFY_ENUM_CASE(ELF, SHT_AARCH64_MEMTAG_GLOBALS_STATIC);
}
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/ObjectYAML/ELFYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration(
ECase(SHT_MSP430_ATTRIBUTES);
break;
case ELF::EM_AARCH64:
ECase(SHT_AARCH64_AUTH_RELR);
ECase(SHT_AARCH64_MEMTAG_GLOBALS_STATIC);
ECase(SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC);
break;
Expand Down
98 changes: 0 additions & 98 deletions llvm/test/tools/llvm-readobj/ELF/AArch64/aarch64-feature-pauth.s

This file was deleted.

40 changes: 0 additions & 40 deletions llvm/test/tools/llvm-readobj/ELF/broken-dynamic-reloc.test
Original file line number Diff line number Diff line change
Expand Up @@ -459,43 +459,3 @@ ProgramHeaders:
- Type: PT_DYNAMIC
FirstSec: .dynamic
LastSec: .dynamic

## Show we print a warning for an invalid relocation table size stored in a DT_AARCH64_AUTH_RELRSZ entry.
# RUN: yaml2obj --docnum=8 -DRELTYPE=RELR -DTAG1=DT_AARCH64_AUTH_RELRSZ -DTAG1VAL=0xFF -DTAG2=DT_AARCH64_AUTH_RELRENT %s -o %t14
# RUN: llvm-readobj --dyn-relocations %t14 2>&1 | FileCheck %s -DFILE=%t14 --check-prefix=INVALID-DT-AARCH64-AUTH-RELRSZ
# RUN: llvm-readelf --dyn-relocations %t14 2>&1 | FileCheck %s -DFILE=%t14 --check-prefix=INVALID-DT-AARCH64-AUTH-RELRSZ

# INVALID-DT-AARCH64-AUTH-RELRSZ: warning: '[[FILE]]': invalid DT_AARCH64_AUTH_RELRSZ value (0xff) or DT_AARCH64_AUTH_RELRENT value (0x18)

## Show we print a warning for an invalid relocation table entry size stored in a DT_AARCH64_AUTH_RELRENT entry.
# RUN: yaml2obj --docnum=8 -DRELTYPE=RELR -DTAG1=DT_AARCH64_AUTH_RELRSZ -DTAG2=DT_AARCH64_AUTH_RELRENT -DTAG2VAL=0xFF %s -o %t15
# RUN: llvm-readobj --dyn-relocations %t15 2>&1 | FileCheck %s -DFILE=%t15 --check-prefix=INVALID-DT-AARCH64-AUTH-RELRENT
# RUN: llvm-readelf --dyn-relocations %t15 2>&1 | FileCheck %s -DFILE=%t15 --check-prefix=INVALID-DT-AARCH64-AUTH-RELRENT

# INVALID-DT-AARCH64-AUTH-RELRENT: invalid DT_AARCH64_AUTH_RELRSZ value (0x18) or DT_AARCH64_AUTH_RELRENT value (0xff)

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_DYN
Machine: EM_AARCH64
Sections:
- Name: .relx.dyn
Type: SHT_[[RELTYPE]]
- Name: .dynamic
Type: SHT_DYNAMIC
Entries:
- Tag: DT_[[RELTYPE]]
Value: 0x0
- Tag: [[TAG1]]
Value: [[TAG1VAL=0x18]]
- Tag: [[TAG2]]
Value: [[TAG2VAL=0x18]]
- Tag: DT_NULL
Value: 0x0
DynamicSymbols: []
ProgramHeaders:
- Type: PT_LOAD
FirstSec: .relx.dyn
LastSec: .dynamic
32 changes: 10 additions & 22 deletions llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
Original file line number Diff line number Diff line change
Expand Up @@ -355,26 +355,20 @@ ProgramHeaders:
# RUN: llvm-readobj --dynamic-table %t.aarch64 | FileCheck %s --check-prefix=LLVM-AARCH64
# RUN: llvm-readelf --dynamic-table %t.aarch64 | FileCheck %s --check-prefix=GNU-AARCH64

# LLVM-AARCH64: DynamicSection [ (7 entries)
# LLVM-AARCH64: DynamicSection [ (4 entries)
# LLVM-AARCH64-NEXT: Tag Type Name/Value
# LLVM-AARCH64-NEXT: 0x0000000070000001 AARCH64_BTI_PLT 1
# LLVM-AARCH64-NEXT: 0x0000000070000003 AARCH64_PAC_PLT 2
# LLVM-AARCH64-NEXT: 0x0000000070000005 AARCH64_VARIANT_PCS 3
# LLVM-AARCH64-NEXT: 0x0000000070000012 AARCH64_AUTH_RELR 0x4
# LLVM-AARCH64-NEXT: 0x0000000070000011 AARCH64_AUTH_RELRSZ 5
# LLVM-AARCH64-NEXT: 0x0000000070000013 AARCH64_AUTH_RELRENT 6
# LLVM-AARCH64-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-AARCH64-NEXT: 0x0000000070000001 AARCH64_BTI_PLT 1
# LLVM-AARCH64-NEXT: 0x0000000070000003 AARCH64_PAC_PLT 2
# LLVM-AARCH64-NEXT: 0x0000000070000005 AARCH64_VARIANT_PCS 3
# LLVM-AARCH64-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-AARCH64-NEXT:]

# GNU-AARCH64: Dynamic section at offset {{.*}} contains 7 entries:
# GNU-AARCH64: Dynamic section at offset {{.*}} contains 4 entries:
# GNU-AARCH64-NEXT: Tag Type Name/Value
# GNU-AARCH64-NEXT: 0x0000000070000001 (AARCH64_BTI_PLT) 1
# GNU-AARCH64-NEXT: 0x0000000070000003 (AARCH64_PAC_PLT) 2
# GNU-AARCH64-NEXT: 0x0000000070000005 (AARCH64_VARIANT_PCS) 3
# GNU-AARCH64-NEXT: 0x0000000070000012 (AARCH64_AUTH_RELR) 0x4
# GNU-AARCH64-NEXT: 0x0000000070000011 (AARCH64_AUTH_RELRSZ) 5
# GNU-AARCH64-NEXT: 0x0000000070000013 (AARCH64_AUTH_RELRENT) 6
# GNU-AARCH64-NEXT: 0x0000000000000000 (NULL) 0x0
# GNU-AARCH64-NEXT: 0x0000000070000001 (AARCH64_BTI_PLT) 1
# GNU-AARCH64-NEXT: 0x0000000070000003 (AARCH64_PAC_PLT) 2
# GNU-AARCH64-NEXT: 0x0000000070000005 (AARCH64_VARIANT_PCS) 3
# GNU-AARCH64-NEXT: 0x0000000000000000 (NULL) 0x0

--- !ELF
FileHeader:
Expand All @@ -392,12 +386,6 @@ Sections:
Value: 2
- Tag: DT_AARCH64_VARIANT_PCS
Value: 3
- Tag: DT_AARCH64_AUTH_RELR
Value: 4
- Tag: DT_AARCH64_AUTH_RELRSZ
Value: 5
- Tag: DT_AARCH64_AUTH_RELRENT
Value: 6
- Tag: DT_NULL
Value: 0
ProgramHeaders:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,11 @@
# MIPS-GNU: abiflags MIPS_ABIFLAGS
# MIPS-GNU: dwarf MIPS_DWARF

# AARCH64-LLVM: Name: aarch64_auth_relr
# AARCH64-LLVM: Type: SHT_AARCH64_AUTH_RELR
# AARCH64-LLVM: Name: .memtag.globals.dynamic
# AARCH64-LLVM: Type: SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC
# AARCH64-LLVM: Name: .memtag.globals.static
# AARCH64-LLVM: Type: SHT_AARCH64_MEMTAG_GLOBALS_STATIC

# AARCH64-GNU: aarch64_auth_relr AARCH64_AUTH_RELR
# AARCH64-GNU: .memtag.globals.dynamic AARCH64_MEMTAG_GLOBALS_DYNAMIC
# AARCH64-GNU: .memtag.globals.static AARCH64_MEMTAG_GLOBALS_STATIC

Expand Down Expand Up @@ -116,8 +113,6 @@ FileHeader:
Type: ET_REL
Machine: EM_AARCH64
Sections:
- Name: aarch64_auth_relr
Type: SHT_AARCH64_AUTH_RELR
- Name: .memtag.globals.dynamic
Type: SHT_AARCH64_MEMTAG_GLOBALS_DYNAMIC
- Name: .memtag.globals.static
Expand Down
17 changes: 2 additions & 15 deletions llvm/test/tools/llvm-readobj/ELF/relr-relocs.test
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Sections:
Link: [[LINK=<none>]]

## Check we report a warning when we are unable to dump relocations
## for a SHT_RELR/SHT_ANDROID_RELR/SHT_AARCH64_AUTH_RELR section.
## for a SHT_RELR/SHT_ANDROID_RELR section.

## Case A: check the case when relocations can't be read from an SHT_RELR section.
# RUN: yaml2obj --docnum=2 -DENTSIZE=1 %s -o %t2.broken
Expand Down Expand Up @@ -186,20 +186,7 @@ Sections:
# RUN: llvm-readelf --relocations %t2.broken.android 2>&1 | \
# RUN: FileCheck -DFILE=%t2.broken.android --check-prefix=BROKEN-GNU %s -DSECNAME=SHT_ANDROID_RELR

## Case C: check the case when we have an SHT_AARCH64_AUTH_RELR section in non-AArch64 ELF.
## SHT_AARCH64_AUTH_RELR = 0x70000004.
# RUN: yaml2obj --docnum=2 -DENTSIZE=1 -DSHTYPE=0x70000004 %s -o %t2.broken.aarch64auth
# RUN: llvm-readobj --relocations %t2.broken.aarch64auth 2>&1 | \
# RUN: FileCheck -DFILE=%t2.broken.aarch64auth --check-prefix=WRONGARCH-LLVM-AARCH64-AUTH %s -DSECNAME=SHT_AARCH64_AUTH_RELR
# RUN: llvm-readelf --relocations %t2.broken.aarch64auth 2>&1 | \
# RUN: FileCheck -DFILE=%t2.broken.aarch64auth --check-prefix=WRONGARCH-GNU-AARCH64-AUTH %s -DSECNAME=SHT_AARCH64_AUTH_RELR

# WRONGARCH-LLVM-AARCH64-AUTH: Relocations [
# WRONGARCH-LLVM-AARCH64-AUTH-NEXT: ]

# WRONGARCH-GNU-AARCH64-AUTH-NOT: Relocation section

## Check the behavior when the sh_link field of the SHT_RELR/SHT_ANDROID_RELR/SHT_AARCH64_AUTH_RELR section
## Check the behavior when the sh_link field of the SHT_RELR/SHT_ANDROID_RELR section
## is set to an arbitrary value. Normally, it is set to 0, because such sections contains
## only relative relocations and do not have an associated symbol table, like other
## relocation sections.
Expand Down
Loading