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]

[1/2] Add VxWorks PIC support to i386


Richard Henderson <rth@redhat.com> writes:
> On Fri, Mar 02, 2007 at 02:12:30PM +0000, Richard Sandiford wrote:
>> CodeSourcery is gearing up to submit support for the VxWorks RTP PIC
>> model.  Six targets are affected: arm, i386, mips, rs6000, sh and sparc.
>> All this code is conditional on TARGET_VXWORKS_RTP being true and refers
>> to two other macros: VXWORKS_GOTT_BASE and VXWORKS_GOTT_INDEX.
>> 
>> Before submitting patches, I just wanted to ask how this code should
>> be integrated into the surrounding non-VxWorks code.  Some obvious
>> alternatives are:
>> 
>>   1) Wrap it in #ifdef TARGET_VXWORKS_RTP.
>> 
>>   2) Provide an always-false definition of TARGET_VXWORKS_RTP in
>>      arm.h, i386.h, etc.  Also provide dummy definitions of the
>>      VXWORKS_GOTT_* macros.
>> 
>>   3) Provide an always-false definition of TARGET_VXWORKS_RTP in
>>      defaults.h.  Also provide dummy definitions of the VXWORKS_GOTT_*
>>      macros.
>> 
>>   4) Like (3), but provide the real VxWorks default values of the
>>      VXWORKS_GOTT_* macros (rather than dummy ones).
>
> How about (3), but instead of putting them in defaults.h, put them in
> config/vxworks-dummy.h, and include that in the relevant cpu.c files?

Sounds good.  Some of the patches need to go in cpu.md as well as cpu.c,
so is it OK to include it in cpu.h instead?  I realise we try not to
include configuration files from cpu.h, but this isn't really a
configuration file as such.

> I am fond of dummy versions like
>
> #define VXWORKS_GOTT_BASE	(gcc_unreachable(), "")

Yeah, that's better than the NULL I was going to use.

Here's a patch to add config/vxworks-dummy.h and include it in i386.h.
Bootstrapped & regression-tested on x86_64-linux-gnu.  OK to install?

I'll send the main patch in a sec.

Richard


gcc/
	* config/vxworks.h (VXWORKS_GOTT_BASE, VXWORKS_GOTT_INDEX): Undefine
	before defining.
	* config/vxworks-dummy.h: New file.
	* config/i386/i386.h: Include it.

Index: gcc/config/vxworks.h
===================================================================
--- gcc/config/vxworks.h	(revision 122473)
+++ gcc/config/vxworks.h	(working copy)
@@ -97,11 +97,11 @@ #define TARGET_ASM_DESTRUCTOR vxworks_as
 extern void vxworks_asm_out_constructor (rtx symbol, int priority);
 extern void vxworks_asm_out_destructor (rtx symbol, int priority);
 
-/* The name of the symbol for the table of GOTs in a particular
-   RTP.  */
+/* Override the vxworks-dummy.h definitions.  TARGET_VXWORKS_RTP
+   is defined by vxworks.opt.  */
+#undef VXWORKS_GOTT_BASE
 #define VXWORKS_GOTT_BASE "__GOTT_BASE__"
-/* The name of the symbol for the index into the table of GOTs for the
-   GOT associated with the current shared library.  */
+#undef VXWORKS_GOTT_INDEX
 #define VXWORKS_GOTT_INDEX "__GOTT_INDEX__"
 
 #define VXWORKS_KIND VXWORKS_KIND_NORMAL
Index: gcc/config/vxworks-dummy.h
===================================================================
--- gcc/config/vxworks-dummy.h	(revision 0)
+++ gcc/config/vxworks-dummy.h	(revision 0)
@@ -0,0 +1,31 @@
+/* Dummy definitions of VxWorks-related macros
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
+
+/* True if generating code for a VxWorks RTP.  */
+#ifndef TARGET_VXWORKS_RTP
+#define TARGET_VXWORKS_RTP false
+#endif
+
+/* The symbol that points to an RTP's table of GOTs.  */
+#define VXWORKS_GOTT_BASE (gcc_unreachable (), "")
+
+/* The symbol that holds the index of the current module's GOT in
+   VXWORKS_GOTT_BASE.  */
+#define VXWORKS_GOTT_INDEX (gcc_unreachable (), "")
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h	(revision 122473)
+++ gcc/config/i386/i386.h	(working copy)
@@ -20,6 +20,8 @@ the Free Software Foundation; either ver
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+#include "config/vxworks-dummy.h"
+
 /* Algorithm to expand string function with.  */
 enum stringop_alg
 {


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