public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix section conflict compiling rtld.c
@ 2012-04-27 20:51 John David Anglin
  2012-05-30 22:59 ` John David Anglin
  0 siblings, 1 reply; 2+ messages in thread
From: John David Anglin @ 2012-04-27 20:51 UTC (permalink / raw)
  To: gcc-patches

The attached change fixes a problem compiling the linux dynamic loader
for the PA target.

Putting function labels (plabels) in the constant pool results
in a section flag conflict compiling rtld.c.  Other targets don't
do this, and testing indicates that it is not necessary.

Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and
hppa64-hp-hpux11.11 with no regressions.

Committed to trunk.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2012-04-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR target/52999
	* config/pa/pa.c (pa_legitimate_constant_p): Don't put function labels
	in constant pool.

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 186918)
+++ config/pa/pa.c	(working copy)
@@ -10332,9 +10332,6 @@
       && !pa_cint_ok_for_move (INTVAL (x)))
     return false;
 
-  if (function_label_operand (x, mode))
-    return false;
-
   return true;
 }
 

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

* Re: [committed] Fix section conflict compiling rtld.c
  2012-04-27 20:51 [committed] Fix section conflict compiling rtld.c John David Anglin
@ 2012-05-30 22:59 ` John David Anglin
  0 siblings, 0 replies; 2+ messages in thread
From: John David Anglin @ 2012-05-30 22:59 UTC (permalink / raw)
  To: gcc-patches

The previous fix for PR target/52999 didn't work...

This change implements the suggestion Jakub.

Tested on hppa-unknown-linux-gnu, hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2012-05-30  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	PR target/52999
	* config/pa/pa.c (TARGET_SECTION_TYPE_FLAGS): Define.
	(pa_section_type_flags): New.
	(pa_legitimate_constant_p): Revert previous change.

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 187680)
+++ config/pa/pa.c	(working copy)
@@ -188,6 +188,7 @@
 static section *pa_function_section (tree, enum node_frequency, bool, bool);
 static bool pa_cannot_force_const_mem (enum machine_mode, rtx);
 static bool pa_legitimate_constant_p (enum machine_mode, rtx);
+static unsigned int pa_section_type_flags (tree, const char *, int);
 
 /* The following extra sections are only used for SOM.  */
 static GTY(()) section *som_readonly_data_section;
@@ -383,6 +384,8 @@
 
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P pa_legitimate_constant_p
+#undef TARGET_SECTION_TYPE_FLAGS
+#define TARGET_SECTION_TYPE_FLAGS pa_section_type_flags
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -10340,7 +10343,29 @@
       && !pa_cint_ok_for_move (INTVAL (x)))
     return false;
 
+  if (function_label_operand (x, mode))
+    return false;
+
   return true;
 }
 
+/* Implement TARGET_SECTION_TYPE_FLAGS.  */
+
+static unsigned int
+pa_section_type_flags (tree decl, const char *name, int reloc)
+{
+  unsigned int flags;
+
+  flags = default_section_type_flags (decl, name, reloc);
+
+  /* Function labels are placed in the constant pool.  This can
+     cause a section conflict if decls are put in ".data.rel.ro"
+     or ".data.rel.ro.local" using the __attribute__ construct.  */
+  if (strcmp (name, ".data.rel.ro") == 0
+      || strcmp (name, ".data.rel.ro.local") == 0)
+    flags |= SECTION_WRITE | SECTION_RELRO;
+
+  return flags;
+}
+
 #include "gt-pa.h"

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

end of thread, other threads:[~2012-05-30 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-27 20:51 [committed] Fix section conflict compiling rtld.c John David Anglin
2012-05-30 22:59 ` John David Anglin

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).