This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[VxWorks] Reject PIC options for kernel mode


PIC is not supported for VxWorks kernel mode.  It's unnecessary,
because kernel modules are relocatable objects anyway.

This patch adds an appropriate error to VXWORKS_OVERRIDE_OPTIONS.
Tested on i586-wrs-vxworks.  OK to install?

Richard


gcc/
	* config/vxworks.h (vxworks_override_options): Declare.
	(VXWORKS_OVERRIDE_OPTIONS): Use it.
	* config/vxworks.c: Include target.h and toplev.h.
	(vxworks_override_options): New function.
	* config/t-vxworks (vxworks.o): Depend on $(TARGET_H) and toplev.h.

Index: gcc/config/vxworks.h
===================================================================
--- gcc/config/vxworks.h	(revision 122653)
+++ gcc/config/vxworks.h	(working copy)
@@ -82,13 +82,10 @@ #define VXWORKS_LIBGCC_SPEC \
 #define	VXWORKS_STARTFILE_SPEC "%{mrtp:%{!shared:crt0.o%s}}"
 #define VXWORKS_ENDFILE_SPEC ""
 
-/* We can use .ctors/.dtors sections only in RTP mode.
-   Unfortunately this must be an integer constant expression;
-   fix up in override_options.  */
+/* Do VxWorks-specific parts of OVERRIDE_OPTIONS.  */
 #undef VXWORKS_OVERRIDE_OPTIONS
-#define VXWORKS_OVERRIDE_OPTIONS do { \
-  targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; \
-} while (0)
+#define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options ()
+extern void vxworks_override_options (void);
 
 /* VxWorks requires special handling of constructors and destructors.
    All VxWorks configurations must use these functions.  */
Index: gcc/config/vxworks.c
===================================================================
--- gcc/config/vxworks.c	(revision 122652)
+++ gcc/config/vxworks.c	(working copy)
@@ -23,6 +23,8 @@ Software Foundation; either version 2, o
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "target.h"
+#include "toplev.h"
 #include "output.h"
 #include "tm.h"
 
@@ -54,3 +56,16 @@ vxworks_asm_out_destructor (rtx symbol, 
 				    /*constructor_p=*/false);
   assemble_addr_to_section (symbol, sec);
 }
+
+/* Do VxWorks-specific parts of OVERRIDE_OPTIONS.  */
+
+void
+vxworks_override_options (void)
+{
+  /* We can use .ctors/.dtors sections only in RTP mode.  */
+  targetm.have_ctors_dtors = TARGET_VXWORKS_RTP;
+
+  /* PIC is only supported for RTPs.  */
+  if (flag_pic && !TARGET_VXWORKS_RTP)
+    error ("PIC is only supported for RTPs");
+}
Index: gcc/config/t-vxworks
===================================================================
--- gcc/config/t-vxworks	(revision 122652)
+++ gcc/config/t-vxworks	(working copy)
@@ -33,5 +33,5 @@ LIMITS_H_TEST = true
 EXTRA_MULTILIB_PARTS = 
 
 vxworks.o: $(srcdir)/config/vxworks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-	output.h $(TM_H)
+	$(TARGET_H) toplev.h output.h $(TM_H)
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<


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