Hi Kewen and Segher,

On 2020/3/6 上午10:02, binbin wrote:


On 2020/3/4 下午6:35, Kewen.Lin wrote:
on 2020/3/4 下午3:24, binbin wrote:
Hi

On 2020/3/4 上午8:33, Segher Boessenkool wrote:
Hi!

On Tue, Mar 03, 2020 at 10:13:56AM -0600, Bin Bin Lv wrote:
Rewrite the declaration of toc_section from the source file rs6000.c to its
header file for standardizing the code.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0faf44b..c0a6e86 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -181,7 +181,6 @@ static GTY(()) section *tls_private_data_section;
   static GTY(()) section *read_only_private_data_section;
   static GTY(()) section *sdata2_section;
   -extern GTY(()) section *toc_section;
   section *toc_section = 0;
     /* Describe the vector unit used for modes.  */
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 3844bec..e77a84a 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2494,6 +2494,7 @@ extern GTY(()) tree rs6000_builtin_types[RS6000_BTI_MAX];
   extern GTY(()) tree rs6000_builtin_decls[RS6000_BUILTIN_COUNT];
   extern GTY(()) tree builtin_mode_to_type[MAX_MACHINE_MODE][2];
   extern GTY(()) tree altivec_builtin_mask_for_load;
+extern union GTY(()) section *toc_section;

Why does this add "union"?


Segher


If "union" is not added, it reports error showing unknown type name ‘section’ in file included from ../../host-powerpc64le-unknown-linux-gnu/gcc/tm.h:25,
from ../.././libgcc/generic-morestack-thread.c:29:
extern GTY(()) section *toc_section.  Then add "union" to solve this. Thanks.


Hi Binbin,

Another try seems to move it into #ifndef USED_FOR_TARGET hunk.
Since "typedef union section section" is guard by #ifndef USED_FOR_TARGET
in coretypes.h.  It can make them consistent.

BR,
Kewen


OK, changed the code.  Bootstrap and regression tests were done on
powerpc64le-linux-gnu (LE) with no regressions.  Thanks for your suggestion.

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0faf44b..c0a6e86 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -181,7 +181,6 @@ static GTY(()) section *tls_private_data_section;
 static GTY(()) section *read_only_private_data_section;
 static GTY(()) section *sdata2_section;
 
-extern GTY(()) section *toc_section;
 section *toc_section = 0;
 
 /* Describe the vector unit used for modes.  */
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index cd3d054..06c214e 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -2494,6 +2494,9 @@ extern GTY(()) tree 
builtin_mode_to_type[MAX_MACHINE_MODE][2];
 extern GTY(()) tree altivec_builtin_mask_for_load;
 
 #ifndef USED_FOR_TARGET
+
+extern GTY(()) section *toc_section;
+
 /* A C structure for machine-specific, per-function data.
    This is added to the cfun structure.  */
 typedef struct GTY(()) machine_function

Reply via email to