public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] gcc/dwarf2asm.c: Add dw2_asm_voutput_delta() with var_list for dw2_asm_output_delta()
@ 2014-06-17  1:01 Chen Gang
  2014-06-25 22:26 ` Chen Gang
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2014-06-17  1:01 UTC (permalink / raw)
  To: Joseph S. Myers, rth; +Cc: gcc-patches, davem, Jeff Law, Bin.Cheng

dw2_asm_output_vms_delta() calls dw2_asm_output_delta() in an abnormal
way, so need add a new function just like vprintf() for printf(), and
then the related call will be in normal way.

The related warning:

  ../../gcc/gcc/dwarf2asm.c: In function ‘void dw2_asm_output_vms_delta(int, const char*, const char*, const char*, ...)’:
  ../../gcc/gcc/dwarf2asm.c:167:50: warning: format not a string literal and no format arguments [-Wformat-security]


Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 gcc/ChangeLog   |  6 ++++++
 gcc/dwarf2asm.c | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index edb3fc0..01a1cc1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-06-14  Chen Gang <gang.chen.5i5j@gmail.com>
+
+	* dwarf2asm.c (dw2_asm_output_delta): Add dw2_asm_voutput_delta() for
+	dw2_asm_output_delta(), just like vprintf() for printf(), so that
+	dw2_asm_output_vms_delta() can use it in normal way.
+
 2014-06-13  Vladimir Makarov  <vmakarov@redhat.com>
 
 	* lra-assign.c (assign_by_spills): Add code to assign vector regs
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 1372b23..376b939 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -123,14 +123,10 @@ dw2_asm_output_data (int size, unsigned HOST_WIDE_INT value,
    impossible to do here, since the ASM_SET_OP for the difference
    symbol must appear after both symbols are defined.  */
 
-void
-dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
-		      const char *comment, ...)
+static void
+dw2_asm_voutput_delta (int size, const char *lab1, const char *lab2,
+		      const char *comment, va_list ap)
 {
-  va_list ap;
-
-  va_start (ap, comment);
-
 #ifdef ASM_OUTPUT_DWARF_DELTA
   ASM_OUTPUT_DWARF_DELTA (asm_out_file, size, lab1, lab2);
 #else
@@ -145,7 +141,16 @@ dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
       vfprintf (asm_out_file, comment, ap);
     }
   fputc ('\n', asm_out_file);
+}
 
+void
+dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
+		      const char *comment, ...)
+{
+  va_list ap;
+
+  va_start (ap, comment);
+  dw2_asm_voutput_delta (size, lab1, lab2, comment, ap);
   va_end (ap);
 }
 
@@ -164,7 +169,7 @@ dw2_asm_output_vms_delta (int size ATTRIBUTE_UNUSED,
 #ifndef ASM_OUTPUT_DWARF_VMS_DELTA
   /* VMS Delta is only special on ia64-vms, but this function also gets
      called on alpha-vms so it has to do something sane.  */
-  dw2_asm_output_delta (size, lab1, lab2, comment);
+  dw2_asm_voutput_delta (size, lab1, lab2, comment, ap);
 #else
   ASM_OUTPUT_DWARF_VMS_DELTA (asm_out_file, size, lab1, lab2);
   if (flag_debug_asm && comment)
-- 
1.9.2.459.g68773ac

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gcc/dwarf2asm.c: Add dw2_asm_voutput_delta() with var_list for dw2_asm_output_delta()
  2014-06-17  1:01 [PATCH v2] gcc/dwarf2asm.c: Add dw2_asm_voutput_delta() with var_list for dw2_asm_output_delta() Chen Gang
@ 2014-06-25 22:26 ` Chen Gang
  2014-06-27  5:51   ` Chen Gang
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2014-06-25 22:26 UTC (permalink / raw)
  To: Joseph S. Myers, rth
  Cc: gcc-patches, davem, Jeff Law, Bin.Cheng, Guenter Roeck

Hello maintainers:

Please help check this patch when you have time, thanks.

BTW: one linux kernel member found a gcc issue for the latest version
(4.10.0 20140622 or later), but for old version (e.g. 4.10.0 2014060*),
it is OK. It is my chance to fix it (hope can finish within 2014-06-30).

Also sorry for I have lost a chance to fix a issue about h8300, because
it is never used for linux main line, it is beyond my border (I have no
enough time resource on it), at present.

Thanks.

On 06/17/2014 09:00 AM, Chen Gang wrote:
> dw2_asm_output_vms_delta() calls dw2_asm_output_delta() in an abnormal
> way, so need add a new function just like vprintf() for printf(), and
> then the related call will be in normal way.
> 
> The related warning:
> 
>   ../../gcc/gcc/dwarf2asm.c: In function ‘void dw2_asm_output_vms_delta(int, const char*, const char*, const char*, ...)’:
>   ../../gcc/gcc/dwarf2asm.c:167:50: warning: format not a string literal and no format arguments [-Wformat-security]
> 
> 
> Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
> ---
>  gcc/ChangeLog   |  6 ++++++
>  gcc/dwarf2asm.c | 21 +++++++++++++--------
>  2 files changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index edb3fc0..01a1cc1 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,9 @@
> +2014-06-14  Chen Gang <gang.chen.5i5j@gmail.com>
> +
> +	* dwarf2asm.c (dw2_asm_output_delta): Add dw2_asm_voutput_delta() for
> +	dw2_asm_output_delta(), just like vprintf() for printf(), so that
> +	dw2_asm_output_vms_delta() can use it in normal way.
> +
>  2014-06-13  Vladimir Makarov  <vmakarov@redhat.com>
>  
>  	* lra-assign.c (assign_by_spills): Add code to assign vector regs
> diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
> index 1372b23..376b939 100644
> --- a/gcc/dwarf2asm.c
> +++ b/gcc/dwarf2asm.c
> @@ -123,14 +123,10 @@ dw2_asm_output_data (int size, unsigned HOST_WIDE_INT value,
>     impossible to do here, since the ASM_SET_OP for the difference
>     symbol must appear after both symbols are defined.  */
>  
> -void
> -dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
> -		      const char *comment, ...)
> +static void
> +dw2_asm_voutput_delta (int size, const char *lab1, const char *lab2,
> +		      const char *comment, va_list ap)
>  {
> -  va_list ap;
> -
> -  va_start (ap, comment);
> -
>  #ifdef ASM_OUTPUT_DWARF_DELTA
>    ASM_OUTPUT_DWARF_DELTA (asm_out_file, size, lab1, lab2);
>  #else
> @@ -145,7 +141,16 @@ dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
>        vfprintf (asm_out_file, comment, ap);
>      }
>    fputc ('\n', asm_out_file);
> +}
>  
> +void
> +dw2_asm_output_delta (int size, const char *lab1, const char *lab2,
> +		      const char *comment, ...)
> +{
> +  va_list ap;
> +
> +  va_start (ap, comment);
> +  dw2_asm_voutput_delta (size, lab1, lab2, comment, ap);
>    va_end (ap);
>  }
>  
> @@ -164,7 +169,7 @@ dw2_asm_output_vms_delta (int size ATTRIBUTE_UNUSED,
>  #ifndef ASM_OUTPUT_DWARF_VMS_DELTA
>    /* VMS Delta is only special on ia64-vms, but this function also gets
>       called on alpha-vms so it has to do something sane.  */
> -  dw2_asm_output_delta (size, lab1, lab2, comment);
> +  dw2_asm_voutput_delta (size, lab1, lab2, comment, ap);
>  #else
>    ASM_OUTPUT_DWARF_VMS_DELTA (asm_out_file, size, lab1, lab2);
>    if (flag_debug_asm && comment)
> 


-- 
Chen Gang

Open share and attitude like air water and life which God blessed

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gcc/dwarf2asm.c: Add dw2_asm_voutput_delta() with var_list for dw2_asm_output_delta()
  2014-06-25 22:26 ` Chen Gang
