This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GNU as 2.14 on IRIX 6: crashes with shared libs


Richard Sandiford writes:

> Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> writes:
> > Bootstrap finished with this hack, checking is now in progress and looks
> > quite good :-)  I suppose the decision whether or not to create the .pdr
> > section on IRIX 6 should be controlled by a flag, to allow for use of one
> > gas binary with the native ld (off) or GNU ld (on).  It could default to
> > always on on non-IRIX systems, and off on IRIX to avoid the massive
> > breakage observed here.  Comments?
> 
> Sounds good. ;)

Ok, here's the promised patch.  It has the desired effect, although it
wasn't clear to me which form to use for the option.  I've chosen and
documented -pdr/-mno-pdr, but --pdr/--no-pdr work as well.  -mpdr/-mno-pdr
are another plausible choice; I just couldn't recognize a common pattern
which option uses which form.

This patch may be useful for the 2.14 branch, too, since without it gas is
pretty useless on IRIX.

Btw., I noticed that -mdebug/-no-mdebug are documented neiter in as --help
nor in doc/c-mips.texi.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University


Tue Jul 22 01:24:35 2003  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* config/tc-mips.c (mips_flag_pdr): Define.
	(md_begin) [OBJ_ELF]: Use it to control .pdr creation.
	(s_mips_end) [OBJ_ELF]: Likewise.
	(md_longopts) [OBJ_ELF]: Define OPTION_PDR, OPTION_NO_PDR.
	(md_parse_option) [OBJ_ELF]: Handle them.
	(md_show_usage) [OBJ_ELF]: Document -pdr, -no-pdr.

	* doc/c-mips.texi (MIPS Opts): Document -pdr, -no-pdr.

Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.226
diff -u -p -r1.226 tc-mips.c
--- config/tc-mips.c	15 Jul 2003 07:50:38 -0000	1.226
+++ config/tc-mips.c	21 Jul 2003 23:17:14 -0000
@@ -74,6 +74,15 @@ static int mips_output_flavor (void) { r
 
 int mips_flag_mdebug = -1;
 
+/* Control generation of .pdr sections.  Off by default on IRIX: the native
+   linker doesn't know about and discards them, but relocations against them
+   remain, leading to rld crashes.  */
+#ifdef TE_IRIX
+int mips_flag_pdr = FALSE;
+#else
+int mips_flag_pdr = TRUE;
+#endif
+
 #include "ecoff.h"
 
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
@@ -1283,7 +1292,7 @@ md_begin (void)
 	    (void) bfd_set_section_alignment (stdoutput, sec, 2);
 	  }
 #ifdef OBJ_ELF
-	else if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
+	else if (OUTPUT_FLAVOR == bfd_target_elf_flavour && mips_flag_pdr)
 	  {
 	    pdr_seg = subseg_new (".pdr", (subsegT) 0);
 	    (void) bfd_set_section_flags (stdoutput, pdr_seg,
@@ -10322,6 +10331,10 @@ struct option md_longopts[] =
   {"mdebug", no_argument, NULL, OPTION_MDEBUG},
 #define OPTION_NO_MDEBUG   (OPTION_ELF_BASE + 8)
   {"no-mdebug", no_argument, NULL, OPTION_NO_MDEBUG},
+#define OPTION_PDR	   (OPTION_ELF_BASE + 9)
+  {"pdr", no_argument, NULL, OPTION_PDR},
+#define OPTION_NO_PDR	   (OPTION_ELF_BASE + 10)
+  {"no-pdr", no_argument, NULL, OPTION_NO_PDR},
 #endif /* OBJ_ELF */
 
   {NULL, no_argument, NULL, 0}
@@ -10670,6 +10683,14 @@ md_parse_option (int c, char *arg)
     case OPTION_NO_MDEBUG:
       mips_flag_mdebug = FALSE;
       break;
+
+    case OPTION_PDR:
+      mips_flag_pdr = TRUE;
+      break;
+
+    case OPTION_NO_PDR:
+      mips_flag_pdr = FALSE;
+      break;
 #endif /* OBJ_ELF */
 
     default:
@@ -14040,7 +14061,8 @@ s_mips_end (int x ATTRIBUTE_UNUSED)
 
 #ifdef OBJ_ELF
   /* Generate a .pdr section.  */
-  if (OUTPUT_FLAVOR == bfd_target_elf_flavour && ! ECOFF_DEBUGGING)
+  if (OUTPUT_FLAVOR == bfd_target_elf_flavour && ! ECOFF_DEBUGGING
+      && mips_flag_pdr)
     {
       segT saved_seg = now_seg;
       subsegT saved_subseg = now_subseg;
@@ -14525,6 +14547,7 @@ MIPS options:\n\
 -KPIC, -call_shared	generate SVR4 position independent code\n\
 -non_shared		do not generate position independent code\n\
 -xgot			assume a 32 bit GOT\n\
+-pdr, -no-pdr		enable/disable creation of .pdr sections\n\
 -mabi=ABI		create ABI conformant object file for:\n"));
 
   first = 1;
Index: doc/c-mips.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-mips.texi,v
retrieving revision 1.27
diff -u -p -r1.27 c-mips.texi
--- doc/c-mips.texi	15 Jul 2003 09:02:59 -0000	1.27
+++ doc/c-mips.texi	21 Jul 2003 23:17:14 -0000
@@ -230,6 +230,11 @@ are only supported at Instruction Set Ar
 Generate code to take a break exception rather than a trap exception when an
 error is detected.  This is the default.
 
+@item -pdr
+@itemx -no-pdr
+Control generation of @code{.pdr} sections.  Off by default on IRIX, on
+elsewhere.
+
 @item -n
 When this option is used, @code{@value{AS}} will issue a warning every
 time it generates a nop instruction from a macro.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]