c-common.c (noplt): New attribute.
authorSriraman Tallam <tmsriram@google.com>
Thu, 4 Jun 2015 21:14:10 +0000 (21:14 +0000)
committerSriraman Tallam <tmsriram@gcc.gnu.org>
Thu, 4 Jun 2015 21:14:10 +0000 (21:14 +0000)
commit4bb794e25d5e141fd57fd206c276d04d93e25e4a
tree6b25a7412ce088321aa5a46c7d80ebb9b7e8b619
parent172f0ce5ab5fa74a5695cf855c9ba7c4e98c754a
c-common.c (noplt): New attribute.

2015-06-04  Sriraman Tallam  <tmsriram@google.com>

* c-family/c-common.c (noplt): New attribute.
(handle_noplt_attribute): New handler.
* calls.c (prepare_call_address): Check for noplt
attribute.
* config/i386/i386.c (ix86_expand_call): Check
for noplt attribute.
(ix86_nopic_noplt_attribute_p): New function.
(ix86_output_call_insn): Output indirect call for non-pic
no plt calls.
* doc/extend.texi (noplt): Document new attribute.
* doc/invoke.texi: Document new attribute.
* testsuite/gcc.target/i386/noplt-1.c: New test.
* testsuite/gcc.target/i386/noplt-2.c: New test.
* testsuite/gcc.target/i386/noplt-3.c: New test.
* testsuite/gcc.target/i386/noplt-4.c: New test.

This patch does two things:

* Adds new generic function attribute "noplt" that is similar in functionality
  to -fno-plt except that it applies only to calls to functions that are marked
  with this attribute.
* For x86_64, it makes -fno-plt(and the attribute) also work for non-PIC code by
  directly generating an indirect call via a GOT entry.

From-SVN: r224138
gcc/ChangeLog
gcc/c-family/c-common.c
gcc/calls.c
gcc/config/i386/i386.c
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/noplt-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/noplt-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/noplt-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/noplt-4.c [new file with mode: 0644]