mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
Recover elf32-bigmips and elf32-powerpc support in LLD
This fixes a 7.0 -> 8.0 regression when parsing OUTPUT_FORMAT("elf32-powerpc"); or elf32-bigmips directive in ldscripts as well as an unknown emulation error when lld is invoked by clang due to missed elf32ppclinux case. Patch by vit9696 Differential Revision: https://reviews.llvm.org/D58005 llvm-svn: 353968
This commit is contained in:
parent
265e8e8252
commit
4134143cf5
@ -129,7 +129,7 @@ static std::tuple<ELFKind, uint16_t, uint8_t> parseEmulation(StringRef Emul) {
|
||||
.Cases("elf32btsmip", "elf32btsmipn32", {ELF32BEKind, EM_MIPS})
|
||||
.Cases("elf32ltsmip", "elf32ltsmipn32", {ELF32LEKind, EM_MIPS})
|
||||
.Case("elf32lriscv", {ELF32LEKind, EM_RISCV})
|
||||
.Case("elf32ppc", {ELF32BEKind, EM_PPC})
|
||||
.Cases("elf32ppc", "elf32ppclinux", {ELF32BEKind, EM_PPC})
|
||||
.Case("elf64btsmip", {ELF64BEKind, EM_MIPS})
|
||||
.Case("elf64ltsmip", {ELF64LEKind, EM_MIPS})
|
||||
.Case("elf64lriscv", {ELF64LEKind, EM_RISCV})
|
||||
|
@ -391,10 +391,11 @@ static std::pair<ELFKind, uint16_t> parseBfdName(StringRef S) {
|
||||
.Case("elf32-x86-64", {ELF32LEKind, EM_X86_64})
|
||||
.Case("elf64-aarch64", {ELF64LEKind, EM_AARCH64})
|
||||
.Case("elf64-littleaarch64", {ELF64LEKind, EM_AARCH64})
|
||||
.Case("elf32-powerpc", {ELF32BEKind, EM_PPC})
|
||||
.Case("elf64-powerpc", {ELF64BEKind, EM_PPC64})
|
||||
.Case("elf64-powerpcle", {ELF64LEKind, EM_PPC64})
|
||||
.Case("elf64-x86-64", {ELF64LEKind, EM_X86_64})
|
||||
.Case("elf32-tradbigmips", {ELF32BEKind, EM_MIPS})
|
||||
.Cases("elf32-tradbigmips", "elf32-bigmips", {ELF32BEKind, EM_MIPS})
|
||||
.Case("elf32-ntradbigmips", {ELF32BEKind, EM_MIPS})
|
||||
.Case("elf32-tradlittlemips", {ELF32LEKind, EM_MIPS})
|
||||
.Case("elf32-ntradlittlemips", {ELF32LEKind, EM_MIPS})
|
||||
|
@ -7,6 +7,9 @@
|
||||
# RUN: echo 'OUTPUT_FORMAT(elf32-tradbigmips)' > %tmips.script
|
||||
# RUN: ld.lld %tmips.script -e _start %tmips -o %t4mips
|
||||
# RUN: llvm-readobj -file-headers %t4mips | FileCheck --check-prefix=MIPS %s
|
||||
# RUN: echo 'OUTPUT_FORMAT(elf32-bigmips)' > %tmips2.script
|
||||
# RUN: ld.lld %tmips2.script -e _start %tmips -o %t5mips
|
||||
# RUN: llvm-readobj -file-headers %t5mips | FileCheck --check-prefix=MIPS %s
|
||||
# MIPS: ElfHeader {
|
||||
# MIPS-NEXT: Ident {
|
||||
# MIPS-NEXT: Magic: (7F 45 4C 46)
|
||||
|
@ -103,5 +103,42 @@
|
||||
# PPC64LE-NEXT: StringTableSectionIndex:
|
||||
# PPC64LE-NEXT: }
|
||||
|
||||
# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-linux %s -o %tppc32
|
||||
# RUN: ld.lld -m elf32ppc %tppc32 -o %t2ppc32
|
||||
# RUN: llvm-readobj -file-headers %t2ppc32 | FileCheck --check-prefix=PPC32 %s
|
||||
# RUN: ld.lld %tppc32 -o %t3ppc32
|
||||
# RUN: llvm-readobj -file-headers %t3ppc32 | FileCheck --check-prefix=PPC32 %s
|
||||
# RUN: echo 'OUTPUT_FORMAT(elf32-powerpc)' > %tppc32.script
|
||||
# RUN: ld.lld %tppc32.script %tppc32 -o %t4ppc32
|
||||
# RUN: llvm-readobj -file-headers %t4ppc32 | FileCheck --check-prefix=PPC32 %s
|
||||
# RUN: ld.lld -m elf32ppclinux %tppc32 -o %t5ppc32
|
||||
# RUN: llvm-readobj -file-headers %t5ppc32 | FileCheck --check-prefix=PPC32 %s
|
||||
|
||||
# PPC32: ElfHeader {
|
||||
# PPC32-NEXT: Ident {
|
||||
# PPC32-NEXT: Magic: (7F 45 4C 46)
|
||||
# PPC32-NEXT: Class: 32-bit (0x1)
|
||||
# PPC32-NEXT: DataEncoding: BigEndian (0x2)
|
||||
# PPC32-NEXT: FileVersion: 1
|
||||
# PPC32-NEXT: OS/ABI: SystemV (0x0)
|
||||
# PPC32-NEXT: ABIVersion: 0
|
||||
# PPC32-NEXT: Unused: (00 00 00 00 00 00 00)
|
||||
# PPC32-NEXT: }
|
||||
# PPC32-NEXT: Type: Executable (0x2)
|
||||
# PPC32-NEXT: Machine: EM_PPC (0x14)
|
||||
# PPC32-NEXT: Version: 1
|
||||
# PPC32-NEXT: Entry:
|
||||
# PPC32-NEXT: ProgramHeaderOffset: 0x34
|
||||
# PPC32-NEXT: SectionHeaderOffset:
|
||||
# PPC32-NEXT: Flags [ (0x0)
|
||||
# PPC32-NEXT: ]
|
||||
# PPC32-NEXT: HeaderSize: 52
|
||||
# PPC32-NEXT: ProgramHeaderEntrySize: 32
|
||||
# PPC32-NEXT: ProgramHeaderCount:
|
||||
# PPC32-NEXT: SectionHeaderEntrySize: 40
|
||||
# PPC32-NEXT: SectionHeaderCount:
|
||||
# PPC32-NEXT: StringTableSectionIndex:
|
||||
# PPC32-NEXT: }
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
Loading…
Reference in New Issue
Block a user