From 91d190199d4d9e2cd657be48754e0182e2433c9f Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Tue, 3 Jul 2018 14:39:27 +0000 Subject: [PATCH] [ELF][MIPS] Use llvm-mc to generate test case input file. NFC llvm-svn: 336201 --- lld/test/ELF/Inputs/mips-n32-rels.o | Bin 1092 -> 0 bytes lld/test/ELF/mips-n32-rels.s | 45 ++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 lld/test/ELF/Inputs/mips-n32-rels.o diff --git a/lld/test/ELF/Inputs/mips-n32-rels.o b/lld/test/ELF/Inputs/mips-n32-rels.o deleted file mode 100644 index 88cbce699e6df9a81048d22c4b6c901447115602..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1092 zcmah{O-sW-6nu%*YW)@uf*yJj5eW#M#6vwO7E}s7dMK$)(_(EU*@B+z!JpvKAK_2% zPkF90XVmlf-c#YqFeq0nYYB!jD|p z$YBB1T-UYp=J*`W^>8>&lyb=tFMfG6ejBriW^+$b6byXN1kXmij&FSN+Hovi6oma@ zcO>3Tz0vgicE3CDL+DSPh>O?~jb?Tn z+Lyc0bovdh@dlv1pr$o#0&7pGzhgWQq@g~}S{q;@e*&yx@So$k%)f+T<#W^nIf-QB E4}Bdz8~^|S diff --git a/lld/test/ELF/mips-n32-rels.s b/lld/test/ELF/mips-n32-rels.s index 33dda7f..b59000c 100644 --- a/lld/test/ELF/mips-n32-rels.s +++ b/lld/test/ELF/mips-n32-rels.s @@ -1,28 +1,27 @@ # REQUIRES: mips # Check handling of N32 ABI relocation records. -# For now llvm-mc generates incorrect object files for N32 ABI. -# We use the binary input file generated by GNU tool. -# llvm-mc -filetype=obj -triple=mips64-unknown-linux \ -# -target-abi n32 %s -o %t.o -# RUN: ld.lld %S/Inputs/mips-n32-rels.o -o %t.exe +# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux \ +# RUN: -target-abi n32 -o %t.o %s +# RUN: ld.lld %t.o -o %t.exe # RUN: llvm-objdump -t -d -s %t.exe | FileCheck %s # RUN: llvm-readobj -h %t.exe | FileCheck -check-prefix=ELF %s -# .text -# .type __start, @function -# .global __start -# __start: -# lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 -# # R_MIPS_SUB -# # R_MIPS_HI16 -# loc: -# daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 -# # R_MIPS_SUB -# # R_MIPS_LO16 -# -# .section .rodata,"a",@progbits -# .gpword(loc) # R_MIPS_32 + .option pic2 + .text + .type __start, @function + .global __start +__start: + lui $gp,%hi(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 + # R_MIPS_SUB + # R_MIPS_HI16 +loc: + daddiu $gp,$gp,%lo(%neg(%gp_rel(__start))) # R_MIPS_GPREL16 + # R_MIPS_SUB + # R_MIPS_LO16 + + .section .rodata,"a",@progbits + .gpword(loc) # R_MIPS_GPREL32 # CHECK: Disassembly of section .text: # CHECK-NEXT: __start: @@ -37,8 +36,8 @@ # ^-- %lo(0x17ff0) # CHECK: Contents of section .rodata: -# CHECK-NEXT: {{[0-9a-f]+}} 00020004 -# ^-- loc +# CHECK-NEXT: {{[0-9a-f]+}} fffe8014 +# ^-- loc - _gp # CHECK: 00020004 .text 00000000 loc # CHECK: 00037ff0 .got 00000000 .hidden _gp @@ -66,5 +65,7 @@ # ELF-NEXT: SectionHeaderOffset: # ELF-NEXT: Flags [ # ELF-NEXT: EF_MIPS_ABI2 -# ELF-NEXT: EF_MIPS_ARCH_64R2 +# ELF-NEXT: EF_MIPS_ARCH_64 +# ELF-NEXT: EF_MIPS_CPIC +# ELF-NEXT: EF_MIPS_PIC # ELF-NEXT: ] -- 2.7.4