diff options
author | tmsriram <tmsriram@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-04 21:14:10 +0000 |
---|---|---|
committer | tmsriram <tmsriram@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-04 21:14:10 +0000 |
commit | 4641882f2e4634b56893c438f34b12fb0f3d2ede (patch) | |
tree | 6b25a7412ce088321aa5a46c7d80ebb9b7e8b619 /gcc/testsuite/gcc.target/i386/noplt-2.c | |
parent | 8fa3561113f8432706fc5426408fe7b63ad17eca (diff) | |
download | gcc-4641882f2e4634b56893c438f34b12fb0f3d2ede.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224138 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/noplt-2.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/noplt-2.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/noplt-2.c b/gcc/testsuite/gcc.target/i386/noplt-2.c new file mode 100644 index 00000000000..4df0618b679 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/noplt-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target x86_64-*-linux* } } */ +/* { dg-options "-O2 -fno-pic" } */ + + +__attribute__ ((noplt)) +int foo(); + +int main() +{ + return foo(); +} + +/* { dg-final { scan-assembler "jmp\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\)" } } */ |