return "ELF32-x86-64";
case ELF::EM_ARM:
return (IsLittleEndian ? "ELF32-arm-little" : "ELF32-arm-big");
+ case ELF::EM_AVR:
+ return "ELF32-avr";
case ELF::EM_HEXAGON:
return "ELF32-hexagon";
case ELF::EM_MIPS:
return Triple::aarch64;
case ELF::EM_ARM:
return Triple::arm;
+ case ELF::EM_AVR:
+ return Triple::avr;
case ELF::EM_HEXAGON:
return Triple::hexagon;
case ELF::EM_MIPS:
#include "ELFRelocs/ARM.def"
};
+// AVR specific e_flags
+enum : unsigned {
+ EF_AVR_ARCH_AVR1 = 1,
+ EF_AVR_ARCH_AVR2 = 2,
+ EF_AVR_ARCH_AVR25 = 25,
+ EF_AVR_ARCH_AVR3 = 3,
+ EF_AVR_ARCH_AVR31 = 31,
+ EF_AVR_ARCH_AVR35 = 35,
+ EF_AVR_ARCH_AVR4 = 4,
+ EF_AVR_ARCH_AVR5 = 5,
+ EF_AVR_ARCH_AVR51 = 51,
+ EF_AVR_ARCH_AVR6 = 6,
+ EF_AVR_ARCH_AVRTINY = 100,
+ EF_AVR_ARCH_XMEGA1 = 101,
+ EF_AVR_ARCH_XMEGA2 = 102,
+ EF_AVR_ARCH_XMEGA3 = 103,
+ EF_AVR_ARCH_XMEGA4 = 104,
+ EF_AVR_ARCH_XMEGA5 = 105,
+ EF_AVR_ARCH_XMEGA6 = 106,
+ EF_AVR_ARCH_XMEGA7 = 107
+};
+
+// ELF Relocation types for AVR
+enum {
+#include "ELFRelocs/AVR.def"
+};
+
// Mips Specific e_flags
enum : unsigned {
EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
--- /dev/null
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_AVR_NONE, 0)
+ELF_RELOC(R_AVR_32, 1)
+ELF_RELOC(R_AVR_7_PCREL, 2)
+ELF_RELOC(R_AVR_13_PCREL, 3)
+ELF_RELOC(R_AVR_16, 4)
+ELF_RELOC(R_AVR_16_PM, 5)
+EL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ARCH_AVR35)
+ BCase(EF_AVR_ARCH_AVR4)
+ BCase(EF_AVR_ARCH_AVR51)
+ BCase(EF_AVR_ARCH_AVR6)
+ BCase(EF_AVR_ARCH_AVRTINY)
+ BCase(EF_AVR_ARCH_XMEGA1)
+ BCase(EF_AVR_ARCH_XMEGA2)
+ BCase(EF_AVR_ARCH_XMEGA3)
+ BCase(EF_AVR_ARCH_XMEGA4)
+ BCase(EF_AVR_ARCH_XMEGA5)
+ BCase(EF_AVR_ARCH_XMEGA6)
+ BCase(EF_AVR_ARCH_XMEGA7)
+ break;
default:
llvm_unreachable("Unsupported architecture");
}
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mipsel | FileCheck %s --check-prefix ELF-MIPSEL
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-mips64el | FileCheck %s --check-prefix ELF-MIPS64EL
RUN: obj2yaml %p/Inputs/trivial-object-test.elf-x86-64 | FileCheck %s --check-prefix ELF-X86-64
+RUN: obj2yaml %p/Inputs/trivial-object-test.elf-avr | FileCheck %s --check-prefix ELF-AVR
RUN: obj2yaml %p/Inputs/unwind-section.elf-x86-64 \
RUN: | FileCheck %s --check-prefix ELF-X86-64-UNWIND
ELF-X86-64-NEXT: - Name: SomeOtherFunction
ELF-X86-64-NEXT: - Name: puts
+
+ELF-AVR: FileHeader:
+ELF-AVR-NEXT: Class: ELFCLASS32
+ELF-AVR-NEXT: Data: ELFDATA2LSB
+ELF-AVR-NEXT: Type: ET_EXEC
+ELF-AVR-NEXT: Machine: EM_AVR
+ELF-AVR-NEXT: Flags: [ EF_AVR_ARCH_AVR2 ]
+ELF-AVR-NEXT: Sections:
+ELF-AVR-NEXT: - Name: .text
+ELF-AVR-NEXT: Type: SHT_PROGBITS
+ELF-AVR-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ELF-AVR-NEXT: AddressAlign: 0x0000000000000002
+ELF-AVR-NEXT: Content: C20E0895
+ELF-AVR-NEXT: - Name: .data
+ELF-AVR-NEXT: Type: SHT_PROGBITS
+ELF-AVR-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ]
+ELF-AVR-NEXT: Address: 0x0000000000800060
+ELF-AVR-NEXT: AddressAlign: 0x0000000000000001
+ELF-AVR-NEXT: Content: ''
+ELF-AVR-NEXT: Symbols:
+ELF-AVR-NEXT: Local:
+ELF-AVR-NEXT: - Type: STT_SECTION
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Type: STT_SECTION
+ELF-AVR-NEXT: Section: .data
+ELF-AVR-NEXT: Value: 0x0000000000800060
+ELF-AVR-NEXT: - Name: a.o
+ELF-AVR-NEXT: Type: STT_FILE
+ELF-AVR-NEXT: - Name: main
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: Global:
+ELF-AVR-NEXT: - Name: __trampolines_start
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: _etext
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: Value: 0x0000000000000004
+ELF-AVR-NEXT: - Name: __data_load_end
+ELF-AVR-NEXT: Value: 0x0000000000000004
+ELF-AVR-NEXT: - Name: __trampolines_end
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: __data_load_start
+ELF-AVR-NEXT: Value: 0x0000000000000004
+ELF-AVR-NEXT: - Name: __dtors_end
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: __eeprom_end
+ELF-AVR-NEXT: Section: .data
+ELF-AVR-NEXT: Value: 0x0000000000810000
+ELF-AVR-NEXT: - Name: __ctors_start
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: __dtors_start
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: __ctors_end
+ELF-AVR-NEXT: Section: .text
+ELF-AVR-NEXT: - Name: _edata
+ELF-AVR-NEXT: Section: .data
+ELF-AVR-NEXT: Value: 0x0000000000800060
+ELF-AVR-NEXT: - Name: _end
+ELF-AVR-NEXT: Section: .data
+ELF-AVR-NEXT: Value: 0x0000000000800060
+
+
ELF-X86-64-UNWIND: - Name: .eh_frame
ELF-X86-64-UNWIND-NEXT: Type: SHT_X86_64_UNWIND
ELF-X86-64-UNWIND-NEXT: Flags: [ SHF_ALLOC ]