This is the mail archive of the gcc-bugs@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]

support for i386-pc-nto-qnx* target


Enclosed is support for QNX 6.2 I developed for my employer.

While there are a few nits that I would have liked to have addressed
before I submitted these changes, it is useful in its current state.
In fact, it is planned that our next release will be built with this
compiler.

The reason I'm contributing this now is that the aquisition of our
company is due to be completed soon, and I wanted the submission to
fall under our current copyright assignment.  Hopefully any future
changes from this baseline will be small enough to not require an
assignment, at least until I can work through the bureaucracy and
get a new one in place.

While we only use the i386 QNX port, I did my very best to put the
platform independent definitions into config/qnx.h and config/t-qnx
and platform dependent definitions in config/i386/qnx.h.  Hopefully
this will be useful to anyone wanting to add support for the other
QNX ports.

One nit left to be addressed are fixinclude patterns for some of the
QNX headers to make them work with gcc >= 2.  I submitted them to QNX
long ago, but they were not present in the latest release.

Another nit is conflicts between the gcc headers and the system
headers.  In particular, wchar_t and <float.h>.  For the time being I
have been removing gcc's headers when the target libiberty build fails
and continuing on.  This is probably the most significant problem.

And finally, we're exclusively building this as a cross compiler, so I
have no idea whether it will configure and build on a QNX host.  In the 
past, I think I had trouble with the "od" utility, which doesn't support
legacy (pre-POSIX) command line arguments.

Enclosed is a ChangeLog entry, a diff containing the changes to config.gcc,
and a shar archive containing the new files.

        --jtc


2002-08-12  J.T. Conklin  <jtc@acorntoolworks.com>

	* config.gcc (i386-pc-nto-qnx*): New target.

	* config/qnx.h: New file.
	* config/t-qnx: New file.
	* config/i386/qnx.h: New file.

Index: config.gcc
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config.gcc,v
retrieving revision 1.167.2.23
diff -c -r1.167.2.23 config.gcc
*** config.gcc	7 Jun 2002 23:35:31 -0000	1.167.2.23
--- config.gcc	12 Aug 2002 14:15:24 -0000
***************
*** 1382,1387 ****
--- 1382,1393 ----
  	tmake_file=i386/t-osf
  	extra_objs=halfpic.o
  	;;
+ i[34567]86-*-nto-qnx*)
+ 	tm_file="${tm_file} i386/att.h dbxelf.h elfos.h svr4.h qnx.h i386/qnx.h"
+ 	tmake_file="t-libc-ok t-qnx"
+ 	gnu_ld=yes
+ 	gas=yes
+ 	;;
  i[34567]86-go32-rtems*)
  	xm_defines=POSIX
  	tm_file="i386/djgpp.h i386/djgpp-rtems.h rtems.h"

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	config/t-qnx
#	config/qnx.h
#	config/i386/qnx.h
#
echo x - config/t-qnx
sed 's/^X//' >config/t-qnx << 'END-of-config/t-qnx'
X# Don't run fixproto
XSTMP_FIXPROTO =
X
X# The crt* files distributed with QNX don't work with exceptions, so 
X# we build our own.
XEXTRA_PARTS = crtbegin.o crtend.o crtbeginS.o crtendS.o
END-of-config/t-qnx
echo x - config/qnx.h
sed 's/^X//' >config/qnx.h << 'END-of-config/qnx.h'
X/* Definitions for QNX/Neutrino
X   Copyright (C) 2002 Free Software Foundation, Inc.
X
XThis file is part of GNU CC.
X
XGNU CC is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License as published by
Xthe Free Software Foundation; either version 2, or (at your option)
Xany later version.
X
XGNU CC is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
XGNU General Public License for more details.
X
XYou should have received a copy of the GNU General Public License
Xalong with GNU CC; see the file COPYING.  If not, write to
Xthe Free Software Foundation, 59 Temple Place - Suite 330,
XBoston, MA 02111-1307, USA.  */
X
X#undef MD_EXEC_PREFIX
X#undef MD_STARTFILE_PREFIX
X
X#undef STARTFILE_SPEC
X#define STARTFILE_SPEC \
X  "%{!shared: \
X    %{!symbolic: \
X     %{pg:mcrt1.o%s} %{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \
X   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
X
X#undef ENDFILE_SPEC
X#define ENDFILE_SPEC \
X  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
X
X/* QNX's shared libc is missing about 150+ functions found in the static
X   library so we link it staticly to pick up any unresolved functions.  */
X#undef LIB_SPEC
X#define LIB_SPEC							\
X  "%{!shared:%{!symbolic:-lc %{!static:-Bstatic -lc}}}"
X
X
X#undef LINK_SPEC
X#define LINK_SPEC							\
X  "%{assert*} %{R*} %{rpath*}						\
X   %{shared:-shared}							\
X   %{!shared:								\
X     -dc -dp								\
X     %{!static:								\
X       %{rdynamic:-export-dynamic}					\
X       %{!dynamic-linker:-dynamic-linker /usr/lib/ldqnx.so.2}}		\
X     %{static:-static}}"
X
X/* Implicit library calls should use memcpy, not bcopy, etc.  */
X#define TARGET_MEM_FUNCTIONS
X
X/* The QNX system headers are C++-aware.  */
X#define NO_IMPLICIT_EXTERN_C
END-of-config/qnx.h
echo x - config/i386/qnx.h
sed 's/^X//' >config/i386/qnx.h << 'END-of-config/i386/qnx.h'
X/* Definitions for Intel 386 running QNX/Neutrino.
X   Copyright (C) 2002 Free Software Foundation, Inc.
X
XThis file is part of GNU CC.
X
XGNU CC is free software; you can redistribute it and/or modify
Xit under the terms of the GNU General Public License as published by
Xthe Free Software Foundation; either version 2, or (at your option)
Xany later version.
X
XGNU CC is distributed in the hope that it will be useful,
Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
XGNU General Public License for more details.
X
XYou should have received a copy of the GNU General Public License
Xalong with GNU CC; see the file COPYING.  If not, write to
Xthe Free Software Foundation, 59 Temple Place - Suite 330,
XBoston, MA 02111-1307, USA.  */
X
X#undef TARGET_VERSION
X#define TARGET_VERSION	fprintf (stderr, " (i386 QNX/Neutrino)");
X
X#undef CPP_PREDEFINES
X#define CPP_PREDEFINES  \
X  "-D__X86__ -Di386 -D__QNXNTO__ -D__QNX__ --D__LITTLEENDIAN__ " \
X  "-Asystem=unix -Asystem=nto -Asystem=qnxnto -Asystem=qnx " \
X  "-Acpu=i386 -Amachine=i386"
X
X#undef WCHAR_TYPE
X#define WCHAR_TYPE "long unsigned int"
X
X#undef WCHAR_TYPE_SIZE
X#define WCHAR_TYPE_SIZE 32
END-of-config/i386/qnx.h
exit




-- 
J.T. Conklin


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