https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65780

--- Comment #27 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #26)
> Created attachment 35333 [details]
> A patch with updated comments

Found a couple of issues, here is incremental diff, mostly formatting
improvements,
and in the case of default_binds_local_p_2 (right now unused, hopefully
incrementally used
by arm, s390 and perhaps other backends later), passing true to
common_maybe_local unconditionally,
when only in non-PIE binaries (thus !flag_pic) it works fine.

--- gcc/varasm.c
+++ gcc/varasm.c
@@ -6811,8 +6811,7 @@

 bool
 default_binds_local_p_3 (const_tree exp, bool shlib, bool weak_dominate,
-             bool extern_protected_data,
-             bool common_maybe_local)
+             bool extern_protected_data, bool common_maybe_local)
 {
   /* A non-decl is an entry in the constant pool.  */
   if (!DECL_P (exp))
@@ -6902,8 +6901,7 @@
 bool
 default_binds_local_p (const_tree exp)
 {
-  return default_binds_local_p_3 (exp, flag_shlib != 0, true, false,
-                  false);
+  return default_binds_local_p_3 (exp, flag_shlib != 0, true, false, false);
 }

 /* Similar to default_binds_local_p, but common symbol may be local.  */
@@ -6912,14 +6910,13 @@
 default_binds_local_p_2 (const_tree exp)
 {
   return default_binds_local_p_3 (exp, flag_shlib != 0, true, false,
-                  true);
+                  !flag_pic);
 }

 bool
 default_binds_local_p_1 (const_tree exp, int shlib)
 {
-  return default_binds_local_p_3 (exp, shlib != 0, false, false,
-                  false);
+  return default_binds_local_p_3 (exp, shlib != 0, false, false, false);
 }

 /* Return true when references to DECL must bind to current definition in

Reply via email to