PATCH: PR target/39013: [4.3/4.4 regression] Missing @PLT when -fpie is used

Richard Guenther richard.guenther@gmail.com
Thu Jan 29 09:42:00 GMT 2009


On Thu, Jan 29, 2009 at 5:03 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Functions marked inline without body won't bind locally.  This patch
> fixes it.  OK for trunk after regression test on Linux/ia32,
> Linux/ia64 and Linux/x86-64.

I am not sure we should test DECL_DECLARED_INLINE_P here.
Why does the fndecl not have DECL_EXTERNAL set?  Thus, this
IMHO looks more like a frontend issue.

Richard.

> Thanks.
>
>
> H.J.
> ---
> gcc/
>
> 2009-01-28  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/39013
>        * varasm.c (default_binds_local_p_1): Return false for functions
>        marked inline without body.
>
> gcc/testsuite/
>
> 2009-01-28  H.J. Lu  <hongjiu.lu@intel.com>
>
>        PR target/39013
>        * gcc.target/i386/pie-1.c: New.
>
> --- gcc/testsuite/gcc.target/i386/pie-1.c.pie   2009-01-28 19:56:00.000000000 -0800
> +++ gcc/testsuite/gcc.target/i386/pie-1.c       2009-01-28 19:55:12.000000000 -0800
> @@ -0,0 +1,12 @@
> +/* PR target/39013 */
> +/* { dg-do compile { target { *-*-linux* } } } */
> +/* { dg-options "-fpie" } */
> +/* { dg-final { scan-assembler "call\[\\t \]*foo@PLT" } } */
> +
> +inline int foo (void);
> +
> +int
> +main ()
> +{
> +  return foo ();
> +}
> --- gcc/varasm.c.pie    2008-12-03 13:36:01.000000000 -0800
> +++ gcc/varasm.c        2009-01-28 19:56:24.000000000 -0800
> @@ -6321,6 +6321,11 @@ default_binds_local_p_1 (const_tree exp,
>           && (DECL_INITIAL (exp) == NULL
>               || DECL_INITIAL (exp) == error_mark_node))
>     local_p = false;
> +  /* Functions marked inline without body are not local.  */
> +  else if (TREE_CODE (exp) == FUNCTION_DECL
> +          && DECL_DECLARED_INLINE_P (exp)
> +          && DECL_INITIAL (exp) == NULL)
> +    local_p = false;
>   /* Otherwise we're left with initialized (or non-common) global data
>      which is of necessity defined locally.  */
>   else
>



More information about the Gcc-patches mailing list