• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: riscv
2
3# RUN: llvm-mc -filetype=obj -triple=riscv32 %s -o %t.o
4# RUN: ld.lld %t.o -o %t
5# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV32 %s
6# RUN: ld.lld -m elf32lriscv %t.o -o %t
7# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV32 %s
8# RUN: echo 'OUTPUT_FORMAT(elf32-littleriscv)' > %t.script
9# RUN: ld.lld %t.script %t.o -o %t
10# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV32 %s
11
12# RV32:      ElfHeader {
13# RV32-NEXT:   Ident {
14# RV32-NEXT:     Magic: (7F 45 4C 46)
15# RV32-NEXT:     Class: 32-bit (0x1)
16# RV32-NEXT:     DataEncoding: LittleEndian (0x1)
17# RV32-NEXT:     FileVersion: 1
18# RV32-NEXT:     OS/ABI: SystemV (0x0)
19# RV32-NEXT:     ABIVersion: 0
20# RV32-NEXT:     Unused: (00 00 00 00 00 00 00)
21# RV32-NEXT:   }
22# RV32-NEXT:   Type: Executable (0x2)
23# RV32-NEXT:   Machine: EM_RISCV (0xF3)
24# RV32-NEXT:   Version: 1
25# RV32-NEXT:   Entry:
26# RV32-NEXT:   ProgramHeaderOffset: 0x34
27# RV32-NEXT:   SectionHeaderOffset:
28# RV32-NEXT:   Flags [ (0x0)
29# RV32-NEXT:   ]
30# RV32-NEXT:   HeaderSize: 52
31# RV32-NEXT:   ProgramHeaderEntrySize: 32
32# RV32-NEXT:   ProgramHeaderCount:
33# RV32-NEXT:   SectionHeaderEntrySize: 40
34# RV32-NEXT:   SectionHeaderCount:
35# RV32-NEXT:   StringTableSectionIndex:
36# RV32-NEXT: }
37
38# RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
39# RUN: ld.lld %t.o -o %t
40# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV64 %s
41# RUN: ld.lld -m elf64lriscv %t.o -o %t
42# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV64 %s
43# RUN: echo 'OUTPUT_FORMAT(elf64-littleriscv)' > %t.script
44# RUN: ld.lld %t.script %t.o -o %t
45# RUN: llvm-readobj --file-headers %t | FileCheck --check-prefix=RV64 %s
46
47# RV64:      ElfHeader {
48# RV64-NEXT:   Ident {
49# RV64-NEXT:     Magic: (7F 45 4C 46)
50# RV64-NEXT:     Class: 64-bit (0x2)
51# RV64-NEXT:     DataEncoding: LittleEndian (0x1)
52# RV64-NEXT:     FileVersion: 1
53# RV64-NEXT:     OS/ABI: SystemV (0x0)
54# RV64-NEXT:     ABIVersion: 0
55# RV64-NEXT:     Unused: (00 00 00 00 00 00 00)
56# RV64-NEXT:   }
57# RV64-NEXT:   Type: Executable (0x2)
58# RV64-NEXT:   Machine: EM_RISCV (0xF3)
59# RV64-NEXT:   Version: 1
60# RV64-NEXT:   Entry:
61# RV64-NEXT:   ProgramHeaderOffset: 0x40
62# RV64-NEXT:   SectionHeaderOffset:
63# RV64-NEXT:   Flags [ (0x0)
64# RV64-NEXT:   ]
65# RV64-NEXT:   HeaderSize: 64
66# RV64-NEXT:   ProgramHeaderEntrySize: 56
67# RV64-NEXT:   ProgramHeaderCount:
68# RV64-NEXT:   SectionHeaderEntrySize: 64
69# RV64-NEXT:   SectionHeaderCount:
70# RV64-NEXT:   StringTableSectionIndex:
71# RV64-NEXT: }
72
73.globl _start
74_start:
75