Handle stack split for x32
X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.
PR gold/17729
* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
(DEFAULT_TARGET_X32): Set for x32.
* x86_64.cc (cmp_insn_32): New.
(lea_r10_insn_32): Likewise.
(lea_r11_insn_32): Likewise.
(cmp_insn_64): Likewise.
(lea_r10_insn_64): Likewise.
(lea_r11_insn_64): Likewise.
(Target_x86_64<size>::do_calls_non_split): Handle x32.
* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
(check_DATA): Add split_x32 files.
(split_x32_[1234n].o): New targets.
(split_x32_[124]): New targets.
(split_x32_[1234r].stdout): New targets.
* testsuite/split_x32.sh: New file.
* testsuite/split_x32_1.s: Likewise.
* testsuite/split_x32_2.s: Likewise.
* testsuite/split_x32_3.s: Likewise.
* testsuite/split_x32_4.s: Likewise.
* testsuite/split_x32_n.s: Likewise.
* configure: Regenerated.
* testsuite/Makefile.in: Likewise.
2014-12-19 03:09:28 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# split_x32.sh -- test -fstack-split for x32
|
|
|
|
|
2017-01-02 11:36:43 +08:00
|
|
|
# Copyright (C) 2014-2017 Free Software Foundation, Inc.
|
Handle stack split for x32
X32 uses cmp %fs:NN,%esp, lea NN(%rsp),%r10d, lea NN(%rsp),%r11d,
instead of cmp %fs:NN,%rsp, lea NN(%rsp),%r10, lea NN(%rsp),%r11.
This patch handles it.
PR gold/17729
* configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
(DEFAULT_TARGET_X32): Set for x32.
* x86_64.cc (cmp_insn_32): New.
(lea_r10_insn_32): Likewise.
(lea_r11_insn_32): Likewise.
(cmp_insn_64): Likewise.
(lea_r10_insn_64): Likewise.
(lea_r11_insn_64): Likewise.
(Target_x86_64<size>::do_calls_non_split): Handle x32.
* testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
(check_DATA): Add split_x32 files.
(split_x32_[1234n].o): New targets.
(split_x32_[124]): New targets.
(split_x32_[1234r].stdout): New targets.
* testsuite/split_x32.sh: New file.
* testsuite/split_x32_1.s: Likewise.
* testsuite/split_x32_2.s: Likewise.
* testsuite/split_x32_3.s: Likewise.
* testsuite/split_x32_4.s: Likewise.
* testsuite/split_x32_n.s: Likewise.
* configure: Regenerated.
* testsuite/Makefile.in: Likewise.
2014-12-19 03:09:28 +08:00
|
|
|
# Written by Ian Lance Taylor <iant@google.com>.
|
|
|
|
# Modified by H.J. Lu <hongjiu.lu@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.
|
|
|
|
|
|
|
|
match()
|
|
|
|
{
|
|
|
|
if ! egrep "$1" "$2" >/dev/null 2>&1; then
|
|
|
|
echo 1>&2 "could not find '$1' in $2"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
nomatch()
|
|
|
|
{
|
|
|
|
if egrep "$1" "$2" >/dev/null 2>&1; then
|
|
|
|
echo 1>&2 "found unexpected '$1' in $2"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
match 'cmp.*+%fs:[^,]*,%esp' split_x32_1.stdout
|
|
|
|
match 'callq.*__morestack>?$' split_x32_1.stdout
|
|
|
|
match 'lea.*-0x200\(%rsp\),' split_x32_1.stdout
|
|
|
|
|
|
|
|
match 'stc' split_x32_2.stdout
|
|
|
|
match 'callq.*__morestack_non_split>?$' split_x32_2.stdout
|
|
|
|
nomatch 'callq.*__morestack>?$' split_x32_2.stdout
|
|
|
|
match 'lea.*-0x4200\(%rsp\),' split_x32_2.stdout
|
|
|
|
|
|
|
|
match 'failed to match' split_x32_3.stdout
|
|
|
|
|
|
|
|
match 'callq.*__morestack>?$' split_x32_4.stdout
|
|
|
|
|
|
|
|
match 'cannot mix' split_x32_r.stdout
|