This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] i386: Update naked-1.c for PIC
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 1 Aug 2017 07:57:38 +0200
- Subject: Re: [PATCH] i386: Update naked-1.c for PIC
- Authentication-results: sourceware.org; auth=none
- References: <20170731224818.GA28113@gmail.com>
On Tue, Aug 1, 2017 at 12:48 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> For ia32 targets, -fPIC may generate
>
> call __x86.get_pc_thunk.ax
> ...
> __x86.get_pc_thunk.ax:
> movl (%esp), %eax
> ret
>
> We should check "ret" only for non-PIC or non-ia32 targets.
I have added -fno-pic to dg-options.
Tested on x86_64-linux-gnu {,-m32} and committed.
Uros.
Index: gcc.target/i386/naked-1.c
===================================================================
--- gcc.target/i386/naked-1.c (revision 250745)
+++ gcc.target/i386/naked-1.c (working copy)
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O0" } */
+/* { dg-options "-O0 -fno-pic" } */
/* Verify that __attribute__((naked)) produces a naked function
that does not use ret to return but traps at the end. */