Patchwork RFA: MN10300: Call default_encode_section_info

login
register
mail settings
Submitter Nick Clifton
Date July 5, 2012, 2:29 p.m.
Message ID <8762a28eo2.fsf@redhat.com>
Download mbox | patch
Permalink /patch/169211/
State New
Headers show

Comments

Nick Clifton - July 5, 2012, 2:29 p.m.
Hi Jeff, Hi Alex,

  This may count as an obvious fix, but I felt that I ought to check,
  just in case...  Currently mn10300_encode_section_info() does not call
  default_encode_section_info().  This means that it misses out on
  possibly setting some important flags in the symbol, such as
  SYMBOL_FLAG_FUNCTION, SYMBOL_FLAG_LOCAL or the TLS encoding.

  Fixed by the following patch, and tested on an mn10300-elf toolchain.

  OK for mainline and 4.7/4.6 branches ?

Cheers
  Nick

gcc/ChangeLog
2012-07-05  Nick Clifton  <nickc@redhat.com>

	* config/mn10300/mn10300.c (mn10300_encode_section_info): Call
	default_encode_section_info.
Jeff Law - July 5, 2012, 3:38 p.m.
On 07/05/2012 08:29 AM, Nick Clifton wrote:
> Hi Jeff, Hi Alex,
>
>    This may count as an obvious fix, but I felt that I ought to check,
>    just in case...  Currently mn10300_encode_section_info() does not call
>    default_encode_section_info().  This means that it misses out on
>    possibly setting some important flags in the symbol, such as
>    SYMBOL_FLAG_FUNCTION, SYMBOL_FLAG_LOCAL or the TLS encoding.
>
>    Fixed by the following patch, and tested on an mn10300-elf toolchain.
>
>    OK for mainline and 4.7/4.6 branches ?
>
> Cheers
>    Nick
>
> gcc/ChangeLog
> 2012-07-05  Nick Clifton  <nickc@redhat.com>
>
> 	* config/mn10300/mn10300.c (mn10300_encode_section_info): Call
> 	default_encode_section_info.
OK.  Presumably it doesn't matter in any significant way whether the 
default_encode_section_info is called early or late in that routine, or 
if it does for the mn103 you selected the right call point.  I spot 
checked several other ports and there's no clear consensus on that issue.


Jeff
Nick Clifton - July 6, 2012, 9:05 a.m.
Hi Jeff,

   Thanks - patch committed.  I decided that it would be best to call 
default_encode_section_info first, just in case it turns out to be 
important one day.

Cheers
   Nick
Richard Henderson - July 25, 2012, 6:29 p.m.
On 07/05/2012 07:29 AM, Nick Clifton wrote:
>  static void
> -mn10300_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
> +mn10300_encode_section_info (tree decl, rtx rtl, int first)
>  {
>    rtx symbol;
>  
> @@ -2480,6 +2488,8 @@
>  
>    if (flag_pic)
>      SYMBOL_REF_FLAG (symbol) = (*targetm.binds_local_p) (decl);
> +
> +  default_encode_section_info (decl, rtl, first);
>  }

If you replace SYMBOL_REF_FLAG with SYMBOL_REF_LOCAL_P in MN10300_GLOBAL_P,
you can eliminate this target hook entirely.


r~

Patch

Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c	(revision 189281)
+++ gcc/config/mn10300/mn10300.c	(working copy)
@@ -2468,7 +2476,7 @@ 
    may access it using GOTOFF instead of GOT.  */
 
 static void
-mn10300_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
+mn10300_encode_section_info (tree decl, rtx rtl, int first)
 {
   rtx symbol;
 
@@ -2480,6 +2488,8 @@ 
 
   if (flag_pic)
     SYMBOL_REF_FLAG (symbol) = (*targetm.binds_local_p) (decl);
+
+  default_encode_section_info (decl, rtl, first);
 }
 
 /* Dispatch tables on the mn10300 are extremely expensive in terms of code