@ 2014-06-27  5:51   ` Chen Gang
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang @ 2014-06-27  5:51 UTC (permalink / raw)
  To: Joseph S. Myers, rth, hubicka
  Cc: gcc-patches, davem, Jeff Law, Bin.Cheng, Guenter Roeck


On 06/26/2014 06:25 AM, Chen Gang wrote:
> 
> BTW: one linux kernel member found a gcc issue for the latest version
> (4.10.0 20140622 or later), but for old version (e.g. 4.10.0 2014060*),
> it is OK. It is my chance to fix it (hope can finish within 2014-06-30).
> 

For this issue, at present, I find root cause: when find duplicate decls,
it need merge with the old one, and let old and new share 'function_decl.f',
After free new, also free the old.

I shall continue analysing this issue, and welcome any members' suggestions
or completions.

The related git number is 71e19e54060804493e13748613077b0e69c0cfd9, and the
related contents are below:

  diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
  index 54d0de7..47cf3cc 100644
  --- a/gcc/c/ChangeLog
  +++ b/gcc/c/ChangeLog
  @@ -1,3 +1,8 @@
  +2014-06-07  Jan Hubicka  <hubicka@ucw.cz>
  +
  +       * c-decl.c (merge_decls): Use set_decl_section_name.
  +       (duplicate_decls): Remove node if it exists.
  +
   2014-06-05  S. Gilles  <sgilles@terpmail.umd.edu>
   
          PR c/53119
  diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
  index 8fb3296..524b064 100644
  --- a/gcc/c/c-decl.c
  +++ b/gcc/c/c-decl.c
  @@ -2304,8 +2304,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
           We want to issue an error if the sections conflict but that
           must be done later in decl_attributes since we are called
           before attributes are assigned.  */
  -      if (DECL_SECTION_NAME (newdecl) == NULL_TREE)
  -       DECL_SECTION_NAME (newdecl) = DECL_SECTION_NAME (olddecl);
  +      if ((DECL_EXTERNAL (olddecl) || TREE_PUBLIC (olddecl) || TREE_STATIC (olddecl))
  +         && DECL_SECTION_NAME (newdecl) == NULL_TREE
  +         && DECL_SECTION_NAME (olddecl))
  +       set_decl_section_name (newdecl, DECL_SECTION_NAME (olddecl));
   
         /* Copy the assembler name.
           Currently, it can only be defined in the prototype.  */
  @@ -2574,6 +2576,13 @@ duplicate_decls (tree newdecl, tree olddecl)
     merge_decls (newdecl, olddecl, newtype, oldtype);
   
     /* The NEWDECL will no longer be needed.  */
  +  if (TREE_CODE (newdecl) == FUNCTION_DECL
  +      || TREE_CODE (newdecl) == VAR_DECL)
  +    {
  +      struct symtab_node *snode = symtab_get_node (newdecl);
  +      if (snode)
  +       symtab_remove_node (snode);
  +    }
  [...]

The related operation:

  root@gchen:/upstream/linux# cat elevator.i
  extern int __attribute__ ((__section__(".init.text"))) elv_register(void)
  {
   return 0;
  }
  extern typeof(elv_register) elv_register;
  root@gchen:/upstream/linux# /usr/local/libexec/gcc/score-elf/4.10.0/cc1 elevator.i
   elv_register
  Analyzing compilation unit
  Segmentation fault (core dumped)
  root@gchen:/upstream/linux# /usr/local/bin/score-elf-gcc -v
  Using built-in specs.
  COLLECT_GCC=/usr/local/bin/score-elf-gcc
  COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/score-elf/4.10.0/lto-wrapper
  Target: score-elf
  Configured with: ../gcc/configure --without-header --disable-nls --enable-language=c --disable-threads --disable-shared --enable-werror=no target_configargs=enable_vtable_verify=yes --target=score-elf --enable-obsolete : (reconfigured) ../gcc/configure --without-header --disable-nls --enable-language=c --disable-threads --disable-shared --enable-werror=no target_configargs=enable_vtable_verify=yes --target=score-elf --enable-obsolete --enable-debug --disable-release
  Thread model: single
  gcc version 4.10.0 20140625 (experimental) (GCC) 



Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-27  5:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17  1:01 [PATCH v2] gcc/dwarf2asm.c: Add dw2_asm_voutput_delta() with var_list for dw2_asm_output_delta() Chen Gang
2014-06-25 22:26 ` Chen Gang
2014-06-27  5:51   ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).