Index: gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c =================================================================== --- gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c (revision 154873) +++ gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c (working copy) @@ -880,9 +880,9 @@ if (e[0].etype == ETYPE_STRUCT_ARRAY || e[0].etype == ETYPE_UNION_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); /* If this is an array type, do not put aligned attributes on elements. Aligning elements to a value greater than their size will result in a compiler error. */ @@ -935,9 +935,9 @@ if (e[0].etype == ETYPE_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); } else { @@ -1003,11 +1003,11 @@ case 'I': case 'L': case 'Q': - snprintf (buf, 20, "B%cN(%d)", e[0].type->bitfld, e[0].len); + sprintf (buf, "B%cN(%d)", e[0].type->bitfld, e[0].len); break; case 'B': case ' ': - snprintf (buf, 20, "%d", e[0].len); + sprintf (buf, "%d", e[0].len); break; default: abort (); @@ -1235,8 +1235,7 @@ return 1 + e[0].len; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf) - 1, - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); q = strchr (p, '\0'); /* FALLTHROUGH */ case ETYPE_STRUCT: @@ -1264,16 +1263,14 @@ return 1; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); output_FNB ('F', e); if ((generate_random () & 7) == 0) { j = generate_random () % e[0].arr_len; if (i != j) { - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, j); + sprintf (p, "%c[%d]", *letter, j); output_FNB ('F', e); } } Index: gcc/testsuite/g++.dg/warn/miss-format-1.C =================================================================== --- gcc/testsuite/g++.dg/warn/miss-format-1.C (revision 154873) +++ gcc/testsuite/g++.dg/warn/miss-format-1.C (working copy) @@ -4,7 +4,7 @@ /* { dg-options "-Wmissing-format-attribute" } */ /* { dg-options "-Wmissing-format-attribute -Wno-abi" { target arm_eabi } } */ /* VxWorks does not provide vscanf, either in kernel or RTP mode. */ -/* { dg-error "not declared" "" { target *-*-solaris2.[7-8] *-*-vxworks* } 25 } */ +/* { dg-error "not declared" "" { target *-*-irix* *-*-solaris2.[7-8] *-*-vxworks* } 25 } */ #include #include @@ -23,7 +23,7 @@ { va_list ap; va_start (ap, fmt); - vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-solaris2.[7-8] *-*-vxworks* } } */ + vscanf (fmt, ap); /* { dg-warning "candidate" "scanf attribute warning" { xfail *-*-irix* *-*-solaris2.[7-8] *-*-vxworks* } } */ va_end (ap); } Index: gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c =================================================================== --- gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c (revision 154873) +++ gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c (working copy) @@ -624,9 +624,9 @@ if (e[0].etype == ETYPE_STRUCT_ARRAY || e[0].etype == ETYPE_UNION_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); /* If this is an array type, do not put aligned attributes on elements. Aligning elements to a value greater than their size will result in a compiler error. */ @@ -679,9 +679,9 @@ if (e[0].etype == ETYPE_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); } else { @@ -740,7 +740,7 @@ ++*letter; return 1; } - snprintf (buf, 20, "%d", e[0].len); + sprintf (buf, "%d", e[0].len); if (e[0].attrib) switch (generate_random () % 3) { @@ -887,8 +887,7 @@ return 1 + e[0].len; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf) - 1, - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); q = strchr (p, '\0'); /* FALLTHROUGH */ case ETYPE_STRUCT: @@ -916,16 +915,14 @@ return 1; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); output_FNB ('F', e); if ((generate_random () & 7) == 0) { j = generate_random () % e[0].arr_len; if (i != j) { - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, j); + sprintf (p, "%c[%d]", *letter, j); output_FNB ('F', e); } } Index: gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c =================================================================== --- gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c (revision 154873) +++ gcc/testsuite/objc.dg/gnu-encoding/struct-layout-encoding-1_generate.c (working copy) @@ -337,9 +337,9 @@ if (e[0].etype == ETYPE_STRUCT_ARRAY || e[0].etype == ETYPE_UNION_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); } else { @@ -385,9 +385,9 @@ if (e[0].etype == ETYPE_ARRAY) { if (e[0].arr_len == 255) - snprintf (buf, 20, "%c[]", *letter); + sprintf (buf, "%c[]", *letter); else - snprintf (buf, 20, "%c[%d]", *letter, e[0].arr_len); + sprintf (buf, "%c[%d]", *letter, e[0].arr_len); } else { @@ -439,11 +439,11 @@ case 'I': case 'L': case 'Q': - snprintf (buf, 20, "B%cN(%d)", e[0].type->bitfld, e[0].len); + sprintf (buf, "B%cN(%d)", e[0].type->bitfld, e[0].len); break; case 'B': case ' ': - snprintf (buf, 20, "%d", e[0].len); + sprintf (buf, "%d", e[0].len); break; default: abort (); @@ -635,8 +635,7 @@ return 1 + e[0].len; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf) - 1, - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); q = strchr (p, '\0'); /* FALLTHROUGH */ case ETYPE_STRUCT: @@ -664,16 +663,14 @@ return 1; } i = generate_random () % e[0].arr_len; - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, i); + sprintf (p, "%c[%d]", *letter, i); output_FNB ('F', e); if ((generate_random () & 7) == 0) { j = generate_random () % e[0].arr_len; if (i != j) { - snprintf (p, sizeof (namebuf) - (p - namebuf), - "%c[%d]", *letter, j); + sprintf (p, "%c[%d]", *letter, j); output_FNB ('F', e); } } Index: gcc/config.gcc =================================================================== --- gcc/config.gcc (revision 154873) +++ gcc/config.gcc (working copy) @@ -1660,6 +1660,10 @@ then tm_file="${tm_file} dbx.h mips/dbxmdebug.h" fi + if test "x$gas" = xyes + then + tm_defines="${tm_defines} IRIX_USING_GNU_AS" + fi if test "x$gnu_ld" = xyes then tm_defines="${tm_defines} IRIX_USING_GNU_LD" Index: gcc/config/mips/iris5.h =================================================================== --- gcc/config/mips/iris5.h (revision 154873) +++ gcc/config/mips/iris5.h (working copy) @@ -21,7 +21,9 @@ #ifdef IRIX_USING_GNU_LD #define IRIX_SUBTARGET_LINK_SPEC "-melf32bsmip" #else -#define IRIX_SUBTARGET_LINK_SPEC "-_SYSTYPE_SVR4" +#define IRIX_SUBTARGET_LINK_SPEC \ + "%{w} -_SYSTYPE_SVR4 \ + %{shared:-hidden_symbol __dso_handle,__gcc_init,__gcc_fini}" #endif #undef STARTFILE_SPEC @@ -42,3 +44,42 @@ #undef MACHINE_TYPE #define MACHINE_TYPE "SGI running IRIX 5.x" + +/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ +#define HANDLE_PRAGMA_PACK_PUSH_POP 1 + +/* Both GAS and the SGI assembler cannot grok .stabd directives. */ +#undef NO_DBX_BNSYM_ENSYM +#define NO_DBX_BNSYM_ENSYM 1 + +#ifdef IRIX_USING_GNU_AS +/* GAS needs '-mdebug' to emit stabs in ECOFF */ +#undef SUBTARGET_ASM_DEBUGGING_SPEC +#define SUBTARGET_ASM_DEBUGGING_SPEC "\ +%{g} %{g0} %{g1} %{g2} %{g3} \ +%{ggdb:-g} %{ggdb0:-g0} %{ggdb1:-g1} %{ggdb2:-g2} %{ggdb3:-g3} \ +%{gstabs:-g} %{gstabs0:-g0} %{gstabs1:-g1} %{gstabs2:-g2} %{gstabs3:-g3} \ +%{gstabs+:-g} %{gstabs+0:-g0} %{gstabs+1:-g1} %{gstabs+2:-g2} %{gstabs+3:-g3} \ +%{gstabs*:-mdebug} %{!gstabs*:-no-mdebug}" +#endif + +#ifdef IRIX_USING_GNU_LD +#define SUBTARGET_DONT_WARN_UNUSED_SPEC "" +#define SUBTARGET_WARN_UNUSED_SPEC "" +#else +#define SUBTARGET_DONT_WARN_UNUSED_SPEC "-dont_warn_unused" +#define SUBTARGET_WARN_UNUSED_SPEC "-warn_unused" +#endif + +/* Avoid getting three warnings for libgcc.a everytime we link. */ +#undef LIBGCC_SPEC +#define LIBGCC_SPEC \ + SUBTARGET_DONT_WARN_UNUSED_SPEC \ + " -lgcc " \ + SUBTARGET_WARN_UNUSED_SPEC + +/* The init_priority attribute is not supported with IRIX ld. */ +#ifndef IRIX_USING_GNU_LD +#undef SUPPORTS_INIT_PRIORITY +#define SUPPORTS_INIT_PRIORITY 0 +#endif Index: gcc/config/mips/iris6.h =================================================================== --- gcc/config/mips/iris6.h (revision 154873) +++ gcc/config/mips/iris6.h (working copy) @@ -48,6 +48,9 @@ #undef MACHINE_TYPE #define MACHINE_TYPE "SGI running IRIX 6.x" +/* Enable parsing of #pragma pack(push,) and #pragma pack(pop). */ +#define HANDLE_PRAGMA_PACK_PUSH_POP 1 + #ifdef IRIX_USING_GNU_LD #define IRIX_SUBTARGET_LINK_SPEC \ "%{mabi=32: -melf32bsmip}%{mabi=n32: -melf32bmipn32}%{mabi=64: -melf64bmip}" @@ -143,3 +146,8 @@ #undef SUBTARGET_CPP_SPEC #define SUBTARGET_CPP_SPEC "%{pthread:-D_REENTRANT}" +/* The init_priority attribute is not supported with the MIPSpro linker. */ +#ifndef IRIX_USING_GNU_LD +#undef SUPPORTS_INIT_PRIORITY +#define SUPPORTS_INIT_PRIORITY 0 +#endif Index: libiberty/Makefile.in =================================================================== --- libiberty/Makefile.in (revision 154873) +++ libiberty/Makefile.in (working copy) @@ -142,6 +142,7 @@ pex-common.c pex-djgpp.c pex-msdos.c pex-one.c \ pex-unix.c pex-win32.c \ physmem.c putenv.c \ + qsort.c \ random.c regex.c rename.c rindex.c \ safe-ctype.c setenv.c sha1.c sigsetmask.c snprintf.c sort.c \ spaces.c splay-tree.c stpcpy.c stpncpy.c strcasecmp.c \ @@ -171,6 +172,7 @@ ./objalloc.o ./obstack.o \ ./partition.o ./pexecute.o ./physmem.o \ ./pex-common.o ./pex-one.o @pexecute@ \ + ./qsort.o \ ./safe-ctype.o ./sort.o ./spaces.o ./splay-tree.o ./strerror.o \ ./strsignal.o \ ./unlink-if-ordinary.o \ @@ -894,6 +896,12 @@ else true; fi $(COMPILE.c) $(srcdir)/putenv.c $(OUTPUT_OPTION) +./qsort.o: $(srcdir)/qsort.c + if [ x"$(PICFLAG)" != x ]; then \ + $(COMPILE.c) $(PICFLAG) $(srcdir)/qsort.c -o pic/$@; \ + else true; fi + $(COMPILE.c) $(srcdir)/qsort.c $(OUTPUT_OPTION) + ./random.o: $(srcdir)/random.c $(INCDIR)/ansidecl.h if [ x"$(PICFLAG)" != x ]; then \ $(COMPILE.c) $(PICFLAG) $(srcdir)/random.c -o pic/$@; \