diff --git a/lld/test/ELF/basic-avr.s b/lld/test/ELF/basic-avr.s --- a/lld/test/ELF/basic-avr.s +++ b/lld/test/ELF/basic-avr.s @@ -1,14 +1,223 @@ # REQUIRES: avr # RUN: llvm-mc -filetype=obj -triple=avr-unknown-linux -mcpu=atmega328p %s -o %t.o # RUN: ld.lld %t.o -o %t.exe -Ttext=0 -# RUN: llvm-objdump -d %t.exe | FileCheck %s +# RUN: llvm-objdump -d %t.exe --mcpu=atmega328 | FileCheck %s --check-prefix=ASM +# RUN: llvm-readobj --file-headers --sections -l --symbols %t.exe \ +# RUN: | FileCheck %s --check-prefix=OBJ main: - call foo + call foo foo: - jmp foo + jmp foo + rcall foo + rjmp foo -# CHECK:
: -# CHECK-NEXT: 0: 0e 94 02 00 -# CHECK: : -# CHECK-NEXT: 4: 0c 94 02 00 +# ASM:
: +# ASM-NEXT: 0: 0e 94 02 00 call 0x4 +# ASM: : +# ASM-NEXT: 4: 0c 94 02 00 jmp 0x4 +# ASM-NEXT: 8: fd df rcall .-6 +# ASM-NEXT: a: fc cf rjmp .-8 + +# OBJ: Format: elf32-avr +# OBJ-NEXT: Arch: avr +# OBJ-NEXT: AddressSize: 32bit +# OBJ-NEXT: LoadName: +# OBJ-NEXT: ElfHeader { +# OBJ-NEXT: Ident { +# OBJ-NEXT: Magic: (7F 45 4C 46) +# OBJ-NEXT: Class: 32-bit (0x1) +# OBJ-NEXT: DataEncoding: LittleEndian (0x1) +# OBJ-NEXT: FileVersion: 1 +# OBJ-NEXT: OS/ABI: SystemV (0x0) +# OBJ-NEXT: ABIVersion: 0 +# OBJ-NEXT: Unused: (00 00 00 00 00 00 00) +# OBJ-NEXT: } +# OBJ-NEXT: Type: Executable (0x2) +# OBJ-NEXT: Machine: EM_AVR (0x53) +# OBJ-NEXT: Version: 1 +# OBJ-NEXT: Entry: 0x0 +# OBJ-NEXT: ProgramHeaderOffset: 0x34 +# OBJ-NEXT: SectionHeaderOffset: 0x1078 +# OBJ-NEXT: Flags [ (0x85) +# OBJ-NEXT: EF_AVR_ARCH_AVR5 (0x5) +# OBJ-NEXT: EF_AVR_LINKRELAX_PREPARED (0x80) +# OBJ-NEXT: ] +# OBJ-NEXT: HeaderSize: 52 +# OBJ-NEXT: ProgramHeaderEntrySize: 32 +# OBJ-NEXT: ProgramHeaderCount: 4 +# OBJ-NEXT: SectionHeaderEntrySize: 40 +# OBJ-NEXT: SectionHeaderCount: 6 +# OBJ-NEXT: StringTableSectionIndex: 4 +# OBJ-NEXT: } +# OBJ-NEXT: Sections [ +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 0 +# OBJ-NEXT: Name: (0) +# OBJ-NEXT: Type: SHT_NULL (0x0) +# OBJ-NEXT: Flags [ (0x0) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x0 +# OBJ-NEXT: Size: 0 +# OBJ-NEXT: Link: 0 +# OBJ-NEXT: Info: 0 +# OBJ-NEXT: AddressAlignment: 0 +# OBJ-NEXT: EntrySize: 0 +# OBJ-NEXT: } +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 1 +# OBJ-NEXT: Name: .text (1) +# OBJ-NEXT: Type: SHT_PROGBITS (0x1) +# OBJ-NEXT: Flags [ (0x6) +# OBJ-NEXT: SHF_ALLOC (0x2) +# OBJ-NEXT: SHF_EXECINSTR (0x4) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x1000 +# OBJ-NEXT: Size: 12 +# OBJ-NEXT: Link: 0 +# OBJ-NEXT: Info: 0 +# OBJ-NEXT: AddressAlignment: 4 +# OBJ-NEXT: EntrySize: 0 +# OBJ-NEXT: } +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 2 +# OBJ-NEXT: Name: .comment (7) +# OBJ-NEXT: Type: SHT_PROGBITS (0x1) +# OBJ-NEXT: Flags [ (0x30) +# OBJ-NEXT: SHF_MERGE (0x10) +# OBJ-NEXT: SHF_STRINGS (0x20) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x100C +# OBJ-NEXT: Size: 8 +# OBJ-NEXT: Link: 0 +# OBJ-NEXT: Info: 0 +# OBJ-NEXT: AddressAlignment: 1 +# OBJ-NEXT: EntrySize: 1 +# OBJ-NEXT: } +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 3 +# OBJ-NEXT: Name: .symtab (16) +# OBJ-NEXT: Type: SHT_SYMTAB (0x2) +# OBJ-NEXT: Flags [ (0x0) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x1014 +# OBJ-NEXT: Size: 48 +# OBJ-NEXT: Link: 5 +# OBJ-NEXT: Info: 3 +# OBJ-NEXT: AddressAlignment: 4 +# OBJ-NEXT: EntrySize: 16 +# OBJ-NEXT: } +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 4 +# OBJ-NEXT: Name: .shstrtab (24) +# OBJ-NEXT: Type: SHT_STRTAB (0x3) +# OBJ-NEXT: Flags [ (0x0) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x1044 +# OBJ-NEXT: Size: 42 +# OBJ-NEXT: Link: 0 +# OBJ-NEXT: Info: 0 +# OBJ-NEXT: AddressAlignment: 1 +# OBJ-NEXT: EntrySize: 0 +# OBJ-NEXT: } +# OBJ-NEXT: Section { +# OBJ-NEXT: Index: 5 +# OBJ-NEXT: Name: .strtab (34) +# OBJ-NEXT: Type: SHT_STRTAB (0x3) +# OBJ-NEXT: Flags [ (0x0) +# OBJ-NEXT: ] +# OBJ-NEXT: Address: 0x0 +# OBJ-NEXT: Offset: 0x106E +# OBJ-NEXT: Size: 10 +# OBJ-NEXT: Link: 0 +# OBJ-NEXT: Info: 0 +# OBJ-NEXT: AddressAlignment: 1 +# OBJ-NEXT: EntrySize: 0 +# OBJ-NEXT: } +# OBJ-NEXT: ] +# OBJ-NEXT: ProgramHeaders [ +# OBJ-NEXT: ProgramHeader { +# OBJ-NEXT: Type: PT_PHDR (0x6) +# OBJ-NEXT: Offset: 0x34 +# OBJ-NEXT: VirtualAddress: 0x10034 +# OBJ-NEXT: PhysicalAddress: 0x10034 +# OBJ-NEXT: FileSize: 128 +# OBJ-NEXT: MemSize: 128 +# OBJ-NEXT: Flags [ (0x4) +# OBJ-NEXT: PF_R (0x4) +# OBJ-NEXT: ] +# OBJ-NEXT: Alignment: 4 +# OBJ-NEXT: } +# OBJ-NEXT: ProgramHeader { +# OBJ-NEXT: Type: PT_LOAD (0x1) +# OBJ-NEXT: Offset: 0x0 +# OBJ-NEXT: VirtualAddress: 0x10000 +# OBJ-NEXT: PhysicalAddress: 0x10000 +# OBJ-NEXT: FileSize: 180 +# OBJ-NEXT: MemSize: 180 +# OBJ-NEXT: Flags [ (0x4) +# OBJ-NEXT: PF_R (0x4) +# OBJ-NEXT: ] +# OBJ-NEXT: Alignment: 4096 +# OBJ-NEXT: } +# OBJ-NEXT: ProgramHeader { +# OBJ-NEXT: Type: PT_LOAD (0x1) +# OBJ-NEXT: Offset: 0x1000 +# OBJ-NEXT: VirtualAddress: 0x0 +# OBJ-NEXT: PhysicalAddress: 0x0 +# OBJ-NEXT: FileSize: 12 +# OBJ-NEXT: MemSize: 12 +# OBJ-NEXT: Flags [ (0x5) +# OBJ-NEXT: PF_R (0x4) +# OBJ-NEXT: PF_X (0x1) +# OBJ-NEXT: ] +# OBJ-NEXT: Alignment: 4096 +# OBJ-NEXT: } +# OBJ-NEXT: ProgramHeader { +# OBJ-NEXT: Type: PT_GNU_STACK (0x6474E551) +# OBJ-NEXT: Offset: 0x0 +# OBJ-NEXT: VirtualAddress: 0x0 +# OBJ-NEXT: PhysicalAddress: 0x0 +# OBJ-NEXT: FileSize: 0 +# OBJ-NEXT: MemSize: 0 +# OBJ-NEXT: Flags [ (0x6) +# OBJ-NEXT: PF_R (0x4) +# OBJ-NEXT: PF_W (0x2) +# OBJ-NEXT: ] +# OBJ-NEXT: Alignment: 0 +# OBJ-NEXT: } +# OBJ-NEXT: ] +# OBJ-NEXT: Symbols [ +# OBJ-NEXT: Symbol { +# OBJ-NEXT: Name: (0) +# OBJ-NEXT: Value: 0x0 +# OBJ-NEXT: Size: 0 +# OBJ-NEXT: Binding: Local (0x0) +# OBJ-NEXT: Type: None (0x0) +# OBJ-NEXT: Other: 0 +# OBJ-NEXT: Section: Undefined (0x0) +# OBJ-NEXT: } +# OBJ-NEXT: Symbol { +# OBJ-NEXT: Name: main (1) +# OBJ-NEXT: Value: 0x0 +# OBJ-NEXT: Size: 0 +# OBJ-NEXT: Binding: Local (0x0) +# OBJ-NEXT: Type: None (0x0) +# OBJ-NEXT: Other: 0 +# OBJ-NEXT: Section: .text (0x1) +# OBJ-NEXT: } +# OBJ-NEXT: Symbol { +# OBJ-NEXT: Name: foo (6) +# OBJ-NEXT: Value: 0x4 +# OBJ-NEXT: Size: 0 +# OBJ-NEXT: Binding: Local (0x0) +# OBJ-NEXT: Type: None (0x0) +# OBJ-NEXT: Other: 0 +# OBJ-NEXT: Section: .text (0x1) +# OBJ-NEXT: } +# OBJ-NEXT: ]