Could you please explain more about the changes in cgemit.cxx? Thank
you very much.

2011/11/25 Gang Yu <yugang...@gmail.com>:
> Hi,
>
>    Could a gatekeeper please help review the fix for bug924?
> https://bugs.open64.net/show_bug.cgi?id=924
>
> This is a kernel build bug, the cut-down bug case below:
>
> typedef unsigned int __u32;
> typedef unsigned long kernel_ulong_t;
> struct pci_device_id {
>  __u32 vendor, device;
>  __u32 subvendor, subdevice;
>  __u32 class, class_mask;
>  kernel_ulong_t driver_data;
> };
> static struct pci_device_id flexcop_pci_tbl[] = {
>  { .vendor = (0x13d0), .device = (0x2103), .subvendor = (~0), .subdevice =
> (~0) },
>  { },
> };
> extern const struct pci_device_id __mod_pci_device_table __attribute__
> ((unused, alias("flexcop_pci_tbl")));
> wgen asserts,
> ### Compiler Error during Writing WHIRL file phase:
> ### Invalid Storage class (COMMON) for ST Flag: (ST_INITIALIZED)
>
> If provided with the option -fno-common,
> ### Invalid Storage class (UGLOBAL) for ST Flag: (ST_INITIALIZED)
>
> Analysis:
>  current wgen does not handle the common kernel code pattern (base local,
> aliased extern const) correctly.
>
> Suggested patch(comments embedded in code):
>
> osprey/be/cg/cgemit.cxx    -- 0edf22d..ea2660c 100644
> --- a/osprey/be/cg/cgemit.cxx
> +++ b/osprey/be/cg/cgemit.cxx
> @@ -8265,7 +8265,9 @@ Process_Bss_Data (SYMTAB_IDX stab)
>                     ST_base_idx(sym) != ST_st_idx(sym) &&
>                     !ST_is_equivalenced(sym) &&
>                     ST_class(ST_base(sym)) != CLASS_BLOCK &&
> -                    pu != NULL && ! PU_ftn_lang(*pu) /* bug 13585 */)
> +                    // originally bug 13585. bug 924 open64.net.
> +                    // no pu case should also be considered.
> +                    ((!pu) || !PU_ftn_lang (*pu)))
>                   goto skip_definition;
>  #endif
>                 size = TY_size(ST_type(sym));
> osprey/wgen/wgen_decl.cxx    -- 8b37860..23f8143 100644
> --- a/osprey/wgen/wgen_decl.cxx
> +++ b/osprey/wgen/wgen_decl.cxx
> @@ -4723,12 +4723,28 @@ WGEN_Assemble_Alias (gs_t decl, gs_t target)
>    else {
>      Set_ST_base_idx (st, ST_st_idx (base_st));
>      Set_ST_emit_symbol(st);    // for cg
> -    if (ST_is_initialized (base_st))
> +    if (ST_is_initialized (base_st)) {
>        Set_ST_is_initialized (st);
> +      // bug924 open64.net. global alias symbol with base initialized
> +      // should set storage class SCLASS_DGLOBAL.
> +      if (ST_sclass(st) == SCLASS_COMMON || ST_sclass(st) ==
> SCLASS_UGLOBAL)
> +        Set_ST_sclass (st, SCLASS_DGLOBAL);
> +    }
>  #ifdef KEY
> -    if (ST_init_value_zero (base_st))
> +    if (ST_init_value_zero (base_st)) {
>        Set_ST_init_value_zero (st);
> +      // bug924 open64.net. Those base initialized zero
> +      // symbols should restore to SCLASS_UGLOBAL.
> +      if (ST_sclass(st) == SCLASS_DGLOBAL)
> +        Set_ST_sclass (st, SCLASS_UGLOBAL);
> +    }
>  #endif
> +    // bug924 open64.net aliased symbols in COMMON section should be
> +    // set to be uninitialized. Since aliased symbols themselves
> +    // should never be allocated.
> +    if (ST_sclass(st) == SCLASS_COMMON) {
> +      Set_ST_sclass (st, SCLASS_UGLOBAL);
> +    }
>    }
>  #ifdef KEY
>    if (!lang_cplus)
>  Would a gatekeeper please help a review? thanks
> Regards
> Gang
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> Open64-devel mailing list
> Open64-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/open64-devel
>
>



-- 
Regards,
Lai Jian-Xin

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to