x86: Disallow -mindirect-branch=/-mfunction-return= with -mcmodel=large
authorH.J. Lu <hongjiu.lu@intel.com>
Sun, 14 Jan 2018 14:43:10 +0000 (14:43 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Sun, 14 Jan 2018 14:43:10 +0000 (06:43 -0800)
commit95d11c1707a97883b62598aef2a6c1b86ed99c49
tree644b6ad219d131e735470112561e6caaef3f260c
parent6abe11c1a3b9f86398134533560bdc57788a93c9
x86: Disallow -mindirect-branch=/-mfunction-return= with -mcmodel=large

Since the thunk function may not be reachable in large code model,
-mcmodel=large is incompatible with -mindirect-branch=thunk,
-mindirect-branch=thunk-extern, -mfunction-return=thunk and
-mfunction-return=thunk-extern.  Issue an error when they are used with
-mcmodel=large.

gcc/

* config/i386/i386.c (ix86_set_indirect_branch_type): Disallow
-mcmodel=large with -mindirect-branch=thunk,
-mindirect-branch=thunk-extern, -mfunction-return=thunk and
-mfunction-return=thunk-extern.
* doc/invoke.texi: Document -mcmodel=large is incompatible with
-mindirect-branch=thunk, -mindirect-branch=thunk-extern,
-mfunction-return=thunk and -mfunction-return=thunk-extern.

gcc/testsuite/

* gcc.target/i386/indirect-thunk-10.c: New test.
* gcc.target/i386/indirect-thunk-8.c: Likewise.
* gcc.target/i386/indirect-thunk-9.c: Likewise.
* gcc.target/i386/indirect-thunk-attr-10.c: Likewise.
* gcc.target/i386/indirect-thunk-attr-11.c: Likewise.
* gcc.target/i386/indirect-thunk-attr-9.c: Likewise.
* gcc.target/i386/ret-thunk-17.c: Likewise.
* gcc.target/i386/ret-thunk-18.c: Likewise.
* gcc.target/i386/ret-thunk-19.c: Likewise.
* gcc.target/i386/ret-thunk-20.c: Likewise.
* gcc.target/i386/ret-thunk-21.c: Likewise.

From-SVN: r256664
15 files changed:
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/indirect-thunk-10.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-9.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-attr-10.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-attr-11.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/indirect-thunk-attr-9.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ret-thunk-17.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ret-thunk-18.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ret-thunk-19.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ret-thunk-20.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/ret-thunk-21.c [new file with mode: 0644]