Subject: bin/2570: gcc config for mips needs support for linker-warning attributes
To: None <gnats-bugs@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: netbsd-bugs
Date: 06/25/1996 21:55:08
>Number:         2570
>Category:       bin
>Synopsis:       gcc config for mips needs support for linker-warning attributes
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 26 01:05:02 1996
>Last-Modified:
>Originator:     Jonathan Stone
>Organization:
	
>Release:        1.2_BETA
>Environment:
	
System: NetBSD Reno.DSG.Stanford.EDU 1.2_BETA NetBSD 1.2_BETA (DSG) #0: Tue Jun 25 08:06:47 PDT 1996 jonathan@Reno.DSG.Stanford.EDU:/usr/src/sys/arch/pmax/compile/DSG pmax


>Description:

	The mips gcc config is missing a patch to support attributes.
	The NetBSD/mips toolchain supports attributes, and has done since
	NetBSD/1.1, and the mips header files expect that support.

	``make build'' and other attempts to build a distribution
	fail due to compilation errors / warnings.

>How-To-Repeat:
	build gcc afresh from NetBSD sources, install it,
	try a "make build", note how the compiler barfs on
	warn and other  attributes.>Fix:

Apply the following diff to /usr/src/gnu/usr.bin/gcc/arch/mips/mips.h,
or better yet, add it to the script that makes NetBSD's gcc.  It's
been in use by the port maintainer since before the NetBSD 1.1
release. Yet somehow it's never made it into the tree...


*** mips.h.DIST	Mon Dec 11 12:14:19 1995
--- mips.h.dsg.SAVE	Thu Dec 14 14:39:21 1995
***************
*** 3811,3813 ****
--- 3811,3829 ----
  #define NO_BUILTIN_PTRDIFF_TYPE
  #define PTRDIFF_TYPE (TARGET_LONG64 ? "long int" : "int")
  #endif
+ 
+ /* A C statement to output something to the assembler file to switch to section
+    NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+    NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
+    define this macro in such cases.  */
+ 
+ #define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME) \
+ do {								\
+   extern FILE *asm_out_text_file;				\
+   if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL)		\
+     fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \
+   else if ((DECL) && TREE_READONLY (DECL))			\
+     fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME));	\
+   else								\
+     fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME));	\
+ } while (0)


>Fix:
>Audit-Trail:
>Unformatted: