From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93830 invoked by alias); 10 Aug 2016 21:36:54 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 93810 invoked by uid 89); 10 Aug 2016 21:36:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=no version=3.3.2 spammy=0808, 41010, mips***, mips*-*-* X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Aug 2016 21:36:47 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 5F1395D2394CF for ; Wed, 10 Aug 2016 22:36:29 +0100 (IST) Received: from [10.20.78.240] (10.20.78.240) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server id 14.3.294.0; Wed, 10 Aug 2016 22:36:32 +0100 Date: Wed, 10 Aug 2016 21:36:00 -0000 From: "Maciej W. Rozycki" To: CC: Faraz Shahbazker Subject: [committed 4/4] MIPS/LD/testsuite: Verify microMIPS LA25 stub generation In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2016-08/txt/msg00069.txt.bz2 Repeat `PIC and non-PIC test 1' checks for microMIPS LA25 stubs, covering code generation and stub symbol annotation. ld/ * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd: New test. * testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s: New test source. * testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. --- binutils-mips-cross-mode-la25-test.diff Index: binutils/ld/testsuite/ld-mips-elf/mips-elf.exp =================================================================== --- binutils.orig/ld/testsuite/ld-mips-elf/mips-elf.exp 2016-08-10 12:48:18.558855684 +0100 +++ binutils/ld/testsuite/ld-mips-elf/mips-elf.exp 2016-08-10 21:41:34.633794932 +0100 @@ -357,6 +357,8 @@ if { $linux_gnu } { # # The third test checks that we do the same when linking the # result of the first link (with no other source files). + # + # We then repeat the same three tests for microMIPS stubs. run_ld_link_tests { {"PIC and non-PIC test 1 (relocatable)" "-r -melf32btsmip" "" "-32 -EB -mips2" {pic-and-nonpic-1a.s pic-and-nonpic-1b.s} @@ -375,6 +377,42 @@ if { $linux_gnu } { {{objdump -dr pic-and-nonpic-1.dd} {readelf --symbols pic-and-nonpic-1.nd}} "pic-and-nonpic-1-static2.o"} + {"PIC and non-PIC test 1, microMIPS (relocatable)" + "-r -melf32btsmip" "" + "-32 -EB -mips2" + {pic-and-nonpic-1a-micromips.s pic-and-nonpic-1b-micromips.s} + {{objdump -dr pic-and-nonpic-1-micromips-rel.dd} + {readelf --symbols pic-and-nonpic-1-micromips-rel.nd}} + "pic-and-nonpic-1-micromips-rel.o"} + {"PIC and non-PIC test 1, microMIPS (static 1)" + "-melf32btsmip -Tpic-and-nonpic-1.ld" "" + "-32 -EB -mips2" + {pic-and-nonpic-1a-micromips.s pic-and-nonpic-1b-micromips.s} + {{objdump -dr pic-and-nonpic-1-micromips.dd} + {readelf --symbols pic-and-nonpic-1-micromips.nd}} + "pic-and-nonpic-1-micromips-static1.o"} + } + # The final executable produced with the following test is supposed + # to be the same as one produced with the preceding test, however + # as noted in PR ld/20453 it is not. Consequently output from + # `objdump -dr' is not the same either. Expect: + # + # regexp_diff match failure + # regexp "^ 4103c: f001 0415 jalx 41054 $" + # line " 4103c: f001 0400 jalx 41000 <.pic.f3>" + # + # from the test below due to this problem. + setup_kfail "mips*-*-*" "ld/20453" + # The final check below should be folded into the `run_ld_link_tests' + # call above once `setup_kfail' has been removed. + run_ld_link_tests { + {"PIC and non-PIC test 1, microMIPS (static 2)" + "-melf32btsmip -Tpic-and-nonpic-1.ld \ + tmpdir/pic-and-nonpic-1-micromips-rel.o" "" + "" {} + {{objdump -dr pic-and-nonpic-1-micromips.dd} + {readelf --symbols pic-and-nonpic-1-micromips.nd}} + "pic-and-nonpic-1-micromips-static2.o"} } run_dump_test "pic-and-nonpic-2" run_ld_link_tests { Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.dd 2016-08-10 20:45:05.600801556 +0100 @@ -0,0 +1,42 @@ + +.* + +Disassembly of section \.text: + +00000000 : + 0: 41bc 0000 lui gp,0x0 + 0: R_MICROMIPS_HI16 _gp_disp + 4: 339c 0000 addiu gp,gp,0 + 4: R_MICROMIPS_LO16 _gp_disp + 8: 033c e150 addu gp,gp,t9 + c: f400 0000 jal 0 .* + c: R_MICROMIPS_26_S1 f3 + 10: 0000 0000 nop + 14: 45bf jrc ra + +00000016 : + 16: 41bc 0000 lui gp,0x0 + 16: R_MICROMIPS_HI16 _gp_disp + 1a: 339c 0000 addiu gp,gp,0 + 1a: R_MICROMIPS_LO16 _gp_disp + 1e: 033c e150 addu gp,gp,t9 + 22: 45bf jrc ra + +00000024 : + 24: 3c1c0000 lui gp,0x0 + 24: R_MIPS_HI16 _gp_disp + 28: 279c0000 addiu gp,gp,0 + 28: R_MIPS_LO16 _gp_disp + 2c: 0399e021 addu gp,gp,t9 + +00000030 <__start>: + 30: f400 0000 jal 0 .* + 30: R_MICROMIPS_26_S1 f1 + 34: 0000 0000 nop + 38: f400 0000 jal 0 .* + 38: R_MICROMIPS_26_S1 f2 + 3c: 0000 0000 nop + 40: f400 0000 jal 0 .* + 40: R_MICROMIPS_26_S1 f3 + 44: 0000 0000 nop + \.\.\. Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips-rel.nd 2016-08-10 20:45:05.614008484 +0100 @@ -0,0 +1,5 @@ +#... +.*: 00000024 +12 +FUNC +GLOBAL +DEFAULT +\[MIPS PIC\] .* f3 +.*: 00000030 +24 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* __start +.*: 00000016 +14 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS, MIPS PIC\] .* f2 +.*: 00000000 +22 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS, MIPS PIC\] .* f1 Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.dd 2016-08-10 20:45:05.633226287 +0100 @@ -0,0 +1,48 @@ + +.* + +Disassembly of section \.text: + +00041000 <\.pic\.f3>: + 41000: 3c190004 lui t9,0x4 + 41004: 08010415 j 41054 + 41008: 27391054 addiu t9,t9,4180 + 4100c: 00000000 nop + +00041010 <\.pic\.f2>: + 41010: 41b9 0004 lui t9,0x4 + 41014: d402 0823 j 41046 + 41018: 3339 1047 addiu t9,t9,4167 + \.\.\. + +00041028 <\.pic\.f1>: + 41028: 41b9 0004 lui t9,0x4 + 4102c: 3339 1031 addiu t9,t9,4145 + +00041030 : + 41030: 41bc 0002 lui gp,0x2 + 41034: 339c 6fcf addiu gp,gp,28623 + 41038: 033c e150 addu gp,gp,t9 + 4103c: f001 0415 jalx 41054 + 41040: 0000 0000 nop + 41044: 45bf jrc ra + +00041046 : + 41046: 41bc 0002 lui gp,0x2 + 4104a: 339c 6fb9 addiu gp,gp,28601 + 4104e: 033c e150 addu gp,gp,t9 + 41052: 45bf jrc ra + +00041054 : + 41054: 3c1c0002 lui gp,0x2 + 41058: 279c6fac addiu gp,gp,28588 + 4105c: 0399e021 addu gp,gp,t9 + +00041060 <__start>: + 41060: f402 0814 jal 41028 <\.pic\.f1> + 41064: 0000 0000 nop + 41068: f402 0808 jal 41010 <\.pic\.f2> + 4106c: 0000 0000 nop + 41070: f001 0400 jalx 41000 <\.pic\.f3> + 41074: 0000 0000 nop + \.\.\. Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1-micromips.nd 2016-08-10 20:45:05.656425528 +0100 @@ -0,0 +1,8 @@ +#... +.*: 00068000 +0 +NOTYPE +LOCAL +DEFAULT +ABS _gp +.*: 00041028 +8 +FUNC +LOCAL +DEFAULT +\[MICROMIPS\] .* .pic.f1 +.*: 00041010 +16 +FUNC +LOCAL +DEFAULT +\[MICROMIPS\] .* .pic.f2 +.*: 00041054 +12 +FUNC +GLOBAL +DEFAULT .* f3 +.*: 00041060 +24 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* __start +.*: 00041046 +14 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* f2 +.*: 00041030 +22 +FUNC +GLOBAL +DEFAULT +\[MICROMIPS\] .* f1 Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1a-micromips.s 2016-08-10 20:45:05.682724773 +0100 @@ -0,0 +1,31 @@ + .abicalls + .global f1 + .global f2 + .global f3 + .set micromips + .ent f1 +f1: + .set noreorder + .cpload $25 + .set reorder + .option pic0 + jal f3 + .option pic2 + jr $31 + .end f1 + + .ent f2 +f2: + .set noreorder + .cpload $25 + .set reorder + jr $31 + .end f2 + + .set nomicromips + .ent f3 +f3: + .set noreorder + .cpload $25 + .set reorder + .end f3 Index: binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ binutils/ld/testsuite/ld-mips-elf/pic-and-nonpic-1b-micromips.s 2016-08-10 20:45:05.699949948 +0100 @@ -0,0 +1,10 @@ + .abicalls + .option pic0 + .global __start + .set micromips + .ent __start +__start: + jal f1 + jal f2 + jal f3 + .end __start