1# REQUIRES: mips 2# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %tmips 3# RUN: ld.lld -m elf32btsmip -e _start %tmips -o %t2mips 4# RUN: llvm-readobj --file-headers %t2mips \ 5# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS %s 6# RUN: ld.lld -m elf32btsmip_fbsd -e _start %tmips -o %t2mips 7# RUN: llvm-readobj --file-headers %t2mips \ 8# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS %s 9# RUN: ld.lld %tmips -e _start -o %t3mips 10# RUN: llvm-readobj --file-headers %t3mips \ 11# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS %s 12# RUN: echo 'OUTPUT_FORMAT(elf32-tradbigmips)' > %tmips.script 13# RUN: ld.lld %tmips.script -e _start %tmips -o %t4mips 14# RUN: llvm-readobj --file-headers %t4mips \ 15# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS %s 16# RUN: echo 'OUTPUT_FORMAT(elf32-tradbigmips-freebsd)' > %tmips.script 17# RUN: ld.lld %tmips.script -e _start %tmips -o %t4mips 18# RUN: llvm-readobj --file-headers %t4mips \ 19# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS %s 20# RUN: echo 'OUTPUT_FORMAT(elf32-bigmips)' > %tmips2.script 21# RUN: ld.lld %tmips2.script -e _start %tmips -o %t5mips 22# RUN: llvm-readobj --file-headers %t5mips \ 23# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS %s 24# MIPS: ElfHeader { 25# MIPS-NEXT: Ident { 26# MIPS-NEXT: Magic: (7F 45 4C 46) 27# MIPS-NEXT: Class: 32-bit (0x1) 28# MIPS-NEXT: DataEncoding: BigEndian (0x2) 29# MIPS-NEXT: FileVersion: 1 30# MIPS-NEXT: OS/ABI: [[OSABI]] 31# MIPS-NEXT: ABIVersion: 1 32# MIPS-NEXT: Unused: (00 00 00 00 00 00 00) 33# MIPS-NEXT: } 34# MIPS-NEXT: Type: Executable (0x2) 35# MIPS-NEXT: Machine: EM_MIPS (0x8) 36# MIPS-NEXT: Version: 1 37# MIPS-NEXT: Entry: 38# MIPS-NEXT: ProgramHeaderOffset: 0x34 39# MIPS-NEXT: SectionHeaderOffset: 40# MIPS-NEXT: Flags [ 41# MIPS-NEXT: EF_MIPS_ABI_O32 42# MIPS-NEXT: EF_MIPS_ARCH_32 43# MIPS-NEXT: EF_MIPS_CPIC 44# MIPS-NEXT: ] 45 46# RUN: llvm-mc -filetype=obj -triple=mipsel-unknown-linux %s -o %tmipsel 47# RUN: ld.lld -m elf32ltsmip -e _start %tmipsel -o %t2mipsel 48# RUN: llvm-readobj --file-headers %t2mipsel \ 49# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSEL %s 50# RUN: ld.lld -m elf32ltsmip_fbsd -e _start %tmipsel -o %t2mipsel 51# RUN: llvm-readobj --file-headers %t2mipsel \ 52# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSEL %s 53# RUN: ld.lld -melf32ltsmip -e _start %tmipsel -o %t2mipsel 54# RUN: llvm-readobj --file-headers %t2mipsel \ 55# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSEL %s 56# RUN: ld.lld %tmipsel -e _start -o %t3mipsel 57# RUN: llvm-readobj --file-headers %t3mipsel \ 58# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSEL %s 59# RUN: echo 'OUTPUT_FORMAT(elf32-tradlittlemips)' > %tmipsel.script 60# RUN: ld.lld %tmipsel.script -e _start %tmipsel -o %t4mipsel 61# RUN: llvm-readobj --file-headers %t4mipsel \ 62# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSEL %s 63# RUN: echo 'OUTPUT_FORMAT(elf32-tradlittlemips-freebsd)' > %tmipsel.script 64# RUN: ld.lld %tmipsel.script -e _start %tmipsel -o %t4mipsel 65# RUN: llvm-readobj --file-headers %t4mipsel \ 66# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSEL %s 67# MIPSEL: ElfHeader { 68# MIPSEL-NEXT: Ident { 69# MIPSEL-NEXT: Magic: (7F 45 4C 46) 70# MIPSEL-NEXT: Class: 32-bit (0x1) 71# MIPSEL-NEXT: DataEncoding: LittleEndian (0x1) 72# MIPSEL-NEXT: FileVersion: 1 73# MIPSEL-NEXT: OS/ABI: [[OSABI]] 74# MIPSEL-NEXT: ABIVersion: 1 75# MIPSEL-NEXT: Unused: (00 00 00 00 00 00 00) 76# MIPSEL-NEXT: } 77# MIPSEL-NEXT: Type: Executable (0x2) 78# MIPSEL-NEXT: Machine: EM_MIPS (0x8) 79# MIPSEL-NEXT: Version: 1 80# MIPSEL-NEXT: Entry: 81# MIPSEL-NEXT: ProgramHeaderOffset: 0x34 82# MIPSEL-NEXT: SectionHeaderOffset: 83# MIPSEL-NEXT: Flags [ 84# MIPSEL-NEXT: EF_MIPS_ABI_O32 85# MIPSEL-NEXT: EF_MIPS_ARCH_32 86# MIPSEL-NEXT: EF_MIPS_CPIC 87# MIPSEL-NEXT: ] 88 89# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux-gnuabin32 %s -o %tmipsn32 90# RUN: ld.lld -m elf32btsmipn32 -e _start %tmipsn32 -o %t2mipsn32 91# RUN: llvm-readobj --file-headers %t2mipsn32 \ 92# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32 %s 93# RUN: ld.lld -m elf32btsmipn32_fbsd -e _start %tmipsn32 -o %t2mipsn32 94# RUN: llvm-readobj --file-headers %t2mipsn32 \ 95# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSN32 %s 96# RUN: ld.lld %tmipsn32 -e _start -o %t3mipsn32 97# RUN: llvm-readobj --file-headers %t3mipsn32 \ 98# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32 %s 99# RUN: echo 'OUTPUT_FORMAT(elf32-ntradbigmips)' > %tmipsn32.script 100# RUN: ld.lld %tmipsn32.script -e _start %tmipsn32 -o %t4mipsn32 101# RUN: llvm-readobj --file-headers %t4mipsn32 \ 102# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32 %s 103# RUN: echo 'OUTPUT_FORMAT(elf32-ntradbigmips-freebsd)' > %tmipsn32.script 104# RUN: ld.lld %tmipsn32.script -e _start %tmipsn32 -o %t4mipsn32 105# RUN: llvm-readobj --file-headers %t4mipsn32 \ 106# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSN32 %s 107# MIPSN32: ElfHeader { 108# MIPSN32-NEXT: Ident { 109# MIPSN32-NEXT: Magic: (7F 45 4C 46) 110# MIPSN32-NEXT: Class: 32-bit (0x1) 111# MIPSN32-NEXT: DataEncoding: BigEndian (0x2) 112# MIPSN32-NEXT: FileVersion: 1 113# MIPSN32-NEXT: OS/ABI: [[OSABI]] 114# MIPSN32-NEXT: ABIVersion: 1 115# MIPSN32-NEXT: Unused: (00 00 00 00 00 00 00) 116# MIPSN32-NEXT: } 117# MIPSN32-NEXT: Type: Executable (0x2) 118# MIPSN32-NEXT: Machine: EM_MIPS (0x8) 119# MIPSN32-NEXT: Version: 1 120# MIPSN32-NEXT: Entry: 121# MIPSN32-NEXT: ProgramHeaderOffset: 0x34 122# MIPSN32-NEXT: SectionHeaderOffset: 123# MIPSN32-NEXT: Flags [ 124# MIPSN32-NEXT: EF_MIPS_ABI2 125# MIPSN32-NEXT: EF_MIPS_ARCH_64 126# MIPSN32-NEXT: EF_MIPS_CPIC 127# MIPSN32-NEXT: ] 128 129# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux-gnuabin32 %s -o %tmipsn32el 130# RUN: ld.lld -m elf32ltsmipn32 -e _start %tmipsn32el -o %t2mipsn32el 131# RUN: llvm-readobj --file-headers %t2mipsn32el \ 132# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32EL %s 133# RUN: ld.lld -m elf32ltsmipn32_fbsd -e _start %tmipsn32el -o %t2mipsn32el 134# RUN: llvm-readobj --file-headers %t2mipsn32el \ 135# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSN32EL %s 136# RUN: ld.lld -melf32ltsmipn32 -e _start %tmipsn32el -o %t2mipsn32el 137# RUN: llvm-readobj --file-headers %t2mipsn32el \ 138# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32EL %s 139# RUN: ld.lld %tmipsn32el -e _start -o %t3mipsn32el 140# RUN: llvm-readobj --file-headers %t3mipsn32el \ 141# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32EL %s 142# RUN: echo 'OUTPUT_FORMAT(elf32-ntradlittlemips)' > %tmipsn32el.script 143# RUN: ld.lld %tmipsn32el.script -e _start %tmipsn32el -o %t4mipsn32el 144# RUN: llvm-readobj --file-headers %t4mipsn32el \ 145# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPSN32EL %s 146# RUN: echo 'OUTPUT_FORMAT(elf32-ntradlittlemips-freebsd)' > %tmipsn32el.script 147# RUN: ld.lld %tmipsn32el.script -e _start %tmipsn32el -o %t4mipsn32el 148# RUN: llvm-readobj --file-headers %t4mipsn32el \ 149# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPSN32EL %s 150# MIPSN32EL: ElfHeader { 151# MIPSN32EL-NEXT: Ident { 152# MIPSN32EL-NEXT: Magic: (7F 45 4C 46) 153# MIPSN32EL-NEXT: Class: 32-bit (0x1) 154# MIPSN32EL-NEXT: DataEncoding: LittleEndian (0x1) 155# MIPSN32EL-NEXT: FileVersion: 1 156# MIPSN32EL-NEXT: OS/ABI: [[OSABI]] 157# MIPSN32EL-NEXT: ABIVersion: 1 158# MIPSN32EL-NEXT: Unused: (00 00 00 00 00 00 00) 159# MIPSN32EL-NEXT: } 160# MIPSN32EL-NEXT: Type: Executable (0x2) 161# MIPSN32EL-NEXT: Machine: EM_MIPS (0x8) 162# MIPSN32EL-NEXT: Version: 1 163# MIPSN32EL-NEXT: Entry: 164# MIPSN32EL-NEXT: ProgramHeaderOffset: 0x34 165# MIPSN32EL-NEXT: SectionHeaderOffset: 166# MIPSN32EL-NEXT: Flags [ 167# MIPSN32EL-NEXT: EF_MIPS_ABI2 168# MIPSN32EL-NEXT: EF_MIPS_ARCH_64 169# MIPSN32EL-NEXT: EF_MIPS_CPIC 170# MIPSN32EL-NEXT: ] 171 172# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux -position-independent \ 173# RUN: %s -o %tmips64 174# RUN: ld.lld -m elf64btsmip -e _start %tmips64 -o %t2mips64 175# RUN: llvm-readobj --file-headers %t2mips64 \ 176# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64 %s 177# RUN: ld.lld -m elf64btsmip_fbsd -e _start %tmips64 -o %t2mips64 178# RUN: llvm-readobj --file-headers %t2mips64 \ 179# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS64 %s 180# RUN: ld.lld %tmips64 -e _start -o %t3mips64 181# RUN: llvm-readobj --file-headers %t3mips64 \ 182# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64 %s 183# RUN: echo 'OUTPUT_FORMAT(elf64-tradbigmips)' > %tmips64.script 184# RUN: ld.lld %tmips64.script -e _start %tmips64 -o %t4mips64 185# RUN: llvm-readobj --file-headers %t4mips64 \ 186# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64 %s 187# RUN: echo 'OUTPUT_FORMAT(elf64-tradbigmips-freebsd)' > %tmips64.script 188# RUN: ld.lld %tmips64.script -e _start %tmips64 -o %t4mips64 189# RUN: llvm-readobj --file-headers %t4mips64 \ 190# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS64 %s 191# MIPS64: ElfHeader { 192# MIPS64-NEXT: Ident { 193# MIPS64-NEXT: Magic: (7F 45 4C 46) 194# MIPS64-NEXT: Class: 64-bit (0x2) 195# MIPS64-NEXT: DataEncoding: BigEndian (0x2) 196# MIPS64-NEXT: FileVersion: 1 197# MIPS64-NEXT: OS/ABI: [[OSABI]] 198# MIPS64-NEXT: ABIVersion: 0 199# MIPS64-NEXT: Unused: (00 00 00 00 00 00 00) 200# MIPS64-NEXT: } 201# MIPS64-NEXT: Type: Executable (0x2) 202# MIPS64-NEXT: Machine: EM_MIPS (0x8) 203# MIPS64-NEXT: Version: 1 204# MIPS64-NEXT: Entry: 205# MIPS64-NEXT: ProgramHeaderOffset: 0x40 206# MIPS64-NEXT: SectionHeaderOffset: 207# MIPS64-NEXT: Flags [ 208# MIPS64-NEXT: EF_MIPS_ARCH_64 209# MIPS64-NEXT: EF_MIPS_CPIC 210# MIPS64-NEXT: EF_MIPS_PIC 211# MIPS64-NEXT: ] 212 213# RUN: llvm-mc -filetype=obj -triple=mips64el-unknown-linux \ 214# RUN: -position-independent %s -o %tmips64el 215# RUN: ld.lld -m elf64ltsmip -e _start %tmips64el -o %t2mips64el 216# RUN: llvm-readobj --file-headers %t2mips64el \ 217# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64EL %s 218# RUN: ld.lld -m elf64ltsmip_fbsd -e _start %tmips64el -o %t2mips64el 219# RUN: llvm-readobj --file-headers %t2mips64el \ 220# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS64EL %s 221# RUN: ld.lld %tmips64el -e _start -o %t3mips64el 222# RUN: llvm-readobj --file-headers %t3mips64el \ 223# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64EL %s 224# RUN: echo 'OUTPUT_FORMAT(elf64-tradlittlemips)' > %tmips64el.script 225# RUN: ld.lld %tmips64el.script -e _start %tmips64el -o %t4mips64el 226# RUN: llvm-readobj --file-headers %t4mips64el \ 227# RUN: | FileCheck -DOSABI=SystemV --check-prefix=MIPS64EL %s 228# RUN: echo 'OUTPUT_FORMAT(elf64-tradlittlemips-freebsd)' > %tmips64el.script 229# RUN: ld.lld %tmips64el.script -e _start %tmips64el -o %t4mips64el 230# RUN: llvm-readobj --file-headers %t4mips64el \ 231# RUN: | FileCheck -DOSABI=FreeBSD --check-prefix=MIPS64EL %s 232# MIPS64EL: ElfHeader { 233# MIPS64EL-NEXT: Ident { 234# MIPS64EL-NEXT: Magic: (7F 45 4C 46) 235# MIPS64EL-NEXT: Class: 64-bit (0x2) 236# MIPS64EL-NEXT: DataEncoding: LittleEndian (0x1) 237# MIPS64EL-NEXT: FileVersion: 1 238# MIPS64EL-NEXT: OS/ABI: [[OSABI]] 239# MIPS64EL-NEXT: ABIVersion: 0 240# MIPS64EL-NEXT: Unused: (00 00 00 00 00 00 00) 241# MIPS64EL-NEXT: } 242# MIPS64EL-NEXT: Type: Executable (0x2) 243# MIPS64EL-NEXT: Machine: EM_MIPS (0x8) 244# MIPS64EL-NEXT: Version: 1 245# MIPS64EL-NEXT: Entry: 246# MIPS64EL-NEXT: ProgramHeaderOffset: 0x40 247# MIPS64EL-NEXT: SectionHeaderOffset: 248# MIPS64EL-NEXT: Flags [ 249# MIPS64EL-NEXT: EF_MIPS_ARCH_64 250# MIPS64EL-NEXT: EF_MIPS_CPIC 251# MIPS64EL-NEXT: EF_MIPS_PIC 252# MIPS64EL-NEXT: ] 253 254.globl _start 255_start: 256