On Mon, Oct 20, 2014 at 11:59 AM, Sriraman Tallam <tmsri...@google.com> wrote: > On Mon, Oct 20, 2014 at 10:51 AM, Andrew Pinski <pins...@gmail.com> wrote: >> On Mon, Oct 20, 2014 at 10:46 AM, Sriraman Tallam <tmsri...@google.com> >> wrote: >>> On Mon, Oct 20, 2014 at 10:42 AM, Xinliang David Li <davi...@google.com> >>> wrote: >>>> Why removing the tree_code check? >>> >>> The actual problem happens because STRING_CSTs (end up in .lrodata) >>> are not set a far address as they dont match the VAR_DECL check here. >>> Futher, "ix86_in_large_data_p" call has the TREE_CODE check to do the >>> right thing so this seems unnecessary & buggy here. >> >> I think he is asking because TREE_STATIC (decl) || DECL_EXTERNAL >> (decl) might be an issue for STRING_CSTs. > > TREE_STATIC is true for STRING_CSTs and DECL_EXTERNAL false, that looks ok.
The values for STRING_CST make sense, but it is not documented in tree.h for use with STRING_CST. Maybe do this: if (((TREE_CODE (decl) == VAR_DECL&& (TREE_STATIC (decl) || DECL_EXTERNAL (decl)) ||TREE_CODE (decl) == STRING_CST) && ix86_in_large_data_p (decl)) which can be simplified to: if ((TREE_CODE (decl) == VAR_DECL && is_global_var (decl) ||TREE_CODE (decl) == STRING_CST) && ix86_in_large_data_p (decl)) ... David > > Thanks > Sri > >> >> Thanks, >> Andrew >> >> >>> >>> Thanks >>> Sri >>> >>>> >>>> David >>>> >>>> On Mon, Oct 20, 2014 at 10:35 AM, Sriraman Tallam <tmsri...@google.com> >>>> wrote: >>>>> Hi, >>>>> >>>>> This patch is under review for trunk GCC : >>>>> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01638.html. >>>>> >>>>> In the mean time, is this ok for google/gcc-4_9 branch? Without >>>>> this, -mcmodel=medium is unusable if .lrodata goes beyond the 2G >>>>> boundary. >>>>> >>>>> Thanks >>>>> Sri