[lld] r353968 - Recover elf32-bigmips and elf32-powerpc support in LLD
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 14 02:48:44 PST 2019
Merged to release_80 in r354016.
On Wed, Feb 13, 2019 at 7:50 PM Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
> Author: ruiu
> Date: Wed Feb 13 10:51:15 2019
> New Revision: 353968
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353968&view=rev
> Log:
> 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
>
> Modified:
> lld/trunk/ELF/Driver.cpp
> lld/trunk/ELF/ScriptParser.cpp
> lld/trunk/test/ELF/emulation-mips.s
> lld/trunk/test/ELF/emulation-ppc.s
>
> Modified: lld/trunk/ELF/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=353968&r1=353967&r2=353968&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Driver.cpp (original)
> +++ lld/trunk/ELF/Driver.cpp Wed Feb 13 10:51:15 2019
> @@ -129,7 +129,7 @@ static std::tuple<ELFKind, uint16_t, uin
> .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})
>
> Modified: lld/trunk/ELF/ScriptParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=353968&r1=353967&r2=353968&view=diff
> ==============================================================================
> --- lld/trunk/ELF/ScriptParser.cpp (original)
> +++ lld/trunk/ELF/ScriptParser.cpp Wed Feb 13 10:51:15 2019
> @@ -391,10 +391,11 @@ static std::pair<ELFKind, uint16_t> pars
> .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})
>
> Modified: lld/trunk/test/ELF/emulation-mips.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/emulation-mips.s?rev=353968&r1=353967&r2=353968&view=diff
> ==============================================================================
> --- lld/trunk/test/ELF/emulation-mips.s (original)
> +++ lld/trunk/test/ELF/emulation-mips.s Wed Feb 13 10:51:15 2019
> @@ -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)
>
> Modified: lld/trunk/test/ELF/emulation-ppc.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/emulation-ppc.s?rev=353968&r1=353967&r2=353968&view=diff
> ==============================================================================
> --- lld/trunk/test/ELF/emulation-ppc.s (original)
> +++ lld/trunk/test/ELF/emulation-ppc.s Wed Feb 13 10:51:15 2019
> @@ -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:
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list