Index: include/llvm/Object/ELFObjectFile.h =================================================================== --- include/llvm/Object/ELFObjectFile.h +++ include/llvm/Object/ELFObjectFile.h @@ -967,6 +967,8 @@ return "ELF32-wasm"; case ELF::EM_AMDGPU: return "ELF32-amdgpu"; + case ELF::EM_AAP: + return "ELF32-aap"; default: return "ELF32-unknown"; } @@ -1014,6 +1016,8 @@ return Triple::x86; case ELF::EM_X86_64: return Triple::x86_64; + case ELF::EM_AAP: + return Triple::aap; case ELF::EM_AARCH64: return IsLittleEndian ? Triple::aarch64 : Triple::aarch64_be; case ELF::EM_ARM: Index: include/llvm/Support/ELF.h =================================================================== --- include/llvm/Support/ELF.h +++ include/llvm/Support/ELF.h @@ -315,6 +315,11 @@ // such numbers for an official value for WebAssembly. As soon as one is // allocated, this enum will be updated to use it. EM_WEBASSEMBLY = 0x4157, // WebAssembly architecture + + // A request has been made to the maintainer of the official registry for + // such numbers for an official value for AAP. As soon as one is allocated, + // this enum will be updated to use it. + EM_AAP = 0x5343 // AAP }; // Object file classes. @@ -619,6 +624,11 @@ #include "ELFRelocs/BPF.def" }; +// ELF Relocation type for AAP. +enum { +#include "ELFRelocs/AAP.def" +}; + #undef ELF_RELOC // Section header. Index: include/llvm/Support/ELFRelocs/AAP.def =================================================================== --- /dev/null +++ include/llvm/Support/ELFRelocs/AAP.def @@ -0,0 +1,23 @@ + +#ifndef ELF_RELOC +#error "ELF_RELOC must be defined" +#endif + +ELF_RELOC(R_AAP_NONE, 0x00) +ELF_RELOC(R_AAP_8, 0x01) +ELF_RELOC(R_AAP_16, 0x02) +ELF_RELOC(R_AAP_32, 0x03) +ELF_RELOC(R_AAP_64, 0x04) +ELF_RELOC(R_AAP_BR16, 0x05) +ELF_RELOC(R_AAP_BR32, 0x06) +ELF_RELOC(R_AAP_BRCC16, 0x07) +ELF_RELOC(R_AAP_BRCC32, 0x08) +ELF_RELOC(R_AAP_BAL16, 0x09) +ELF_RELOC(R_AAP_BAL32, 0x0a) +ELF_RELOC(R_AAP_ABS6, 0x0b) +ELF_RELOC(R_AAP_ABS9, 0x0c) +ELF_RELOC(R_AAP_ABS10, 0x0d) +ELF_RELOC(R_AAP_ABS12, 0x0e) +ELF_RELOC(R_AAP_ABS16, 0x0f) +ELF_RELOC(R_AAP_OFF10, 0x10) +ELF_RELOC(R_AAP_SHIFT6, 0x11) Index: include/llvm/module.modulemap =================================================================== --- include/llvm/module.modulemap +++ include/llvm/module.modulemap @@ -261,6 +261,7 @@ textual header "Support/AArch64TargetParser.def" textual header "Support/Dwarf.def" textual header "Support/MachO.def" + textual header "Support/ELFRelocs/AAP.def" textual header "Support/ELFRelocs/AArch64.def" textual header "Support/ELFRelocs/AMDGPU.def" textual header "Support/ELFRelocs/ARM.def" Index: lib/Object/ELF.cpp =================================================================== --- lib/Object/ELF.cpp +++ lib/Object/ELF.cpp @@ -44,6 +44,13 @@ break; } break; + case ELF::EM_AAP: + switch (Type) { +#include "llvm/Support/ELFRelocs/AAP.def" + default: + break; + } + break; case ELF::EM_AARCH64: switch (Type) { #include "llvm/Support/ELFRelocs/AArch64.def" Index: lib/ObjectYAML/ELFYAML.cpp =================================================================== --- lib/ObjectYAML/ELFYAML.cpp +++ lib/ObjectYAML/ELFYAML.cpp @@ -195,6 +195,7 @@ ECase(EM_RISCV); ECase(EM_LANAI); ECase(EM_BPF); + ECase(EM_AAP); #undef ECase } @@ -537,6 +538,9 @@ case ELF::EM_LANAI: #include "llvm/Support/ELFRelocs/Lanai.def" break; + case ELF::EM_AAP: +#include "llvm/Support/ELFRelocs/AAP.def" + break; case ELF::EM_AMDGPU: #include "llvm/Support/ELFRelocs/AMDGPU.def" break; Index: test/Object/AAP/elf32-aap-rel.yaml =================================================================== --- /dev/null +++ test/Object/AAP/elf32-aap-rel.yaml @@ -0,0 +1,113 @@ +# RUN: yaml2obj %s > %t +# RUN: llvm-readobj -r %t | FileCheck %s + +#CHECK: Relocations [ +#CHECK-NEXT: Section (2) .rela.text { +#CHECK-NEXT: 0x0 R_AAP_NONE - 0x0 +#CHECK-NEXT: 0x4 R_AAP_8 - 0x0 +#CHECK-NEXT: 0x6 R_AAP_16 - 0x0 +#CHECK-NEXT: 0x8 R_AAP_32 - 0x0 +#CHECK-NEXT: 0xC R_AAP_64 - 0x0 +#CHECK-NEXT: 0x14 R_AAP_BR16 - 0x0 +#CHECK-NEXT: 0x16 R_AAP_BR32 - 0x0 +#CHECK-NEXT: 0x1A R_AAP_BRCC16 - 0x0 +#CHECK-NEXT: 0x1C R_AAP_BRCC32 - 0x0 +#CHECK-NEXT: 0x20 R_AAP_BAL16 - 0x0 +#CHECK-NEXT: 0x22 R_AAP_BAL32 - 0x0 +#CHECK-NEXT: 0x26 R_AAP_ABS6 - 0x0 +#CHECK-NEXT: 0x2A R_AAP_ABS9 - 0x0 +#CHECK-NEXT: 0x2E R_AAP_ABS10 - 0x0 +#CHECK-NEXT: 0x32 R_AAP_ABS12 - 0x0 +#CHECK-NEXT: 0x36 R_AAP_ABS16 - 0x0 +#CHECK-NEXT: 0x3A R_AAP_SHIFT6 - 0x0 +#CHECK-NEXT: 0x3E R_AAP_OFF10 - 0x0 +#CHECK-NEXT: 0x42 R_AAP_OFF10 - 0x0 +#CHECK_NEXT: } +#CHECK_NEXT: ] + +!ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_AAP +Sections: + - Type: SHT_PROGBITS + Name: .text + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x04 + Content: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + - Type: SHT_RELA + Name: .rela.text + Link: .symtab + Info: .text + AddressAlign: 0x04 + Relocations: + - Offset: 0 + Symbol: apple + Type: R_AAP_NONE + - Offset: 4 + Symbol: banana + Type: R_AAP_8 + - Offset: 6 + Symbol: carrot + Type: R_AAP_16 + - Offset: 8 + Symbol: dandelion + Type: R_AAP_32 + - Offset: 12 + Symbol: egg + Type: R_AAP_64 + - Offset: 20 + Symbol: fruit + Type: R_AAP_BR16 + - Offset: 22 + Symbol: golf + Type: R_AAP_BR32 + - Offset: 26 + Symbol: hello + Type: R_AAP_BRCC16 + - Offset: 28 + Symbol: igloo + Type: R_AAP_BRCC32 + - Offset: 32 + Symbol: joke + Type: R_AAP_BAL16 + - Offset: 34 + Symbol: kennel + Type: R_AAP_BAL32 + - Offset: 38 + Symbol: lemon + Type: R_AAP_ABS6 + - Offset: 42 + Symbol: money + Type: R_AAP_ABS9 + - Offset: 46 + Symbol: octopus + Type: R_AAP_ABS10 + - Offset: 50 + Symbol: pterodactyl + Type: R_AAP_ABS12 + - Offset: 54 + Symbol: qwerty + Type: R_AAP_ABS16 + - Offset: 58 + Symbol: risk + Type: R_AAP_SHIFT6 + - Offset: 62 + Symbol: staple + Type: R_AAP_OFF10 + - Offset: 66 + Symbol: tunnel + Type: R_AAP_OFF10 +Symbols: + Local: + - Name: .text + Type: STT_SECTION + Section: .text + + Global: + - Name: main + Type: STT_FUNC + Section: .text + Size: 68 Index: test/Object/AAP/elf32-aap.yaml =================================================================== --- /dev/null +++ test/Object/AAP/elf32-aap.yaml @@ -0,0 +1,12 @@ +# RUN: yaml2obj %s > %t.o +# RUN: llvm-readobj -s -file-headers %t.o | FileCheck %s + +# CHECK: Format: ELF32-aap +# CHECK: Arch: aap + +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_REL + Machine: EM_AAP Index: tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- tools/llvm-objdump/llvm-objdump.cpp +++ tools/llvm-objdump/llvm-objdump.cpp @@ -768,6 +768,7 @@ case ELF::EM_MIPS: case ELF::EM_BPF: case ELF::EM_RISCV: + case ELF::EM_AAP: res = Target; break; case ELF::EM_WEBASSEMBLY: Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -953,6 +953,7 @@ ENUM_ENT(EM_WEBASSEMBLY, "EM_WEBASSEMBLY"), ENUM_ENT(EM_LANAI, "EM_LANAI"), ENUM_ENT(EM_BPF, "EM_BPF"), + ENUM_ENT(EM_AAP, "AAP"), }; static const EnumEntry ElfSymbolBindings[] = {