diff options
author | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2015-04-21 17:40:38 +0300 |
---|---|---|
committer | Alexander Ivchenko <alexander.ivchenko@intel.com> | 2015-04-21 17:42:03 +0300 |
commit | 86097ec44f8794ece572a5344a6dc2e558c6a4b1 (patch) | |
tree | 0f9ac3311e11dac658ed7440ad18e185688a9f77 /binutils-2.25/gold/testsuite | |
parent | e1103f940633e91aff9c5e56070acab3b58fe0dc (diff) | |
download | toolchain_binutils-86097ec44f8794ece572a5344a6dc2e558c6a4b1.zip toolchain_binutils-86097ec44f8794ece572a5344a6dc2e558c6a4b1.tar.gz toolchain_binutils-86097ec44f8794ece572a5344a6dc2e558c6a4b1.tar.bz2 |
[2.24, 2.25] Convert mov foo@GOT(%reg), %reg to lea foo@GOTOFF(%reg), %reg
2015-04-01 Ilya Tocar <ilya.tocar@intel.com>
PR gold/17640
* i386.cc (Target_i386::can_convert_mov_to_lea): New.
(Target_i386::Scan::local): Don't create GOT entry, when we
can convert GOT to GOTOFF.
(Target_i386::Scan::global): Ditto.
(Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
lea foo@GOTOFF(%reg), %reg if possible.
* testsuite/Makefile.am (i386_mov_to_lea): New test.
* testsuite/i386_mov_to_lea1.s: New.
* testsuite/i386_mov_to_lea2.s: Ditto.
* testsuite/i386_mov_to_lea3.s: Ditto.
* testsuite/i386_mov_to_lea4.s: Ditto.
* testsuite/i386_mov_to_lea5.s: Ditto.
* testsuite/i386_mov_to_lea.sh: Ditto.
Change-Id: I7916a1da20873600a910ce358990b1fe2c1f9897
Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
Diffstat (limited to 'binutils-2.25/gold/testsuite')
-rw-r--r-- | binutils-2.25/gold/testsuite/Makefile.am | 56 | ||||
-rwxr-xr-x | binutils-2.25/gold/testsuite/i386_mov_to_lea.sh | 36 | ||||
-rw-r--r-- | binutils-2.25/gold/testsuite/i386_mov_to_lea1.s | 11 | ||||
-rw-r--r-- | binutils-2.25/gold/testsuite/i386_mov_to_lea2.s | 10 | ||||
-rw-r--r-- | binutils-2.25/gold/testsuite/i386_mov_to_lea3.s | 4 | ||||
-rw-r--r-- | binutils-2.25/gold/testsuite/i386_mov_to_lea4.s | 12 | ||||
-rw-r--r-- | binutils-2.25/gold/testsuite/i386_mov_to_lea5.s | 12 |
7 files changed, 141 insertions, 0 deletions
diff --git a/binutils-2.25/gold/testsuite/Makefile.am b/binutils-2.25/gold/testsuite/Makefile.am index 7b73f9d..8361942 100644 --- a/binutils-2.25/gold/testsuite/Makefile.am +++ b/binutils-2.25/gold/testsuite/Makefile.am @@ -957,6 +957,62 @@ endif FN_PTRS_IN_SO_WITHOUT_PIC endif TLS +if DEFAULT_TARGET_I386 + +check_SCRIPTS += i386_mov_to_lea.sh +check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \ + i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \ + i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \ + i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout +MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \ + i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \ + i386_mov_to_lea7 i386_mov_to_lea8 + +i386_mov_to_lea1.o: i386_mov_to_lea1.s + $(TEST_AS) --32 -o $@ $< +i386_mov_to_lea2.o: i386_mov_to_lea2.s + $(TEST_AS) --32 -o $@ $< +i386_mov_to_lea3.o: i386_mov_to_lea3.s + $(TEST_AS) --32 -o $@ $< +i386_mov_to_lea4.o: i386_mov_to_lea4.s + $(TEST_AS) --32 -o $@ $< +i386_mov_to_lea5.o: i386_mov_to_lea5.s + $(TEST_AS) --32 -o $@ $< +i386_mov_to_lea1: i386_mov_to_lea1.o + ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $< +i386_mov_to_lea2: i386_mov_to_lea1.o + ../ld-new -pie -melf_i386 -o $@ $< +i386_mov_to_lea3: i386_mov_to_lea1.o + ../ld-new -melf_i386 -o $@ $< +i386_mov_to_lea4: i386_mov_to_lea1.o + ../ld-new -melf_i386 -shared -o $@ $< +i386_mov_to_lea5: i386_mov_to_lea2.o + ../ld-new -melf_i386 -shared -o $@ $< +i386_mov_to_lea6: i386_mov_to_lea3.o + ../ld-new -melf_i386 -shared -o $@ $< +i386_mov_to_lea7: i386_mov_to_lea4.o + ../ld-new -melf_i386 -shared -o $@ $< +i386_mov_to_lea8: i386_mov_to_lea5.o + ../ld-new -melf_i386 -shared -o $@ $< +i386_mov_to_lea1.stdout: i386_mov_to_lea1 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea2.stdout: i386_mov_to_lea2 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea3.stdout: i386_mov_to_lea3 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea4.stdout: i386_mov_to_lea4 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea5.stdout: i386_mov_to_lea5 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea6.stdout: i386_mov_to_lea6 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea7.stdout: i386_mov_to_lea7 + $(TEST_OBJDUMP) -dw $< > $@ +i386_mov_to_lea8.stdout: i386_mov_to_lea8 + $(TEST_OBJDUMP) -dw $< > $@ + +endif DEFAULT_TARGET_I386 + check_PROGRAMS += many_sections_test many_sections_test_SOURCES = many_sections_test.cc many_sections_test_DEPENDENCIES = gcctestdir/ld diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea.sh b/binutils-2.25/gold/testsuite/i386_mov_to_lea.sh new file mode 100755 index 0000000..0370372 --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +# i386_mov_to_lea.sh -- a test for mov2lea conversion. + +# Copyright (C) 2010-2015 Free Software Foundation, Inc. +# Written by Tocar Ilya <ilya.tocar@intel.com> + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +set -e + +grep -q "lea -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea1.stdout +grep -q "lea -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea2.stdout +grep -q "lea -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea3.stdout +grep -q "mov -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea4.stdout +grep -q "lea -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea5.stdout +grep -q "mov -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea6.stdout +grep -q "lea -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea7.stdout +grep -q "mov -0x[a-f0-9]\+(%ecx),%eax" i386_mov_to_lea8.stdout + +exit 0 diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea1.s b/binutils-2.25/gold/testsuite/i386_mov_to_lea1.s new file mode 100644 index 0000000..6d0f436 --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea1.s @@ -0,0 +1,11 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl bar + .type bar, @function +bar: + movl foo@GOT(%ecx), %eax + .size bar, .-bar diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea2.s b/binutils-2.25/gold/testsuite/i386_mov_to_lea2.s new file mode 100644 index 0000000..65f1bfd --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea2.s @@ -0,0 +1,10 @@ + .text + .type foo, @function +foo: + ret + .size foo, .-foo + .globl bar + .type bar, @function +bar: + movl foo@GOT(%ecx), %eax + .size bar, .-bar diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea3.s b/binutils-2.25/gold/testsuite/i386_mov_to_lea3.s new file mode 100644 index 0000000..6785e71 --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea3.s @@ -0,0 +1,4 @@ + .type bar, @function +bar: + movl _DYNAMIC@GOT(%ecx), %eax + .size bar, .-bar diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea4.s b/binutils-2.25/gold/testsuite/i386_mov_to_lea4.s new file mode 100644 index 0000000..7e4c4db --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea4.s @@ -0,0 +1,12 @@ + .text + .globl foo + .hidden foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl bar + .type bar, @function +bar: + movl foo@GOT(%ecx), %eax + .size bar, .-bar diff --git a/binutils-2.25/gold/testsuite/i386_mov_to_lea5.s b/binutils-2.25/gold/testsuite/i386_mov_to_lea5.s new file mode 100644 index 0000000..6999aae --- /dev/null +++ b/binutils-2.25/gold/testsuite/i386_mov_to_lea5.s @@ -0,0 +1,12 @@ + .text + .globl foo + .protected foo + .type foo, @function +foo: + ret + .size foo, .-foo + .globl bar + .type bar, @function +bar: + movl foo@GOT(%ecx), %eax + .size bar, .-bar |