Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3 Compiling some files with -fPIC and -O2 ends u...



details:   https://anonhg.NetBSD.org/src/rev/42ae29edeb5a
branches:  trunk
changeset: 450005:42ae29edeb5a
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 02 02:59:50 2019 +0000

description:
Compiling some files with -fPIC and -O2 ends up having global
symbols classified as local in pic mode, and that ends up with PC32
relocations "movl *psp, %rx" (/bin/sh parse.c). Treat pic code as
shared libraries to avoid classifying common initialized symbols
as local. Thanks to thorpej@ for his help.

diffstat:

 external/gpl3/gcc.old/dist/gcc/config/vax/vax.c |  12 ++++++++++++
 external/gpl3/gcc/dist/gcc/config/vax/vax.c     |  17 ++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)

diffs (57 lines):

diff -r 167e6cdae5a8 -r 42ae29edeb5a external/gpl3/gcc.old/dist/gcc/config/vax/vax.c
--- a/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c   Tue Apr 02 01:50:32 2019 +0000
+++ b/external/gpl3/gcc.old/dist/gcc/config/vax/vax.c   Tue Apr 02 02:59:50 2019 +0000
@@ -114,6 +114,18 @@
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE vax_option_override
 
+#if TARGET_ELF
+#undef TARGET_BINDS_LOCAL_P
+#define TARGET_BINDS_LOCAL_P vax_elf_binds_local_p
+
+static bool
+vax_elf_binds_local_p (const_tree exp)
+{
+  return default_binds_local_p_3 (exp, (flag_shlib | flag_pic) != 0,
+                                 true, false, false);
+}
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Set global variables as needed for the options enabled.  */
diff -r 167e6cdae5a8 -r 42ae29edeb5a external/gpl3/gcc/dist/gcc/config/vax/vax.c
--- a/external/gpl3/gcc/dist/gcc/config/vax/vax.c       Tue Apr 02 01:50:32 2019 +0000
+++ b/external/gpl3/gcc/dist/gcc/config/vax/vax.c       Tue Apr 02 02:59:50 2019 +0000
@@ -118,6 +118,18 @@
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE vax_option_override
 
+#if TARGET_ELF
+#undef TARGET_BINDS_LOCAL_P
+#define TARGET_BINDS_LOCAL_P vax_elf_binds_local_p
+
+static bool
+vax_elf_binds_local_p (const_tree exp)
+{
+  return default_binds_local_p_3 (exp, (flag_shlib | flag_pic) != 0,
+                                 true, false, false);
+}
+#endif
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Set global variables as needed for the options enabled.  */
@@ -1828,8 +1840,11 @@
 static bool
 indirectable_constant_address_p (rtx x, bool indirect)
 {
-  if (GET_CODE (x) == SYMBOL_REF)
+  if (GET_CODE (x) == SYMBOL_REF) {
+    fprintf (asm_out_file, "%s: %d %d %d\n", __func__,
+    !flag_pic, SYMBOL_REF_LOCAL_P (x), !indirect);
     return !flag_pic || SYMBOL_REF_LOCAL_P (x) || !indirect;
+}
 
   if (GET_CODE (x) == CONST)
     return !flag_pic



Home | Main Index | Thread Index | Old Index