2 # RUN: llvm-mc -filetype=obj -triple=avr-unknown-linux -mcpu=atmega328p %s -o %t.o
3 # RUN: ld.lld %t.o -o %t.exe -Ttext=0
4 # RUN: llvm-objdump -d %t.exe --mcpu=atmega328 | FileCheck %s --check-prefix=ASM
5 # RUN: llvm-readelf --file-headers --sections -l --symbols %t.exe \
6 # RUN: | FileCheck %s --check-prefix=ELF
16 # ASM-NEXT: 0: 0e 94 02 00 call 0x4
18 # ASM-NEXT: 4: 0c 94 02 00 jmp 0x4
19 # ASM-NEXT: 8: fd df rcall .-6
20 # ASM-NEXT: a: fc cf rjmp .-8
23 # ELF-NEXT: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
24 # ELF-NEXT: Class: ELF32
25 # ELF-NEXT: Data: 2's complement, little endian
26 # ELF-NEXT: Version: 1 (current)
27 # ELF-NEXT: OS/ABI: UNIX - System V
28 # ELF-NEXT: ABI Version: 0
29 # ELF-NEXT: Type: EXEC (Executable file)
30 # ELF-NEXT: Machine: Atmel AVR 8-bit microcontroller
31 # ELF-NEXT: Version: 0x1
32 # ELF-NEXT: Entry point address: 0x0
33 # ELF-NEXT: Start of program headers: 52 (bytes into file)
34 # ELF-NEXT: Start of section headers: 4216 (bytes into file)
35 # ELF-NEXT: Flags: 0x85, EF_AVR_ARCH_AVR5, relaxable
36 # ELF-NEXT: Size of this header: 52 (bytes)
37 # ELF-NEXT: Size of program headers: 32 (bytes)
38 # ELF-NEXT: Number of program headers: 4
39 # ELF-NEXT: Size of section headers: 40 (bytes)
40 # ELF-NEXT: Number of section headers: 6
41 # ELF-NEXT: Section header string table index: 4
42 # ELF-NEXT: There are 6 section headers, starting at offset 0x1078:
44 # ELF: Section Headers:
45 # ELF-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
46 # ELF-NEXT: [ 0] NULL 00000000 000000 000000 00 0 0 0
47 # ELF-NEXT: [ 1] .text PROGBITS 00000000 001000 00000c 00 AX 0 0 4
48 # ELF-NEXT: [ 2] .comment PROGBITS 00000000 00100c 000008 01 MS 0 0 1
49 # ELF-NEXT: [ 3] .symtab SYMTAB 00000000 001014 000030 10 5 3 4
50 # ELF-NEXT: [ 4] .shstrtab STRTAB 00000000 001044 00002a 00 0 0 1
51 # ELF-NEXT: [ 5] .strtab STRTAB 00000000 00106e 00000a 00 0 0 1
52 # ELF-NEXT: Key to Flags:
53 # ELF-NEXT: W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
54 # ELF-NEXT: L (link order), O (extra OS processing required), G (group), T (TLS),
55 # ELF-NEXT: C (compressed), x (unknown), o (OS specific), E (exclude),
56 # ELF-NEXT: R (retain), p (processor specific)
58 # ELF: Elf file type is EXEC (Executable file)
59 # ELF-NEXT: Entry point 0x0
60 # ELF-NEXT: There are 4 program headers, starting at offset 52
62 # ELF: Program Headers:
63 # ELF-NEXT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
64 # ELF-NEXT: PHDR 0x000034 0x00010034 0x00010034 0x00080 0x00080 R 0x4
65 # ELF-NEXT: LOAD 0x000000 0x00010000 0x00010000 0x000b4 0x000b4 R 0x1000
66 # ELF-NEXT: LOAD 0x001000 0x00000000 0x00000000 0x0000c 0x0000c R E 0x1000
67 # ELF-NEXT: GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x0
69 # ELF: Section to Segment mapping:
70 # ELF-NEXT: Segment Sections...
75 # ELF-NEXT: None .comment .symtab .shstrtab .strtab
77 # ELF: Symbol table '.symtab' contains 3 entries:
78 # ELF-NEXT: Num: Value Size Type Bind Vis Ndx Name
79 # ELF-NEXT: 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
80 # ELF-NEXT: 1: 00000000 0 NOTYPE LOCAL DEFAULT 1 main
81 # ELF-NEXT: 2: 00000004 0 NOTYPE LOCAL DEFAULT 1 foo