Index: lld/ELF/ScriptParser.cpp =================================================================== --- lld/ELF/ScriptParser.cpp +++ lld/ELF/ScriptParser.cpp @@ -436,6 +436,7 @@ .Case("elf64-littleriscv", {ELF64LEKind, EM_RISCV}) .Case("elf64-sparc", {ELF64BEKind, EM_SPARCV9}) .Case("elf32-msp430", {ELF32LEKind, EM_MSP430}) + .Case("elf32-avr", {ELF32LEKind, EM_AVR}) .Default({ELFNoneKind, EM_NONE}); } Index: lld/test/ELF/linkerscript/Inputs/avr5.s =================================================================== --- /dev/null +++ lld/test/ELF/linkerscript/Inputs/avr5.s @@ -0,0 +1,15 @@ + .text + .globl _start + .p2align 1 +_start: + ldi r24, 10 + ldi r25, 20 + sts abc+1, r25 + sts abc, r24 + rjmp _start + + .type abc, @object + .section .data + .globl abc +abc: + .short 100 Index: lld/test/ELF/linkerscript/avr5.test =================================================================== --- /dev/null +++ lld/test/ELF/linkerscript/avr5.test @@ -0,0 +1,28 @@ +# REQUIRES: avr + +# RUN: llvm-mc -filetype=obj -triple=avr -mattr=+avr5 %p/Inputs/avr5.s -o %t +# RUN: ld.lld %t --script %s -o %t1 +# RUN: llvm-readelf --sections %t1 | FileCheck %s --check-prefix=SEC +# RUN: llvm-objdump --mattr=+avr5 -d %t1 | FileCheck %s --check-prefix=ASM + +# SEC: Name Type Address Off Size +# SEC-NEXT: NULL 00000000 000000 000000 +# SEC-NEXT: .text PROGBITS 00000000 001000 00000e +# SEC-NEXT: .data PROGBITS 00000100 001100 000002 + +# ASM: ldi r24, 10 +# ASM-NEXT: ldi r25, 20 +# ASM-NEXT: sts 257, r25 +# ASM-NEXT: sts 256, r24 + +OUTPUT_FORMAT("elf32-avr", "elf32-avr", "elf32-avr") +OUTPUT_ARCH(avr:5) + +ENTRY(_start) + +SECTIONS { + . = 0; + .text : { *(.text*) } + . = 256; + .data : { *(.data*) } +}