On 06/20/2014 05:17 PM, Sriraman Tallam wrote:
> Index: config/i386/i386.c
> ===================================================================
> --- config/i386/i386.c        (revision 211826)
> +++ config/i386/i386.c        (working copy)
> @@ -12691,7 +12691,9 @@ legitimate_pic_address_disp_p (rtx disp)
>               return true;
>           }
>         else if (!SYMBOL_REF_FAR_ADDR_P (op0)
> -                && SYMBOL_REF_LOCAL_P (op0)
> +                && (SYMBOL_REF_LOCAL_P (op0)
> +                    || (TARGET_64BIT && ix86_copyrelocs && flag_pie
> +                        && !SYMBOL_REF_FUNCTION_P (op0)))
>                  && ix86_cmodel != CM_LARGE_PIC)
>           return true;
>         break;

This is the wrong place to patch.

You ought to be adjusting SYMBOL_REF_LOCAL_P, by providing a modified
TARGET_BINDS_LOCAL_P.

Note in particular that I believe that you are doing the wrong thing with weak
and COMMON symbols, in that you probably ought not force a copy reloc there.

Note the complexity of default_binds_local_p_1, and the fact that all you
really want to modify is

  /* If PIC, then assume that any global name can be overridden by
     symbols resolved from other modules.  */
  else if (shlib)
    local_p = false;

near the bottom of that function.


r~

Reply via email to