File: avr5.test

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (52 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# REQUIRES: avr

## Test ld.lld supports OUTPUT_FORMAT/OUTPUT_ARCH for AVR output.

# RUN: split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=avr -mcpu=atmega328 %t/avr5.s -o %t/avr5.o
# RUN: ld.lld %t/avr5.o -T %t/avr5.lds -o %t/avr5a.out
# RUN: llvm-objdump --no-print-imm-hex --mcpu=atmega328 -d %t/avr5a.out | FileCheck %s --check-prefix=RELOC
# RUN: ld.lld %t/avr5.o -Ttext=0 -Tdata=0x800 -e _start -o %t/avr5b.out
# RUN: llvm-objdump --no-print-imm-hex --mcpu=atmega328 -d %t/avr5b.out | FileCheck %s --check-prefix=RELOC

# RELOC:      ldi  r24, 2
# RELOC-NEXT: ldi  r25, 8

# RUN: llvm-readelf --headers %t/avr5a.out | FileCheck %s --check-prefix=HEAD
# RUN: llvm-readelf --headers %t/avr5b.out | FileCheck %s --check-prefix=HEAD

# HEAD: Atmel AVR 8-bit microcontroller
# HEAD: 0x85, EF_AVR_ARCH_AVR5, relaxable

# HEAD:      Name     Type      Address   Off     Size
# HEAD-NEXT:          NULL      00000000  000000  000000
# HEAD-NEXT: .text    PROGBITS  00000000  001000  000006
# HEAD-NEXT: .data    PROGBITS  00000800  001800  000004

#--- avr5.s
	.text
	.globl _start
	.p2align 1
_start:
	ldi   r24, lo8(def) ; Load lower byte of variable def 16-bit address to r24
	ldi   r25, hi8(def) ; Load higher byte of variable def 16-bit address to r25
	rjmp  _start

	.section .data
	.type abc, @object
	.type def, @object
	.globl abc
	.globl def
abc:
	.short 100
def:
	.short 200

#--- avr5.lds
OUTPUT_FORMAT("elf32-avr", "elf32-avr", "elf32-avr")
OUTPUT_ARCH(avr:5)
ENTRY(_start)
SECTIONS {
	.text 0x000: { *(.text*) }
	.data 0x800: { *(.data*) }
}