This commit was generated by cvs2svn to compensate for changes in r133582,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
parent
3b76f3bcca
commit
6d3e93598f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=133583
@ -1,44 +0,0 @@
|
||||
/* Define to 1 if NLS is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define as 1 if you have catgets and don't want to use GNU gettext. */
|
||||
#undef HAVE_CATGETS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define as 1 if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your assembler supports specifying the maximum number
|
||||
of bytes to skip when using the GAS .p2align command. */
|
||||
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
|
||||
|
||||
/* Define if your assembler supports .balign and .p2align. */
|
||||
#undef HAVE_GAS_BALIGN_AND_P2ALIGN
|
||||
|
||||
/* Define if your assembler uses the old HImode fild and fist notation. */
|
||||
#undef HAVE_GAS_FILDS_FISTS
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#undef ssize_t
|
||||
|
||||
/* Define if cpp should also search $prefix/include. */
|
||||
#undef PREFIX_INCLUDE_DIR
|
||||
|
||||
@BOTTOM@
|
||||
|
||||
/* Bison unconditionally undefines `const' if neither `__STDC__' nor
|
||||
__cplusplus are defined. That's a problem since we use `const' in
|
||||
the GCC headers, and the resulting bison code is therefore type
|
||||
unsafe. Thus, we must match the bison behavior here. */
|
||||
|
||||
#ifndef __STDC__
|
||||
#ifndef __cplusplus
|
||||
#undef const
|
||||
#define const
|
||||
#endif
|
||||
#endif
|
4
contrib/gcc/config.guess
vendored
4
contrib/gcc/config.guess
vendored
@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Use the top-level config.guess so that we don't have two of them.
|
||||
guesssys=`echo $0 | sed 's|config.guess|../config.guess|'`
|
||||
exec ${guesssys} "$@"
|
@ -1,150 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha
|
||||
running Windows/NT.
|
||||
Copyright (C) 1995, 1996, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
From code
|
||||
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* cpp handles __STDC__ */
|
||||
/* The three "Alpha" defines on the first such line are from the CLAXP spec */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__INTERIX"); \
|
||||
builtin_define ("__OPENNT"); \
|
||||
builtin_define ("__Alpha_AXP"); \
|
||||
builtin_define ("_M_ALPHA"); \
|
||||
builtin_define ("_ALPHA_"); \
|
||||
builtin_define ("__stdcall="); \
|
||||
builtin_define ("__cdecl="); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=interix"); \
|
||||
} while (0)
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
-remap \
|
||||
%{posix:-D_POSIX_SOURCE} \
|
||||
-isystem %$INTERIX_ROOT/usr/include"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (alpha Interix)");
|
||||
|
||||
/* alpha.h sets this, but it doesn't apply to us */
|
||||
#undef OBJECT_FORMAT_ECOFF
|
||||
#undef OBJECT_FORMAT_COFF
|
||||
|
||||
/* LINK_SPEC */
|
||||
|
||||
/* MD_STARTFILE_PREFIX */
|
||||
|
||||
/* ASM_OUTPUT_LOOP_ALIGN; ASM_OUTPUT_ALIGN_CODE */
|
||||
|
||||
/* Codegen macro overrides for NT internal conventions */
|
||||
|
||||
/* the below are ecoff specific... we don't need them, so
|
||||
undef them (they'll get a default later) */
|
||||
|
||||
#undef PUT_SDB_BLOCK_START
|
||||
#undef PUT_SDB_BLOCK_END
|
||||
|
||||
/* The following are needed for C++, but also needed for profiling */
|
||||
|
||||
/* Support const sections and the ctors and dtors sections for g++. */
|
||||
|
||||
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
|
||||
|
||||
/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
|
||||
|
||||
Note that we want to give these sections the SHF_WRITE attribute
|
||||
because these sections will actually contain data (i.e. tables of
|
||||
addresses of functions in the current root executable or shared library
|
||||
file) and, in the case of a shared library, the relocatable addresses
|
||||
will have to be properly resolved/relocated (and then written into) by
|
||||
the dynamic linker when it actually attaches the given shared library
|
||||
to the executing process. (Note that on SVR4, you may wish to use the
|
||||
`-z text' option to the ELF linker, when building a shared library, as
|
||||
an additional check that you are doing everything right. But if you do
|
||||
use the `-z text' option when building a shared library, you will get
|
||||
errors unless the .ctors and .dtors sections are marked as writable
|
||||
via the SHF_WRITE attribute.) */
|
||||
|
||||
#define CTORS_SECTION_ASM_OP "\t.ctors"
|
||||
#define DTORS_SECTION_ASM_OP "\t.dtors"
|
||||
|
||||
/* The linker will take care of this, and having them causes problems with
|
||||
ld -r (specifically -rU). */
|
||||
#define CTOR_LISTS_DEFINED_EXTERNALLY 1
|
||||
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
/* Output a definition (implements alias) */
|
||||
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
|
||||
do \
|
||||
{ \
|
||||
fprintf ((FILE), "\t"); \
|
||||
assemble_name (FILE, LABEL1); \
|
||||
fprintf (FILE, "="); \
|
||||
assemble_name (FILE, LABEL2); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* We use the defaults, so undef the null definitions */
|
||||
#undef PUT_SDB_FUNCTION_START
|
||||
#undef PUT_SDB_FUNCTION_END
|
||||
#undef PUT_SDB_EPILOGUE_END
|
||||
|
||||
#define HOST_PTR_PRINTF "%p"
|
||||
#define HOST_PTR_AS_INT unsigned long
|
||||
|
||||
#define PCC_BITFIELD_TYPE_MATTERS 1
|
||||
#define PCC_BITFIELD_TYPE_TEST TYPE_NATIVE(rec)
|
||||
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
|
||||
|
||||
/* DWARF2 Unwinding doesn't work with exception handling yet. */
|
||||
#undef DWARF2_UNWIND_INFO
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
/* The definition of this macro implies that there are cases where
|
||||
a scalar value cannot be returned in registers.
|
||||
|
||||
On NT (according to the spec) anything except strings/array that fits
|
||||
in 64 bits is returned in the registers (this appears to differ from
|
||||
the rest of the Alpha family). */
|
||||
|
||||
#undef RETURN_IN_MEMORY
|
||||
#define RETURN_IN_MEMORY(TYPE) \
|
||||
(TREE_CODE (TYPE) == ARRAY_TYPE || int_size_in_bytes(TYPE) > 8)
|
||||
|
||||
#define ASM_LOAD_ADDR(loc, reg) " lda " #reg "," #loc "\n"
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
{ \
|
||||
alpha_write_verstamp (FILE); \
|
||||
fprintf (FILE, "\t.set noreorder\n"); \
|
||||
fprintf (FILE, "\t.set volatile\n"); \
|
||||
fprintf (FILE, "\t.set noat\n"); \
|
||||
fprintf (FILE, "\t.globl\t__fltused\n"); \
|
||||
ASM_OUTPUT_SOURCE_FILENAME (FILE, main_input_filename); \
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for DEC Alpha
|
||||
running Windows/NT.
|
||||
Copyright (C) 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Derived from code
|
||||
Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
|
||||
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
|
||||
This file contains the code-generation stuff common to the 32-bit
|
||||
versions of the DEC/Compaq Alpha architecture. It is shared by
|
||||
Interix and NT/Win32 ports. It should not contain compile-time
|
||||
or run-time dependent environment values (such as compiler options
|
||||
or anything containing a file or pathname.)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef TARGET_ABI_WINDOWS_NT
|
||||
#define TARGET_ABI_WINDOWS_NT 1
|
||||
|
||||
/* WinNT (and thus Interix) use unsigned int */
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
|
||||
#undef POINTER_SIZE
|
||||
#define POINTER_SIZE 32
|
||||
#define POINTERS_EXTEND_UNSIGNED 0
|
||||
|
||||
/* We don't change Pmode to the "obvious" SI mode... the above appears
|
||||
to affect the in-memory size; we want the registers to stay DImode
|
||||
to match the md file */
|
||||
|
||||
/* "long" is 32 bits. */
|
||||
#undef LONG_TYPE_SIZE
|
||||
#define LONG_TYPE_SIZE 32
|
||||
|
||||
|
||||
/* Output assembler code for a block containing the constant parts
|
||||
of a trampoline, leaving space for the variable parts.
|
||||
|
||||
The trampoline should set the static chain pointer to value placed
|
||||
into the trampoline and should branch to the specified routine. */
|
||||
|
||||
#undef TRAMPOLINE_TEMPLATE
|
||||
#define TRAMPOLINE_TEMPLATE(FILE) \
|
||||
{ \
|
||||
fprintf (FILE, "\tbr $27,$LTRAMPP\n"); \
|
||||
fprintf (FILE, "$LTRAMPP:\n\tldl $1,12($27)\n"); \
|
||||
fprintf (FILE, "\tldl $27,16($27)\n"); \
|
||||
fprintf (FILE, "\tjmp $31,($27),0\n"); \
|
||||
fprintf (FILE, "\t.long 0,0\n"); \
|
||||
}
|
||||
|
||||
/* Length in units of the trampoline for entering a nested function. */
|
||||
|
||||
#undef TRAMPOLINE_SIZE
|
||||
#define TRAMPOLINE_SIZE 24
|
||||
|
||||
/* The alignment of a trampoline, in bits. */
|
||||
|
||||
#undef TRAMPOLINE_ALIGNMENT
|
||||
#define TRAMPOLINE_ALIGNMENT 32
|
||||
|
||||
/* Emit RTL insns to initialize the variable parts of a trampoline.
|
||||
FNADDR is an RTX for the address of the function's pure code.
|
||||
CXT is an RTX for the static chain value for the function. */
|
||||
|
||||
#undef INITIALIZE_TRAMPOLINE
|
||||
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
|
||||
alpha_initialize_trampoline (TRAMP, FNADDR, CXT, 20, 16, 12)
|
@ -1,7 +0,0 @@
|
||||
# t-interix
|
||||
|
||||
# System headers will track gcc's needs.
|
||||
USER_H=
|
||||
|
||||
LIB1ASMSRC = alpha/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _divqu _divq _divlu _divl _remqu _remq _remlu _reml
|
@ -1,55 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks Alpha version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file just exists to give specs for the Alpha running on VxWorks. */
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC "\
|
||||
%{mvxsim:-DCPU=SIMALPHADUNIX} \
|
||||
%{!mvxsim: %{!mcpu*|mcpu=21064:-DCPU=21064} %{mcpu=21164:-DCPU=21164}} \
|
||||
%{posix: -D_POSIX_SOURCE}"
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_define ("__alpha_vxworks"); \
|
||||
builtin_define ("_LONGLONG"); \
|
||||
builtin_assert ("system=vxworks"); \
|
||||
builtin_assert ("system=embedded"); \
|
||||
} while (0)
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. Make linker just combine
|
||||
objects. Also show using 32 bit mode and set start of text to 0. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r -taso -T 0"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
@ -1,39 +0,0 @@
|
||||
/* Configuration for GNU compiler
|
||||
for an DEC/Compaq Alpha
|
||||
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
|
||||
Donn Terry, Softway Systems, Inc.
|
||||
derived from code by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define HOST_BITS_PER_WIDE_INT 64
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDE_INT long long
|
||||
#else
|
||||
# define HOST_WIDE_INT __int64
|
||||
#endif
|
||||
|
||||
#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDEST_INT long long
|
||||
#else
|
||||
# define HOST_WIDEST_INT __int64
|
||||
#endif
|
||||
#define HOST_WIDEST_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
|
@ -1,29 +0,0 @@
|
||||
/* Configuration for GNU C-compiler for openVMS/Alpha.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by Douglas Rupp (rupp@gnat.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef HOST_WIDE_INT
|
||||
|
||||
/* Since DEC C long != Gnu C long */
|
||||
#define HOST_PTR_PRINTF "%llx"
|
||||
#define HOST_WIDE_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDE_INT_PRINT_HEX "0x%llx"
|
||||
#define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
|
@ -1,41 +0,0 @@
|
||||
/* aoutos.h -- operating system specific defines to be used when
|
||||
targeting GCC for some system that uses a.out file format.
|
||||
Copyright (C) 1992 Free Software Foundation, Inc.
|
||||
|
||||
Written by Ron Guilmette (rfg@netcom.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* To use this file, make up a file with a name like:
|
||||
|
||||
?????aout.h
|
||||
|
||||
where ????? is replaced by the name of the basic hardware that you
|
||||
are targeting for. Then, in the file ?????aout.h, put something
|
||||
like:
|
||||
|
||||
#include "?????.h"
|
||||
#include "aoutos.h"
|
||||
|
||||
followed by any really system-specific defines (or overrides of
|
||||
defines) which you find that you need. Now, modify the configure
|
||||
or configure.in script to properly use the new ?????aout.h file
|
||||
when configuring for the system. */
|
||||
|
||||
/* Define a symbol indicating that we are using aoutos.h. */
|
||||
#define USING_AOUTOS_H
|
@ -1,46 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for ARM with ConiX OS.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Philip Blundell <pb@futuretv.com>
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
`Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* elfos.h should have already been included. Now just override
|
||||
any conflicting definitions and add any extras. */
|
||||
|
||||
/* Run-time Target Specification. */
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/ELF ConiX)", stderr);
|
||||
|
||||
/* Default to using APCS-32 and software floating point. */
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32)
|
||||
|
||||
#ifndef CPP_APCS_PC_DEFAULT_SPEC
|
||||
#define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
|
||||
#endif
|
||||
|
||||
#ifndef SUBTARGET_CPU_DEFAULT
|
||||
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm7tdmi
|
||||
#endif
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__CONIX__"); \
|
||||
builtin_define ("__ELF__"); \
|
||||
} while (0)
|
@ -1,29 +0,0 @@
|
||||
LIB1ASMSRC = arm/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#ifndef __ARMEB__' >> fp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
|
||||
echo '#endif' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#ifndef __ARMEB__' > dp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#endif' >> dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS = mhard-float/msoft-float mapcs-32/mapcs-26 mno-thumb-interwork/mthumb-interwork arm/thumb
|
||||
# MULTILIB_DIRNAMES = le be fpu soft 32bit 26bit normal interwork arm thumb
|
||||
# MULTILIB_MATCHES =
|
||||
# MULTILIB_EXCEPTIONS = *mapcs-26/*mthumb-interwork* *mpacs-26/*mthumb*
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,34 +0,0 @@
|
||||
LIB1ASMSRC = arm/lib1funcs.asm
|
||||
LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#ifndef __ARMEB__' >> fp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c
|
||||
echo '#endif' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#ifndef __ARMEB__' > dp-bit.c
|
||||
echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c
|
||||
echo '#endif' >> dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mlittle-endian/mbig-endian mhard-float/msoft-float
|
||||
MULTILIB_DIRNAMES = le be fpu soft
|
||||
MULTILIB_MATCHES =
|
||||
EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# Currently there is a bug somwehere in GCC's alias analysis
|
||||
# or scheduling code that is breaking _fpmul_parts in fp-bit.c.
|
||||
# Disabling function inlining is a workaround for this problem.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc -fno-inline
|
@ -1,29 +0,0 @@
|
||||
/* Definitions for non-Linux based ARM systems using ELF old abi
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Catherine Moore <clm@cygnus.com>
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Run-time Target Specification. */
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/ELF non-Linux old abi)", stderr);
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "-moabi %{mbig-endian:-EB} %{mcpu=*:-mcpu=%*} %{march=*:-march=%*} \
|
||||
%{mapcs-*:-mapcs-%*} %{mthumb-interwork:-mthumb-interwork}"
|
||||
|
@ -1,71 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for ARM with targetting the VXWorks run time environment.
|
||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Contributed by: Mike Stump <mrs@wrs.com>
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm710
|
||||
|
||||
#undef SUBTARGET_CPP_SPEC
|
||||
#define SUBTARGET_CPP_SPEC \
|
||||
"%{march=arm710:-DCPU=ARM710A} \
|
||||
%{march=arm7tdmi:-DCPU=ARM7TDMI} \
|
||||
%{march=arm810:-DCPU=ARM810} \
|
||||
%{march=strongarm110:-DCPU=ARMSA110} \
|
||||
%{!march=*: \
|
||||
%{mcpu=arm710:-DCPU=ARM710A} \
|
||||
%{mcpu=arm7tdmi:-DCPU=ARM7TDMI} \
|
||||
%{mcpu=arm810:-DCPU=ARM810} \
|
||||
%{mcpu=strongarm110:-DCPU=ARMSA110}} \
|
||||
%{!mcpu*:%{!march=*:-DCPU=ARM710A}} \
|
||||
"
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
builtin_define ("__vxworks"); \
|
||||
} while (0)
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. make linker just
|
||||
combine objects. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fputs (" (ARM/VxWorks)", stderr);
|
||||
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(STREAM) \
|
||||
do \
|
||||
{ \
|
||||
fprintf (STREAM, "%s Generated by gcc %s for ARM/VxWorks\n", \
|
||||
ASM_COMMENT_START, version_string); \
|
||||
} \
|
||||
while (0)
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 3.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define FBSD_MAJOR 3
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 4.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define FBSD_MAJOR 4
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 5.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define FBSD_MAJOR 5
|
@ -1,22 +0,0 @@
|
||||
/* FreeBSD version number setting for FreeBSD 6.x systems.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define FBSD_MAJOR 6
|
@ -1,66 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. VxWorks i386 version.
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (80386, VxWorks BSD syntax)");
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
\
|
||||
if (TARGET_386) \
|
||||
builtin_define ("CPU=I80386"); \
|
||||
else if (TARGET_486) \
|
||||
builtin_define ("CPU=I80486"); \
|
||||
else if (TARGET_PENTIUM) \
|
||||
{ \
|
||||
builtin_define ("CPU=PENTIUM"); \
|
||||
builtin_define ("CPU_VARIANT=PENTIUM"); \
|
||||
} \
|
||||
else if (TARGET_PENTIUMPRO) \
|
||||
{ \
|
||||
builtin_define ("CPU=PENTIUM"); \
|
||||
builtin_define ("CPU_VARIANT=PENTIUMPRO"); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define HANDLE_SYSV_PRAGMA 1
|
||||
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* VxWorks uses object files, not loadable images. make linker just
|
||||
combine objects. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
@ -1,173 +0,0 @@
|
||||
/* Operating system specific defines to be used when targeting GCC for
|
||||
hosting on Windows NT 3.x, using a Unix style C library and tools,
|
||||
as distinct from winnt.h, which is used to build GCC for use with a
|
||||
windows style library and tool set and uses the Microsoft tools.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Enable parsing of #pragma pack(push,<n>) and #pragma pack(pop). */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP 1
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
#define SDB_DEBUGGING_INFO 1
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
#include "i386/unix.h"
|
||||
#include "i386/bsd.h"
|
||||
#include "i386/gas.h"
|
||||
#include "dbxcoff.h"
|
||||
|
||||
/* Augment TARGET_SWITCHES with the cygwin/win32 options. */
|
||||
#define MASK_WIN32 0x40000000 /* Use -lming32 interface */
|
||||
#define MASK_CYGWIN 0x20000000 /* Use -lcygwin interface */
|
||||
#define MASK_WINDOWS 0x10000000 /* Use windows interface */
|
||||
#define MASK_DLL 0x08000000 /* Use dll interface */
|
||||
#define MASK_NOP_FUN_DLLIMPORT 0x20000 /* Ignore dllimport for functions */
|
||||
|
||||
#define TARGET_WIN32 (target_flags & MASK_WIN32)
|
||||
#define TARGET_CYGWIN (target_flags & MASK_CYGWIN)
|
||||
#define TARGET_WINDOWS (target_flags & MASK_WINDOWS)
|
||||
#define TARGET_DLL (target_flags & MASK_DLL)
|
||||
#define TARGET_NOP_FUN_DLLIMPORT (target_flags & MASK_NOP_FUN_DLLIMPORT)
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "win32", MASK_WIN32, \
|
||||
N_("Use Mingw32 interface") }, \
|
||||
{ "cygwin", MASK_CYGWIN, \
|
||||
N_("Use Cygwin interface") }, \
|
||||
{ "windows", MASK_WINDOWS, \
|
||||
N_("Use bare Windows interface") }, \
|
||||
{ "dll", MASK_DLL, \
|
||||
N_("Generate code for a DLL") }, \
|
||||
{ "nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, \
|
||||
N_("Ignore dllimport for functions") }, \
|
||||
{ "no-nop-fun-dllimport", MASK_NOP_FUN_DLLIMPORT, "" },
|
||||
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_WIN32"); \
|
||||
builtin_define_std ("WINNT"); \
|
||||
builtin_define ("_X86_"); \
|
||||
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
|
||||
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
|
||||
builtin_assert ("system=winnt"); \
|
||||
if (TARGET_CYGWIN) \
|
||||
{ \
|
||||
builtin_define ("__CYGWIN32__"); \
|
||||
builtin_define ("__CYGWIN__"); \
|
||||
} \
|
||||
else \
|
||||
builtin_define ("__MINGW32__"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
|
||||
#define STARTFILE_SPEC "%{mdll:dllcrt0%O%s} %{!mdll: %{!mcygwin:mcrt0%O%s} \
|
||||
%{mcygwin:crt0%O%s} %{pg:gcrt0%O%s}}"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} \
|
||||
%{!mcygwin:-iwithprefixbefore include/mingw32}"
|
||||
|
||||
/* We have to dynamic link to get to the system DLLs. All of libc, libm and
|
||||
the Unix stuff is in cygwin.dll. The import library is called
|
||||
'libcygwin.a'. For Windows applications, include more libraries, but
|
||||
always include kernel32. We'd like to specific subsystem windows to
|
||||
ld, but that doesn't work just yet. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{pg:-lgmon} \
|
||||
%{!mcygwin:-lmingw32 -lmoldname -lmsvcrt -lcrtdll} \
|
||||
%{mcygwin:-lcygwin} %{mwindows:-luser32 -lgdi32 -lcomdlg32} \
|
||||
-lkernel32 -ladvapi32 -lshell32"
|
||||
|
||||
#define LINK_SPEC "%{mwindows:--subsystem windows} \
|
||||
%{mdll:--dll -e _DllMainCRTStartup@12}"
|
||||
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define PTRDIFF_TYPE "int"
|
||||
#define WCHAR_TYPE_SIZE 16
|
||||
#define WCHAR_TYPE "short unsigned int"
|
||||
/* Currently we do not have the atexit() function,
|
||||
so take that from libgcc2.c */
|
||||
|
||||
#define NEED_ATEXIT 1
|
||||
|
||||
#undef TARGET_ENCODE_SECTION_INFO
|
||||
#define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
|
||||
#undef TARGET_STRIP_NAME_ENCODING
|
||||
#define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full
|
||||
|
||||
/* Emit code to check the stack when allocating more that 4000
|
||||
bytes in one go. */
|
||||
|
||||
#define CHECK_STACK_LIMIT 4000
|
||||
|
||||
/* By default, target has a 80387, uses IEEE compatible arithmetic,
|
||||
and returns float values in the 387 and needs stack probes */
|
||||
#undef TARGET_SUBTARGET_DEFAULT
|
||||
|
||||
#define TARGET_SUBTARGET_DEFAULT \
|
||||
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE)
|
||||
|
||||
/* This is how to output an assembler line
|
||||
that says to advance the location counter
|
||||
to a multiple of 2**LOG bytes. */
|
||||
|
||||
#undef ASM_OUTPUT_ALIGN
|
||||
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
|
||||
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
|
||||
|
||||
/* Define this macro if in some cases global symbols from one translation
|
||||
unit may not be bound to undefined symbols in another translation unit
|
||||
without user intervention. For instance, under Microsoft Windows
|
||||
symbols must be explicitly imported from shared libraries (DLLs). */
|
||||
#define MULTIPLE_SYMBOL_SPACES
|
||||
|
||||
extern void i386_pe_unique_section PARAMS ((tree, int));
|
||||
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
|
||||
|
||||
#define SUPPORTS_ONE_ONLY 1
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
|
||||
|
||||
/* Select attributes for named sections. */
|
||||
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
|
||||
|
||||
#undef ASM_COMMENT_START
|
||||
#define ASM_COMMENT_START " #"
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
#define SUBTARGET_PROLOGUE \
|
||||
if (current_function_profile \
|
||||
&& MAIN_NAME_P (DECL_NAME (current_function_decl)) \
|
||||
{ \
|
||||
rtx xops[1]; \
|
||||
xops[0] = gen_rtx_MEM (FUNCTION_MODE, \
|
||||
gen_rtx (SYMBOL_REF, Pmode, "_monstartup")); \
|
||||
emit_call_insn (gen_rtx (CALL, VOIDmode, xops[0], const0_rtx)); \
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/* Configuration for GNU compiler
|
||||
for an Intel i386 or later processor running Interix.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Contributed by Donn Terry (donn@interix.com)
|
||||
Derived from code by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
|
||||
#ifdef __GNUC__
|
||||
# define HOST_WIDEST_INT long long
|
||||
#else
|
||||
# define HOST_WIDEST_INT __int64
|
||||
#endif
|
||||
#define HOST_WIDEST_INT_PRINT_DEC "%lld"
|
||||
#define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
|
||||
#define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
|
@ -1,11 +0,0 @@
|
||||
/* Use semicolons to separate elements of a path. */
|
||||
#define PATH_SEPARATOR ';'
|
||||
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_std ("unix"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
|
@ -1,159 +0,0 @@
|
||||
/* Definitions of target machine GNU compiler. IA-64/AIX version.
|
||||
Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Timothy Wall (twall@cygnus.com)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* AIX5 (aka Monterey): a mix of AIX and UnixWare.
|
||||
This file is loosely based on ia64/linux.h. */
|
||||
|
||||
/* This macro is a C statement to print on `stderr' a string describing the
|
||||
particular machine description choice. */
|
||||
|
||||
#define TARGET_VERSION fprintf (stderr, " (IA-64) AIX");
|
||||
|
||||
#undef ASM_APP_ON
|
||||
#define ASM_APP_ON "#APP\n"
|
||||
|
||||
#undef ASM_APP_OFF
|
||||
#define ASM_APP_OFF "#NO_APP\n"
|
||||
|
||||
#define SET_ASM_OP "\t.set\t"
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
#define MD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) \
|
||||
do { \
|
||||
output_file_directive (FILE, main_input_filename); \
|
||||
fprintf (FILE, "\t.version\t\"01.01\"\n"); \
|
||||
} while (0)
|
||||
|
||||
/* Provide a STARTFILE_SPEC appropriate for AIX. Here we add
|
||||
the crti C++ startup files file which provide part of the support
|
||||
for getting C++ file-scope static object constructed before entering
|
||||
`main'. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC \
|
||||
"%{!shared: \
|
||||
%{pg:gcrt1_64.o%s} %{!pg:%{p:mcrt1_64.o%s} \
|
||||
%{!p:%{profile:gcrt1_64.o%s} \
|
||||
%{!profile:crt1_64.o%s}}}} \
|
||||
crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
|
||||
|
||||
/* Provide a ENDFILE_SPEC appropriate for AIX. Here we tack on
|
||||
the crtn file which provides termination of the support for getting C++
|
||||
file-scope static object constructed before entering `main'. */
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
|
||||
|
||||
/* Define this so we can compile MS code for use with WINE. */
|
||||
#define HANDLE_PRAGMA_PACK_PUSH_POP
|
||||
|
||||
/* Target OS builtins. */
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do { \
|
||||
if (flag_iso) \
|
||||
builtin_define("_ANSI_C_SOURCE"); \
|
||||
builtin_define("_AIX"); \
|
||||
builtin_define("_AIX64"); \
|
||||
builtin_define("unix"); \
|
||||
builtin_assert("system=unix"); \
|
||||
builtin_assert("system=aix"); \
|
||||
builtin_define("__64BIT__"); \
|
||||
builtin_define("_LONG_LONG"); \
|
||||
builtin_define("_IA64"); \
|
||||
builtin_define("__int128=__size128_t"); \
|
||||
if (c_language == clk_cplusplus) \
|
||||
{ \
|
||||
builtin_define("_XOPEN_SOURCE=500"); \
|
||||
builtin_define("_XOPEN_SOURCE_EXTENDED=1"); \
|
||||
builtin_define("_LARGE_FILE_API"); \
|
||||
builtin_define("_ALL_SOURCE"); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* A C string constant that tells the GNU CC driver program options to pass to
|
||||
CPP. It can also specify how to translate options you give to GNU CC into
|
||||
options for GNU CC to pass to the CPP. */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "\
|
||||
%{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Define this for shared library support. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "\
|
||||
%{shared:-shared} \
|
||||
%{!shared: \
|
||||
%{!static: \
|
||||
%{rdynamic:-export-dynamic} \
|
||||
%{!dynamic-linker:-dynamic-linker /usr/lib/ia64l64/libc.so.1}} \
|
||||
%{static:-static}}"
|
||||
|
||||
#define JMP_BUF_SIZE 85
|
||||
|
||||
/* A C statement or compound statement to output to FILE some assembler code to
|
||||
call the profiling subroutine `mcount'.
|
||||
|
||||
FIXME this is not supported until xlC supports it and can thus tell us
|
||||
how to do it.
|
||||
*/
|
||||
|
||||
#undef FUNCTION_PROFILER
|
||||
#define FUNCTION_PROFILER(FILE, LABELNO) \
|
||||
do { \
|
||||
} while (0)
|
||||
|
||||
/* Tell the linker where to find the crt*.o files. */
|
||||
|
||||
#ifndef CROSS_COMPILE
|
||||
#undef STANDARD_STARTFILE_PREFIX
|
||||
#define STANDARD_STARTFILE_PREFIX "/usr/lib/ia64l64/"
|
||||
#endif
|
||||
|
||||
/* It is illegal to have relocations in shared segments on AIX.
|
||||
Pretend flag_pic is always set. */
|
||||
#undef TARGET_ASM_SELECT_SECTION
|
||||
#define TARGET_ASM_SELECT_SECTION ia64_rwreloc_select_section
|
||||
#undef TARGET_ASM_UNIQUE_SECTION
|
||||
#define TARGET_ASM_UNIQUE_SECTION ia64_rwreloc_unique_section
|
||||
#undef TARGET_ASM_SELECT_RTX_SECTION
|
||||
#define TARGET_ASM_SELECT_RTX_SECTION ia64_rwreloc_select_rtx_section
|
||||
|
||||
/* Override ia64/sysv4.h setting with that used by AIX5. */
|
||||
#undef WCHAR_TYPE
|
||||
#ifdef __64BIT__
|
||||
#define WCHAR_TYPE "unsigned int"
|
||||
#else
|
||||
#define WCHAR_TYPE "unsigned short"
|
||||
#endif
|
||||
|
||||
/* Define the `__builtin_va_list' type for AIX. Use char* b/c that's what the
|
||||
system headers expect. */
|
||||
#define BUILD_VA_LIST_TYPE(VALIST) \
|
||||
(VALIST) = build_pointer_type(char_type_node)
|
||||
|
||||
/* End of aix.h */
|
@ -1,99 +0,0 @@
|
||||
/* Definitions of long double support for GNU compiler.
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* We are using IEEE quad precision, not a double-extended with padding. */
|
||||
#undef INTEL_EXTENDED_IEEE_FORMAT
|
||||
#define INTEL_EXTENDED_IEEE_FORMAT 0
|
||||
|
||||
/* Define library calls for quad FP operations. These are all part of the
|
||||
IA32 and IA64 ABIs. */
|
||||
|
||||
#define ADDTF3_LIBCALL "_U_Qfadd"
|
||||
#define SUBTF3_LIBCALL "_U_Qfsub"
|
||||
#define MULTF3_LIBCALL "_U_Qfmpy"
|
||||
#define DIVTF3_LIBCALL "_U_Qfdiv"
|
||||
#define NEGTF2_LIBCALL "_U_Qfneg"
|
||||
#define ABSTF2_LIBCALL "_U_Qfabs"
|
||||
#define SMINTF3_LIBCALL "_U_Qfmin"
|
||||
#define SMAXTF3_LIBCALL "_U_Qfmax"
|
||||
#define EXTENDSFTF2_LIBCALL "_U_Qfcnvff_sgl_to_quad"
|
||||
#define EXTENDDFTF2_LIBCALL "_U_Qfcnvff_dbl_to_quad"
|
||||
#define TRUNCTFSF2_LIBCALL "_U_Qfcnvff_quad_to_sgl"
|
||||
#define TRUNCTFDF2_LIBCALL "_U_Qfcnvff_quad_to_dbl"
|
||||
#define FLOATSITF2_LIBCALL "_U_Qfcnvxf_sgl_to_quad"
|
||||
#define FLOATDITF2_LIBCALL "_U_Qfcnvxf_dbl_to_quad"
|
||||
#define FIX_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxt_quad_to_sgl"
|
||||
#define FIX_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxt_quad_to_dbl"
|
||||
#define FIXUNS_TRUNCTFSI2_LIBCALL "_U_Qfcnvfxut_quad_to_sgl"
|
||||
#define FIXUNS_TRUNCTFDI2_LIBCALL "_U_Qfcnvfxut_quad_to_dbl"
|
||||
#define EQTF2_LIBCALL "_U_Qfeq"
|
||||
#define NETF2_LIBCALL "_U_Qfne"
|
||||
#define GTTF2_LIBCALL "_U_Qfgt"
|
||||
#define GETF2_LIBCALL "_U_Qfge"
|
||||
#define LTTF2_LIBCALL "_U_Qflt"
|
||||
#define LETF2_LIBCALL "_U_Qfle"
|
||||
|
||||
|
||||
#undef INIT_TARGET_OPTABS
|
||||
#define INIT_TARGET_OPTABS \
|
||||
do { \
|
||||
add_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, ADDTF3_LIBCALL); \
|
||||
sub_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SUBTF3_LIBCALL); \
|
||||
smul_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, MULTF3_LIBCALL); \
|
||||
sdiv_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, DIVTF3_LIBCALL); \
|
||||
smin_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SMINTF3_LIBCALL); \
|
||||
smax_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, SMAXTF3_LIBCALL); \
|
||||
abs_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, ABSTF2_LIBCALL); \
|
||||
neg_optab->handlers[(int) TFmode].libfunc \
|
||||
= gen_rtx_SYMBOL_REF (Pmode, NEGTF2_LIBCALL); \
|
||||
extendsftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDSFTF2_LIBCALL); \
|
||||
extenddftf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EXTENDDFTF2_LIBCALL); \
|
||||
trunctfsf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFSF2_LIBCALL); \
|
||||
trunctfdf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, TRUNCTFDF2_LIBCALL); \
|
||||
floatsitf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATSITF2_LIBCALL); \
|
||||
floatditf_libfunc = gen_rtx_SYMBOL_REF (Pmode, FLOATDITF2_LIBCALL); \
|
||||
fixtfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFSI2_LIBCALL);\
|
||||
fixtfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIX_TRUNCTFDI2_LIBCALL);\
|
||||
fixunstfsi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFSI2_LIBCALL); \
|
||||
fixunstfdi_libfunc = gen_rtx_SYMBOL_REF (Pmode, FIXUNS_TRUNCTFDI2_LIBCALL); \
|
||||
eqtf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, EQTF2_LIBCALL); \
|
||||
netf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, NETF2_LIBCALL); \
|
||||
gttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GTTF2_LIBCALL); \
|
||||
getf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, GETF2_LIBCALL); \
|
||||
lttf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LTTF2_LIBCALL); \
|
||||
letf2_libfunc = gen_rtx_SYMBOL_REF (Pmode, LETF2_LIBCALL); \
|
||||
\
|
||||
INIT_SUBTARGET_OPTABS; \
|
||||
} while (0)
|
||||
|
||||
/* This is meant to be redefined in the host dependent files */
|
||||
#define INIT_SUBTARGET_OPTABS
|
||||
|
||||
/* Nonzero if a floating point comparison library call for
|
||||
mode MODE that will return a boolean value. Zero if one
|
||||
of the libgcc2 functions is used. */
|
||||
#define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
|
@ -1,15 +0,0 @@
|
||||
# AIX support
|
||||
|
||||
# Compile crtbeginS.o and crtendS.o with pic.
|
||||
CRTSTUFF_T_CFLAGS_S = -fPIC
|
||||
# Compile libgcc2.a with pic and defines required by AIX headers
|
||||
TARGET_LIBGCC2_CFLAGS = -fPIC -D__64BIT__ -D_LONG_LONG -D_IA64 -D__int128=__size128_t
|
||||
LIB2ADDEH += $(srcdir)/config/ia64/unwind-aix.c
|
||||
|
||||
# Assemble startup files.
|
||||
crti.o: $(srcdir)/config/ia64/crti.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/ia64/crti.asm
|
||||
crtn.o: $(srcdir)/config/ia64/crtn.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/ia64/crtn.asm
|
||||
|
||||
# end t-aix
|
@ -1,120 +0,0 @@
|
||||
/* Implements unwind table entry lookup for AIX (cf. fde-glibc.c).
|
||||
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Timothy Wall <twall@redhat.com>
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "tconfig.h"
|
||||
#include "tsystem.h"
|
||||
#include "unwind.h"
|
||||
#include "unwind-ia64.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <link.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
static struct unw_table_entry *
|
||||
find_fde_for_dso (Elf64_Addr pc, rt_link_map *map,
|
||||
unsigned long* pseg_base, unsigned long* pgp)
|
||||
{
|
||||
rt_segment *seg;
|
||||
Elf64_Addr seg_base;
|
||||
struct unw_table_entry *f_base;
|
||||
size_t lo, hi;
|
||||
|
||||
/* See if PC falls into one of the loaded segments. */
|
||||
for (seg = map->l_segments; seg; seg = (rt_segment *)seg->s_next)
|
||||
{
|
||||
if (pc >= seg->s_map_addr && pc < seg->s_map_addr + seg->s_mapsz)
|
||||
break;
|
||||
}
|
||||
if (!seg)
|
||||
return NULL;
|
||||
|
||||
/* Search for the entry within the unwind table. */
|
||||
f_base = (struct unw_table_entry *) (map->l_unwind_table);
|
||||
seg_base = (Elf64_Addr) seg->s_map_addr;
|
||||
lo = 0;
|
||||
hi = map->l_unwind_sz / sizeof (struct unw_table_entry);
|
||||
|
||||
while (lo < hi)
|
||||
{
|
||||
size_t mid = (lo + hi) / 2;
|
||||
struct unw_table_entry *f = f_base + mid;
|
||||
|
||||
if (pc < f->start_offset + seg_base)
|
||||
hi = mid;
|
||||
else if (pc >= f->end_offset + seg_base)
|
||||
lo = mid + 1;
|
||||
else {
|
||||
/* AIX executables are *always* dynamic. Look up GP for this
|
||||
object. */
|
||||
Elf64_Dyn *dyn = map->l_ld;
|
||||
*pgp = 0;
|
||||
for (; dyn->d_tag != DT_NULL ; dyn++)
|
||||
{
|
||||
if (dyn->d_tag == DT_PLTGOT)
|
||||
{
|
||||
*pgp = dyn->d_un.d_ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*pseg_base = seg_base;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Return a pointer to the unwind table entry for the function containing
|
||||
PC. */
|
||||
struct unw_table_entry *
|
||||
_Unwind_FindTableEntry (void *pc, unsigned long *pseg_base, unsigned long *pgp)
|
||||
{
|
||||
extern rt_r_debug _r_debug;
|
||||
struct unw_table_entry *ret;
|
||||
rt_link_map *map = _r_debug.r_map; /* address of link map */
|
||||
|
||||
/* Check the main application first, hoping that most of the user's
|
||||
code is there instead of in some library. */
|
||||
ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp);
|
||||
if (ret)
|
||||
{
|
||||
/* If we're in the main application, use the current GP value. */
|
||||
register unsigned long gp __asm__("gp");
|
||||
*pgp = gp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* FIXME need a DSO lock mechanism for AIX here, to ensure shared
|
||||
libraries aren't changed while we're examining them. */
|
||||
|
||||
for (map = _r_debug.r_map; map; map = map->l_next)
|
||||
{
|
||||
/* Skip the main application's entry. */
|
||||
if (!map->l_name)
|
||||
continue;
|
||||
ret = find_fde_for_dso ((Elf64_Addr)pc, map, pseg_base, pgp);
|
||||
if (ret)
|
||||
break;
|
||||
}
|
||||
|
||||
/* FIXME need a DSO unlock mechanism for AIX here. */
|
||||
|
||||
return ret;
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/* Operating system specific defines to be used when targeting GCC for some
|
||||
embedded system running pSOS. We assume GNU tools with ELF, but
|
||||
try to maintain compatibility with the MRI tools. Based on svr4.h.
|
||||
Copyright (C) 1996, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
To use this file, make up a file with a name like:
|
||||
|
||||
?????-psos.h
|
||||
|
||||
where ????? is replaced by the name of the basic hardware that you
|
||||
are targeting for. Then, in the file ?????-psos.h, put something
|
||||
like:
|
||||
|
||||
#include "?????.h"
|
||||
#include "psos.h"
|
||||
|
||||
followed by any really system-specific defines (or overrides of
|
||||
defines) which you find that you need.
|
||||
*/
|
||||
|
||||
|
||||
/* Define a symbol indicating that we are using psos.h. */
|
||||
|
||||
#define USING_PSOS_H
|
||||
|
||||
|
||||
/* All pSOS targets currently use the ELF object file format. */
|
||||
|
||||
#define OBJECT_FORMAT_ELF
|
||||
|
||||
|
||||
/* Provide a NULL STARTFILE_SPEC. The startfile cannot be specified
|
||||
here because it depends on the architecture (e.g. 68K), the
|
||||
board-support package (e.g. M162) and the run-time configuration
|
||||
(e.g. application vs. ram-image vs. rom-image). Specify the
|
||||
startfile in a linker-script created from the generic
|
||||
architecture-specific linker-scripts. */
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
|
||||
/* Predefined macros (independent of processor type). */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dpsos"
|
||||
|
||||
|
||||
/* Implicit library calls should use ANSI memcpy rather than BSD
|
||||
bcopy, etc. */
|
||||
|
||||
#define TARGET_MEM_FUNCTIONS
|
||||
|
||||
/* This is how we tell the assembler that a symbol is weak. */
|
||||
|
||||
#define ASM_WEAKEN_LABEL(FILE,NAME) \
|
||||
do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
|
||||
fputc ('\n', FILE); } while (0)
|
||||
|
||||
/* Switch into a generic section. */
|
||||
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
|
||||
|
||||
/* Use DBX debugging info by default. */
|
||||
|
||||
#ifndef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
#endif
|
||||
|
||||
/* For pSOS we use DBX debugging info. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
@ -1,87 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 running AIX version 3.1.
|
||||
Copyright (C) 1993,1997, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner (kenner@nyu.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Output something to declare an external symbol to the assembler. Most
|
||||
assemblers don't need this.
|
||||
|
||||
If we haven't already, add "[RW]" (or "[DS]" for a function) to the
|
||||
name. Normally we write this out along with the name. In the few cases
|
||||
where we can't, it gets stripped off. */
|
||||
|
||||
#undef ASM_OUTPUT_EXTERNAL
|
||||
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
|
||||
{ rtx _symref = XEXP (DECL_RTL (DECL), 0); \
|
||||
if ((TREE_CODE (DECL) == VAR_DECL \
|
||||
|| TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
&& (NAME)[strlen (NAME) - 1] != ']') \
|
||||
{ \
|
||||
XSTR (_symref, 0) = concat (XSTR (_symref, 0), \
|
||||
(TREE_CODE (DECL) == FUNCTION_DECL \
|
||||
? "[DS]" : "[RW]"), \
|
||||
NULL); \
|
||||
} \
|
||||
fputs ("\t.extern ", FILE); \
|
||||
assemble_name (FILE, XSTR (_symref, 0)); \
|
||||
if (TREE_CODE (DECL) == FUNCTION_DECL) \
|
||||
{ \
|
||||
fputs ("\n\t.extern .", FILE); \
|
||||
RS6000_OUTPUT_BASENAME (FILE, XSTR (_symref, 0)); \
|
||||
} \
|
||||
putc ('\n', FILE); \
|
||||
}
|
||||
|
||||
/* Similar, but for libcall. We only have to worry about the function name,
|
||||
not that of the descriptor. */
|
||||
|
||||
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
|
||||
{ fputs ("\t.extern .", FILE); \
|
||||
assemble_name (FILE, XSTR (FUN, 0)); \
|
||||
putc ('\n', FILE); \
|
||||
}
|
||||
|
||||
/* AIX 3.2 defined _AIX32, but older versions do not. */
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("_IBMR2"); \
|
||||
builtin_define ("_AIX"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=aix"); \
|
||||
builtin_assert ("cpu=rs6000"); \
|
||||
builtin_assert ("machine=rs6000"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* AIX 3.1 uses bit 15 in CROR as the magic nop. */
|
||||
#undef RS6000_CALL_GLUE
|
||||
#define RS6000_CALL_GLUE "cror 15,15,15"
|
||||
|
||||
/* AIX 3.1 does not prepend underscores to itrunc, uitrunc, or mcount. */
|
||||
#undef RS6000_ITRUNC
|
||||
#define RS6000_ITRUNC "itrunc"
|
||||
#undef RS6000_UITRUNC
|
||||
#define RS6000_UITRUNC "uitrunc"
|
||||
#undef RS6000_MCOUNT
|
||||
#define RS6000_MCOUNT ".mcount"
|
||||
|
@ -1,60 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 POWER running AIX version 3.x with the fixed assembler.
|
||||
Copyright (C) 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
|
||||
Contributed by Jason Merrill (jason@cygnus.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Tell the assembler to assume that all undefined names are external. */
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "-u %(asm_cpu)"
|
||||
|
||||
#undef ASM_DEFAULT_SPEC
|
||||
#define ASM_DEFAULT_SPEC "-mpwr"
|
||||
|
||||
/* Define the options for the binder: Start text at 512, align all segments
|
||||
to 512 bytes, and warn if there is text relocation.
|
||||
|
||||
The -bhalt:4 option supposedly changes the level at which ld will abort,
|
||||
but it also suppresses warnings about multiply defined symbols and is
|
||||
used by the AIX cc command. So we use it here.
|
||||
|
||||
-bnodelcsect undoes a poor choice of default relating to multiply-defined
|
||||
csects. See AIX documentation for more information about this.
|
||||
|
||||
-bM:SRE tells the linker that the output file is Shared REusable. Note
|
||||
that to actually build a shared library you will also need to specify an
|
||||
export list with the -Wl,-bE option.
|
||||
|
||||
If -mcpu=common, export the architecture dependent multiply/divide routines
|
||||
as per README.RS6000. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#ifndef CROSS_COMPILE
|
||||
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
||||
%{static:-bnso -bI:/lib/syscalls.exp} \
|
||||
%{mcpu=common: milli.exp%s} \
|
||||
%{!shared:%{g*:-bexport:/usr/lib/libg.exp}} %{shared:-bM:SRE}"
|
||||
#else
|
||||
#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\
|
||||
%{static:-bnso} \
|
||||
%{mcpu=common: milli.exp%s} \
|
||||
%{shared:-bM:SRE}"
|
||||
#endif
|
@ -1,36 +0,0 @@
|
||||
/* Embedded ELF system support, using old AIX based calling sequence.
|
||||
Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Default ABI to use */
|
||||
#undef RS6000_ABI_NAME
|
||||
#define RS6000_ABI_NAME "aix"
|
||||
|
||||
/* Define this macro as a C expression for the initializer of an
|
||||
array of string to tell the driver program which options are
|
||||
defaults for this target and thus do not need to be handled
|
||||
specially when using `MULTILIB_OPTIONS'.
|
||||
|
||||
Do not define this macro if `MULTILIB_OPTIONS' is not defined in
|
||||
the target makefile fragment or if none of the options listed in
|
||||
`MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
|
||||
|
||||
#undef MULTILIB_DEFAULTS
|
||||
#define MULTILIB_DEFAULTS { "mbig", "mcall-aix" }
|
@ -1,54 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler,
|
||||
for IBM RS/6000 running MACH.
|
||||
Copyright (C) 1992, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Richard Kenner (kenner@nyu.edu)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_AIX 0
|
||||
|
||||
/* Print subsidiary information on the compiler version in use. */
|
||||
#define TARGET_VERSION fprintf (stderr, " (Mach-RS/6000)");
|
||||
|
||||
/* We don't define AIX under MACH; instead we define `unix'. */
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define_std ("rios"); \
|
||||
builtin_define ("_IBMR2"); \
|
||||
builtin_define_std ("unix"); \
|
||||
builtin_assert ("system=unix"); \
|
||||
builtin_assert ("system=mach"); \
|
||||
builtin_assert ("cpu=rs6000"); \
|
||||
builtin_assert ("machine=rs6000"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Define different binder options for MACH. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC \
|
||||
"-T0x10000000 -D0x20000000 -K %{!nostdlib:%{!r*:%{!e*:-e __start}}} \
|
||||
-bnoso -berrmsg -btextro -bhalt:4 -bnodelcsect"
|
||||
|
||||
/* MACH doesn't have atexit. */
|
||||
#define NEED_ATEXIT
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
|
||||
we want to retain compatibility with older gcc versions. */
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
@ -1,4 +0,0 @@
|
||||
rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \
|
||||
$(srcdir)/config/rs6000/rs6000-protos.h \
|
||||
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) $(TM_P_H) c-pragma.h errors.h
|
||||
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
|
@ -1,57 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks PowerPC version.
|
||||
Copyright (C) 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file just exists to give specs for the PowerPC running on VxWorks. */
|
||||
|
||||
/* Reset defaults */
|
||||
#undef CPP_OS_DEFAULT_SPEC
|
||||
#define CPP_OS_DEFAULT_SPEC "%(cpp_os_vxworks)"
|
||||
|
||||
#undef LIB_DEFAULT_SPEC
|
||||
#define LIB_DEFAULT_SPEC "%(lib_vxworks)"
|
||||
|
||||
#undef STARTFILE_DEFAULT_SPEC
|
||||
#define STARTFILE_DEFAULT_SPEC "%(startfile_vxworks)"
|
||||
|
||||
#undef ENDFILE_DEFAULT_SPEC
|
||||
#define ENDFILE_DEFAULT_SPEC "%(endfile_vxworks)"
|
||||
|
||||
#undef LINK_START_DEFAULT_SPEC
|
||||
#define LINK_START_DEFAULT_SPEC "%(link_start_vxworks)"
|
||||
|
||||
#undef LINK_OS_DEFAULT_SPEC
|
||||
#define LINK_OS_DEFAULT_SPEC "%(link_os_vxworks)"
|
||||
|
||||
#undef TARGET_OS_CPP_BUILTINS
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
builtin_define ("__vxworks"); \
|
||||
builtin_define ("__vxworks__"); \
|
||||
builtin_assert ("system=vxworks"); \
|
||||
builtin_assert ("system=embedded"); \
|
||||
builtin_assert ("cpu=powerpc"); \
|
||||
builtin_assert ("machine=powerpc"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* We use stabs-in-elf for debugging */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
@ -1,5 +0,0 @@
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}"
|
@ -1,33 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for HAL
|
||||
SPARC running Solaris 2 HALOS
|
||||
Copyright 1998 Free Software Foundation, Inc.
|
||||
Contributed by Carol LePage (carolo@hal.com)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Need different command line for assembler */
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -e1 \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
/* Need DWARF for debuggers. */
|
||||
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
|
@ -1,96 +0,0 @@
|
||||
/* Definitions for SPARC running Linux-based GNU systems with a.out.
|
||||
Copyright (C) 1996, 1997, 1999, 2002 Free Software Foundation, Inc.
|
||||
Contributed by Eddie C. Dost (ecd@skynet.be)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Don't assume anything about the header files. */
|
||||
#define NO_IMPLICIT_EXTERN_C
|
||||
|
||||
/* GNU/Linux uses ctype from glibc.a. I am not sure how complete it is.
|
||||
For now, we play safe. It may change later. */
|
||||
|
||||
#if 0
|
||||
#undef MULTIBYTE_CHARS
|
||||
#define MULTIBYTE_CHARS 1
|
||||
#endif
|
||||
|
||||
/* We need that too. */
|
||||
#define HANDLE_SYSV_PRAGMA 1
|
||||
|
||||
#undef MD_EXEC_PREFIX
|
||||
#undef MD_STARTFILE_PREFIX
|
||||
|
||||
/* Output at beginning of assembler file. */
|
||||
/* The .file command should always begin the output. */
|
||||
#undef ASM_FILE_START
|
||||
#define ASM_FILE_START(FILE) output_file_directive (FILE, main_input_filename)
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC "%{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}} %{static:-static}"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc GNU/Linux with a.out)");
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE
|
||||
#define WCHAR_TYPE "int"
|
||||
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
#define WCHAR_TYPE_SIZE 32
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -D__gnu_linux__ -Dlinux -Asystem=unix -Asystem=posix"
|
||||
|
||||
#undef CPP_SUBTARGET_SPEC
|
||||
#define CPP_SUBTARGET_SPEC \
|
||||
"%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler,
|
||||
and we want to retain compatibility with older gcc versions. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
#undef LIB_SPEC
|
||||
|
||||
#if 1
|
||||
/* We no longer link with libc_p.a or libg.a by default. If you
|
||||
want to profile or debug the GNU/Linux C library, please add
|
||||
-lc_p or -ggdb to LDFLAGS at the link time, respectively. */
|
||||
#define LIB_SPEC \
|
||||
"%{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} %{!ggdb:-lc} %{ggdb:-lg}"
|
||||
#else
|
||||
#define LIB_SPEC \
|
||||
"%{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
|
||||
%{!p:%{!pg:%{!g*:-lc} %{g*:-lg -static}}}"
|
||||
#endif
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-m sparclinux"
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
@ -1,38 +0,0 @@
|
||||
/* Definitions for SPARC running LynxOS, using Lynx's old as and ld.
|
||||
Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* ??? Must redefine to get sparclite and v8 defines. Can this be done
|
||||
differently? */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
|
||||
%{mposix:-D_POSIX_SOURCE} \
|
||||
%{msystem-v:-I/usr/include_v} \
|
||||
%(cpp_cpu)"
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -DLynx -DIBITS32 -Asystem=unix -Asystem=lynx -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
/* Provide required defaults for linker switches. */
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-e __main -T 0 %{msystem-v:-V} %{mcoff:-k}"
|
@ -1,47 +0,0 @@
|
||||
/* Definitions for SPARC running LynxOS.
|
||||
Copyright (C) 1993, 1995, 1996, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef ASM_OUTPUT_IDENT
|
||||
|
||||
#define BSS_SECTION_ASM_OP "\t.section\t\".bss\""
|
||||
|
||||
/* ??? Must redefine to get sparclite and v8 defines. Can this be done
|
||||
differently? */
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%{mthreads:-D_MULTITHREADED} \
|
||||
%{mposix:-D_POSIX_SOURCE} \
|
||||
%{msystem-v:-I/usr/include_v} \
|
||||
%(cpp_cpu)"
|
||||
|
||||
/* Names to predefine in the preprocessor for this target machine. */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Dsparc -DSPARC -DLynx -DLYNX -DIBITS32 -Asystem=unix -Asystem=lynx -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
#undef LINK_SPEC
|
||||
|
||||
/* SPARC version of libc.a has references to libm.a (printf calls pow for
|
||||
instance), so we must always link both. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "%{mthreads:-L/lib/thread/} \
|
||||
%{msystem-v:-lc_v -lm_v -lc_v} \
|
||||
%{!msystem-v:%{mposix:-lc_p} -lc -lm -lc}"
|
@ -1,49 +0,0 @@
|
||||
#define TARGET_OS_CPP_BUILTINS() \
|
||||
do \
|
||||
{ \
|
||||
NETBSD_OS_CPP_BUILTINS_AOUT(); \
|
||||
builtin_define_std ("sparc"); \
|
||||
builtin_assert ("cpu=sparc"); \
|
||||
builtin_assert ("machine=sparc"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
/* Make sure this is undefined. */
|
||||
#undef CPP_PREDEFINES
|
||||
|
||||
/* What extra spec entries do we need? */
|
||||
#undef SUBTARGET_EXTRA_SPECS
|
||||
#define SUBTARGET_EXTRA_SPECS \
|
||||
{ "netbsd_cpp_spec", NETBSD_CPP_SPEC },
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) %(netbsd_cpp_spec)"
|
||||
|
||||
/* Make gcc agree with <machine/ansi.h> */
|
||||
|
||||
#undef SIZE_TYPE
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#define PTRDIFF_TYPE "int"
|
||||
|
||||
/* This is BSD, so it wants DBX format. */
|
||||
|
||||
#define DBX_DEBUGGING_INFO 1
|
||||
|
||||
/* This is the char to use for continuation (in case we need to turn
|
||||
continuation back on). */
|
||||
|
||||
#define DBX_CONTIN_CHAR '?'
|
||||
|
||||
/* Don't default to pcc-struct-return, because gcc is the only compiler, and
|
||||
we want to retain compatibility with older gcc versions. */
|
||||
#undef DEFAULT_PCC_STRUCT_RETURN
|
||||
#define DEFAULT_PCC_STRUCT_RETURN 0
|
||||
|
||||
/* Until they use ELF or something that handles dwarf2 unwinds
|
||||
and initialization stuff better. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* Attempt to enable execute permissions on the stack. */
|
||||
#define TRANSFER_FROM_TRAMPOLINE NETBSD_ENABLE_EXECUTE_STACK
|
@ -1,51 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for sparclite 86x w/o FPU.
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__sparc__ -D__sparclite86x__ -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparclite 86x)");
|
||||
|
||||
/* Enable app-regs and epilogue options. Do not enable the fpu. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT MASK_APP_REGS
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "%{v:-v} %{mlittle-endian-data:--little-endian-data} %(asm_cpu)"
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{v:-V}"
|
||||
|
||||
#undef BYTES_BIG_ENDIAN
|
||||
#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA)
|
||||
#undef WORDS_BIG_ENDIAN
|
||||
#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN_DATA)
|
||||
|
||||
#define TARGET_LITTLE_ENDIAN_DATA (target_flags & MASK_LITTLE_ENDIAN)
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{ "little-endian-data", MASK_LITTLE_ENDIAN, N_("Use little-endian byte order for data")},
|
@ -1,46 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARClet.
|
||||
Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans (dje@cygnus.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT MASK_APP_REGS
|
||||
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
#undef SUBTARGET_SWITCHES
|
||||
#define SUBTARGET_SWITCHES \
|
||||
{"big-endian", -MASK_LITTLE_ENDIAN, N_("Generate code for big endian") }, \
|
||||
{"little-endian", MASK_LITTLE_ENDIAN, N_("Generate code for little endian") },
|
||||
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC "%{mlittle-endian:-EL} %(asm_cpu)"
|
||||
|
||||
/* Require the user to supply crt0.o. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{mlittle-endian:-EL}"
|
||||
|
||||
/* sparclet chips are bi-endian. */
|
||||
#undef BYTES_BIG_ENDIAN
|
||||
#define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
||||
#undef WORDS_BIG_ENDIAN
|
||||
#define WORDS_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
|
@ -1,22 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x with gas
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* defaults.h will define DWARF2_UNWIND_INFO for us. */
|
||||
#undef DWARF2_UNWIND_INFO
|
@ -1,11 +0,0 @@
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd"
|
||||
|
||||
/* Override the name of the mcount profiling function. */
|
||||
|
||||
#undef MCOUNT_FUNCTION
|
||||
#define MCOUNT_FUNCTION "*.mcount"
|
||||
|
||||
/* LINK_SPEC is needed only for SunOS 4. */
|
||||
|
||||
#undef LINK_SPEC
|
@ -1,48 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SunOS 4.x
|
||||
Copyright (C) 1994, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef SUNOS4_SHARED_LIBRARIES
|
||||
#define SUNOS4_SHARED_LIBRARIES 1
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Dsun -Dunix -Asystem=unix -Asystem=bsd"
|
||||
|
||||
#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
|
||||
|
||||
/* Provide required defaults for linker -e and -d switches. */
|
||||
|
||||
#define LINK_SPEC \
|
||||
"%{!shared:%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp} %{static:-Bstatic} \
|
||||
%{assert*} %{shared:%{!mimpure-text:-assert pure-text}}"
|
||||
|
||||
/* Use N_BINCL stabs. */
|
||||
|
||||
#define DBX_USE_BINCL
|
||||
|
||||
/* The Sun as doesn't like unaligned data. */
|
||||
#define DWARF2_UNWIND_INFO 0
|
||||
|
||||
/* SunOS has on_exit instead of atexit. */
|
||||
/* The man page says it returns int. */
|
||||
#ifdef IN_LIBGCC2
|
||||
extern int on_exit PARAMS ((void *, void *));
|
||||
#endif
|
||||
#define ON_EXIT(FUNC) on_exit ((FUNC), 0)
|
||||
#define NEED_ATEXIT
|
@ -1,29 +0,0 @@
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS should have msparclite too, but we'd have to make
|
||||
# gas build...
|
||||
MULTILIB_OPTIONS =
|
||||
MULTILIB_DIRNAMES =
|
||||
MULTILIB_MATCHES =
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# Assemble startup files.
|
||||
crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crti.o -x assembler $(srcdir)/config/sparc/sol2-ci.asm
|
||||
crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES)
|
||||
$(GCC_FOR_TARGET) -c -o crtn.o -x assembler $(srcdir)/config/sparc/sol2-cn.asm
|
@ -1,2 +0,0 @@
|
||||
# For a native HALOS compile, we need to set -e1 for the assembler
|
||||
AS=as -e1
|
@ -1,25 +0,0 @@
|
||||
# configuration file for a bare sparc cpu
|
||||
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
# MULTILIB_OPTIONS should have msparclite too, but we'd have to make
|
||||
# gas build...
|
||||
MULTILIB_OPTIONS = msoft-float mcpu=v8
|
||||
MULTILIB_DIRNAMES = soft v8
|
||||
MULTILIB_MATCHES = msoft-float=mno-fpu mcpu?v8=mv8
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,21 +0,0 @@
|
||||
# configuration file for a bare sparclet cpu, aout format files
|
||||
|
||||
LIB1ASMSRC = sparc/lb1spc.asm
|
||||
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
|
||||
|
||||
# We want fine grained libraries, so use the new code to build the
|
||||
# floating point emulation libraries.
|
||||
FPBIT = fp-bit.c
|
||||
DPBIT = dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c > dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS = mlittle-endian mflat
|
||||
MULTILIB_DIRNAMES = little flat
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,12 +0,0 @@
|
||||
# SunOS 4.1.*
|
||||
|
||||
MULTILIB_OPTIONS = fpic/fPIC mcpu=v8
|
||||
MULTILIB_DIRNAMES = pic ucpic v8
|
||||
MULTILIB_MATCHES = mcpu?v8=mv8
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
||||
|
||||
# The native linker doesn't handle linking -fpic code with -fPIC code. Ugh.
|
||||
# We cope by building both variants of libgcc.
|
||||
#TARGET_LIBGCC2_CFLAGS = -fPIC
|
@ -1,10 +0,0 @@
|
||||
# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
|
||||
# does not have _exit.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit
|
||||
|
||||
MULTILIB_OPTIONS=msoft-float mv8
|
||||
MULTILIB_DIRNAMES=soft v8
|
||||
MULTILIB_MATCHES=msoft-float=mno-fpu
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,23 +0,0 @@
|
||||
# We don't want to put exit in libgcc.a for VxWorks, because VxWorks
|
||||
# does not have _exit.
|
||||
TARGET_LIBGCC2_CFLAGS = -Dexit=unused_exit
|
||||
|
||||
LIB2FUNCS_EXTRA = fp-bit.c dp-bit.c
|
||||
|
||||
dp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define US_SOFTWARE_GOFAST' > dp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> dp-bit.c
|
||||
|
||||
fp-bit.c: $(srcdir)/config/fp-bit.c
|
||||
echo '#define FLOAT' > fp-bit.c
|
||||
echo '#define US_SOFTWARE_GOFAST' >> fp-bit.c
|
||||
cat $(srcdir)/config/fp-bit.c >> fp-bit.c
|
||||
|
||||
MULTILIB_OPTIONS=O0
|
||||
MULTILIB_DIRNAMES=O0
|
||||
MULTILIB_MATCHES=
|
||||
MULTILIB_EXCEPTIONS=
|
||||
MULTILIB_EXTRA_OPTS=m64 mcpu=ultrasparc
|
||||
|
||||
LIBGCC = stmp-multilib
|
||||
INSTALL_LIBGCC = install-multilib
|
@ -1,136 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler, for SPARC VxSim
|
||||
Copyright 1996 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#undef TARGET_VERSION
|
||||
#define TARGET_VERSION fprintf (stderr, " (sparc VxSim)");
|
||||
|
||||
/* Supposedly the same as vanilla sparc svr4, except for the stuff below: */
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES \
|
||||
"-DCPU=SIMSPARCSOLARIS -D__vxworks -D__vxworks__ -Dsparc -D__svr4__ -D__SVR4 \
|
||||
-Asystem=embedded -Asystem=svr4 -Acpu=sparc -Amachine=sparc\
|
||||
-D__GCC_NEW_VARARGS__"
|
||||
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC ""
|
||||
|
||||
#undef CC1_SPEC
|
||||
#define CC1_SPEC "-fno-builtin %{sun4:} %{target:}"
|
||||
|
||||
/* The sun bundled assembler doesn't accept -Yd, (and neither does gas).
|
||||
It's safe to pass -s always, even if -g is not used. */
|
||||
#undef ASM_SPEC
|
||||
#define ASM_SPEC \
|
||||
"%{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \
|
||||
%{fpic:-K PIC} %{fPIC:-K PIC}"
|
||||
|
||||
/* However it appears that Solaris 2.0 uses the same reg numbering as
|
||||
the old BSD-style system did. */
|
||||
|
||||
#undef DBX_REGISTER_NUMBER
|
||||
/* Same as sparc.h */
|
||||
#define DBX_REGISTER_NUMBER(REGNO) (REGNO)
|
||||
|
||||
/* We use stabs-in-elf for debugging, because that is what the native
|
||||
toolchain uses. */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* The Solaris 2 assembler uses .skip, not .zero, so put this back. */
|
||||
#undef ASM_OUTPUT_SKIP
|
||||
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
|
||||
fprintf (FILE, "\t.skip %u\n", (SIZE))
|
||||
|
||||
#undef ASM_OUTPUT_ALIGNED_LOCAL
|
||||
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
|
||||
do { \
|
||||
fputs ("\t.local\t", (FILE)); \
|
||||
assemble_name ((FILE), (NAME)); \
|
||||
putc ('\n', (FILE)); \
|
||||
ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \
|
||||
} while (0)
|
||||
|
||||
#undef COMMON_ASM_OP
|
||||
#define COMMON_ASM_OP "\t.common\t"
|
||||
|
||||
#undef LOCAL_LABEL_PREFIX
|
||||
#define LOCAL_LABEL_PREFIX "."
|
||||
|
||||
/* This is how to output a definition of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABEL
|
||||
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d:\n", PREFIX, NUM)
|
||||
|
||||
/* This is how to output a reference to an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class. */
|
||||
|
||||
#undef ASM_OUTPUT_INTERNAL_LABELREF
|
||||
#define ASM_OUTPUT_INTERNAL_LABELREF(FILE,PREFIX,NUM) \
|
||||
fprintf (FILE, ".L%s%d", PREFIX, NUM)
|
||||
|
||||
/* This is how to store into the string LABEL
|
||||
the symbol_ref name of an internal numbered label where
|
||||
PREFIX is the class of label and NUM is the number within the class.
|
||||
This is suitable for output with `assemble_name'. */
|
||||
|
||||
#undef ASM_GENERATE_INTERNAL_LABEL
|
||||
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
|
||||
sprintf (LABEL, "*.L%s%ld", PREFIX, (long)(NUM))
|
||||
|
||||
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef ENDFILE_SPEC
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-r"
|
||||
|
||||
/* This defines which switch letters take arguments.
|
||||
It is as in svr4.h but with -R added. */
|
||||
|
||||
#undef SWITCH_TAKES_ARG
|
||||
#define SWITCH_TAKES_ARG(CHAR) \
|
||||
( (CHAR) == 'D' \
|
||||
|| (CHAR) == 'U' \
|
||||
|| (CHAR) == 'o' \
|
||||
|| (CHAR) == 'e' \
|
||||
|| (CHAR) == 'u' \
|
||||
|| (CHAR) == 'I' \
|
||||
|| (CHAR) == 'm' \
|
||||
|| (CHAR) == 'L' \
|
||||
|| (CHAR) == 'R' \
|
||||
|| (CHAR) == 'A' \
|
||||
|| (CHAR) == 'h' \
|
||||
|| (CHAR) == 'z')
|
||||
|
||||
/* ??? This does not work in SunOS 4.x, so it is not enabled in sparc.h.
|
||||
Instead, it is enabled here, because it does work under Solaris. */
|
||||
/* Define for support of TFmode long double.
|
||||
SPARC ABI says that long double is 4 words. */
|
||||
#define LONG_DOUBLE_TYPE_SIZE 64
|
@ -1,59 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler. Vxworks SPARC version.
|
||||
Copyright (C) 1994, 1996 Free Software Foundation, Inc.
|
||||
Contributed by David Henkel-Wallace (gumby@cygnus.com)
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Specify what to link with. */
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC ""
|
||||
|
||||
/* Provide required defaults for linker -e. */
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "%{!nostdlib:%{!r*:%{!e*:-e start}}}"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dsparc -Acpu=sparc -Amachine=sparc"
|
||||
|
||||
/* Note that we define CPU here even if the user has specified -ansi.
|
||||
This violates user namespace, but the VxWorks headers, and potentially
|
||||
user code, all explicitly rely upon the definition of CPU in order to get
|
||||
the proper processor information. */
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) -DCPU=SPARC"
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#undef SIZE_TYPE
|
||||
#undef WCHAR_TYPE
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
|
||||
#define PTRDIFF_TYPE "long int"
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define WCHAR_TYPE "char"
|
||||
#define WCHAR_TYPE_SIZE 8
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
@ -1,92 +0,0 @@
|
||||
/* Definitions of target machine for GNU compiler.
|
||||
64-bit VxWorks SPARC version.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
/* Specify what to link with. */
|
||||
/* VxWorks does all the library stuff itself. */
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "-r"
|
||||
|
||||
/* VxWorks provides the functionality of crt0.o and friends itself. */
|
||||
#undef STARTFILE_SPEC
|
||||
#undef ENDFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
#define ENDFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC ""
|
||||
|
||||
/* We need to prohibit dots in constructor labels so that we can build a
|
||||
table of { string, address } entries for each non-static name in a
|
||||
program. The address, being of the form &name, it cannot contain a dot or
|
||||
C will try to parse it as a &struct.field phrase. */
|
||||
#undef NO_DOLLAR_IN_LABEL
|
||||
#undef DOLLARS_IN_IDENTIFIERS
|
||||
#define DOLLARS_IN_IDENTIFIERS 1
|
||||
#define NO_DOT_IN_LABEL
|
||||
|
||||
/* Enable #pragma pack(n) */
|
||||
#define HANDLE_SYSV_PRAGMA 1
|
||||
|
||||
/* We use stabs for debugging */
|
||||
#undef PREFERRED_DEBUGGING_TYPE
|
||||
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
|
||||
|
||||
/* Longs are still only 32bits for vxWorks, even for UltraSPARC */
|
||||
#undef LONG_TYPE_SIZE
|
||||
#define LONG_TYPE_SIZE 32
|
||||
|
||||
#undef CPP_ARCH32_SPEC
|
||||
#define CPP_ARCH32_SPEC "-Acpu(sparc) -Amachine(sparc)"
|
||||
#undef CPP_ARCH64_SPEC
|
||||
#define CPP_ARCH64_SPEC \
|
||||
"-Dsparc64 -D__arch64__ -Acpu(sparc64) -Amachine(sparc64)"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-D__vxworks -D__sparc__ -Dsparc -D__GCC_NEW_VARARGS__"
|
||||
|
||||
/* Note that we define CPU here even if the user has specified -ansi.
|
||||
This violates user namespace, but the VxWorks headers, and potentially
|
||||
user code, all explicitly rely upon the definition of CPU in order to get
|
||||
the proper processor information. */
|
||||
#undef CPP_SPEC
|
||||
#define CPP_SPEC "%(cpp_cpu) %(cpp_arch) -DCPU=ULTRASPARC -D__CPU__=CPU"
|
||||
|
||||
#undef TARGET_DEFAULT
|
||||
#define TARGET_DEFAULT (MASK_APP_REGS | MASK_FPU \
|
||||
| MASK_LONG_DOUBLE_128 | MASK_64BIT)
|
||||
|
||||
#undef SPARC_DEFAULT_CMODEL
|
||||
#define SPARC_DEFAULT_CMODEL CM_MEDLOW
|
||||
|
||||
#undef PTRDIFF_TYPE
|
||||
#undef SIZE_TYPE
|
||||
#undef WCHAR_TYPE
|
||||
#undef WCHAR_TYPE_SIZE
|
||||
|
||||
#define PTRDIFF_TYPE "long int"
|
||||
#define SIZE_TYPE "unsigned int"
|
||||
#define WCHAR_TYPE "char"
|
||||
#define WCHAR_TYPE_SIZE 8
|
||||
|
||||
/* US Software GOFAST library support. */
|
||||
#undef INIT_SUBTARGET_OPTABS
|
||||
#define INIT_SUBTARGET_OPTABS INIT_GOFAST_OPTABS
|
@ -1,2 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
@ -1,2 +0,0 @@
|
||||
# Don't run fixproto
|
||||
STMP_FIXPROTO =
|
@ -1,77 +0,0 @@
|
||||
# configure.frag for GCC
|
||||
# Process the host/target/language Makefile fragments.
|
||||
|
||||
# Copyright (C) 1997 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, 59 Temple Place - Suite 330, Boston, MA
|
||||
#02111-1307, USA.
|
||||
|
||||
# First parameter is the source directory, second is list of subdirectories,
|
||||
# third is list of host makefile fragments, fourth is list of target makefile
|
||||
# fragments.
|
||||
|
||||
srcdir=$1
|
||||
subdirs=$2
|
||||
xmake_files=$3
|
||||
tmake_files=$4
|
||||
|
||||
# Copy all the host makefile fragments into Make-host.
|
||||
|
||||
rm -f Make-host
|
||||
touch Make-host
|
||||
for f in .. $xmake_files
|
||||
do
|
||||
if [ -f $f ]
|
||||
then
|
||||
cat $f >> Make-host
|
||||
fi
|
||||
done
|
||||
|
||||
# Copy all the target makefile fragments into Make-target.
|
||||
|
||||
rm -f Make-target
|
||||
touch Make-target
|
||||
for f in .. $tmake_files
|
||||
do
|
||||
if [ -f $f ]
|
||||
then
|
||||
cat $f >> Make-target
|
||||
fi
|
||||
done
|
||||
|
||||
# Ensure the language build subdirectories exist.
|
||||
|
||||
for subdir in . $subdirs
|
||||
do
|
||||
if [ $subdir != . ]
|
||||
then
|
||||
test -d $subdir || mkdir $subdir
|
||||
fi
|
||||
done
|
||||
|
||||
# Now copy each language's Make-lang.in file to Make-lang.
|
||||
|
||||
rm -f Make-lang
|
||||
touch Make-lang
|
||||
|
||||
for subdir in . $subdirs
|
||||
do
|
||||
if [ $subdir != . ]
|
||||
then
|
||||
cat $srcdir/$subdir/Make-lang.in >> Make-lang
|
||||
fi
|
||||
done
|
File diff suppressed because it is too large
Load Diff
@ -1,159 +0,0 @@
|
||||
/* Definitions for switches for C++.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
DEFINE_LANG_NAME ("C++")
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for g++. */
|
||||
|
||||
{ "-faccess-control", "" },
|
||||
{ "-fno-access-control",
|
||||
N_("Do not obey access control semantics") },
|
||||
{ "-falt-external-templates",
|
||||
N_("Change when template instances are emitted") },
|
||||
{ "-fno-alt-external-templates", "" },
|
||||
{ "-fansi-overloading", "" },
|
||||
{ "-fno-ansi-overloading", "" },
|
||||
{ "-fcheck-new",
|
||||
N_("Check the return value of new") },
|
||||
{ "-fno-check-new", "" },
|
||||
{ "-fconserve-space",
|
||||
N_("Reduce size of object files") },
|
||||
{ "-fno-conserve-space", "" },
|
||||
{ "-fconst-strings", "" },
|
||||
{ "-fno-const-strings",
|
||||
N_("Make string literals `char[]' instead of `const char[]'") },
|
||||
{ "-fdefault-inline", "" },
|
||||
{ "-fdump-translation-unit-",
|
||||
N_("Dump the entire translation unit to a file") },
|
||||
{ "-fno-default-inline",
|
||||
N_("Do not inline member functions by default") },
|
||||
{ "-frtti", "" },
|
||||
{ "-fno-rtti",
|
||||
N_("Do not generate run time type descriptor information") },
|
||||
{ "-felide-constructors", "" },
|
||||
{ "-fno-elide-constructors", "" },
|
||||
{ "-fenforce-eh-specs", "" },
|
||||
{ "-fno-enforce-eh-specs",
|
||||
N_("Do not generate code to check exception specifications") },
|
||||
{ "-fexternal-templates", "" },
|
||||
{ "-fno-external-templates", "" },
|
||||
{ "-ffor-scope", "" },
|
||||
{ "-fno-for-scope",
|
||||
N_("Scope of for-init-statement vars extends outside") },
|
||||
{ "-fgnu-keywords", "" },
|
||||
{ "-fno-gnu-keywords",
|
||||
N_("Do not recognize GNU defined keywords") },
|
||||
{ "-fhandle-exceptions", "" },
|
||||
{ "-fno-handle-exceptions", "" },
|
||||
{ "-fhuge-objects",
|
||||
N_("Enable support for huge objects") },
|
||||
{ "-fno-huge-objects", "" },
|
||||
{ "-fimplement-inlines", "" },
|
||||
{ "-fno-implement-inlines",
|
||||
N_("Export functions even if they can be inlined") },
|
||||
{ "-fimplicit-templates", "" },
|
||||
{ "-fno-implicit-templates",
|
||||
N_("Only emit explicit template instantiations") },
|
||||
{ "-fimplicit-inline-templates", "" },
|
||||
{ "-fno-implicit-inline-templates",
|
||||
N_("Only emit explicit instantiations of inline templates") },
|
||||
{ "-finit-priority", "" },
|
||||
{ "-fno-init-priority", "" },
|
||||
{ "-fmemoize-lookups", "" },
|
||||
{ "-fno-memoize-lookups", "" },
|
||||
{ "-fms-extensions",
|
||||
N_("Don't pedwarn about uses of Microsoft extensions") },
|
||||
{ "-fno-ms-extensions", "" },
|
||||
{ "-foperator-names",
|
||||
N_("Recognize and/bitand/bitor/compl/not/or/xor") },
|
||||
{ "-fno-operator-names", "" },
|
||||
{ "-foptional-diags", "" },
|
||||
{ "-fno-optional-diags",
|
||||
N_("Disable optional diagnostics") },
|
||||
{ "-fpermissive",
|
||||
N_("Downgrade conformance errors to warnings") },
|
||||
{ "-fno-permissive", "" },
|
||||
{ "-frepo",
|
||||
N_("Enable automatic template instantiation") },
|
||||
{ "-fno-repo", "" },
|
||||
{ "-fsave-memoized", "" },
|
||||
{ "-fno-save-memoized", "" },
|
||||
{ "-fstats",
|
||||
N_("Display statistics accumulated during compilation") },
|
||||
{ "-fno-stats", "" },
|
||||
{ "-ftemplate-depth-",
|
||||
N_("Specify maximum template instantiation depth") },
|
||||
{ "-fuse-cxa-atexit",
|
||||
N_("Use __cxa_atexit to register destructors") },
|
||||
{ "-fno-use-cxa-atexit", "" },
|
||||
{ "-fvtable-gc",
|
||||
N_("Discard unused virtual functions") },
|
||||
{ "-fno-vtable-gc", "" },
|
||||
{ "-fvtable-thunks",
|
||||
N_("Implement vtables using thunks") },
|
||||
{ "-fno-vtable-thunks", "" },
|
||||
{ "-fweak",
|
||||
N_("Emit common-like symbols as weak symbols") },
|
||||
{ "-fno-weak", "" },
|
||||
{ "-fxref",
|
||||
N_("Emit cross referencing information") },
|
||||
{ "-fno-xref", "" },
|
||||
|
||||
{ "-Wreturn-type",
|
||||
N_("Warn about inconsistent return types") },
|
||||
{ "-Wno-return-type", "" },
|
||||
{ "-Woverloaded-virtual",
|
||||
N_("Warn about overloaded virtual function names") },
|
||||
{ "-Wno-overloaded-virtual", "" },
|
||||
{ "-Wctor-dtor-privacy", "" },
|
||||
{ "-Wno-ctor-dtor-privacy",
|
||||
N_("Don't warn when all ctors/dtors are private") },
|
||||
{ "-Wnon-virtual-dtor",
|
||||
N_("Warn about non virtual destructors") },
|
||||
{ "-Wno-non-virtual-dtor", "" },
|
||||
{ "-Wextern-inline",
|
||||
N_("Warn when a function is declared extern, then inline") },
|
||||
{ "-Wno-extern-inline", "" },
|
||||
{ "-Wreorder",
|
||||
N_("Warn when the compiler reorders code") },
|
||||
{ "-Wno-reorder", "" },
|
||||
{ "-Wsynth",
|
||||
N_("Warn when synthesis behavior differs from Cfront") },
|
||||
{ "-Wno-synth", "" },
|
||||
{ "-Wpmf-conversions", "" },
|
||||
{ "-Wno-pmf-conversions",
|
||||
N_("Don't warn when type converting pointers to member functions") },
|
||||
{ "-Weffc++",
|
||||
N_("Warn about violations of Effective C++ style rules") },
|
||||
{ "-Wno-effc++", "" },
|
||||
{ "-Wsign-promo",
|
||||
N_("Warn when overload promotes from unsigned to signed") },
|
||||
{ "-Wno-sign-promo", "" },
|
||||
{ "-Wold-style-cast",
|
||||
N_("Warn if a C style cast is used in a program") },
|
||||
{ "-Wno-old-style-cast", "" },
|
||||
{ "-Wnon-template-friend", "" },
|
||||
{ "-Wno-non-template-friend",
|
||||
N_("Don't warn when non-templatized friend functions are declared within a template") },
|
||||
{ "-Wdeprecated", "" },
|
||||
{ "-Wno-deprecated",
|
||||
N_("Don't announce deprecation of compiler features") },
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,432 +0,0 @@
|
||||
/* Preprocess only, using cpplib.
|
||||
Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Written by Per Bothner, 1994-95.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
In other words, you are welcome to use, share and improve this program.
|
||||
You are forbidden to forbid anyone else to use, share and improve
|
||||
what you give them. Help stamp out software-hoarding! */
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "cpplib.h"
|
||||
#include "cpphash.h"
|
||||
|
||||
static void setup_callbacks PARAMS ((cpp_reader *));
|
||||
|
||||
/* General output routines. */
|
||||
static void scan_translation_unit PARAMS ((cpp_reader *));
|
||||
static void scan_translation_unit_trad PARAMS ((cpp_reader *));
|
||||
static void account_for_newlines PARAMS ((cpp_reader *, const uchar *,
|
||||
size_t));
|
||||
static int dump_macro PARAMS ((cpp_reader *, cpp_hashnode *, void *));
|
||||
|
||||
static void print_line PARAMS ((cpp_reader *, const struct line_map *,
|
||||
unsigned int, const char *));
|
||||
static void maybe_print_line PARAMS ((cpp_reader *, const struct line_map *,
|
||||
unsigned int));
|
||||
|
||||
/* Callback routines for the parser. Most of these are active only
|
||||
in specific modes. */
|
||||
static void cb_line_change PARAMS ((cpp_reader *, const cpp_token *, int));
|
||||
static void cb_define PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||
static void cb_undef PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
|
||||
static void cb_include PARAMS ((cpp_reader *, unsigned int,
|
||||
const unsigned char *, const cpp_token *));
|
||||
static void cb_ident PARAMS ((cpp_reader *, unsigned int,
|
||||
const cpp_string *));
|
||||
static void cb_file_change PARAMS ((cpp_reader *, const struct line_map *));
|
||||
static void cb_def_pragma PARAMS ((cpp_reader *, unsigned int));
|
||||
|
||||
/* Preprocess and output. */
|
||||
void
|
||||
cpp_preprocess_file (pfile, in_fname, out_stream)
|
||||
cpp_reader *pfile;
|
||||
const char *in_fname;
|
||||
FILE *out_stream;
|
||||
{
|
||||
/* Initialize the printer structure. Setting print.line to -1 here
|
||||
is a trick to guarantee that the first token of the file will
|
||||
cause a linemarker to be output by maybe_print_line. */
|
||||
pfile->print.line = (unsigned int) -1;
|
||||
pfile->print.printed = 0;
|
||||
pfile->print.prev = 0;
|
||||
pfile->print.map = 0;
|
||||
pfile->print.outf = out_stream;
|
||||
|
||||
setup_callbacks (pfile);
|
||||
|
||||
if (cpp_read_main_file (pfile, in_fname, NULL))
|
||||
{
|
||||
cpp_options *options = &pfile->opts;
|
||||
cpp_finish_options (pfile);
|
||||
|
||||
/* A successful cpp_read_main_file guarantees that we can call
|
||||
cpp_scan_nooutput or cpp_get_token next. */
|
||||
if (options->no_output)
|
||||
{
|
||||
/* Scan -included buffers, then the main file. */
|
||||
while (pfile->buffer->prev)
|
||||
cpp_scan_nooutput (pfile);
|
||||
cpp_scan_nooutput (pfile);
|
||||
}
|
||||
else if (options->traditional)
|
||||
scan_translation_unit_trad (pfile);
|
||||
else
|
||||
scan_translation_unit (pfile);
|
||||
|
||||
/* -dM command line option. Should this be in cpp_finish? */
|
||||
if (options->dump_macros == dump_only)
|
||||
cpp_forall_identifiers (pfile, dump_macro, NULL);
|
||||
}
|
||||
|
||||
/* Flush any pending output. */
|
||||
if (pfile->print.printed)
|
||||
putc ('\n', pfile->print.outf);
|
||||
}
|
||||
|
||||
/* Set up the callbacks as appropriate. */
|
||||
static void
|
||||
setup_callbacks (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
cpp_options *options = &pfile->opts;
|
||||
cpp_callbacks *cb = cpp_get_callbacks (pfile);
|
||||
|
||||
if (! options->no_output)
|
||||
{
|
||||
cb->line_change = cb_line_change;
|
||||
/* Don't emit #pragma or #ident directives if we are processing
|
||||
assembly language; the assembler may choke on them. */
|
||||
if (options->lang != CLK_ASM)
|
||||
{
|
||||
cb->ident = cb_ident;
|
||||
cb->def_pragma = cb_def_pragma;
|
||||
}
|
||||
if (! options->no_line_commands)
|
||||
cb->file_change = cb_file_change;
|
||||
}
|
||||
|
||||
if (options->dump_includes)
|
||||
cb->include = cb_include;
|
||||
|
||||
if (options->dump_macros == dump_names
|
||||
|| options->dump_macros == dump_definitions)
|
||||
{
|
||||
cb->define = cb_define;
|
||||
cb->undef = cb_undef;
|
||||
}
|
||||
}
|
||||
|
||||
/* Writes out the preprocessed file, handling spacing and paste
|
||||
avoidance issues. */
|
||||
static void
|
||||
scan_translation_unit (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
bool avoid_paste = false;
|
||||
|
||||
pfile->print.source = NULL;
|
||||
for (;;)
|
||||
{
|
||||
const cpp_token *token = cpp_get_token (pfile);
|
||||
|
||||
if (token->type == CPP_PADDING)
|
||||
{
|
||||
avoid_paste = true;
|
||||
if (pfile->print.source == NULL
|
||||
|| (!(pfile->print.source->flags & PREV_WHITE)
|
||||
&& token->val.source == NULL))
|
||||
pfile->print.source = token->val.source;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (token->type == CPP_EOF)
|
||||
break;
|
||||
|
||||
/* Subtle logic to output a space if and only if necessary. */
|
||||
if (avoid_paste)
|
||||
{
|
||||
if (pfile->print.source == NULL)
|
||||
pfile->print.source = token;
|
||||
if (pfile->print.source->flags & PREV_WHITE
|
||||
|| (pfile->print.prev
|
||||
&& cpp_avoid_paste (pfile, pfile->print.prev, token))
|
||||
|| (pfile->print.prev == NULL && token->type == CPP_HASH))
|
||||
putc (' ', pfile->print.outf);
|
||||
}
|
||||
else if (token->flags & PREV_WHITE)
|
||||
putc (' ', pfile->print.outf);
|
||||
|
||||
avoid_paste = false;
|
||||
pfile->print.source = NULL;
|
||||
pfile->print.prev = token;
|
||||
cpp_output_token (token, pfile->print.outf);
|
||||
|
||||
if (token->type == CPP_COMMENT)
|
||||
account_for_newlines (pfile, token->val.str.text, token->val.str.len);
|
||||
}
|
||||
}
|
||||
|
||||
/* Adjust pfile->print.line for newlines embedded in output. */
|
||||
static void
|
||||
account_for_newlines (pfile, str, len)
|
||||
cpp_reader *pfile;
|
||||
const uchar *str;
|
||||
size_t len;
|
||||
{
|
||||
while (len--)
|
||||
if (*str++ == '\n')
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* Writes out a traditionally preprocessed file. */
|
||||
static void
|
||||
scan_translation_unit_trad (pfile)
|
||||
cpp_reader *pfile;
|
||||
{
|
||||
while (_cpp_read_logical_line_trad (pfile))
|
||||
{
|
||||
size_t len = pfile->out.cur - pfile->out.base;
|
||||
maybe_print_line (pfile, pfile->print.map, pfile->out.first_line);
|
||||
fwrite (pfile->out.base, 1, len, pfile->print.outf);
|
||||
pfile->print.printed = 1;
|
||||
if (!CPP_OPTION (pfile, discard_comments))
|
||||
account_for_newlines (pfile, pfile->out.base, len);
|
||||
}
|
||||
}
|
||||
|
||||
/* If the token read on logical line LINE needs to be output on a
|
||||
different line to the current one, output the required newlines or
|
||||
a line marker, and return 1. Otherwise return 0. */
|
||||
static void
|
||||
maybe_print_line (pfile, map, line)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
unsigned int line;
|
||||
{
|
||||
/* End the previous line of text. */
|
||||
if (pfile->print.printed)
|
||||
{
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
pfile->print.printed = 0;
|
||||
}
|
||||
|
||||
if (line >= pfile->print.line && line < pfile->print.line + 8)
|
||||
{
|
||||
while (line > pfile->print.line)
|
||||
{
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
}
|
||||
else
|
||||
print_line (pfile, map, line, "");
|
||||
}
|
||||
|
||||
/* Output a line marker for logical line LINE. Special flags are "1"
|
||||
or "2" indicating entering or leaving a file. */
|
||||
static void
|
||||
print_line (pfile, map, line, special_flags)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
unsigned int line;
|
||||
const char *special_flags;
|
||||
{
|
||||
/* End any previous line of text. */
|
||||
if (pfile->print.printed)
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.printed = 0;
|
||||
|
||||
pfile->print.line = line;
|
||||
if (! CPP_OPTION (pfile, no_line_commands))
|
||||
{
|
||||
size_t to_file_len = strlen (map->to_file);
|
||||
unsigned char *to_file_quoted = alloca (to_file_len * 4 + 1);
|
||||
unsigned char *p;
|
||||
|
||||
/* cpp_quote_string does not nul-terminate, so we have to do it
|
||||
ourselves. */
|
||||
p = cpp_quote_string (to_file_quoted,
|
||||
(unsigned char *)map->to_file, to_file_len);
|
||||
*p = '\0';
|
||||
fprintf (pfile->print.outf, "# %u \"%s\"%s",
|
||||
SOURCE_LINE (map, pfile->print.line),
|
||||
to_file_quoted, special_flags);
|
||||
|
||||
if (map->sysp == 2)
|
||||
fputs (" 3 4", pfile->print.outf);
|
||||
else if (map->sysp == 1)
|
||||
fputs (" 3", pfile->print.outf);
|
||||
|
||||
putc ('\n', pfile->print.outf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Called when a line of output is started. TOKEN is the first token
|
||||
of the line, and at end of file will be CPP_EOF. */
|
||||
static void
|
||||
cb_line_change (pfile, token, parsing_args)
|
||||
cpp_reader *pfile;
|
||||
const cpp_token *token;
|
||||
int parsing_args;
|
||||
{
|
||||
if (token->type == CPP_EOF || parsing_args)
|
||||
return;
|
||||
|
||||
maybe_print_line (pfile, pfile->print.map, token->line);
|
||||
pfile->print.prev = 0;
|
||||
pfile->print.source = 0;
|
||||
|
||||
/* Supply enough spaces to put this token in its original column,
|
||||
one space per column greater than 2, since scan_translation_unit
|
||||
will provide a space if PREV_WHITE. Don't bother trying to
|
||||
reconstruct tabs; we can't get it right in general, and nothing
|
||||
ought to care. Some things do care; the fault lies with them. */
|
||||
if (!CPP_OPTION (pfile, traditional))
|
||||
{
|
||||
pfile->print.printed = 1;
|
||||
if (token->col > 2)
|
||||
{
|
||||
unsigned int spaces = token->col - 2;
|
||||
|
||||
while (spaces--)
|
||||
putc (' ', pfile->print.outf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cb_ident (pfile, line, str)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
const cpp_string * str;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#ident \"%s\"\n", str->text);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_define (pfile, line, node)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
cpp_hashnode *node;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fputs ("#define ", pfile->print.outf);
|
||||
|
||||
/* -dD command line option. */
|
||||
if (CPP_OPTION (pfile, dump_macros) == dump_definitions)
|
||||
fputs ((const char *) cpp_macro_definition (pfile, node),
|
||||
pfile->print.outf);
|
||||
else
|
||||
fputs ((const char *) NODE_NAME (node), pfile->print.outf);
|
||||
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_undef (pfile, line, node)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
cpp_hashnode *node;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#undef %s\n", NODE_NAME (node));
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
static void
|
||||
cb_include (pfile, line, dir, header)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
const unsigned char *dir;
|
||||
const cpp_token *header;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fprintf (pfile->print.outf, "#%s %s\n", dir,
|
||||
cpp_token_as_text (pfile, header));
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* The file name, line number or system header flags have changed, as
|
||||
described in MAP. From this point on, the old pfile->print.map might be
|
||||
pointing to freed memory, and so must not be dereferenced. */
|
||||
|
||||
static void
|
||||
cb_file_change (pfile, map)
|
||||
cpp_reader *pfile;
|
||||
const struct line_map *map;
|
||||
{
|
||||
const char *flags = "";
|
||||
|
||||
/* First time? */
|
||||
if (pfile->print.map == NULL)
|
||||
{
|
||||
/* Avoid printing foo.i when the main file is foo.c. */
|
||||
if (!CPP_OPTION (pfile, preprocessed))
|
||||
print_line (pfile, map, map->from_line, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bring current file to correct line when entering a new file. */
|
||||
if (map->reason == LC_ENTER)
|
||||
maybe_print_line (pfile, map - 1, map->from_line - 1);
|
||||
|
||||
if (map->reason == LC_ENTER)
|
||||
flags = " 1";
|
||||
else if (map->reason == LC_LEAVE)
|
||||
flags = " 2";
|
||||
print_line (pfile, map, map->from_line, flags);
|
||||
}
|
||||
|
||||
pfile->print.map = map;
|
||||
}
|
||||
|
||||
/* Copy a #pragma directive to the preprocessed output. */
|
||||
static void
|
||||
cb_def_pragma (pfile, line)
|
||||
cpp_reader *pfile;
|
||||
unsigned int line;
|
||||
{
|
||||
maybe_print_line (pfile, pfile->print.map, line);
|
||||
fputs ("#pragma ", pfile->print.outf);
|
||||
cpp_output_line (pfile, pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
/* Dump out the hash table. */
|
||||
static int
|
||||
dump_macro (pfile, node, v)
|
||||
cpp_reader *pfile;
|
||||
cpp_hashnode *node;
|
||||
void *v ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (node->type == NT_MACRO && !(node->flags & NODE_BUILTIN))
|
||||
{
|
||||
fputs ("#define ", pfile->print.outf);
|
||||
fputs ((const char *) cpp_macro_definition (pfile, node),
|
||||
pfile->print.outf);
|
||||
putc ('\n', pfile->print.outf);
|
||||
pfile->print.line++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
/* Storage classes in XCOFF object file format designed for DBX's use.
|
||||
This info is from the `Files Reference' manual for IBM's AIX version 3
|
||||
for the RS6000. */
|
||||
|
||||
#define C_GSYM 0x80
|
||||
#define C_LSYM 0x81
|
||||
#define C_PSYM 0x82
|
||||
#define C_RSYM 0x83
|
||||
#define C_RPSYM 0x84
|
||||
#define C_STSYM 0x85
|
||||
|
||||
#define C_BCOMM 0x87
|
||||
#define C_ECOML 0x88
|
||||
#define C_ECOMM 0x89
|
||||
#define C_DECL 0x8c
|
||||
#define C_ENTRY 0x8d
|
||||
#define C_FUN 0x8e
|
@ -1,725 +0,0 @@
|
||||
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file install.texi.
|
||||
|
||||
@ifnothtml
|
||||
@comment node-name, next, previous, up
|
||||
@node Old, GNU Free Documentation License, Specific, Top
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h1 align="center">Old installation documentation</h1>
|
||||
@end html
|
||||
@ifnothtml
|
||||
@chapter Old installation documentation
|
||||
@end ifnothtml
|
||||
|
||||
Note most of this information is out of date and superseded by the
|
||||
previous chapters of this manual. It is provided for historical
|
||||
reference only, because of a lack of volunteers to merge it into the
|
||||
main manual.
|
||||
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Configurations:: Configurations Supported by GNU CC.
|
||||
* Cross-Compiler:: Building and installing a cross-compiler.
|
||||
* VMS Install:: See below for installation on VMS.
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
Here is the procedure for installing GNU CC on a GNU or Unix system.
|
||||
See @ref{VMS Install}, for VMS systems.
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
If you have chosen a configuration for GNU CC which requires other GNU
|
||||
tools (such as GAS or the GNU linker) instead of the standard system
|
||||
tools, install the required tools in the build directory under the names
|
||||
@file{as}, @file{ld} or whatever is appropriate. This will enable the
|
||||
compiler to find the proper tools for compilation of the program
|
||||
@file{enquire}.
|
||||
|
||||
Alternatively, you can do subsequent compilation using a value of the
|
||||
@code{PATH} environment variable such that the necessary GNU tools come
|
||||
before the standard system tools.
|
||||
|
||||
@item
|
||||
Specify the host, build and target machine configurations. You do this
|
||||
when you run the @file{configure} script.
|
||||
|
||||
The @dfn{build} machine is the system which you are using, the
|
||||
@dfn{host} machine is the system where you want to run the resulting
|
||||
compiler (normally the build machine), and the @dfn{target} machine is
|
||||
the system for which you want the compiler to generate code.
|
||||
|
||||
If you are building a compiler to produce code for the machine it runs
|
||||
on (a native compiler), you normally do not need to specify any operands
|
||||
to @file{configure}; it will try to guess the type of machine you are on
|
||||
and use that as the build, host and target machines. So you don't need
|
||||
to specify a configuration when building a native compiler unless
|
||||
@file{configure} cannot figure out what your configuration is or guesses
|
||||
wrong.
|
||||
|
||||
In those cases, specify the build machine's @dfn{configuration name}
|
||||
with the @option{--host} option; the host and target will default to be
|
||||
the same as the host machine. (If you are building a cross-compiler,
|
||||
see @ref{Cross-Compiler}.)
|
||||
|
||||
Here is an example:
|
||||
|
||||
@smallexample
|
||||
./configure --host=sparc-sun-sunos4.1
|
||||
@end smallexample
|
||||
|
||||
A configuration name may be canonical or it may be more or less
|
||||
abbreviated.
|
||||
|
||||
A canonical configuration name has three parts, separated by dashes.
|
||||
It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
|
||||
(The three parts may themselves contain dashes; @file{configure}
|
||||
can figure out which dashes serve which purpose.) For example,
|
||||
@samp{m68k-sun-sunos4.1} specifies a Sun 3.
|
||||
|
||||
You can also replace parts of the configuration by nicknames or aliases.
|
||||
For example, @samp{sun3} stands for @samp{m68k-sun}, so
|
||||
@samp{sun3-sunos4.1} is another way to specify a Sun 3.
|
||||
|
||||
You can specify a version number after any of the system types, and some
|
||||
of the CPU types. In most cases, the version is irrelevant, and will be
|
||||
ignored. So you might as well specify the version if you know it.
|
||||
|
||||
See @ref{Configurations}, for a list of supported configuration names and
|
||||
notes on many of the configurations. You should check the notes in that
|
||||
section before proceeding any further with the installation of GNU CC@.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@ifnothtml
|
||||
@node Configurations, Cross-Compiler, , Old
|
||||
@section Configurations Supported by GNU CC
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{Configurations}Configurations Supported by GNU CC</h2>
|
||||
@end html
|
||||
@cindex configurations supported by GNU CC
|
||||
|
||||
Here are the possible CPU types:
|
||||
|
||||
@quotation
|
||||
@c gmicro, fx80, spur and tahoe omitted since they don't work.
|
||||
1750a, a29k, alpha, arm, avr, c@var{n}, clipper, dsp16xx, elxsi, fr30, h8300,
|
||||
hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860, i960, m32r,
|
||||
m68000, m68k, m6811, m6812, m88k, mcore, mips, mipsel, mips64, mips64el,
|
||||
mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle, romp, rs6000, sh, sparc,
|
||||
sparclite, sparc64, v850, vax, we32k.
|
||||
@end quotation
|
||||
|
||||
Here are the recognized company names. As you can see, customary
|
||||
abbreviations are used rather than the longer official names.
|
||||
|
||||
@c What should be done about merlin, tek*, dolphin?
|
||||
@quotation
|
||||
acorn, alliant, altos, apollo, apple, att, bull,
|
||||
cbm, convergent, convex, crds, dec, dg, dolphin,
|
||||
elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi,
|
||||
mips, motorola, ncr, next, ns, omron, plexus,
|
||||
sequent, sgi, sony, sun, tti, unicom, wrs.
|
||||
@end quotation
|
||||
|
||||
The company name is meaningful only to disambiguate when the rest of
|
||||
the information supplied is insufficient. You can omit it, writing
|
||||
just @samp{@var{cpu}-@var{system}}, if it is not needed. For example,
|
||||
@samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
|
||||
|
||||
Here is a list of system types:
|
||||
|
||||
@quotation
|
||||
386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux,
|
||||
dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux,
|
||||
linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs,
|
||||
netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim,
|
||||
solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta,
|
||||
vxworks, winnt, xenix.
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
You can omit the system type; then @file{configure} guesses the
|
||||
operating system from the CPU and company.
|
||||
|
||||
You can add a version number to the system type; this may or may not
|
||||
make a difference. For example, you can write @samp{bsd4.3} or
|
||||
@samp{bsd4.4} to distinguish versions of BSD@. In practice, the version
|
||||
number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
|
||||
treated differently.
|
||||
|
||||
@samp{linux-gnu} is the canonical name for the GNU/Linux target; however
|
||||
GNU CC will also accept @samp{linux}. The version of the kernel in use is
|
||||
not relevant on these systems. A suffix such as @samp{libc1} or @samp{aout}
|
||||
distinguishes major versions of the C library; all of the suffixed versions
|
||||
are obsolete.
|
||||
|
||||
If you specify an impossible combination such as @samp{i860-dg-vms},
|
||||
then you may get an error message from @file{configure}, or it may
|
||||
ignore part of the information and do the best it can with the rest.
|
||||
@file{configure} always prints the canonical name for the alternative
|
||||
that it used. GNU CC does not support all possible alternatives.
|
||||
|
||||
Often a particular model of machine has a name. Many machine names are
|
||||
recognized as aliases for CPU/company combinations. Thus, the machine
|
||||
name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
|
||||
Sometimes we accept a company name as a machine name, when the name is
|
||||
popularly used for a particular machine. Here is a table of the known
|
||||
machine names:
|
||||
|
||||
@quotation
|
||||
3300, 3b1, 3b@var{n}, 7300, altos3068, altos,
|
||||
apollo68, att-7300, balance,
|
||||
convex-c@var{n}, crds, decstation-3100,
|
||||
decstation, delta, encore,
|
||||
fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
|
||||
hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
|
||||
hp9k8@var{nn}, iris4d, iris, isi68,
|
||||
m3230, magnum, merlin, miniframe,
|
||||
mmax, news-3600, news800, news, next,
|
||||
pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news,
|
||||
rtpc, sun2, sun386i, sun386, sun3,
|
||||
sun4, symmetry, tower-32, tower.
|
||||
@end quotation
|
||||
|
||||
@noindent
|
||||
Remember that a machine name specifies both the cpu type and the company
|
||||
name.
|
||||
If you want to install your own homemade configuration files, you can
|
||||
use @samp{local} as the company name to access them. If you use
|
||||
configuration @samp{@var{cpu}-local}, the configuration name
|
||||
without the cpu prefix
|
||||
is used to form the configuration file names.
|
||||
|
||||
Thus, if you specify @samp{m68k-local}, configuration uses
|
||||
files @file{m68k.md}, @file{local.h}, @file{m68k.c},
|
||||
@file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the
|
||||
directory @file{config/m68k}.
|
||||
|
||||
Here is a list of configurations that have special treatment or special
|
||||
things you must know:
|
||||
|
||||
@table @samp
|
||||
@item vax-dec-vms
|
||||
See @ref{VMS Install}, for details on how to install GNU CC on VMS@.
|
||||
@end table
|
||||
|
||||
@ifnothtml
|
||||
@node Cross-Compiler, VMS Install, Configurations, Old
|
||||
@section Building and Installing a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{Cross-Compiler}Building and Installing a Cross-Compiler</h2>
|
||||
@end html
|
||||
@cindex cross-compiler, installation
|
||||
|
||||
GNU CC can function as a cross-compiler for many machines, but not all.
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Cross-compilers for the Mips as target using the Mips assembler
|
||||
currently do not work, because the auxiliary programs
|
||||
@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on
|
||||
anything but a Mips. It does work to cross compile for a Mips
|
||||
if you use the GNU assembler and linker.
|
||||
|
||||
@item
|
||||
Cross-compilers between machines with different floating point formats
|
||||
have not all been made to work. GNU CC now has a floating point
|
||||
emulator with which these can work, but each target machine description
|
||||
needs to be updated to take advantage of it.
|
||||
|
||||
@item
|
||||
Cross-compilation between machines of different word sizes is
|
||||
somewhat problematic and sometimes does not work.
|
||||
@end itemize
|
||||
|
||||
Since GNU CC generates assembler code, you probably need a
|
||||
cross-assembler that GNU CC can run, in order to produce object files.
|
||||
If you want to link on other than the target machine, you need a
|
||||
cross-linker as well. You also need header files and libraries suitable
|
||||
for the target machine that you can install on the host machine.
|
||||
|
||||
@ifnothtml
|
||||
@menu
|
||||
* Steps of Cross:: Using a cross-compiler involves several steps
|
||||
that may be carried out on different machines.
|
||||
* Configure Cross:: Configuring a cross-compiler.
|
||||
* Tools and Libraries:: Where to put the linker and assembler, and the C library.
|
||||
* Cross Headers:: Finding and installing header files
|
||||
for a cross-compiler.
|
||||
* Build Cross:: Actually compiling the cross-compiler.
|
||||
@end menu
|
||||
@end ifnothtml
|
||||
|
||||
@ifnothtml
|
||||
@node Steps of Cross, Configure Cross, , Cross-Compiler
|
||||
@subsection Steps of Cross-Compilation
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Steps of Cross-Compilation</h2>
|
||||
@end html
|
||||
|
||||
To compile and run a program using a cross-compiler involves several
|
||||
steps:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Run the cross-compiler on the host machine to produce assembler files
|
||||
for the target machine. This requires header files for the target
|
||||
machine.
|
||||
|
||||
@item
|
||||
Assemble the files produced by the cross-compiler. You can do this
|
||||
either with an assembler on the target machine, or with a
|
||||
cross-assembler on the host machine.
|
||||
|
||||
@item
|
||||
Link those files to make an executable. You can do this either with a
|
||||
linker on the target machine, or with a cross-linker on the host
|
||||
machine. Whichever machine you use, you need libraries and certain
|
||||
startup files (typically @file{crt@dots{}.o}) for the target machine.
|
||||
@end itemize
|
||||
|
||||
It is most convenient to do all of these steps on the same host machine,
|
||||
since then you can do it all with a single invocation of GNU CC@. This
|
||||
requires a suitable cross-assembler and cross-linker. For some targets,
|
||||
the GNU assembler and linker are available.
|
||||
|
||||
@ifnothtml
|
||||
@node Configure Cross, Tools and Libraries, Steps of Cross, Cross-Compiler
|
||||
@subsection Configuring a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Configuring a Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
To build GNU CC as a cross-compiler, you start out by running
|
||||
@file{configure}. Use the @option{--target=@var{target}} to specify the
|
||||
target type. If @file{configure} was unable to correctly identify the
|
||||
system you are running on, also specify the @option{--build=@var{build}}
|
||||
option. For example, here is how to configure for a cross-compiler that
|
||||
produces code for an HP 68030 system running BSD on a system that
|
||||
@file{configure} can correctly identify:
|
||||
|
||||
@smallexample
|
||||
./configure --target=m68k-hp-bsd4.3
|
||||
@end smallexample
|
||||
|
||||
@ifnothtml
|
||||
@node Tools and Libraries, Cross Headers, Configure Cross, Cross-Compiler
|
||||
@subsection Tools and Libraries for a Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Tools and Libraries for a Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
If you have a cross-assembler and cross-linker available, you should
|
||||
install them now. Put them in the directory
|
||||
@file{/usr/local/@var{target}/bin}. Here is a table of the tools
|
||||
you should put in this directory:
|
||||
|
||||
@table @file
|
||||
@item as
|
||||
This should be the cross-assembler.
|
||||
|
||||
@item ld
|
||||
This should be the cross-linker.
|
||||
|
||||
@item ar
|
||||
This should be the cross-archiver: a program which can manipulate
|
||||
archive files (linker libraries) in the target machine's format.
|
||||
|
||||
@item ranlib
|
||||
This should be a program to construct a symbol table in an archive file.
|
||||
@end table
|
||||
|
||||
The installation of GNU CC will find these programs in that directory,
|
||||
and copy or link them to the proper place to for the cross-compiler to
|
||||
find them when run later.
|
||||
|
||||
The easiest way to provide these files is to build the Binutils package
|
||||
and GAS@. Configure them with the same @option{--host} and @option{--target}
|
||||
options that you use for configuring GNU CC, then build and install
|
||||
them. They install their executables automatically into the proper
|
||||
directory. Alas, they do not support all the targets that GNU CC
|
||||
supports.
|
||||
|
||||
If you want to install libraries to use with the cross-compiler, such as
|
||||
a standard C library, put them in the directory
|
||||
@file{/usr/local/@var{target}/lib}; installation of GNU CC copies
|
||||
all the files in that subdirectory into the proper place for GNU CC to
|
||||
find them and link with them. Here's an example of copying some
|
||||
libraries from a target machine:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/lib
|
||||
cd /lib
|
||||
get libc.a
|
||||
cd /usr/lib
|
||||
get libg.a
|
||||
get libm.a
|
||||
quit
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
The precise set of libraries you'll need, and their locations on
|
||||
the target machine, vary depending on its operating system.
|
||||
|
||||
@cindex start files
|
||||
Many targets require ``start files'' such as @file{crt0.o} and
|
||||
@file{crtn.o} which are linked into each executable; these too should be
|
||||
placed in @file{/usr/local/@var{target}/lib}. There may be several
|
||||
alternatives for @file{crt0.o}, for use with profiling or other
|
||||
compilation options. Check your target's definition of
|
||||
@code{STARTFILE_SPEC} to find out what start files it uses.
|
||||
Here's an example of copying these files from a target machine:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/lib
|
||||
prompt
|
||||
cd /lib
|
||||
mget *crt*.o
|
||||
cd /usr/lib
|
||||
mget *crt*.o
|
||||
quit
|
||||
@end example
|
||||
|
||||
@ifnothtml
|
||||
@node Cross Headers, Build Cross, Tools and Libraries, Cross-Compiler
|
||||
@subsection Cross-Compilers and Header Files
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Cross-Compilers and Header Files</h2>
|
||||
@end html
|
||||
|
||||
If you are cross-compiling a standalone program or a program for an
|
||||
embedded system, then you may not need any header files except the few
|
||||
that are part of GNU CC (and those of your program). However, if you
|
||||
intend to link your program with a standard C library such as
|
||||
@file{libc.a}, then you probably need to compile with the header files
|
||||
that go with the library you use.
|
||||
|
||||
The GNU C compiler does not come with these files, because (1) they are
|
||||
system-specific, and (2) they belong in a C library, not in a compiler.
|
||||
|
||||
If the GNU C library supports your target machine, then you can get the
|
||||
header files from there (assuming you actually use the GNU library when
|
||||
you link your program).
|
||||
|
||||
If your target machine comes with a C compiler, it probably comes with
|
||||
suitable header files also. If you make these files accessible from the host
|
||||
machine, the cross-compiler can use them also.
|
||||
|
||||
Otherwise, you're on your own in finding header files to use when
|
||||
cross-compiling.
|
||||
|
||||
When you have found suitable header files, you should put them in the
|
||||
directory @file{/usr/local/@var{target}/include}, before building the
|
||||
cross compiler. Then installation will run fixincludes properly and
|
||||
install the corrected versions of the header files where the compiler
|
||||
will use them.
|
||||
|
||||
Provide the header files before you build the cross-compiler, because
|
||||
the build stage actually runs the cross-compiler to produce parts of
|
||||
@file{libgcc.a}. (These are the parts that @emph{can} be compiled with
|
||||
GNU CC@.) Some of them need suitable header files.
|
||||
|
||||
Here's an example showing how to copy the header files from a target
|
||||
machine. On the target machine, do this:
|
||||
|
||||
@example
|
||||
(cd /usr/include; tar cf - .) > tarfile
|
||||
@end example
|
||||
|
||||
Then, on the host machine, do this:
|
||||
|
||||
@example
|
||||
ftp @var{target-machine}
|
||||
lcd /usr/local/@var{target}/include
|
||||
get tarfile
|
||||
quit
|
||||
tar xf tarfile
|
||||
@end example
|
||||
|
||||
@ifnothtml
|
||||
@node Build Cross, , Cross Headers, Cross-Compiler
|
||||
@subsection Actually Building the Cross-Compiler
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>Actually Building the Cross-Compiler</h2>
|
||||
@end html
|
||||
|
||||
Now you can proceed just as for compiling a single-machine compiler
|
||||
through the step of building stage 1.
|
||||
|
||||
If your target is exotic, you may need to provide the header file
|
||||
@file{float.h}.One way to do this is to compile @file{enquire} and run
|
||||
it on your target machine. The job of @file{enquire} is to run on the
|
||||
target machine and figure out by experiment the nature of its floating
|
||||
point representation. @file{enquire} records its findings in the header
|
||||
file @file{float.h}. If you can't produce this file by running
|
||||
@file{enquire} on the target machine, then you will need to come up with
|
||||
a suitable @file{float.h} in some other way (or else, avoid using it in
|
||||
your programs).
|
||||
|
||||
Do not try to build stage 2 for a cross-compiler. It doesn't work to
|
||||
rebuild GNU CC as a cross-compiler using the cross-compiler, because
|
||||
that would produce a program that runs on the target machine, not on the
|
||||
host. For example, if you compile a 386-to-68030 cross-compiler with
|
||||
itself, the result will not be right either for the 386 (because it was
|
||||
compiled into 68030 code) or for the 68030 (because it was configured
|
||||
for a 386 as the host). If you want to compile GNU CC into 68030 code,
|
||||
whether you compile it on a 68030 or with a cross-compiler on a 386, you
|
||||
must specify a 68030 as the host when you configure it.
|
||||
|
||||
To install the cross-compiler, use @samp{make install}, as usual.
|
||||
|
||||
@ifnothtml
|
||||
@node VMS Install, , Cross-Compiler, Old
|
||||
@section Installing GNU CC on VMS
|
||||
@end ifnothtml
|
||||
@html
|
||||
<h2>@anchor{VMS Install}Installing GNU CC on VMS</h2>
|
||||
@end html
|
||||
@cindex VMS installation
|
||||
@cindex installing GNU CC on VMS
|
||||
|
||||
The VMS version of GNU CC is distributed in a backup saveset containing
|
||||
both source code and precompiled binaries.
|
||||
|
||||
To install the @file{gcc} command so you can use the compiler easily, in
|
||||
the same manner as you use the VMS C compiler, you must install the VMS CLD
|
||||
file for GNU CC as follows:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
|
||||
to point to the directories where the GNU CC executables
|
||||
(@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are
|
||||
kept respectively. This should be done with the commands:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.] gnu_cc
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.include.] gnu_cc_include
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
with the appropriate disk and directory names. These commands can be
|
||||
placed in your system startup file so they will be executed whenever
|
||||
the machine is rebooted. You may, if you choose, do this via the
|
||||
@file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
|
||||
|
||||
@item
|
||||
Install the @file{GCC} command with the command line:
|
||||
|
||||
@smallexample
|
||||
$ set command /table=sys$common:[syslib]dcltables -
|
||||
/output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
|
||||
$ install replace sys$common:[syslib]dcltables
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
To install the help file, do the following:
|
||||
|
||||
@smallexample
|
||||
$ library/help sys$library:helplib.hlb gcc.hlp
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
Now you can invoke the compiler with a command like @samp{gcc /verbose
|
||||
file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
|
||||
Unix.
|
||||
@end enumerate
|
||||
|
||||
If you wish to use GNU C++ you must first install GNU CC, and then
|
||||
perform the following steps:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the
|
||||
directory where the preprocessor will search for the C++ header files.
|
||||
This can be done with the command:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[gcc.gxx_include.] gnu_gxx_include
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
with the appropriate disk and directory name. If you are going to be
|
||||
using a C++ runtime library, this is where its install procedure will install
|
||||
its header files.
|
||||
|
||||
@item
|
||||
Obtain the file @file{gcc-cc1plus.exe}, and place this in the same
|
||||
directory that @file{gcc-cc1.exe} is kept.
|
||||
|
||||
The GNU C++ compiler can be invoked with a command like @samp{gcc /plus
|
||||
/verbose file.cc}, which is equivalent to the command @samp{g++ -v -c
|
||||
file.cc} in Unix.
|
||||
@end enumerate
|
||||
|
||||
We try to put corresponding binaries and sources on the VMS distribution
|
||||
tape. But sometimes the binaries will be from an older version than the
|
||||
sources, because we don't always have time to update them. (Use the
|
||||
@samp{/version} option to determine the version number of the binaries and
|
||||
compare it with the source file @file{version.c} to tell whether this is
|
||||
so.) In this case, you should use the binaries you get to recompile the
|
||||
sources. If you must recompile, here is how:
|
||||
|
||||
@enumerate
|
||||
@item
|
||||
Execute the command procedure @file{vmsconfig.com} to set up the files
|
||||
@file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}, and
|
||||
to create files @file{tconfig.h} and @file{hconfig.h}. This procedure
|
||||
also creates several linker option files used by @file{make-cc1.com} and
|
||||
a data file used by @file{make-l2.com}.
|
||||
|
||||
@smallexample
|
||||
$ @@vmsconfig.com
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
Setup the logical names and command tables as defined above. In
|
||||
addition, define the VMS logical name @samp{GNU_BISON} to point at the
|
||||
to the directories where the Bison executable is kept. This should be
|
||||
done with the command:
|
||||
|
||||
@smallexample
|
||||
$ assign /system /translation=concealed -
|
||||
disk:[bison.] gnu_bison
|
||||
@end smallexample
|
||||
|
||||
You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
|
||||
@file{[BISON]} directory.
|
||||
|
||||
@item
|
||||
Install the @samp{BISON} command with the command line:
|
||||
|
||||
@smallexample
|
||||
$ set command /table=sys$common:[syslib]dcltables -
|
||||
/output=sys$common:[syslib]dcltables -
|
||||
gnu_bison:[000000]bison
|
||||
$ install replace sys$common:[syslib]dcltables
|
||||
@end smallexample
|
||||
|
||||
@item
|
||||
Type @samp{@@make-gcc} to recompile everything, or submit the file
|
||||
@file{make-gcc.com} to a batch queue. If you wish to build the GNU C++
|
||||
compiler as well as the GNU CC compiler, you must first edit
|
||||
@file{make-gcc.com} and follow the instructions that appear in the
|
||||
comments.
|
||||
|
||||
@item
|
||||
In order to use GCC, you need a library of functions which GCC compiled code
|
||||
will call to perform certain tasks, and these functions are defined in the
|
||||
file @file{libgcc2.c}. To compile this you should use the command procedure
|
||||
@file{make-l2.com}, which will generate the library @file{libgcc2.olb}.
|
||||
@file{libgcc2.olb} should be built using the compiler built from
|
||||
the same distribution that @file{libgcc2.c} came from, and
|
||||
@file{make-gcc.com} will automatically do all of this for you.
|
||||
|
||||
To install the library, use the following commands:
|
||||
|
||||
@smallexample
|
||||
$ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
|
||||
$ library gnu_cc:[000000]gcclib/delete=L_*
|
||||
$ library libgcc2/extract=*/output=libgcc2.obj
|
||||
$ library gnu_cc:[000000]gcclib libgcc2.obj
|
||||
@end smallexample
|
||||
|
||||
The first command simply removes old modules that will be replaced with
|
||||
modules from @file{libgcc2} under different module names. The modules
|
||||
@code{new} and @code{eprintf} may not actually be present in your
|
||||
@file{gcclib.olb}---if the VMS librarian complains about those modules
|
||||
not being present, simply ignore the message and continue on with the
|
||||
next command. The second command removes the modules that came from the
|
||||
previous version of the library @file{libgcc2.c}.
|
||||
|
||||
Whenever you update the compiler on your system, you should also update the
|
||||
library with the above procedure.
|
||||
|
||||
@item
|
||||
You may wish to build GCC in such a way that no files are written to the
|
||||
directory where the source files reside. An example would be the when
|
||||
the source files are on a read-only disk. In these cases, execute the
|
||||
following DCL commands (substituting your actual path names):
|
||||
|
||||
@smallexample
|
||||
$ assign dua0:[gcc.build_dir.]/translation=concealed, -
|
||||
dua1:[gcc.source_dir.]/translation=concealed gcc_build
|
||||
$ set default gcc_build:[000000]
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where the directory @file{dua1:[gcc.source_dir]} contains the source
|
||||
code, and the directory @file{dua0:[gcc.build_dir]} is meant to contain
|
||||
all of the generated object files and executables. Once you have done
|
||||
this, you can proceed building GCC as described above. (Keep in mind
|
||||
that @file{gcc_build} is a rooted logical name, and thus the device
|
||||
names in each element of the search list must be an actual physical
|
||||
device name rather than another rooted logical name).
|
||||
|
||||
@item
|
||||
@strong{If you are building GNU CC with a previous version of GNU CC,
|
||||
you also should check to see that you have the newest version of the
|
||||
assembler}. In particular, GNU CC version 2 treats global constant
|
||||
variables slightly differently from GNU CC version 1, and GAS version
|
||||
1.38.1 does not have the patches required to work with GCC version 2.
|
||||
If you use GAS 1.38.1, then @code{extern const} variables will not have
|
||||
the read-only bit set, and the linker will generate warning messages
|
||||
about mismatched psect attributes for these variables. These warning
|
||||
messages are merely a nuisance, and can safely be ignored.
|
||||
|
||||
@item
|
||||
If you want to build GNU CC with the VAX C compiler, you will need to
|
||||
make minor changes in @file{make-cccp.com} and @file{make-cc1.com}
|
||||
to choose alternate definitions of @code{CC}, @code{CFLAGS}, and
|
||||
@code{LIBS}. See comments in those files. However, you must
|
||||
also have a working version of the GNU assembler (GNU as, aka GAS) as
|
||||
it is used as the back end for GNU CC to produce binary object modules
|
||||
and is not included in the GNU CC sources. GAS is also needed to
|
||||
compile @file{libgcc2} in order to build @file{gcclib} (see above);
|
||||
@file{make-l2.com} expects to be able to find it operational in
|
||||
@file{gnu_cc:[000000]gnu-as.exe}.
|
||||
|
||||
To use GNU CC on VMS, you need the VMS driver programs
|
||||
@file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}. They are
|
||||
distributed with the VMS binaries (@file{gcc-vms}) rather than the
|
||||
GNU CC sources. GAS is also included in @file{gcc-vms}, as is Bison.
|
||||
|
||||
Once you have successfully built GNU CC with VAX C, you should use the
|
||||
resulting compiler to rebuild itself. Before doing this, be sure to
|
||||
restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in
|
||||
@file{make-cccp.com} and @file{make-cc1.com}. The second generation
|
||||
compiler will be able to take advantage of many optimizations that must
|
||||
be suppressed when building with other compilers.
|
||||
@end enumerate
|
||||
|
||||
Under previous versions of GNU CC, the generated code would occasionally
|
||||
give strange results when linked with the sharable @file{VAXCRTL} library.
|
||||
Now this should work.
|
||||
|
||||
Even with this version, however, GNU CC itself should not be linked with
|
||||
the sharable @file{VAXCRTL}. The version of @code{qsort} in
|
||||
@file{VAXCRTL} has a bug (known to be present in VMS versions V4.6
|
||||
through V5.5) which causes the compiler to fail.
|
||||
|
||||
The executables are generated by @file{make-cc1.com} and
|
||||
@file{make-cccp.com} use the object library version of @file{VAXCRTL} in
|
||||
order to make use of the @code{qsort} routine in @file{gcclib.olb}. If
|
||||
you wish to link the compiler executables with the shareable image
|
||||
version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created
|
||||
by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}.
|
||||
|
||||
@code{QSORT_WORKAROUND} is always defined when GNU CC is compiled with
|
||||
VAX C, to avoid a problem in case @file{gcclib.olb} is not yet
|
||||
available.
|
File diff suppressed because it is too large
Load Diff
@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Convert the GCC install documentation from texinfo format to HTML.
|
||||
#
|
||||
# $SOURCEDIR and $DESTDIR, resp., refer to the directory containing
|
||||
# the texinfo source and the directory to put the HTML version in.
|
||||
#
|
||||
# (C) 2001 Free Software Foundation
|
||||
# Originally by Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, June 2001.
|
||||
#
|
||||
# This script is Free Software, and it can be copied, distributed and
|
||||
# modified as defined in the GNU General Public License. A copy of
|
||||
# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
SOURCEDIR=${SOURCEDIR-.}
|
||||
DESTDIR=${DESTDIR-HTML}
|
||||
|
||||
MAKEINFO=${MAKEINFO-makeinfo}
|
||||
|
||||
if [ ! -d $DESTDIR ]; then
|
||||
mkdir -p $DESTDIR
|
||||
fi
|
||||
|
||||
for x in index.html specific.html download.html configure.html \
|
||||
build.html test.html finalinstall.html binaries.html old.html \
|
||||
gfdl.html
|
||||
do
|
||||
define=`echo $x | sed -e 's/\.//g'`
|
||||
echo "define = $define"
|
||||
$MAKEINFO -I $SOURCEDIR -I $SOURCEDIR/include $SOURCEDIR/install.texi --html --no-split -D$define -o$DESTDIR/$x
|
||||
done
|
@ -1,360 +0,0 @@
|
||||
/*
|
||||
** DosFCheck - check file names for DOS consistency
|
||||
**
|
||||
** Distribute freely, it only encourages DOS compatibility!
|
||||
** - DJ Delorie
|
||||
*/
|
||||
|
||||
/* This file is not part of GCC. */
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef __MSDOS__
|
||||
#include <alloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct ENT
|
||||
{
|
||||
struct ENT *next;
|
||||
char *dos_name;
|
||||
char *full_name;
|
||||
char *path;
|
||||
int tagged;
|
||||
} ENT;
|
||||
|
||||
ENT *eroot = 0;
|
||||
|
||||
int first_inv = 1;
|
||||
int first_msg = 1;
|
||||
|
||||
/****************************************************************\
|
||||
* Utility routines *
|
||||
\****************************************************************/
|
||||
|
||||
void
|
||||
invalid_msg ()
|
||||
{
|
||||
if (first_inv)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following files are not valid DOS file names:\n");
|
||||
first_inv = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ENT *
|
||||
alloc_ent ()
|
||||
{
|
||||
ENT *rv = (ENT *)malloc (sizeof (ENT));
|
||||
if (rv == 0)
|
||||
{
|
||||
fprintf (stderr, "Unable to allocate memory for an ENT\n");
|
||||
exit (1);
|
||||
}
|
||||
memset (rv, 0, sizeof (ENT));
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
fill_ent (ent, path)
|
||||
ENT *ent;
|
||||
char *path;
|
||||
{
|
||||
char *first = path;
|
||||
char *null = path+strlen (path);
|
||||
char *last_slash = strrchr (path, '/');
|
||||
char *cp, *dp;
|
||||
int dots_seen, chars_seen;
|
||||
|
||||
if (last_slash+1 == null)
|
||||
{
|
||||
* --null = '\0';
|
||||
last_slash = strrchr (path, '/');
|
||||
}
|
||||
|
||||
if (!last_slash)
|
||||
{
|
||||
last_slash = first-1;
|
||||
}
|
||||
|
||||
if (null-last_slash < 13)
|
||||
ent->dos_name = (char *)malloc (null-last_slash);
|
||||
else
|
||||
ent->dos_name = (char *)malloc (13);
|
||||
ent->full_name = (char *)malloc (null-last_slash);
|
||||
ent->path = (char *)malloc (last_slash-first+1);
|
||||
|
||||
strcpy (ent->full_name, last_slash+1);
|
||||
if (last_slash > first)
|
||||
{
|
||||
strncpy (ent->path, first, last_slash-first);
|
||||
ent->path[last_slash-first] = '\0';
|
||||
}
|
||||
else
|
||||
*ent->path = '\0';
|
||||
|
||||
cp = last_slash+1;
|
||||
dp = ent->dos_name;
|
||||
dots_seen = 0;
|
||||
chars_seen = 0;
|
||||
while (1)
|
||||
{
|
||||
if (! *cp)
|
||||
break;
|
||||
switch (*cp)
|
||||
{
|
||||
case '.':
|
||||
if (cp == last_slash+1 && strcmp (last_slash+1, "."))
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - file name cannot start with dot\n", path);
|
||||
*dp = 0;
|
||||
break;
|
||||
}
|
||||
if (dots_seen == 1)
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - too many dots\n", path);
|
||||
*dp = '\0';
|
||||
break;
|
||||
}
|
||||
*dp++ = '.';
|
||||
chars_seen = 0;
|
||||
dots_seen++;
|
||||
break;
|
||||
case '"':
|
||||
case '*':
|
||||
case '+':
|
||||
case ',':
|
||||
case ';':
|
||||
case '<':
|
||||
case '=':
|
||||
case '>':
|
||||
case '?':
|
||||
case '[':
|
||||
case '\\':
|
||||
case ']':
|
||||
case '|':
|
||||
invalid_msg ();
|
||||
printf ("%s - invalid character `%c'\n", path, *cp);
|
||||
*dp++ = '?';
|
||||
chars_seen++;
|
||||
break;
|
||||
default:
|
||||
if (dots_seen)
|
||||
{
|
||||
if (chars_seen >= 3)
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (chars_seen >= 8)
|
||||
break;
|
||||
if ((*cp <= ' ') || (*cp >= 0x7f))
|
||||
{
|
||||
invalid_msg ();
|
||||
printf ("%s - invalid character `%c'\n", path, *cp);
|
||||
*dp++ = '?';
|
||||
chars_seen++;
|
||||
break;
|
||||
}
|
||||
if (islower (*cp))
|
||||
*dp++ = toupper (*cp);
|
||||
else
|
||||
*dp++ = *cp;
|
||||
chars_seen++;
|
||||
break;
|
||||
}
|
||||
cp++;
|
||||
}
|
||||
*dp++ = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
compare_ent_dosname (e1, e2)
|
||||
ENT **e1;
|
||||
ENT **e2;
|
||||
{
|
||||
int r = strcmp ((*e1)->dos_name, (*e2)->dos_name);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->path, (*e2)->path);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->full_name, (*e2)->full_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
compare_ent_fullname (e1, e2)
|
||||
ENT **e1;
|
||||
ENT **e2;
|
||||
{
|
||||
int r = strncmp ((*e1)->full_name, (*e2)->full_name, 14);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->path, (*e2)->path);
|
||||
if (r == 0)
|
||||
r = strcmp ((*e1)->full_name, (*e2)->full_name);
|
||||
return r;
|
||||
}
|
||||
|
||||
char *
|
||||
mpath (ent)
|
||||
ENT *ent;
|
||||
{
|
||||
static char buf[500];
|
||||
if (ent->path && ent->path[0])
|
||||
sprintf (buf, "%s/%s", ent->path, ent->full_name);
|
||||
else
|
||||
return ent->full_name;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/****************************************************************\
|
||||
* List handling routines *
|
||||
\****************************************************************/
|
||||
|
||||
void
|
||||
add_ent (ent)
|
||||
ENT *ent;
|
||||
{
|
||||
ent->next = eroot;
|
||||
eroot = ent;
|
||||
}
|
||||
|
||||
void
|
||||
handle_input (line)
|
||||
char *line;
|
||||
{
|
||||
ENT *ent = alloc_ent ();
|
||||
fill_ent (ent, line);
|
||||
add_ent (ent);
|
||||
}
|
||||
|
||||
void
|
||||
display_problems ()
|
||||
{
|
||||
ENT **elist, *ent;
|
||||
int ecount, i, first, first_err;
|
||||
|
||||
for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++);
|
||||
elist = (ENT **)malloc (sizeof (ENT *) * ecount);
|
||||
for (ecount=0, ent=eroot; ent; ent=ent->next, ecount++)
|
||||
elist[ecount] = ent;
|
||||
|
||||
qsort (elist, ecount, sizeof (ENT *), compare_ent_dosname);
|
||||
|
||||
first = 1;
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount-1; i++)
|
||||
{
|
||||
if ((strcmp (elist[i]->dos_name, elist[i+1]->dos_name) == 0)
|
||||
&& (strcmp (elist[i]->path, elist[i+1]->path) == 0))
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following resolve to the same DOS file names:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
printf ("%14s : %s\n", elist[i]->dos_name, mpath (elist[i]));
|
||||
first = 0;
|
||||
}
|
||||
printf ("\t\t %s\n", mpath (elist[i+1]));
|
||||
}
|
||||
else
|
||||
first = 1;
|
||||
}
|
||||
|
||||
qsort (elist, ecount, sizeof (ENT *), compare_ent_fullname);
|
||||
|
||||
first = 1;
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount-1; i++)
|
||||
{
|
||||
if ((strncmp (elist[i]->full_name, elist[i+1]->full_name, 14) == 0)
|
||||
&& (strcmp (elist[i]->path, elist[i+1]->path) == 0))
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following resolve to the same SysV file names:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i]));
|
||||
first = 0;
|
||||
elist[i]->tagged = 1;
|
||||
}
|
||||
printf ("\t\t %s\n", mpath (elist[i+1]));
|
||||
elist[i+1]->tagged = 1;
|
||||
}
|
||||
else
|
||||
first = 1;
|
||||
}
|
||||
|
||||
first_err = 1;
|
||||
for (i=0; i<ecount; i++)
|
||||
{
|
||||
if ((strlen (elist[i]->full_name) > 14) && !elist[i]->tagged)
|
||||
{
|
||||
if (first_err)
|
||||
{
|
||||
if (first_msg)
|
||||
first_msg = 0;
|
||||
else
|
||||
putchar ('\n');
|
||||
printf ("The following file names are too long for SysV:\n");
|
||||
first_err = 0;
|
||||
}
|
||||
printf ("%.14s : %s\n", elist[i]->full_name, mpath (elist[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************\
|
||||
* Main entry point *
|
||||
\****************************************************************/
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
FILE *input = stdin;
|
||||
if (argc > 1)
|
||||
{
|
||||
input = fopen (argv[1], "r");
|
||||
if (!input)
|
||||
{
|
||||
perror (argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
char line[500];
|
||||
char *lp;
|
||||
fgets (line, 500, input);
|
||||
if (feof (input))
|
||||
break;
|
||||
lp = line+strlen (line);
|
||||
while ((lp != line) && (*lp <= ' '))
|
||||
lp--;
|
||||
lp[1] = 0;
|
||||
handle_input (line);
|
||||
}
|
||||
display_problems ();
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
1995-02-15
|
||||
|
||||
This directory is the f/ subdirectory, which is designed to
|
||||
be a subdirectory in a gcc development tree, i.e. named gcc/f/.
|
||||
|
||||
Please see gcc/README.g77 for information on the contents of this
|
||||
directory.
|
@ -1,239 +0,0 @@
|
||||
/* lang-options.h file for Fortran
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Contributed by James Craig Burley.
|
||||
|
||||
This file is part of GNU Fortran.
|
||||
|
||||
GNU Fortran 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.
|
||||
|
||||
GNU Fortran 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 GNU Fortran; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for g77. */
|
||||
|
||||
#ifdef __STDC__ /* To be consistent with lang-specs.h. Maybe avoid
|
||||
overflowing some old compiler's tables, etc. */
|
||||
|
||||
DEFINE_LANG_NAME ("Fortran")
|
||||
|
||||
{ "-fversion",
|
||||
N_("Print g77-specific compiler version info, run internal tests") },
|
||||
/*"-fident",*/
|
||||
/*"-fno-ident",*/
|
||||
{ "-ff66",
|
||||
N_("Program is written in typical FORTRAN 66 dialect") },
|
||||
{ "-fno-f66", "" },
|
||||
{ "-ff77",
|
||||
N_("Program is written in typical Unix f77 dialect") },
|
||||
{ "-fno-f77",
|
||||
N_("Program does not use Unix-f77 dialectal features") },
|
||||
{ "-ff90",
|
||||
N_("Program is written in Fortran-90-ish dialect") },
|
||||
{ "-fno-f90", "" },
|
||||
{ "-fautomatic", "" },
|
||||
{ "-fno-automatic",
|
||||
N_("Treat local vars and COMMON blocks as if they were named in SAVE statements") },
|
||||
{ "-fdollar-ok",
|
||||
N_("Allow $ in symbol names") },
|
||||
{ "-fno-dollar-ok", "" },
|
||||
{ "-ff2c", "" },
|
||||
{ "-fno-f2c",
|
||||
N_("f2c-compatible code need not be generated") },
|
||||
{ "-ff2c-library", "" },
|
||||
{ "-fno-f2c-library",
|
||||
N_("Unsupported; do not generate libf2c-calling code") },
|
||||
{ "-fflatten-arrays",
|
||||
N_("Unsupported; affects code-generation of arrays") },
|
||||
{ "-fno-flatten-arrays", "" },
|
||||
{ "-ffree-form",
|
||||
N_("Program is written in Fortran-90-ish free form") },
|
||||
{ "-fno-free-form", "" },
|
||||
{ "-ffixed-form", "" },
|
||||
{ "-fno-fixed-form", "" },
|
||||
{ "-fpedantic",
|
||||
N_("Warn about use of (only a few for now) Fortran extensions") },
|
||||
{ "-fno-pedantic", "" },
|
||||
{ "-fvxt",
|
||||
N_("Program is written in VXT (Digital-like) FORTRAN") },
|
||||
{ "-fno-vxt", "" },
|
||||
{ "-fno-ugly",
|
||||
N_("Disallow all ugly features") },
|
||||
{ "-fugly-args", "" },
|
||||
{ "-fno-ugly-args",
|
||||
N_("Hollerith and typeless constants not passed as arguments") },
|
||||
{ "-fugly-assign",
|
||||
N_("Allow ordinary copying of ASSIGN'ed vars") },
|
||||
{ "-fno-ugly-assign", "" },
|
||||
{ "-fugly-assumed",
|
||||
N_("Dummy array dimensioned to (1) is assumed-size") },
|
||||
{ "-fno-ugly-assumed", "" },
|
||||
{ "-fugly-comma",
|
||||
N_("Trailing comma in procedure call denotes null argument") },
|
||||
{ "-fno-ugly-comma", "" },
|
||||
{ "-fugly-complex",
|
||||
N_("Allow REAL(Z) and AIMAG(Z) given DOUBLE COMPLEX Z") },
|
||||
{ "-fno-ugly-complex", "" },
|
||||
{ "-fugly-init", "" },
|
||||
{ "-fno-ugly-init",
|
||||
N_("Initialization via DATA and PARAMETER is type-compatible") },
|
||||
{ "-fugly-logint",
|
||||
N_("Allow INTEGER and LOGICAL interchangeability") },
|
||||
{ "-fno-ugly-logint", "" },
|
||||
{ "-fxyzzy",
|
||||
N_("Print internal debugging-related info") },
|
||||
{ "-fno-xyzzy", "" },
|
||||
{ "-finit-local-zero",
|
||||
N_("Initialize local vars and arrays to zero") },
|
||||
{ "-fno-init-local-zero", "" },
|
||||
{ "-fbackslash", "" },
|
||||
{ "-fno-backslash",
|
||||
N_("Backslashes in character/hollerith constants not special (C-style)") },
|
||||
{ "-femulate-complex",
|
||||
N_("Have front end emulate COMPLEX arithmetic to avoid bugs") },
|
||||
{ "-fno-emulate-complex", "" },
|
||||
{ "-funderscoring", "" },
|
||||
{ "-fno-underscoring",
|
||||
N_("Disable the appending of underscores to externals") },
|
||||
{ "-fsecond-underscore", "" },
|
||||
{ "-fno-second-underscore",
|
||||
N_("Never append a second underscore to externals") },
|
||||
{ "-fintrin-case-initcap",
|
||||
N_("Intrinsics spelled as e.g. SqRt") },
|
||||
{ "-fintrin-case-upper",
|
||||
N_("Intrinsics in uppercase") },
|
||||
{ "-fintrin-case-lower", "" },
|
||||
{ "-fintrin-case-any",
|
||||
N_("Intrinsics letters in arbitrary cases") },
|
||||
{ "-fmatch-case-initcap",
|
||||
N_("Language keywords spelled as e.g. IOStat") },
|
||||
{ "-fmatch-case-upper",
|
||||
N_("Language keywords in uppercase") },
|
||||
{ "-fmatch-case-lower", "" },
|
||||
{ "-fmatch-case-any",
|
||||
N_("Language keyword letters in arbitrary cases") },
|
||||
{ "-fsource-case-upper",
|
||||
N_("Internally convert most source to uppercase") },
|
||||
{ "-fsource-case-lower", "" },
|
||||
{ "-fsource-case-preserve",
|
||||
N_("Internally preserve source case") },
|
||||
{ "-fsymbol-case-initcap",
|
||||
N_("Symbol names spelled in mixed case") },
|
||||
{ "-fsymbol-case-upper",
|
||||
N_("Symbol names in uppercase") },
|
||||
{ "-fsymbol-case-lower",
|
||||
N_("Symbol names in lowercase") },
|
||||
{ "-fsymbol-case-any", "" },
|
||||
{ "-fcase-strict-upper",
|
||||
N_("Program written in uppercase") },
|
||||
{ "-fcase-strict-lower",
|
||||
N_("Program written in lowercase") },
|
||||
{ "-fcase-initcap",
|
||||
N_("Program written in strict mixed-case") },
|
||||
{ "-fcase-upper",
|
||||
N_("Compile as if program written in uppercase") },
|
||||
{ "-fcase-lower",
|
||||
N_("Compile as if program written in lowercase") },
|
||||
{ "-fcase-preserve",
|
||||
N_("Preserve all spelling (case) used in program") },
|
||||
{ "-fbadu77-intrinsics-delete",
|
||||
N_("Delete libU77 intrinsics with bad interfaces") },
|
||||
{ "-fbadu77-intrinsics-disable",
|
||||
N_("Disable libU77 intrinsics with bad interfaces") },
|
||||
{ "-fbadu77-intrinsics-enable", "" },
|
||||
{ "-fbadu77-intrinsics-hide",
|
||||
N_("Hide libU77 intrinsics with bad interfaces") },
|
||||
{ "-ff2c-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff2c-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff2c-intrinsics-enable", "" },
|
||||
{ "-ff2c-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics f2c supports") },
|
||||
{ "-ff90-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-ff90-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-ff90-intrinsics-enable", "" },
|
||||
{ "-ff90-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics F90 supports") },
|
||||
{ "-fgnu-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics g77 supports") },
|
||||
{ "-fgnu-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN 77 intrinsics F90 supports") },
|
||||
{ "-fgnu-intrinsics-enable", "" },
|
||||
{ "-fgnu-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN 77 intrinsics F90 supports") },
|
||||
{ "-fmil-intrinsics-delete",
|
||||
N_("Delete MIL-STD 1753 intrinsics") },
|
||||
{ "-fmil-intrinsics-disable",
|
||||
N_("Disable MIL-STD 1753 intrinsics") },
|
||||
{ "-fmil-intrinsics-enable", "" },
|
||||
{ "-fmil-intrinsics-hide",
|
||||
N_("Hide MIL-STD 1753 intrinsics") },
|
||||
{ "-funix-intrinsics-delete",
|
||||
N_("Delete libU77 intrinsics") },
|
||||
{ "-funix-intrinsics-disable",
|
||||
N_("Disable libU77 intrinsics") },
|
||||
{ "-funix-intrinsics-enable", "" },
|
||||
{ "-funix-intrinsics-hide",
|
||||
N_("Hide libU77 intrinsics") },
|
||||
{ "-fvxt-intrinsics-delete",
|
||||
N_("Delete non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fvxt-intrinsics-disable",
|
||||
N_("Disable non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fvxt-intrinsics-enable", "" },
|
||||
{ "-fvxt-intrinsics-hide",
|
||||
N_("Hide non-FORTRAN-77 intrinsics VXT FORTRAN supports") },
|
||||
{ "-fzeros",
|
||||
N_("Treat initial values of 0 like non-zero values") },
|
||||
{ "-fno-zeros", "" },
|
||||
{ "-fdebug-kludge",
|
||||
N_("Emit special debugging information for COMMON and EQUIVALENCE (disabled)") },
|
||||
{ "-fno-debug-kludge", "" },
|
||||
{ "-fonetrip",
|
||||
N_("Take at least one trip through each iterative DO loop") },
|
||||
{ "-fno-onetrip", "" },
|
||||
{ "-fsilent", "" },
|
||||
{ "-fno-silent",
|
||||
N_("Print names of program units as they are compiled") },
|
||||
{ "-fglobals", "" },
|
||||
{ "-fno-globals",
|
||||
N_("Disable fatal diagnostics about inter-procedural problems") },
|
||||
{ "-ftypeless-boz",
|
||||
N_("Make prefix-radix non-decimal constants be typeless") },
|
||||
{ "-fno-typeless-boz", "" },
|
||||
{ "-fbounds-check",
|
||||
N_("Generate code to check subscript and substring bounds") },
|
||||
{ "-fno-bounds-check", "" },
|
||||
{ "-ffortran-bounds-check",
|
||||
N_("Fortran-specific form of -fbounds-check") },
|
||||
{ "-fno-fortran-bounds-check", "" },
|
||||
{ "-Wglobals", "" },
|
||||
{ "-Wno-globals",
|
||||
N_("Disable warnings about inter-procedural problems") },
|
||||
/*"-Wimplicit",*/
|
||||
/*"-Wno-implicit",*/
|
||||
{ "-Wsurprising",
|
||||
N_("Warn about constructs with surprising meanings") },
|
||||
{ "-Wno-surprising", "" },
|
||||
/*"-Wall",*/
|
||||
/* Prefix options. */
|
||||
{ "-I",
|
||||
N_("Add a directory for INCLUDE searching") },
|
||||
{ "-ffixed-line-length-",
|
||||
N_("Set the maximum line length") },
|
||||
|
||||
#endif
|
@ -1,944 +0,0 @@
|
||||
/*
|
||||
** libgcc support for software floating point.
|
||||
** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved.
|
||||
** Permission is granted to do *anything* you want with this file,
|
||||
** commercial or otherwise, provided this message remains intact. So there!
|
||||
** I would appreciate receiving any updates/patches/changes that anyone
|
||||
** makes, and am willing to be the repository for said changes (am I
|
||||
** making a big mistake?).
|
||||
|
||||
Warning! Only single-precision is actually implemented. This file
|
||||
won't really be much use until double-precision is supported.
|
||||
|
||||
However, once that is done, this file might make possible
|
||||
cross-compilation for an IEEE target machine from a non-IEEE
|
||||
host such as a VAX.
|
||||
|
||||
If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu.
|
||||
|
||||
--> Double precision floating support added by James Carlson on 20 April 1998.
|
||||
|
||||
**
|
||||
** Pat Wood
|
||||
** Pipeline Associates, Inc.
|
||||
** pipeline!phw@motown.com or
|
||||
** sun!pipeline!phw or
|
||||
** uunet!motown!pipeline!phw
|
||||
**
|
||||
** 05/01/91 -- V1.0 -- first release to gcc mailing lists
|
||||
** 05/04/91 -- V1.1 -- added float and double prototypes and return values
|
||||
** -- fixed problems with adding and subtracting zero
|
||||
** -- fixed rounding in truncdfsf2
|
||||
** -- fixed SWAP define and tested on 386
|
||||
*/
|
||||
|
||||
/*
|
||||
** The following are routines that replace the libgcc soft floating point
|
||||
** routines that are called automatically when -msoft-float is selected.
|
||||
** The support single and double precision IEEE format, with provisions
|
||||
** for byte-swapped machines (tested on 386). Some of the double-precision
|
||||
** routines work at full precision, but most of the hard ones simply punt
|
||||
** and call the single precision routines, producing a loss of accuracy.
|
||||
** long long support is not assumed or included.
|
||||
** Overall accuracy is close to IEEE (actually 68882) for single-precision
|
||||
** arithmetic. I think there may still be a 1 in 1000 chance of a bit
|
||||
** being rounded the wrong way during a multiply. I'm not fussy enough to
|
||||
** bother with it, but if anyone is, knock yourself out.
|
||||
**
|
||||
** Efficiency has only been addressed where it was obvious that something
|
||||
** would make a big difference. Anyone who wants to do this right for
|
||||
** best speed should go in and rewrite in assembler.
|
||||
**
|
||||
** I have tested this only on a 68030 workstation and 386/ix integrated
|
||||
** in with -msoft-float.
|
||||
*/
|
||||
|
||||
/* the following deal with IEEE single-precision numbers */
|
||||
#define EXCESS 126
|
||||
#define SIGNBIT 0x80000000
|
||||
#define HIDDEN (1 << 23)
|
||||
#define SIGN(fp) ((fp) & SIGNBIT)
|
||||
#define EXP(fp) (((fp) >> 23) & 0xFF)
|
||||
#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN)
|
||||
#define PACK(s,e,m) ((s) | ((e) << 23) | (m))
|
||||
|
||||
/* the following deal with IEEE double-precision numbers */
|
||||
#define EXCESSD 1022
|
||||
#define HIDDEND (1 << 20)
|
||||
#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF)
|
||||
#define SIGND(fp) ((fp.l.upper) & SIGNBIT)
|
||||
#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
|
||||
(fp.l.lower >> 22))
|
||||
#define HIDDEND_LL ((long long)1 << 52)
|
||||
#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
|
||||
#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m))
|
||||
|
||||
/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */
|
||||
union double_long {
|
||||
double d;
|
||||
#ifdef SWAP
|
||||
struct {
|
||||
unsigned long lower;
|
||||
long upper;
|
||||
} l;
|
||||
#else
|
||||
struct {
|
||||
long upper;
|
||||
unsigned long lower;
|
||||
} l;
|
||||
#endif
|
||||
long long ll;
|
||||
};
|
||||
|
||||
union float_long
|
||||
{
|
||||
float f;
|
||||
long l;
|
||||
};
|
||||
|
||||
/* add two floats */
|
||||
float
|
||||
__addsf3 (float a1, float a2)
|
||||
{
|
||||
long mant1, mant2;
|
||||
union float_long fl1, fl2;
|
||||
int exp1, exp2;
|
||||
int sign = 0;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl1.l) {
|
||||
fl1.f = fl2.f;
|
||||
goto test_done;
|
||||
}
|
||||
if (!fl2.l)
|
||||
goto test_done;
|
||||
|
||||
exp1 = EXP (fl1.l);
|
||||
exp2 = EXP (fl2.l);
|
||||
|
||||
if (exp1 > exp2 + 25)
|
||||
goto test_done;
|
||||
if (exp2 > exp1 + 25) {
|
||||
fl1.f = fl2.f;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* do everything in excess precision so's we can round later */
|
||||
mant1 = MANT (fl1.l) << 6;
|
||||
mant2 = MANT (fl2.l) << 6;
|
||||
|
||||
if (SIGN (fl1.l))
|
||||
mant1 = -mant1;
|
||||
if (SIGN (fl2.l))
|
||||
mant2 = -mant2;
|
||||
|
||||
if (exp1 > exp2)
|
||||
{
|
||||
mant2 >>= exp1 - exp2;
|
||||
}
|
||||
else
|
||||
{
|
||||
mant1 >>= exp2 - exp1;
|
||||
exp1 = exp2;
|
||||
}
|
||||
mant1 += mant2;
|
||||
|
||||
if (mant1 < 0)
|
||||
{
|
||||
mant1 = -mant1;
|
||||
sign = SIGNBIT;
|
||||
}
|
||||
else if (!mant1) {
|
||||
fl1.f = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* normalize up */
|
||||
while (!(mant1 & 0xE0000000))
|
||||
{
|
||||
mant1 <<= 1;
|
||||
exp1--;
|
||||
}
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & (1 << 30))
|
||||
{
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* round to even */
|
||||
mant1 += (mant1 & 0x40) ? 0x20 : 0x1F;
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & (1 << 30))
|
||||
{
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* lose extra precision */
|
||||
mant1 >>= 6;
|
||||
|
||||
/* turn off hidden bit */
|
||||
mant1 &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp1, mant1);
|
||||
test_done:
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* subtract two floats */
|
||||
float
|
||||
__subsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.l)
|
||||
return (fl1.f);
|
||||
if (!fl1.l)
|
||||
return (-fl2.f);
|
||||
|
||||
/* twiddle sign bit and add */
|
||||
fl2.l ^= SIGNBIT;
|
||||
return __addsf3 (a1, fl2.f);
|
||||
}
|
||||
|
||||
/* compare two floats */
|
||||
long
|
||||
__cmpsf2 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
if (SIGN (fl1.l) && SIGN (fl2.l))
|
||||
{
|
||||
fl1.l ^= SIGNBIT;
|
||||
fl2.l ^= SIGNBIT;
|
||||
}
|
||||
if (fl1.l < fl2.l)
|
||||
return (-1);
|
||||
if (fl1.l > fl2.l)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* multiply two floats */
|
||||
float
|
||||
__mulsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
unsigned long result;
|
||||
int exp;
|
||||
int sign;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
if (!fl1.l || !fl2.l) {
|
||||
fl1.f = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* compute sign and exponent */
|
||||
sign = SIGN (fl1.l) ^ SIGN (fl2.l);
|
||||
exp = EXP (fl1.l) - EXCESS;
|
||||
exp += EXP (fl2.l);
|
||||
|
||||
fl1.l = MANT (fl1.l);
|
||||
fl2.l = MANT (fl2.l);
|
||||
|
||||
/* the multiply is done as one 16x16 multiply and two 16x8 multiples */
|
||||
result = (fl1.l >> 8) * (fl2.l >> 8);
|
||||
result += ((fl1.l & 0xFF) * (fl2.l >> 8)) >> 8;
|
||||
result += ((fl2.l & 0xFF) * (fl1.l >> 8)) >> 8;
|
||||
|
||||
result >>= 2;
|
||||
if (result & 0x20000000)
|
||||
{
|
||||
/* round */
|
||||
result += 0x20;
|
||||
result >>= 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* round */
|
||||
result += 0x10;
|
||||
result >>= 5;
|
||||
exp--;
|
||||
}
|
||||
if (result & (HIDDEN<<1)) {
|
||||
result >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
result &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp, result);
|
||||
test_done:
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* divide two floats */
|
||||
float
|
||||
__divsf3 (float a1, float a2)
|
||||
{
|
||||
union float_long fl1, fl2;
|
||||
int result;
|
||||
int mask;
|
||||
int exp, sign;
|
||||
|
||||
fl1.f = a1;
|
||||
fl2.f = a2;
|
||||
|
||||
/* subtract exponents */
|
||||
exp = EXP (fl1.l) - EXP (fl2.l) + EXCESS;
|
||||
|
||||
/* compute sign */
|
||||
sign = SIGN (fl1.l) ^ SIGN (fl2.l);
|
||||
|
||||
/* divide by zero??? */
|
||||
if (!fl2.l)
|
||||
/* return NaN or -NaN */
|
||||
return (sign ? 0xFFFFFFFF : 0x7FFFFFFF);
|
||||
|
||||
/* numerator zero??? */
|
||||
if (!fl1.l)
|
||||
return (0);
|
||||
|
||||
/* now get mantissas */
|
||||
fl1.l = MANT (fl1.l);
|
||||
fl2.l = MANT (fl2.l);
|
||||
|
||||
/* this assures we have 25 bits of precision in the end */
|
||||
if (fl1.l < fl2.l)
|
||||
{
|
||||
fl1.l <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* now we perform repeated subtraction of fl2.l from fl1.l */
|
||||
mask = 0x1000000;
|
||||
result = 0;
|
||||
while (mask)
|
||||
{
|
||||
if (fl1.l >= fl2.l)
|
||||
{
|
||||
result |= mask;
|
||||
fl1.l -= fl2.l;
|
||||
}
|
||||
fl1.l <<= 1;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* round */
|
||||
result += 1;
|
||||
|
||||
/* normalize down */
|
||||
exp++;
|
||||
result >>= 1;
|
||||
|
||||
result &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.l = PACK (sign, exp, result);
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* convert int to double */
|
||||
double
|
||||
__floatsidf (long a1)
|
||||
{
|
||||
int sign = 0, exp = 31 + EXCESSD;
|
||||
union double_long dl;
|
||||
|
||||
if (!a1)
|
||||
{
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
if (a1 < 0)
|
||||
{
|
||||
sign = SIGNBIT;
|
||||
a1 = -a1;
|
||||
}
|
||||
|
||||
while (a1 < 0x1000000)
|
||||
{
|
||||
a1 <<= 4;
|
||||
exp -= 4;
|
||||
}
|
||||
|
||||
while (a1 < 0x40000000)
|
||||
{
|
||||
a1 <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* pack up and go home */
|
||||
dl.l.upper = sign;
|
||||
dl.l.upper |= exp << 20;
|
||||
dl.l.upper |= (a1 >> 10) & ~HIDDEND;
|
||||
dl.l.lower = a1 << 22;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
double
|
||||
__floatdidf (long long a1)
|
||||
{
|
||||
int exp = 63 + EXCESSD;
|
||||
union double_long dl;
|
||||
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
if (a1 == 0)
|
||||
return (dl.d);
|
||||
|
||||
if (a1 < 0) {
|
||||
dl.l.upper = SIGNBIT;
|
||||
a1 = -a1;
|
||||
}
|
||||
|
||||
while (a1 < (long long)1<<54) {
|
||||
a1 <<= 8;
|
||||
exp -= 8;
|
||||
}
|
||||
while (a1 < (long long)1<<62) {
|
||||
a1 <<= 1;
|
||||
exp -= 1;
|
||||
}
|
||||
|
||||
/* pack up and go home */
|
||||
dl.ll |= (a1 >> 10) & ~HIDDEND_LL;
|
||||
dl.l.upper |= exp << 20;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
float
|
||||
__floatsisf (long a1)
|
||||
{
|
||||
(float)__floatsidf(a1);
|
||||
}
|
||||
|
||||
float
|
||||
__floatdisf (long long a1)
|
||||
{
|
||||
(float)__floatdidf(a1);
|
||||
}
|
||||
|
||||
/* negate a float */
|
||||
float
|
||||
__negsf2 (float a1)
|
||||
{
|
||||
union float_long fl1;
|
||||
|
||||
fl1.f = a1;
|
||||
if (!fl1.l)
|
||||
return (0);
|
||||
|
||||
fl1.l ^= SIGNBIT;
|
||||
return (fl1.f);
|
||||
}
|
||||
|
||||
/* negate a double */
|
||||
double
|
||||
__negdf2 (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (dl1.d);
|
||||
|
||||
dl1.l.upper ^= SIGNBIT;
|
||||
return (dl1.d);
|
||||
}
|
||||
|
||||
/* convert float to double */
|
||||
double
|
||||
__extendsfdf2 (float a1)
|
||||
{
|
||||
union float_long fl1;
|
||||
union double_long dl;
|
||||
int exp;
|
||||
|
||||
fl1.f = a1;
|
||||
|
||||
if (!fl1.l)
|
||||
{
|
||||
dl.l.upper = dl.l.lower = 0;
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
dl.l.upper = SIGN (fl1.l);
|
||||
exp = EXP (fl1.l) - EXCESS + EXCESSD;
|
||||
dl.l.upper |= exp << 20;
|
||||
dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
|
||||
dl.l.lower = MANT (fl1.l) << 29;
|
||||
|
||||
return (dl.d);
|
||||
}
|
||||
|
||||
/* convert double to float */
|
||||
float
|
||||
__truncdfsf2 (double a1)
|
||||
{
|
||||
int exp;
|
||||
long mant;
|
||||
union float_long fl;
|
||||
union double_long dl1;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (float)(0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD + EXCESS;
|
||||
|
||||
/* shift double mantissa 6 bits so we can round */
|
||||
mant = MANTD (dl1) >> 6;
|
||||
|
||||
/* now round and shift down */
|
||||
mant += 1;
|
||||
mant >>= 1;
|
||||
|
||||
/* did the round overflow? */
|
||||
if (mant & 0xFE000000)
|
||||
{
|
||||
mant >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
mant &= ~HIDDEN;
|
||||
|
||||
/* pack up and go home */
|
||||
fl.l = PACK (SIGND (dl1), exp, mant);
|
||||
return (fl.f);
|
||||
}
|
||||
|
||||
/* compare two doubles */
|
||||
long
|
||||
__cmpdf2 (double a1, double a2)
|
||||
{
|
||||
union double_long dl1, dl2;
|
||||
|
||||
dl1.d = a1;
|
||||
dl2.d = a2;
|
||||
|
||||
if (SIGND (dl1) && SIGND (dl2))
|
||||
{
|
||||
dl1.l.upper ^= SIGNBIT;
|
||||
dl2.l.upper ^= SIGNBIT;
|
||||
}
|
||||
if (dl1.l.upper < dl2.l.upper)
|
||||
return (-1);
|
||||
if (dl1.l.upper > dl2.l.upper)
|
||||
return (1);
|
||||
if (dl1.l.lower < dl2.l.lower)
|
||||
return (-1);
|
||||
if (dl1.l.lower > dl2.l.lower)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* convert double to int */
|
||||
long
|
||||
__fixdfsi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 31;
|
||||
l = MANTD (dl1);
|
||||
|
||||
if (exp > 0)
|
||||
return SIGND(dl1) ? (1<<31) : ((1ul<<31)-1);
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -32 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (SIGND (dl1) ? -l : l);
|
||||
}
|
||||
|
||||
/* convert double to int */
|
||||
long long
|
||||
__fixdfdi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
long long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 64;
|
||||
l = MANTD_LL(dl1);
|
||||
|
||||
if (exp > 0) {
|
||||
l = (long long)1<<63;
|
||||
if (!SIGND(dl1))
|
||||
l--;
|
||||
return l;
|
||||
}
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -64 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (SIGND (dl1) ? -l : l);
|
||||
}
|
||||
|
||||
/* convert double to unsigned int */
|
||||
unsigned long
|
||||
__fixunsdfsi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
unsigned long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (!dl1.l.upper && !dl1.l.lower)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 32;
|
||||
l = (((((dl1.l.upper) & 0xFFFFF) | HIDDEND) << 11) | (dl1.l.lower >> 21));
|
||||
|
||||
if (exp > 0)
|
||||
return (0xFFFFFFFFul); /* largest integer */
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -32 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (l);
|
||||
}
|
||||
|
||||
/* convert double to unsigned int */
|
||||
unsigned long long
|
||||
__fixunsdfdi (double a1)
|
||||
{
|
||||
union double_long dl1;
|
||||
int exp;
|
||||
unsigned long long l;
|
||||
|
||||
dl1.d = a1;
|
||||
|
||||
if (dl1.ll == 0)
|
||||
return (0);
|
||||
|
||||
exp = EXPD (dl1) - EXCESSD - 64;
|
||||
|
||||
l = dl1.ll;
|
||||
|
||||
if (exp > 0)
|
||||
return (unsigned long long)-1;
|
||||
|
||||
/* shift down until exp = 0 or l = 0 */
|
||||
if (exp < 0 && exp > -64 && l)
|
||||
l >>= -exp;
|
||||
else
|
||||
return (0);
|
||||
|
||||
return (l);
|
||||
}
|
||||
|
||||
/* addtwo doubles */
|
||||
double
|
||||
__adddf3 (double a1, double a2)
|
||||
{
|
||||
long long mant1, mant2;
|
||||
union double_long fl1, fl2;
|
||||
int exp1, exp2;
|
||||
int sign = 0;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.ll)
|
||||
goto test_done;
|
||||
if (!fl1.ll) {
|
||||
fl1.d = fl2.d;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
exp1 = EXPD(fl1);
|
||||
exp2 = EXPD(fl2);
|
||||
|
||||
if (exp1 > exp2 + 54)
|
||||
goto test_done;
|
||||
if (exp2 > exp1 + 54) {
|
||||
fl1.d = fl2.d;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* do everything in excess precision so's we can round later */
|
||||
mant1 = MANTD_LL(fl1) << 9;
|
||||
mant2 = MANTD_LL(fl2) << 9;
|
||||
|
||||
if (SIGND(fl1))
|
||||
mant1 = -mant1;
|
||||
if (SIGND(fl2))
|
||||
mant2 = -mant2;
|
||||
|
||||
if (exp1 > exp2)
|
||||
mant2 >>= exp1 - exp2;
|
||||
else {
|
||||
mant1 >>= exp2 - exp1;
|
||||
exp1 = exp2;
|
||||
}
|
||||
mant1 += mant2;
|
||||
|
||||
if (mant1 < 0) {
|
||||
mant1 = -mant1;
|
||||
sign = SIGNBIT;
|
||||
} else if (!mant1) {
|
||||
fl1.d = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* normalize up */
|
||||
while (!(mant1 & ((long long)7<<61))) {
|
||||
mant1 <<= 1;
|
||||
exp1--;
|
||||
}
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & ((long long)3<<62)) {
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* round to even */
|
||||
mant1 += (mant1 & (1<<9)) ? (1<<8) : ((1<<8)-1);
|
||||
|
||||
/* normalize down? */
|
||||
if (mant1 & ((long long)3<<62)) {
|
||||
mant1 >>= 1;
|
||||
exp1++;
|
||||
}
|
||||
|
||||
/* lose extra precision */
|
||||
mant1 >>= 9;
|
||||
|
||||
/* turn off hidden bit */
|
||||
mant1 &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign,exp1,mant1);
|
||||
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
/* subtract two doubles */
|
||||
double
|
||||
__subdf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* check for zero args */
|
||||
if (!fl2.ll)
|
||||
return (fl1.d);
|
||||
/* twiddle sign bit and add */
|
||||
fl2.l.upper ^= SIGNBIT;
|
||||
if (!fl1.ll)
|
||||
return (fl2.d);
|
||||
return __adddf3 (a1, fl2.d);
|
||||
}
|
||||
|
||||
/* multiply two doubles */
|
||||
double
|
||||
__muldf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
unsigned long long result;
|
||||
int exp;
|
||||
int sign;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
if (!fl1.ll || !fl2.ll) {
|
||||
fl1.d = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* compute sign and exponent */
|
||||
sign = SIGND(fl1) ^ SIGND(fl2);
|
||||
exp = EXPD(fl1) - EXCESSD;
|
||||
exp += EXPD(fl2);
|
||||
|
||||
fl1.ll = MANTD_LL(fl1);
|
||||
fl2.ll = MANTD_LL(fl2);
|
||||
|
||||
/* the multiply is done as one 31x31 multiply and two 31x21 multiples */
|
||||
result = (fl1.ll >> 21) * (fl2.ll >> 21);
|
||||
result += ((fl1.ll & 0x1FFFFF) * (fl2.ll >> 21)) >> 21;
|
||||
result += ((fl2.ll & 0x1FFFFF) * (fl1.ll >> 21)) >> 21;
|
||||
|
||||
result >>= 2;
|
||||
if (result & ((long long)1<<61)) {
|
||||
/* round */
|
||||
result += 1<<8;
|
||||
result >>= 9;
|
||||
} else {
|
||||
/* round */
|
||||
result += 1<<7;
|
||||
result >>= 8;
|
||||
exp--;
|
||||
}
|
||||
if (result & (HIDDEND_LL<<1)) {
|
||||
result >>= 1;
|
||||
exp++;
|
||||
}
|
||||
|
||||
result &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign,exp,result);
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
/* divide two doubles */
|
||||
double
|
||||
__divdf3 (double a1, double a2)
|
||||
{
|
||||
union double_long fl1, fl2;
|
||||
long long mask,result;
|
||||
int exp, sign;
|
||||
|
||||
fl1.d = a1;
|
||||
fl2.d = a2;
|
||||
|
||||
/* subtract exponents */
|
||||
exp = EXPD(fl1) - EXPD(fl2) + EXCESSD;
|
||||
|
||||
/* compute sign */
|
||||
sign = SIGND(fl1) ^ SIGND(fl2);
|
||||
|
||||
/* numerator zero??? */
|
||||
if (fl1.ll == 0) {
|
||||
/* divide by zero??? */
|
||||
if (fl2.ll == 0)
|
||||
fl1.ll = ((unsigned long long)1<<63)-1; /* NaN */
|
||||
else
|
||||
fl1.ll = 0;
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
/* return +Inf or -Inf */
|
||||
if (fl2.ll == 0) {
|
||||
fl1.ll = PACKD_LL(SIGND(fl1),2047,0);
|
||||
goto test_done;
|
||||
}
|
||||
|
||||
|
||||
/* now get mantissas */
|
||||
fl1.ll = MANTD_LL(fl1);
|
||||
fl2.ll = MANTD_LL(fl2);
|
||||
|
||||
/* this assures we have 54 bits of precision in the end */
|
||||
if (fl1.ll < fl2.ll) {
|
||||
fl1.ll <<= 1;
|
||||
exp--;
|
||||
}
|
||||
|
||||
/* now we perform repeated subtraction of fl2.ll from fl1.ll */
|
||||
mask = (long long)1<<53;
|
||||
result = 0;
|
||||
while (mask) {
|
||||
if (fl1.ll >= fl2.ll)
|
||||
{
|
||||
result |= mask;
|
||||
fl1.ll -= fl2.ll;
|
||||
}
|
||||
fl1.ll <<= 1;
|
||||
mask >>= 1;
|
||||
}
|
||||
|
||||
/* round */
|
||||
result += 1;
|
||||
|
||||
/* normalize down */
|
||||
exp++;
|
||||
result >>= 1;
|
||||
|
||||
result &= ~HIDDEND_LL;
|
||||
|
||||
/* pack up and go home */
|
||||
fl1.ll = PACKD_LL(sign, exp, result);
|
||||
|
||||
test_done:
|
||||
return (fl1.d);
|
||||
}
|
||||
|
||||
int
|
||||
__gtdf2 (double a1, double a2)
|
||||
{
|
||||
return __cmpdf2 ((float) a1, (float) a2) > 0;
|
||||
}
|
||||
|
||||
int
|
||||
__gedf2 (double a1, double a2)
|
||||
{
|
||||
return (__cmpdf2 ((float) a1, (float) a2) >= 0) - 1;
|
||||
}
|
||||
|
||||
int
|
||||
__ltdf2 (double a1, double a2)
|
||||
{
|
||||
return - (__cmpdf2 ((float) a1, (float) a2) < 0);
|
||||
}
|
||||
|
||||
int
|
||||
__ledf2 (double a1, double a2)
|
||||
{
|
||||
return __cmpdf2 ((float) a1, (float) a2) > 0;
|
||||
}
|
||||
|
||||
int
|
||||
__eqdf2 (double a1, double a2)
|
||||
{
|
||||
return *(long long *) &a1 == *(long long *) &a2;
|
||||
}
|
||||
|
||||
int
|
||||
__nedf2 (double a1, double a2)
|
||||
{
|
||||
return *(long long *) &a1 != *(long long *) &a2;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
From: friedman@gnu.ai.mit.edu (Noah Friedman)
|
||||
To: roland@gnu.ai.mit.edu (Roland McGrath),
|
||||
rms@gnu.ai.mit.edu (Richard Stallman),
|
||||
jimb@gnu.ai.mit.edu (Jim Blandy),
|
||||
mib@gnu.ai.mit.edu (Michael Bushnell)
|
||||
Cc: cgw@sol.acs.unt.edu (chris williams),
|
||||
clc@gnu.ai.mit.edu (Christian Longshore Claiborn)
|
||||
Subject: Some gcc options we'd like to see.
|
||||
Date: Mon, 28 Jun 93 00:45:09 EST
|
||||
Reply-To: friedman@gnu.ai.mit.edu
|
||||
|
||||
-Waggravate-return
|
||||
-Wcast-spell
|
||||
-Wcaste-align
|
||||
-Win
|
||||
-Wmissing-protons
|
||||
-Wredundant-repetitions
|
||||
-antsy
|
||||
-fbungee-jump
|
||||
-fexpensive-operations
|
||||
-fextra-strength
|
||||
-fjesus-saves
|
||||
-fkeep-programmers-inline
|
||||
-fno-peeping-toms
|
||||
-fruit-roll-ups
|
||||
-fshort-enough
|
||||
-mno-dialogue
|
||||
-pedophile
|
||||
-vomit-frame-pointer
|
||||
|
||||
From: Alexandre Oliva <aoliva@redhat.com>
|
||||
Date: 06 Jan 2002 17:37:07 -0200
|
||||
|
||||
On Jan 2, 2002, in a long, heated thread concerning the interpretation
|
||||
of certain passages of the C standard, jtv <jtv@xs4all.nl> wrote:
|
||||
|
||||
> (Yes, I'm a pedant. I'm pining for the day when gcc will support the
|
||||
> options "-ffascist -Wanal")
|
||||
|
||||
How about introducing the options `-flame -War' :-)
|
@ -1,38 +0,0 @@
|
||||
/* Definition of location data type used in various part of GCC
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
In other words, you are welcome to use, share and improve this program.
|
||||
You are forbidden to forbid anyone else to use, share and improve
|
||||
what you give them. Help stamp out software-hoarding! */
|
||||
|
||||
#ifndef GCC_LOCATION_H
|
||||
#define GCC_LOCATION_H
|
||||
|
||||
/* The data structure used to record a location in a translation unit. */
|
||||
struct location_s GTY (())
|
||||
{
|
||||
/* The name of the source file involved. */
|
||||
const char *file;
|
||||
|
||||
/* The line-location in the source file. */
|
||||
int line;
|
||||
};
|
||||
typedef struct location_s location_t;
|
||||
|
||||
#endif
|
||||
|
@ -1,334 +0,0 @@
|
||||
/* Multibyte Character Functions.
|
||||
Copyright (C) 1998 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, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* Note regarding cross compilation:
|
||||
|
||||
In general, translation of multibyte characters to wide characters can
|
||||
only work in a native compiler since the translation function (mbtowc)
|
||||
needs to know about both the source and target character encoding. However,
|
||||
this particular implementation for JIS, SJIS and EUCJP source characters
|
||||
will work for any compiler with a newlib target. Other targets may also
|
||||
work provided that their wchar_t implementation is 2 bytes and the encoding
|
||||
leaves the source character values unchanged (except for removing the
|
||||
state shifting markers). */
|
||||
|
||||
#include "config.h"
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include "system.h"
|
||||
#include "mbchar.h"
|
||||
#include <locale.h>
|
||||
|
||||
typedef enum {ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER,
|
||||
JIS_C_NUM} JIS_CHAR_TYPE;
|
||||
|
||||
typedef enum {ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR,
|
||||
J2_ESC, J2_ESC_BR, INV, JIS_S_NUM} JIS_STATE;
|
||||
|
||||
typedef enum {COPYA, COPYJ, COPYJ2, MAKE_A, MAKE_J, NOOP,
|
||||
EMPTY, ERROR} JIS_ACTION;
|
||||
|
||||
/* State/action tables for processing JIS encoding:
|
||||
|
||||
Where possible, switches to JIS are grouped with proceding JIS characters
|
||||
and switches to ASCII are grouped with preceding JIS characters.
|
||||
Thus, maximum returned length is:
|
||||
2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6. */
|
||||
|
||||
static const JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = {
|
||||
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH*/
|
||||
/*ASCII*/ { A_ESC, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
|
||||
/*A_ESC*/ { ASCII, A_ESC_DL,ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
|
||||
/*A_ESC_DL*/{ ASCII, ASCII, ASCII, JIS, JIS, ASCII, ASCII,ASCII,ASCII},
|
||||
/*JIS*/ { J_ESC, JIS_1, JIS_1, JIS_1, JIS_1, JIS_1, INV, JIS_1,INV },
|
||||
/*JIS_1*/ { INV, JIS_2, JIS_2, JIS_2, JIS_2, JIS_2, INV, JIS_2,INV },
|
||||
/*JIS_2*/ { J2_ESC,JIS, JIS, JIS, JIS, JIS, INV, JIS, JIS },
|
||||
/*J_ESC*/ { INV, INV, J_ESC_BR, INV, INV, INV, INV, INV, INV },
|
||||
/*J_ESC_BR*/{ INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
|
||||
/*J2_ESC*/ { INV, INV, J2_ESC_BR,INV, INV, INV, INV, INV, INV },
|
||||
/*J2_ESC_BR*/{INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
|
||||
};
|
||||
|
||||
static const JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
|
||||
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTH */
|
||||
/*ASCII */ {NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, EMPTY, COPYA, COPYA},
|
||||
/*A_ESC */ {COPYA, NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA},
|
||||
/*A_ESC_DL */{COPYA, COPYA, COPYA, MAKE_J, MAKE_J, COPYA, COPYA, COPYA, COPYA},
|
||||
/*JIS */ {NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR},
|
||||
/*JIS_1 */ {ERROR, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR},
|
||||
/*JIS_2 */ {NOOP, COPYJ2,COPYJ2,COPYJ2, COPYJ2, COPYJ2,ERROR, COPYJ2,COPYJ2},
|
||||
/*J_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
|
||||
/*J_ESC_BR */{ERROR, ERROR, ERROR, ERROR, NOOP, NOOP, ERROR, ERROR, ERROR},
|
||||
/*J2_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR},
|
||||
/*J2_ESC_BR*/{ERROR, ERROR, ERROR, ERROR, COPYJ, COPYJ, ERROR, ERROR, ERROR},
|
||||
};
|
||||
|
||||
|
||||
const char *literal_codeset = NULL;
|
||||
|
||||
/* Store into *PWC (if PWC is not null) the wide character
|
||||
corresponding to the multibyte character at the start of the
|
||||
buffer S of size N. Return the number of bytes in the multibyte
|
||||
character. Return -1 if the bytes do not form a valid character,
|
||||
or 0 if S is null or points to a null byte.
|
||||
|
||||
This function behaves like the Standard C function mbtowc, except
|
||||
it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mbtowc (pwc, s, n)
|
||||
wchar_t *pwc;
|
||||
const char *s;
|
||||
size_t n;
|
||||
{
|
||||
static JIS_STATE save_state = ASCII;
|
||||
JIS_STATE curr_state = save_state;
|
||||
const unsigned char *t = (const unsigned char *) s;
|
||||
|
||||
if (s != NULL && n == 0)
|
||||
return -1;
|
||||
|
||||
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
|
||||
/* This must be the "C" locale or unknown locale -- fall thru */
|
||||
;
|
||||
else if (! strcmp (literal_codeset, "C-SJIS"))
|
||||
{
|
||||
int char1;
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
char1 = *t;
|
||||
if (ISSJIS1 (char1))
|
||||
{
|
||||
int char2 = t[1];
|
||||
|
||||
if (n <= 1)
|
||||
return -1;
|
||||
|
||||
if (ISSJIS2 (char2))
|
||||
{
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1));
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *t;
|
||||
|
||||
if (*t == '\0')
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (! strcmp (literal_codeset, "C-EUCJP"))
|
||||
{
|
||||
int char1;
|
||||
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
char1 = *t;
|
||||
if (ISEUCJP (char1))
|
||||
{
|
||||
int char2 = t[1];
|
||||
|
||||
if (n <= 1)
|
||||
return -1;
|
||||
|
||||
if (ISEUCJP (char2))
|
||||
{
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *t) << 8) + (wchar_t) (*(t + 1));
|
||||
return 2;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *t;
|
||||
|
||||
if (*t == '\0')
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
else if (! strcmp (literal_codeset, "C-JIS"))
|
||||
{
|
||||
JIS_ACTION action;
|
||||
JIS_CHAR_TYPE ch;
|
||||
const unsigned char *ptr;
|
||||
size_t i, curr_ch;
|
||||
|
||||
if (s == NULL)
|
||||
{
|
||||
save_state = ASCII;
|
||||
/* State-dependent. */
|
||||
return 1;
|
||||
}
|
||||
|
||||
ptr = t;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
curr_ch = t[i];
|
||||
switch (curr_ch)
|
||||
{
|
||||
case JIS_ESC_CHAR:
|
||||
ch = ESCAPE;
|
||||
break;
|
||||
case '$':
|
||||
ch = DOLLAR;
|
||||
break;
|
||||
case '@':
|
||||
ch = AT;
|
||||
break;
|
||||
case '(':
|
||||
ch = BRACKET;
|
||||
break;
|
||||
case 'B':
|
||||
ch = B;
|
||||
break;
|
||||
case 'J':
|
||||
ch = J;
|
||||
break;
|
||||
case '\0':
|
||||
ch = NUL;
|
||||
break;
|
||||
default:
|
||||
if (ISJIS (curr_ch))
|
||||
ch = JIS_CHAR;
|
||||
else
|
||||
ch = OTHER;
|
||||
}
|
||||
|
||||
action = JIS_action_table[curr_state][ch];
|
||||
curr_state = JIS_state_table[curr_state][ch];
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case NOOP:
|
||||
break;
|
||||
|
||||
case EMPTY:
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) 0;
|
||||
|
||||
save_state = curr_state;
|
||||
return i;
|
||||
|
||||
case COPYA:
|
||||
if (pwc != NULL)
|
||||
*pwc = (wchar_t) *ptr;
|
||||
save_state = curr_state;
|
||||
return i + 1;
|
||||
|
||||
case COPYJ:
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1));
|
||||
|
||||
save_state = curr_state;
|
||||
return i + 1;
|
||||
|
||||
case COPYJ2:
|
||||
if (pwc != NULL)
|
||||
*pwc = (((wchar_t) *ptr) << 8) + (wchar_t) (*(ptr + 1));
|
||||
|
||||
save_state = curr_state;
|
||||
return ptr - t + 2;
|
||||
|
||||
case MAKE_A:
|
||||
case MAKE_J:
|
||||
ptr = (const unsigned char *) (t + i + 1);
|
||||
break;
|
||||
|
||||
case ERROR:
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* More than n bytes needed. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef CROSS_COMPILE
|
||||
if (s == NULL)
|
||||
/* Not state-dependent. */
|
||||
return 0;
|
||||
|
||||
if (pwc != NULL)
|
||||
*pwc = *s;
|
||||
return 1;
|
||||
#else
|
||||
|
||||
/* This must be the "C" locale or unknown locale. */
|
||||
return mbtowc (pwc, s, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return the number of bytes in the multibyte character at the start
|
||||
of the buffer S of size N. Return -1 if the bytes do not form a
|
||||
valid character, or 0 if S is null or points to a null byte.
|
||||
|
||||
This function behaves like the Standard C function mblen, except
|
||||
it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mblen (s, n)
|
||||
const char *s;
|
||||
size_t n;
|
||||
{
|
||||
return local_mbtowc (NULL, s, n);
|
||||
}
|
||||
|
||||
/* Return the maximum mumber of bytes in a multibyte character.
|
||||
|
||||
This function returns the same value as the Standard C macro MB_CUR_MAX,
|
||||
except it treats locale names of the form "C-..." specially. */
|
||||
|
||||
int
|
||||
local_mb_cur_max ()
|
||||
{
|
||||
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
|
||||
;
|
||||
else if (! strcmp (literal_codeset, "C-SJIS"))
|
||||
return 2;
|
||||
else if (! strcmp (literal_codeset, "C-EUCJP"))
|
||||
return 2;
|
||||
else if (! strcmp (literal_codeset, "C-JIS"))
|
||||
return 8; /* 3 + 2 + 3 */
|
||||
|
||||
#ifdef CROSS_COMPILE
|
||||
return 1;
|
||||
#else
|
||||
if (MB_CUR_MAX > 0)
|
||||
return MB_CUR_MAX;
|
||||
|
||||
return 1; /* default */
|
||||
#endif
|
||||
}
|
||||
#else /* MULTIBYTE_CHARS */
|
||||
extern int dummy; /* silence 'ANSI C forbids an empty source file' warning */
|
||||
#endif /* MULTIBYTE_CHARS */
|
@ -1,41 +0,0 @@
|
||||
/* Various declarations for functions found in mbchar.c
|
||||
Copyright (C) 1998, 1999, 2000 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, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef GCC_MBCHAR_H
|
||||
#define GCC_MBCHAR_H
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
|
||||
/* Escape character used for JIS encoding */
|
||||
#define JIS_ESC_CHAR 0x1b
|
||||
|
||||
#define ISSJIS1(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xef))
|
||||
#define ISSJIS2(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc))
|
||||
#define ISEUCJP(c) ((c) >= 0xa1 && (c) <= 0xfe)
|
||||
#define ISJIS(c) ((c) >= 0x21 && (c) <= 0x7e)
|
||||
|
||||
extern int local_mbtowc PARAMS ((wchar_t *, const char *, size_t));
|
||||
extern int local_mblen PARAMS ((const char *, size_t));
|
||||
extern int local_mb_cur_max PARAMS ((void));
|
||||
|
||||
/* The locale being used for multibyte characters in string/char literals. */
|
||||
extern const char *literal_codeset;
|
||||
#endif /* MULTIBYTE_CHARS */
|
||||
#endif /* ! GCC_MBCHAR_H */
|
@ -1,43 +0,0 @@
|
||||
/* Switch definitions for the GNU compiler for the Objective-C language.
|
||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
GNU CC 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.
|
||||
|
||||
GNU CC 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 GNU CC; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This is the contribution to the `documented_lang_options' array in
|
||||
toplev.c for Objective-C. */
|
||||
|
||||
DEFINE_LANG_NAME ("Objective C")
|
||||
|
||||
{ "-gen-decls",
|
||||
N_("Dump decls to a .decl file") },
|
||||
{ "-fgnu-runtime",
|
||||
N_("Generate code for GNU runtime environment") },
|
||||
{ "-fno-gnu-runtime", "" },
|
||||
{ "-fnext-runtime",
|
||||
N_("Generate code for NeXT runtime environment") },
|
||||
{ "-fno-next-runtime", "" },
|
||||
{ "-Wselector",
|
||||
N_("Warn if a selector has multiple methods") },
|
||||
{ "-Wno-selector", "" },
|
||||
{ "-Wprotocol", "" },
|
||||
{ "-Wno-protocol",
|
||||
N_("Do not warn if inherited methods are unimplemented") },
|
||||
{ "-print-objc-runtime-info",
|
||||
N_("Generate C header of platform specific features") },
|
||||
{ "-fconstant-string-class",
|
||||
N_("Specify the name of the class for constant strings") },
|
@ -1,54 +0,0 @@
|
||||
/* profile.h - Defines data exported from profile.c to other passes.
|
||||
Copyright (C) 1998, 1999, 2000, 2001 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, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
#ifndef GCC_PROFILE_H
|
||||
#define GCC_PROFILE_H
|
||||
|
||||
struct profile_info
|
||||
{
|
||||
/* Used by final, for allocating the proper amount of storage for the
|
||||
instrumented arc execution counts. */
|
||||
|
||||
int count_instrumented_edges;
|
||||
|
||||
/* Used by final, for writing correct # of instrumented edges
|
||||
in this function. */
|
||||
|
||||
int count_edges_instrumented_now;
|
||||
|
||||
/* Checksum of the cfg. Used for 'identification' of code.
|
||||
Used by final. */
|
||||
|
||||
long current_function_cfg_checksum;
|
||||
|
||||
/* Max. value of counter in program corresponding to the profile data
|
||||
for the current function. */
|
||||
|
||||
gcov_type max_counter_in_program;
|
||||
|
||||
/* The number of profiles merged to form the profile data for the current
|
||||
function. */
|
||||
int count_profiles_merged;
|
||||
|
||||
};
|
||||
|
||||
extern struct profile_info profile_info;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,733 +0,0 @@
|
||||
/* Dead-code elimination pass for the GNU compiler.
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
|
||||
|
||||
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, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
/* Dead-code elimination is the removal of instructions which have no
|
||||
impact on the program's output. "Dead instructions" have no impact
|
||||
on the program's output, while "necessary instructions" may have
|
||||
impact on the output.
|
||||
|
||||
The algorithm consists of three phases:
|
||||
1) marking as necessary all instructions known to be necessary,
|
||||
e.g., writing a value to memory,
|
||||
2) propagating necessary instructions, e.g., the instructions
|
||||
giving values to operands in necessary instructions, and
|
||||
3) removing dead instructions (except replacing dead conditionals
|
||||
with unconditional jumps).
|
||||
|
||||
Side Effects:
|
||||
The last step can require adding labels, deleting insns, and
|
||||
modifying basic block structures. Some conditional jumps may be
|
||||
converted to unconditional jumps so the control-flow graph may be
|
||||
out-of-date.
|
||||
|
||||
Edges from some infinite loops to the exit block can be added to
|
||||
the control-flow graph, but will be removed after this pass is
|
||||
complete.
|
||||
|
||||
It Does Not Perform:
|
||||
We decided to not simultaneously perform jump optimization and dead
|
||||
loop removal during dead-code elimination. Thus, all jump
|
||||
instructions originally present remain after dead-code elimination
|
||||
but 1) unnecessary conditional jump instructions are changed to
|
||||
unconditional jump instructions and 2) all unconditional jump
|
||||
instructions remain.
|
||||
|
||||
Assumptions:
|
||||
1) SSA has been performed.
|
||||
2) The basic block and control-flow graph structures are accurate.
|
||||
3) The flow graph permits constructing an edge_list.
|
||||
4) note rtxes should be saved.
|
||||
|
||||
Unfinished:
|
||||
When replacing unnecessary conditional jumps with unconditional
|
||||
jumps, the control-flow graph is not updated. It should be.
|
||||
|
||||
References:
|
||||
Building an Optimizing Compiler
|
||||
Robert Morgan
|
||||
Butterworth-Heinemann, 1998
|
||||
Section 8.9
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "rtl.h"
|
||||
#include "hard-reg-set.h"
|
||||
#include "basic-block.h"
|
||||
#include "ssa.h"
|
||||
#include "insn-config.h"
|
||||
#include "recog.h"
|
||||
#include "output.h"
|
||||
|
||||
|
||||
/* A map from blocks to the edges on which they are control dependent. */
|
||||
typedef struct {
|
||||
/* An dynamically allocated array. The Nth element corresponds to
|
||||
the block with index N + 2. The Ith bit in the bitmap is set if
|
||||
that block is dependent on the Ith edge. */
|
||||
bitmap *data;
|
||||
/* The number of elements in the array. */
|
||||
int length;
|
||||
} control_dependent_block_to_edge_map_s, *control_dependent_block_to_edge_map;
|
||||
|
||||
/* Local function prototypes. */
|
||||
static control_dependent_block_to_edge_map control_dependent_block_to_edge_map_create
|
||||
PARAMS((size_t num_basic_blocks));
|
||||
static void set_control_dependent_block_to_edge_map_bit
|
||||
PARAMS ((control_dependent_block_to_edge_map c, basic_block bb,
|
||||
int edge_index));
|
||||
static void control_dependent_block_to_edge_map_free
|
||||
PARAMS ((control_dependent_block_to_edge_map c));
|
||||
static void find_all_control_dependences
|
||||
PARAMS ((struct edge_list *el, dominance_info pdom,
|
||||
control_dependent_block_to_edge_map cdbte));
|
||||
static void find_control_dependence
|
||||
PARAMS ((struct edge_list *el, int edge_index, dominance_info pdom,
|
||||
control_dependent_block_to_edge_map cdbte));
|
||||
static basic_block find_pdom
|
||||
PARAMS ((dominance_info pdom, basic_block block));
|
||||
static int inherently_necessary_register_1
|
||||
PARAMS ((rtx *current_rtx, void *data));
|
||||
static int inherently_necessary_register
|
||||
PARAMS ((rtx current_rtx));
|
||||
static int find_inherently_necessary
|
||||
PARAMS ((rtx current_rtx));
|
||||
static int propagate_necessity_through_operand
|
||||
PARAMS ((rtx *current_rtx, void *data));
|
||||
static void note_inherently_necessary_set
|
||||
PARAMS ((rtx, rtx, void *));
|
||||
|
||||
/* Unnecessary insns are indicated using insns' in_struct bit. */
|
||||
|
||||
/* Indicate INSN is dead-code; returns nothing. */
|
||||
#define KILL_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 1
|
||||
/* Indicate INSN is necessary, i.e., not dead-code; returns nothing. */
|
||||
#define RESURRECT_INSN(INSN) INSN_DEAD_CODE_P(INSN) = 0
|
||||
/* Return nonzero if INSN is unnecessary. */
|
||||
#define UNNECESSARY_P(INSN) INSN_DEAD_CODE_P(INSN)
|
||||
static void mark_all_insn_unnecessary
|
||||
PARAMS ((void));
|
||||
/* Execute CODE with free variable INSN for all unnecessary insns in
|
||||
an unspecified order, producing no output. */
|
||||
#define EXECUTE_IF_UNNECESSARY(INSN, CODE) \
|
||||
{ \
|
||||
rtx INSN; \
|
||||
\
|
||||
for (INSN = get_insns (); INSN != NULL_RTX; INSN = NEXT_INSN (INSN)) \
|
||||
if (INSN_DEAD_CODE_P (INSN)) { \
|
||||
CODE; \
|
||||
} \
|
||||
}
|
||||
/* Find the label beginning block BB. */
|
||||
static rtx find_block_label
|
||||
PARAMS ((basic_block bb));
|
||||
/* Remove INSN, updating its basic block structure. */
|
||||
static void delete_insn_bb
|
||||
PARAMS ((rtx insn));
|
||||
|
||||
/* Recording which blocks are control dependent on which edges. We
|
||||
expect each block to be control dependent on very few edges so we
|
||||
use a bitmap for each block recording its edges. An array holds
|
||||
the bitmap. Its position 0 entry holds the bitmap for block
|
||||
INVALID_BLOCK+1 so that all blocks, including the entry and exit
|
||||
blocks can participate in the data structure. */
|
||||
|
||||
/* Create a control_dependent_block_to_edge_map, given the number
|
||||
NUM_BASIC_BLOCKS of non-entry, non-exit basic blocks, e.g.,
|
||||
n_basic_blocks. This memory must be released using
|
||||
control_dependent_block_to_edge_map_free (). */
|
||||
|
||||
static control_dependent_block_to_edge_map
|
||||
control_dependent_block_to_edge_map_create (num_basic_blocks)
|
||||
size_t num_basic_blocks;
|
||||
{
|
||||
int i;
|
||||
control_dependent_block_to_edge_map c
|
||||
= xmalloc (sizeof (control_dependent_block_to_edge_map_s));
|
||||
c->length = num_basic_blocks - (INVALID_BLOCK+1);
|
||||
c->data = xmalloc ((size_t) c->length*sizeof (bitmap));
|
||||
for (i = 0; i < c->length; ++i)
|
||||
c->data[i] = BITMAP_XMALLOC ();
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Indicate block BB is control dependent on an edge with index
|
||||
EDGE_INDEX in the mapping C of blocks to edges on which they are
|
||||
control-dependent. */
|
||||
|
||||
static void
|
||||
set_control_dependent_block_to_edge_map_bit (c, bb, edge_index)
|
||||
control_dependent_block_to_edge_map c;
|
||||
basic_block bb;
|
||||
int edge_index;
|
||||
{
|
||||
if (bb->index - (INVALID_BLOCK+1) >= c->length)
|
||||
abort ();
|
||||
|
||||
bitmap_set_bit (c->data[bb->index - (INVALID_BLOCK+1)],
|
||||
edge_index);
|
||||
}
|
||||
|
||||
/* Execute CODE for each edge (given number EDGE_NUMBER within the
|
||||
CODE) for which the block containing INSN is control dependent,
|
||||
returning no output. CDBTE is the mapping of blocks to edges on
|
||||
which they are control-dependent. */
|
||||
|
||||
#define EXECUTE_IF_CONTROL_DEPENDENT(CDBTE, INSN, EDGE_NUMBER, CODE) \
|
||||
EXECUTE_IF_SET_IN_BITMAP \
|
||||
(CDBTE->data[BLOCK_NUM (INSN) - (INVALID_BLOCK+1)], 0, \
|
||||
EDGE_NUMBER, CODE)
|
||||
|
||||
/* Destroy a control_dependent_block_to_edge_map C. */
|
||||
|
||||
static void
|
||||
control_dependent_block_to_edge_map_free (c)
|
||||
control_dependent_block_to_edge_map c;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < c->length; ++i)
|
||||
BITMAP_XFREE (c->data[i]);
|
||||
free ((PTR) c);
|
||||
}
|
||||
|
||||
/* Record all blocks' control dependences on all edges in the edge
|
||||
list EL, ala Morgan, Section 3.6. The mapping PDOM of blocks to
|
||||
their postdominators are used, and results are stored in CDBTE,
|
||||
which should be empty. */
|
||||
|
||||
static void
|
||||
find_all_control_dependences (el, pdom, cdbte)
|
||||
struct edge_list *el;
|
||||
dominance_info pdom;
|
||||
control_dependent_block_to_edge_map cdbte;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NUM_EDGES (el); ++i)
|
||||
find_control_dependence (el, i, pdom, cdbte);
|
||||
}
|
||||
|
||||
/* Determine all blocks' control dependences on the given edge with
|
||||
edge_list EL index EDGE_INDEX, ala Morgan, Section 3.6. The
|
||||
mapping PDOM of blocks to their postdominators are used, and
|
||||
results are stored in CDBTE, which is assumed to be initialized
|
||||
with zeros in each (block b', edge) position. */
|
||||
|
||||
static void
|
||||
find_control_dependence (el, edge_index, pdom, cdbte)
|
||||
struct edge_list *el;
|
||||
int edge_index;
|
||||
dominance_info pdom;
|
||||
control_dependent_block_to_edge_map cdbte;
|
||||
{
|
||||
basic_block current_block;
|
||||
basic_block ending_block;
|
||||
|
||||
if (INDEX_EDGE_PRED_BB (el, edge_index) == EXIT_BLOCK_PTR)
|
||||
abort ();
|
||||
ending_block =
|
||||
(INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
|
||||
? ENTRY_BLOCK_PTR->next_bb
|
||||
: find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
|
||||
|
||||
for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
|
||||
current_block != ending_block && current_block != EXIT_BLOCK_PTR;
|
||||
current_block = find_pdom (pdom, current_block))
|
||||
{
|
||||
set_control_dependent_block_to_edge_map_bit (cdbte,
|
||||
current_block,
|
||||
edge_index);
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the immediate postdominator PDOM of the specified basic block
|
||||
BLOCK. This function is necessary because some blocks have
|
||||
negative numbers. */
|
||||
|
||||
static basic_block
|
||||
find_pdom (pdom, block)
|
||||
dominance_info pdom;
|
||||
basic_block block;
|
||||
{
|
||||
if (!block)
|
||||
abort ();
|
||||
if (block->index == INVALID_BLOCK)
|
||||
abort ();
|
||||
|
||||
if (block == ENTRY_BLOCK_PTR)
|
||||
return ENTRY_BLOCK_PTR->next_bb;
|
||||
else if (block == EXIT_BLOCK_PTR)
|
||||
return EXIT_BLOCK_PTR;
|
||||
else
|
||||
{
|
||||
basic_block bb = get_immediate_dominator (pdom, block);
|
||||
if (!bb)
|
||||
return EXIT_BLOCK_PTR;
|
||||
return bb;
|
||||
}
|
||||
}
|
||||
|
||||
/* Determine if the given CURRENT_RTX uses a hard register not
|
||||
converted to SSA. Returns nonzero only if it uses such a hard
|
||||
register. DATA is not used.
|
||||
|
||||
The program counter (PC) is not considered inherently necessary
|
||||
since code should be position-independent and thus not depend on
|
||||
particular PC values. */
|
||||
|
||||
static int
|
||||
inherently_necessary_register_1 (current_rtx, data)
|
||||
rtx *current_rtx;
|
||||
void *data ATTRIBUTE_UNUSED;
|
||||
{
|
||||
rtx x = *current_rtx;
|
||||
|
||||
if (x == NULL_RTX)
|
||||
return 0;
|
||||
switch (GET_CODE (x))
|
||||
{
|
||||
case CLOBBER:
|
||||
/* Do not traverse the rest of the clobber. */
|
||||
return -1;
|
||||
break;
|
||||
case PC:
|
||||
return 0;
|
||||
break;
|
||||
case REG:
|
||||
if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)) || x == pc_rtx)
|
||||
return 0;
|
||||
else
|
||||
return !0;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return nonzero if the insn CURRENT_RTX is inherently necessary. */
|
||||
|
||||
static int
|
||||
inherently_necessary_register (current_rtx)
|
||||
rtx current_rtx;
|
||||
{
|
||||
return for_each_rtx (¤t_rtx,
|
||||
&inherently_necessary_register_1, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Called via note_stores for each store in an insn. Note whether
|
||||
or not a particular store is inherently necessary. Store a
|
||||
nonzero value in inherently_necessary_p if such a store is found. */
|
||||
|
||||
static void
|
||||
note_inherently_necessary_set (dest, set, data)
|
||||
rtx set ATTRIBUTE_UNUSED;
|
||||
rtx dest;
|
||||
void *data;
|
||||
{
|
||||
int *inherently_necessary_set_p = (int *) data;
|
||||
|
||||
while (GET_CODE (dest) == SUBREG
|
||||
|| GET_CODE (dest) == STRICT_LOW_PART
|
||||
|| GET_CODE (dest) == ZERO_EXTRACT
|
||||
|| GET_CODE (dest) == SIGN_EXTRACT)
|
||||
dest = XEXP (dest, 0);
|
||||
|
||||
if (GET_CODE (dest) == MEM
|
||||
|| GET_CODE (dest) == UNSPEC
|
||||
|| GET_CODE (dest) == UNSPEC_VOLATILE)
|
||||
*inherently_necessary_set_p = 1;
|
||||
}
|
||||
|
||||
/* Mark X as inherently necessary if appropriate. For example,
|
||||
function calls and storing values into memory are inherently
|
||||
necessary. This function is to be used with for_each_rtx ().
|
||||
Return nonzero iff inherently necessary. */
|
||||
|
||||
static int
|
||||
find_inherently_necessary (x)
|
||||
rtx x;
|
||||
{
|
||||
if (x == NULL_RTX)
|
||||
return 0;
|
||||
else if (inherently_necessary_register (x))
|
||||
return !0;
|
||||
else
|
||||
switch (GET_CODE (x))
|
||||
{
|
||||
case CALL_INSN:
|
||||
case BARRIER:
|
||||
case PREFETCH:
|
||||
return !0;
|
||||
case CODE_LABEL:
|
||||
case NOTE:
|
||||
return 0;
|
||||
case JUMP_INSN:
|
||||
return JUMP_TABLE_DATA_P (x) || computed_jump_p (x) != 0;
|
||||
case INSN:
|
||||
{
|
||||
int inherently_necessary_set = 0;
|
||||
note_stores (PATTERN (x),
|
||||
note_inherently_necessary_set,
|
||||
&inherently_necessary_set);
|
||||
|
||||
/* If we found an inherently necessary set or an asm
|
||||
instruction, then we consider this insn inherently
|
||||
necessary. */
|
||||
return (inherently_necessary_set
|
||||
|| GET_CODE (PATTERN (x)) == ASM_INPUT
|
||||
|| asm_noperands (PATTERN (x)) >= 0);
|
||||
}
|
||||
default:
|
||||
/* Found an impossible insn type. */
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Propagate necessity through REG and SUBREG operands of CURRENT_RTX.
|
||||
This function is called with for_each_rtx () on necessary
|
||||
instructions. The DATA must be a varray of unprocessed
|
||||
instructions. */
|
||||
|
||||
static int
|
||||
propagate_necessity_through_operand (current_rtx, data)
|
||||
rtx *current_rtx;
|
||||
void *data;
|
||||
{
|
||||
rtx x = *current_rtx;
|
||||
varray_type *unprocessed_instructions = (varray_type *) data;
|
||||
|
||||
if (x == NULL_RTX)
|
||||
return 0;
|
||||
switch ( GET_CODE (x))
|
||||
{
|
||||
case REG:
|
||||
if (CONVERT_REGISTER_TO_SSA_P (REGNO (x)))
|
||||
{
|
||||
rtx insn = VARRAY_RTX (ssa_definition, REGNO (x));
|
||||
if (insn != NULL_RTX && UNNECESSARY_P (insn))
|
||||
{
|
||||
RESURRECT_INSN (insn);
|
||||
VARRAY_PUSH_RTX (*unprocessed_instructions, insn);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Indicate all insns initially assumed to be unnecessary. */
|
||||
|
||||
static void
|
||||
mark_all_insn_unnecessary ()
|
||||
{
|
||||
rtx insn;
|
||||
for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn))
|
||||
KILL_INSN (insn);
|
||||
}
|
||||
|
||||
/* Find the label beginning block BB, adding one if necessary. */
|
||||
|
||||
static rtx
|
||||
find_block_label (bb)
|
||||
basic_block bb;
|
||||
{
|
||||
rtx insn = bb->head;
|
||||
if (LABEL_P (insn))
|
||||
return insn;
|
||||
else
|
||||
{
|
||||
rtx new_label = emit_label_before (gen_label_rtx (), insn);
|
||||
if (insn == bb->head)
|
||||
bb->head = new_label;
|
||||
return new_label;
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove INSN, updating its basic block structure. */
|
||||
|
||||
static void
|
||||
delete_insn_bb (insn)
|
||||
rtx insn;
|
||||
{
|
||||
if (!insn)
|
||||
abort ();
|
||||
|
||||
/* Do not actually delete anything that is not an INSN.
|
||||
|
||||
We can get here because we only consider INSNs as
|
||||
potentially necessary. We leave it to later passes
|
||||
to remove unnecessary notes, unused labels, etc. */
|
||||
if (! INSN_P (insn))
|
||||
return;
|
||||
|
||||
delete_insn (insn);
|
||||
}
|
||||
|
||||
/* Perform the dead-code elimination. */
|
||||
|
||||
void
|
||||
ssa_eliminate_dead_code ()
|
||||
{
|
||||
rtx insn;
|
||||
basic_block bb;
|
||||
/* Necessary instructions with operands to explore. */
|
||||
varray_type unprocessed_instructions;
|
||||
/* Map element (b,e) is nonzero if the block is control dependent on
|
||||
edge. "cdbte" abbreviates control dependent block to edge. */
|
||||
control_dependent_block_to_edge_map cdbte;
|
||||
/* Element I is the immediate postdominator of block I. */
|
||||
dominance_info pdom;
|
||||
struct edge_list *el;
|
||||
|
||||
/* Initialize the data structures. */
|
||||
mark_all_insn_unnecessary ();
|
||||
VARRAY_RTX_INIT (unprocessed_instructions, 64,
|
||||
"unprocessed instructions");
|
||||
cdbte = control_dependent_block_to_edge_map_create (last_basic_block);
|
||||
|
||||
/* Prepare for use of BLOCK_NUM (). */
|
||||
connect_infinite_loops_to_exit ();
|
||||
|
||||
/* Compute control dependence. */
|
||||
pdom = calculate_dominance_info (CDI_POST_DOMINATORS);
|
||||
el = create_edge_list ();
|
||||
find_all_control_dependences (el, pdom, cdbte);
|
||||
|
||||
/* Find inherently necessary instructions. */
|
||||
for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn))
|
||||
if (find_inherently_necessary (insn))
|
||||
{
|
||||
RESURRECT_INSN (insn);
|
||||
VARRAY_PUSH_RTX (unprocessed_instructions, insn);
|
||||
}
|
||||
|
||||
/* Propagate necessity using the operands of necessary instructions. */
|
||||
while (VARRAY_ACTIVE_SIZE (unprocessed_instructions) > 0)
|
||||
{
|
||||
rtx current_instruction;
|
||||
int edge_number;
|
||||
|
||||
current_instruction = VARRAY_TOP_RTX (unprocessed_instructions);
|
||||
VARRAY_POP (unprocessed_instructions);
|
||||
|
||||
/* Make corresponding control dependent edges necessary. */
|
||||
/* Assume the only JUMP_INSN is the block's last insn. It appears
|
||||
that the last instruction of the program need not be a
|
||||
JUMP_INSN. */
|
||||
|
||||
if (INSN_P (current_instruction)
|
||||
&& !JUMP_TABLE_DATA_P (current_instruction))
|
||||
{
|
||||
/* Notes and labels contain no interesting operands. */
|
||||
EXECUTE_IF_CONTROL_DEPENDENT
|
||||
(cdbte, current_instruction, edge_number,
|
||||
{
|
||||
rtx jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end;
|
||||
if (GET_CODE (jump_insn) == JUMP_INSN
|
||||
&& UNNECESSARY_P (jump_insn))
|
||||
{
|
||||
RESURRECT_INSN (jump_insn);
|
||||
VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn);
|
||||
}
|
||||
});
|
||||
|
||||
/* Propagate through the operands. */
|
||||
for_each_rtx (¤t_instruction,
|
||||
&propagate_necessity_through_operand,
|
||||
(PTR) &unprocessed_instructions);
|
||||
|
||||
/* PHI nodes are somewhat special in that each PHI alternative
|
||||
has data and control dependencies. The data dependencies
|
||||
are handled via propagate_necessity_through_operand. We
|
||||
handle the control dependency here.
|
||||
|
||||
We consider the control dependent edges leading to the
|
||||
predecessor block associated with each PHI alternative
|
||||
as necessary. */
|
||||
if (PHI_NODE_P (current_instruction))
|
||||
{
|
||||
rtvec phi_vec = XVEC (SET_SRC (PATTERN (current_instruction)), 0);
|
||||
int num_elem = GET_NUM_ELEM (phi_vec);
|
||||
int v;
|
||||
|
||||
for (v = num_elem - 2; v >= 0; v -= 2)
|
||||
{
|
||||
basic_block bb;
|
||||
|
||||
bb = BASIC_BLOCK (INTVAL (RTVEC_ELT (phi_vec, v + 1)));
|
||||
EXECUTE_IF_CONTROL_DEPENDENT
|
||||
(cdbte, bb->end, edge_number,
|
||||
{
|
||||
rtx jump_insn;
|
||||
|
||||
jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end;
|
||||
if (((GET_CODE (jump_insn) == JUMP_INSN))
|
||||
&& UNNECESSARY_P (jump_insn))
|
||||
{
|
||||
RESURRECT_INSN (jump_insn);
|
||||
VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove the unnecessary instructions. */
|
||||
EXECUTE_IF_UNNECESSARY (insn,
|
||||
{
|
||||
if (any_condjump_p (insn))
|
||||
{
|
||||
basic_block bb = BLOCK_FOR_INSN (insn);
|
||||
basic_block pdom_bb = find_pdom (pdom, bb);
|
||||
rtx lbl;
|
||||
edge e;
|
||||
|
||||
/* Egad. The immediate post dominator is the exit block. We
|
||||
would like to optimize this conditional jump to jump directly
|
||||
to the exit block. That can be difficult as we may not have
|
||||
a suitable CODE_LABEL that allows us to fall unmolested into
|
||||
the exit block.
|
||||
|
||||
So, we just delete the conditional branch by turning it into
|
||||
a deleted note. That is safe, but just not as optimal as
|
||||
it could be. */
|
||||
if (pdom_bb == EXIT_BLOCK_PTR)
|
||||
{
|
||||
/* Since we're going to just delete the branch, we need
|
||||
look at all the edges and remove all those which are not
|
||||
a fallthru edge. */
|
||||
e = bb->succ;
|
||||
while (e)
|
||||
{
|
||||
edge temp = e;
|
||||
|
||||
e = e->succ_next;
|
||||
if ((temp->flags & EDGE_FALLTHRU) == 0)
|
||||
{
|
||||
/* We've found a non-fallthru edge, find any PHI nodes
|
||||
at the target and clean them up. */
|
||||
if (temp->dest != EXIT_BLOCK_PTR)
|
||||
{
|
||||
rtx insn
|
||||
= first_insn_after_basic_block_note (temp->dest);
|
||||
|
||||
while (PHI_NODE_P (insn))
|
||||
{
|
||||
remove_phi_alternative (PATTERN (insn), temp->src);
|
||||
insn = NEXT_INSN (insn);
|
||||
}
|
||||
}
|
||||
|
||||
remove_edge (temp);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now "delete" the conditional jump. */
|
||||
PUT_CODE (insn, NOTE);
|
||||
NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We've found a conditional branch that is unnecessary.
|
||||
|
||||
First, remove all outgoing edges from this block, updating
|
||||
PHI nodes as appropriate. */
|
||||
e = bb->succ;
|
||||
while (e)
|
||||
{
|
||||
edge temp = e;
|
||||
|
||||
e = e->succ_next;
|
||||
|
||||
if (temp->flags & EDGE_ABNORMAL)
|
||||
continue;
|
||||
|
||||
/* We found an edge that is not executable. First simplify
|
||||
the PHI nodes in the target block. */
|
||||
if (temp->dest != EXIT_BLOCK_PTR)
|
||||
{
|
||||
rtx insn = first_insn_after_basic_block_note (temp->dest);
|
||||
|
||||
while (PHI_NODE_P (insn))
|
||||
{
|
||||
remove_phi_alternative (PATTERN (insn), temp->src);
|
||||
insn = NEXT_INSN (insn);
|
||||
}
|
||||
}
|
||||
|
||||
remove_edge (temp);
|
||||
}
|
||||
|
||||
/* Create an edge from this block to the post dominator.
|
||||
What about the PHI nodes at the target? */
|
||||
make_edge (bb, pdom_bb, 0);
|
||||
|
||||
/* Third, transform this insn into an unconditional
|
||||
jump to the label for the immediate postdominator. */
|
||||
lbl = find_block_label (pdom_bb);
|
||||
SET_SRC (PATTERN (insn)) = gen_rtx_LABEL_REF (VOIDmode, lbl);
|
||||
INSN_CODE (insn) = -1;
|
||||
JUMP_LABEL (insn) = lbl;
|
||||
LABEL_NUSES (lbl)++;
|
||||
|
||||
/* A barrier must follow any unconditional jump. Barriers
|
||||
are not in basic blocks so this must occur after
|
||||
deleting the conditional jump. */
|
||||
emit_barrier_after (insn);
|
||||
}
|
||||
else if (!JUMP_P (insn))
|
||||
delete_insn_bb (insn);
|
||||
});
|
||||
|
||||
/* Remove fake edges from the CFG. */
|
||||
remove_fake_edges ();
|
||||
|
||||
/* Find any blocks with no successors and ensure they are followed
|
||||
by a BARRIER. delete_insn has the nasty habit of deleting barriers
|
||||
when deleting insns. */
|
||||
FOR_EACH_BB (bb)
|
||||
{
|
||||
if (bb->succ == NULL)
|
||||
{
|
||||
rtx next = NEXT_INSN (bb->end);
|
||||
|
||||
if (!next || GET_CODE (next) != BARRIER)
|
||||
emit_barrier_after (bb->end);
|
||||
}
|
||||
}
|
||||
/* Release allocated memory. */
|
||||
for (insn = get_insns (); insn != NULL_RTX; insn = NEXT_INSN (insn))
|
||||
RESURRECT_INSN (insn);
|
||||
if (VARRAY_ACTIVE_SIZE (unprocessed_instructions) != 0)
|
||||
abort ();
|
||||
control_dependent_block_to_edge_map_free (cdbte);
|
||||
free ((PTR) pdom);
|
||||
free_edge_list (el);
|
||||
}
|
2334
contrib/gcc/ssa.c
2334
contrib/gcc/ssa.c
File diff suppressed because it is too large
Load Diff
@ -1,72 +0,0 @@
|
||||
/* Static Single Assignment (SSA) definitions for GNU C-Compiler
|
||||
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
|
||||
|
||||
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, 59 Temple Place - Suite 330, Boston, MA
|
||||
02111-1307, USA. */
|
||||
|
||||
|
||||
/* Main SSA routines. */
|
||||
extern void convert_to_ssa PARAMS ((void));
|
||||
extern void convert_from_ssa PARAMS ((void));
|
||||
typedef int (*successor_phi_fn) PARAMS ((rtx, int, int, void *));
|
||||
extern int for_each_successor_phi PARAMS ((basic_block bb,
|
||||
successor_phi_fn,
|
||||
void *));
|
||||
void compute_dominance_frontiers PARAMS ((sbitmap *frontiers,
|
||||
dominance_info idom));
|
||||
extern int remove_phi_alternative PARAMS ((rtx, basic_block));
|
||||
|
||||
|
||||
/* Optimizations. */
|
||||
/* In ssa-dce.c */
|
||||
extern void ssa_eliminate_dead_code PARAMS ((void));
|
||||
|
||||
/* In ssa-ccp.c */
|
||||
extern void ssa_const_prop PARAMS ((void));
|
||||
|
||||
|
||||
/* SSA definitions and uses. */
|
||||
/* This flag is set when the CFG is in SSA form. */
|
||||
extern int in_ssa_form;
|
||||
|
||||
/* Element I is the single instruction that sets register I. */
|
||||
extern GTY(()) varray_type ssa_definition;
|
||||
|
||||
/* Element I is an INSN_LIST of instructions that use register I. */
|
||||
extern varray_type ssa_uses;
|
||||
|
||||
|
||||
/* Specify which hard registers should be converted. */
|
||||
|
||||
/* All pseudo-registers (having register number >=
|
||||
FIRST_PSEUDO_REGISTER) and hard registers satisfying
|
||||
CONVERT_HARD_REGISTER_TO_SSA_P are converted to SSA form. */
|
||||
|
||||
/* Given a hard register number REG_NO, return nonzero if and only if
|
||||
the register should be converted to SSA. */
|
||||
|
||||
#ifndef CONVERT_HARD_REGISTER_TO_SSA_P
|
||||
#define CONVERT_HARD_REGISTER_TO_SSA_P(REG_NO) (0) /* default of no hard registers */
|
||||
#endif /* CONVERT_HARD_REGISTER_TO_SSA_P */
|
||||
|
||||
/* Given a register number REG_NO, return nonzero if and only if the
|
||||
register should be converted to SSA. */
|
||||
|
||||
#define CONVERT_REGISTER_TO_SSA_P(REG_NO) \
|
||||
((!HARD_REGISTER_NUM_P (REG_NO)) || \
|
||||
(CONVERT_HARD_REGISTER_TO_SSA_P (REG_NO)))
|
@ -1,172 +0,0 @@
|
||||
/* Subroutines needed for unwinding stack frames via the libunwind API.
|
||||
Copyright (C) 2002, 2003
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
|
||||
|
||||
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, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, if you link this library with other files,
|
||||
some of which are compiled with GCC, to produce an executable,
|
||||
this library does not by itself cause the resulting executable
|
||||
to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why
|
||||
the executable file might be covered by the GNU General Public License. */
|
||||
|
||||
#include "tconfig.h"
|
||||
#include "tsystem.h"
|
||||
#include "unwind.h"
|
||||
|
||||
#ifndef __USING_SJLJ_EXCEPTIONS__
|
||||
|
||||
#define UNW_LOCAL_ONLY
|
||||
|
||||
#include <libunwind.h>
|
||||
|
||||
typedef struct {
|
||||
_Unwind_Personality_Fn personality;
|
||||
} _Unwind_FrameState;
|
||||
|
||||
struct _Unwind_Context {
|
||||
unw_cursor_t cursor;
|
||||
};
|
||||
|
||||
|
||||
/* First come the helper-routines that are needed by unwind.inc. */
|
||||
|
||||
static _Unwind_Reason_Code
|
||||
uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
|
||||
{
|
||||
unw_proc_info_t pi;
|
||||
|
||||
if (unw_step (&context->cursor) <= 0)
|
||||
return _URC_END_OF_STACK;
|
||||
|
||||
unw_get_proc_info(&context->cursor, &pi);
|
||||
fs->personality = (_Unwind_Personality_Fn) pi.handler;
|
||||
|
||||
return _URC_NO_REASON;
|
||||
}
|
||||
|
||||
#define uw_update_context(context,fs) do { ; } while (0)
|
||||
|
||||
static inline _Unwind_Ptr
|
||||
uw_identify_context (struct _Unwind_Context *context)
|
||||
{
|
||||
unw_word_t ip;
|
||||
unw_get_reg (&context->cursor, UNW_REG_IP, &ip);
|
||||
return (_Unwind_Ptr) ip;
|
||||
}
|
||||
|
||||
#define uw_init_context(context) \
|
||||
do \
|
||||
{ \
|
||||
unw_context_t uc; \
|
||||
unw_getcontext (&uc); \
|
||||
unw_init_local (&(context)->cursor, &uc); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
static inline void __attribute__ ((noreturn))
|
||||
uw_install_context (struct _Unwind_Context *current __attribute__ ((unused)),
|
||||
struct _Unwind_Context *target)
|
||||
{
|
||||
unw_resume (&(target)->cursor);
|
||||
abort ();
|
||||
}
|
||||
|
||||
|
||||
/* Now come the helper-routines which may be called from an exception
|
||||
handler. The interface for these routines are defined by the C++
|
||||
ABI. See: http://www.codesourcery.com/cxx-abi/abi-eh.html */
|
||||
|
||||
_Unwind_Word
|
||||
_Unwind_GetGR (struct _Unwind_Context *context, int index)
|
||||
{
|
||||
unw_word_t ret;
|
||||
|
||||
/* Note: here we depend on the fact that general registers are
|
||||
expected to start with register number 0! */
|
||||
unw_get_reg (&context->cursor, index, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the value of the CFA as saved in CONTEXT. */
|
||||
|
||||
_Unwind_Word
|
||||
_Unwind_GetCFA (struct _Unwind_Context *context)
|
||||
{
|
||||
/* ??? Is there any way to get this information? */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Overwrite the saved value for register REG in CONTEXT with VAL. */
|
||||
|
||||
void
|
||||
_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val)
|
||||
{
|
||||
/* Note: here we depend on the fact that general registers are
|
||||
expected to start with register number 0! */
|
||||
unw_set_reg (&context->cursor, index, val);
|
||||
}
|
||||
|
||||
/* Retrieve the return address for CONTEXT. */
|
||||
|
||||
inline _Unwind_Ptr
|
||||
_Unwind_GetIP (struct _Unwind_Context *context)
|
||||
{
|
||||
unw_word_t ret;
|
||||
|
||||
unw_get_reg (&context->cursor, UNW_REG_IP, &ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Overwrite the return address for CONTEXT with VAL. */
|
||||
|
||||
inline void
|
||||
_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
|
||||
{
|
||||
unw_set_reg (&context->cursor, UNW_REG_IP, val);
|
||||
}
|
||||
|
||||
void *
|
||||
_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context)
|
||||
{
|
||||
unw_proc_info_t pi;
|
||||
|
||||
unw_get_proc_info(&context->cursor, &pi);
|
||||
return (void *) pi.lsda;
|
||||
}
|
||||
|
||||
_Unwind_Ptr
|
||||
_Unwind_GetRegionStart (struct _Unwind_Context *context)
|
||||
{
|
||||
unw_proc_info_t pi;
|
||||
|
||||
unw_get_proc_info(&context->cursor, &pi);
|
||||
return (_Unwind_Ptr) pi.start_ip;
|
||||
}
|
||||
|
||||
void *
|
||||
_Unwind_FindEnclosingFunction (void *pc)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "unwind.inc"
|
||||
|
||||
#endif /* !__USING_SJLJ_EXCEPTIONS__ */
|
@ -1,58 +0,0 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Fortran libU77 library.
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Fortran 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with GNU Fortran; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if 0 /* Don't include these unless necessary -- jcb. */
|
||||
#include "f2c.h"
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
G77_besj0_0 (const real * x)
|
||||
{
|
||||
return j0 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_besj1_0 (const real * x)
|
||||
{
|
||||
return j1 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_besjn_0 (const integer * n, real * x)
|
||||
{
|
||||
return jn (*n, *x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_besy0_0 (const real * x)
|
||||
{
|
||||
return y0 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_besy1_0 (const real * x)
|
||||
{
|
||||
return y1 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_besyn_0 (const integer * n, real * x)
|
||||
{
|
||||
return yn (*n, *x);
|
||||
}
|
||||
#endif
|
@ -1,58 +0,0 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of GNU Fortran libU77 library.
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Fortran 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with GNU Fortran; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if 0 /* Don't include these unless necessary -- dnp. */
|
||||
#include "f2c.h"
|
||||
#include <math.h>
|
||||
|
||||
double
|
||||
G77_dbesj0_0 (const double *x)
|
||||
{
|
||||
return j0 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_dbesj1_0 (const double *x)
|
||||
{
|
||||
return j1 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_dbesjn_0 (const integer * n, double *x)
|
||||
{
|
||||
return jn (*n, *x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_dbesy0_0 (const double *x)
|
||||
{
|
||||
return y0 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_dbesy1_0 (const double *x)
|
||||
{
|
||||
return y1 (*x);
|
||||
}
|
||||
|
||||
double
|
||||
G77_dbesyn_0 (const integer * n, double *x)
|
||||
{
|
||||
return yn (*n, *x);
|
||||
}
|
||||
#endif
|
@ -1,64 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of the GNU ISO C++ Library. This library 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.
|
||||
#
|
||||
# This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
# USA.
|
||||
#
|
||||
# As a special exception, you may use this file as part of a free software
|
||||
# library without restriction. Specifically, if other files instantiate
|
||||
# templates or use macros or inline functions from this file, or you compile
|
||||
# this file and link it with other files to produce an executable, this
|
||||
# file does not by itself cause the resulting executable to be covered by
|
||||
# the GNU General Public License. This exception does not however
|
||||
# invalidate any other reasons why the executable file might be covered by
|
||||
# the GNU General Public License.
|
||||
|
||||
|
||||
if test ${#} -lt 2 || test $1 = '--help'; then
|
||||
echo "Usage: extract_symvers shared_lib output_file" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lib=$1
|
||||
output=$2
|
||||
|
||||
# GNU binutils, somewhere after version 2.11.2, requires -W/--wide to avoid
|
||||
# default line truncation. -W is not supported and truncation did not occur
|
||||
# by default before that point.
|
||||
readelf="readelf --symbols"
|
||||
if readelf --help | grep -- --wide > /dev/null; then
|
||||
readelf="$readelf --wide"
|
||||
fi
|
||||
|
||||
# This avoids weird sorting problems later.
|
||||
export LC_ALL=C
|
||||
|
||||
tmp=extract.$$
|
||||
|
||||
${readelf} ${lib} | sed '/\.dynsym/,/^$/p;d' | egrep -v ' (LOCAL|UND) ' |\
|
||||
awk '{ if ($4 == "FUNC" || $4 == "NOTYPE")
|
||||
printf "%s:%s\n", $4, $8;
|
||||
else if ($4 == "OBJECT")
|
||||
printf "%s:%s:%s\n", $4, $3, $8;
|
||||
}' | sort | uniq > $tmp 2>&1
|
||||
# else printf "Huh? What is %s?\n", $8;
|
||||
|
||||
|
||||
# I think we'll be doing some more with this file, but for now, dump.
|
||||
mv $tmp $output
|
||||
|
||||
exit 0
|
@ -1,194 +0,0 @@
|
||||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
#include <bits/basic_file.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// __basic_file<char> definitions
|
||||
__basic_file<char>::__basic_file(__c_lock* __lock)
|
||||
{
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_lock = __lock;
|
||||
#endif
|
||||
// Don't set the orientation of the stream when initializing.
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
_IO_no_init(this, 0, 0, &_M_wfile, 0);
|
||||
#else /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
_IO_no_init(this, 0, 0, NULL, 0);
|
||||
#endif /* !defined(_GLIBCPP_USE_WCHAR_T) */
|
||||
_IO_JUMPS((_IO_FILE_plus *) this) = &_IO_file_jumps;
|
||||
_IO_file_init((_IO_FILE_plus*)this);
|
||||
}
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::overflow(int __c)
|
||||
{ return _IO_file_overflow(this, __c); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::underflow()
|
||||
{ return _IO_file_underflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::uflow()
|
||||
{ return _IO_default_uflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::pbackfail(int __c)
|
||||
{ return _IO_default_pbackfail(this, __c); }
|
||||
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n)
|
||||
{ return _IO_file_xsputn(this, __s, __n); }
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode)
|
||||
{ return _IO_file_seekoff(this, __off, __way, __mode); }
|
||||
|
||||
streamoff
|
||||
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode)
|
||||
{ return _IO_file_seekoff(this, __pos, ios_base::beg, __mode); }
|
||||
|
||||
// NB: Unused.
|
||||
streambuf*
|
||||
__basic_file<char>::setbuf(char* __b, int __len)
|
||||
{ return (streambuf*) _IO_file_setbuf(this,__b, __len); }
|
||||
|
||||
int
|
||||
__basic_file<char>::sync()
|
||||
{ return _IO_file_sync(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<char>::doallocate()
|
||||
{ return _IO_file_doallocate(this); }
|
||||
|
||||
// __basic_file<wchar_t> definitions
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
__basic_file<wchar_t>::__basic_file(__c_lock* __lock)
|
||||
{
|
||||
#ifdef _IO_MTSAFE_IO
|
||||
_lock = __lock;
|
||||
#endif
|
||||
// Don't set the orientation of the stream when initializing.
|
||||
_IO_no_init(this, 0, 0, &_M_wfile, &_IO_wfile_jumps);
|
||||
_IO_JUMPS((_IO_FILE_plus *) this) = &_IO_wfile_jumps;
|
||||
_IO_file_init((_IO_FILE_plus*)this);
|
||||
|
||||
// In addition, need to allocate the buffer...
|
||||
_IO_wdoallocbuf(this);
|
||||
// Setup initial positions for this buffer...
|
||||
// if (!(_flags & _IO_NO_READS))
|
||||
_IO_wsetg(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base,
|
||||
_wide_data->_IO_buf_base);
|
||||
// if (!(_flags & _IO_NO_WRITES))
|
||||
_IO_wsetp(this, _wide_data->_IO_buf_base, _wide_data->_IO_buf_base);
|
||||
|
||||
// Setup codecvt bits...
|
||||
_codecvt = &__c_libio_codecvt;
|
||||
|
||||
// Do the same for narrow bits...
|
||||
if (_IO_write_base == NULL)
|
||||
{
|
||||
_IO_doallocbuf(this);
|
||||
// if (!(_flags & _IO_NO_READS))
|
||||
_IO_setg(this, _IO_buf_base, _IO_buf_base, _IO_buf_base);
|
||||
// if (!(_flags & _IO_NO_WRITES))
|
||||
_IO_setp(this, _IO_buf_base, _IO_buf_base);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::overflow(int __c)
|
||||
{ return _IO_wfile_overflow(this, __c); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::underflow()
|
||||
{ return _IO_wfile_underflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<wchar_t>::uflow()
|
||||
{ return _IO_wdefault_uflow(this); }
|
||||
|
||||
// NB: Unused.
|
||||
int
|
||||
__basic_file<wchar_t>::pbackfail(int __c)
|
||||
{ return _IO_wdefault_pbackfail(this, __c); }
|
||||
|
||||
streamsize
|
||||
__basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n)
|
||||
{ return _IO_wfile_xsputn(this, __s, __n); }
|
||||
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode)
|
||||
{ return _IO_wfile_seekoff(this, __off, __way, __mode); }
|
||||
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode)
|
||||
{ return _IO_wfile_seekoff(this, __pos, ios_base::beg, __mode); }
|
||||
|
||||
streambuf*
|
||||
__basic_file<wchar_t>::setbuf(wchar_t* __b, int __len)
|
||||
{ return (streambuf*) _IO_wfile_setbuf(this,__b, __len); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::sync()
|
||||
{ return _IO_wfile_sync(this); }
|
||||
|
||||
int
|
||||
__basic_file<wchar_t>::doallocate()
|
||||
{ return _IO_wfile_doallocate(this); }
|
||||
#endif
|
||||
|
||||
// Need to instantiate base class here for type-info bits, etc
|
||||
template struct __basic_file_base<char>;
|
||||
template class __basic_file<char>;
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template struct __basic_file_base<wchar_t>;
|
||||
template class __basic_file<wchar_t>;
|
||||
#endif
|
||||
} // namespace std
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,498 +0,0 @@
|
||||
// Wrapper of C-language FILE struct -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 27.8 File-based streams
|
||||
//
|
||||
|
||||
/** @file basic_file.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BASIC_FILE
|
||||
#define _CPP_BASIC_FILE 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <ios>
|
||||
#include <libioP.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// Ulrich is going to make some detailed comment here, explaining
|
||||
// all this unpleasantness, providing detailed performance analysis
|
||||
// as to why we have to do all this lame vtable hacking instead of a
|
||||
// sane, function-based approach. This verbiage will provide a clear
|
||||
// and detailed description of the whole object-layout,
|
||||
// vtable-swapping, sordid history of this hack.
|
||||
template<typename _CharT>
|
||||
struct __basic_file_base: public __c_file_type
|
||||
{
|
||||
virtual
|
||||
~__basic_file_base() { };
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF) = 0;
|
||||
|
||||
virtual int
|
||||
underflow() = 0;
|
||||
|
||||
virtual int
|
||||
uflow() = 0;
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out) = 0;
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len) = 0;
|
||||
|
||||
virtual int
|
||||
sync() = 0;
|
||||
|
||||
virtual int
|
||||
doallocate() = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n) = 0;
|
||||
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way) = 0;
|
||||
|
||||
virtual int
|
||||
sys_close() = 0;
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v) = 0;
|
||||
|
||||
virtual int
|
||||
showmanyc() = 0;
|
||||
|
||||
virtual void
|
||||
imbue(void* __v) = 0;
|
||||
};
|
||||
|
||||
// Some of these member functions are based on libio/filebuf.cc.
|
||||
// Also note that the order and number of virtual functions has to precisely
|
||||
// match the order and number in the _IO_jump_t struct defined in libioP.h.
|
||||
template<typename _CharT>
|
||||
class __basic_file: public __basic_file_base<_CharT>
|
||||
{
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
__c_wfile_type _M_wfile;
|
||||
# endif
|
||||
|
||||
public:
|
||||
__basic_file(__c_lock* __lock = 0);
|
||||
|
||||
void
|
||||
_M_open_mode(ios_base::openmode __mode, int& __p_mode, int& __rw_mode,
|
||||
char* __c_mode);
|
||||
|
||||
// Equivalent to the normal fopen function.
|
||||
__basic_file*
|
||||
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
|
||||
|
||||
// Used for opening the standard streams, cin, cout, cerr, clog,
|
||||
// and their wide-stream equivalents. Instead of calling open, it
|
||||
// just sets
|
||||
// - for libio: __c_file_type->_fileno and the respective _flags bits
|
||||
// - for stdio: _M_cfile = __file and some internal flags
|
||||
// and returns.
|
||||
__basic_file*
|
||||
sys_open(__c_file_type* __file, ios_base::openmode __mode);
|
||||
|
||||
_CharT
|
||||
sys_getc();
|
||||
|
||||
_CharT
|
||||
sys_ungetc(_CharT);
|
||||
|
||||
__basic_file*
|
||||
close();
|
||||
|
||||
bool
|
||||
is_open();
|
||||
|
||||
int
|
||||
fd();
|
||||
|
||||
// NB: Must match FILE specific jump table starting here--this
|
||||
// means all virtual functions starting with the dtor must match,
|
||||
// slot by slot. For glibc-based dystems, this means the _IO_FILE
|
||||
// as the FILE struct and _IO_jump_t as the jump table.
|
||||
virtual
|
||||
~__basic_file(); // Takes the place of __finish.
|
||||
|
||||
virtual int
|
||||
overflow(int __c = EOF);
|
||||
|
||||
virtual int
|
||||
underflow();
|
||||
|
||||
virtual int
|
||||
uflow();
|
||||
|
||||
virtual int
|
||||
pbackfail(int __c);
|
||||
|
||||
// A complex "write" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsputn(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "read" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamsize
|
||||
xsgetn(_CharT* __s, streamsize __n);
|
||||
|
||||
// A complex "seekoff" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
// A complex "seekpos" function that sets all of __c_file_type's
|
||||
// pointers and associated data members correctly and manages its
|
||||
// relation to the external byte sequence.
|
||||
virtual streamoff
|
||||
seekpos(streamoff __pos,
|
||||
ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
|
||||
virtual streambuf*
|
||||
setbuf(_CharT* __b, int __len);
|
||||
|
||||
virtual int
|
||||
sync();
|
||||
|
||||
virtual int
|
||||
doallocate();
|
||||
|
||||
// A simple read function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_read(_CharT* __s, streamsize __n);
|
||||
|
||||
// A simple write function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamsize
|
||||
sys_write(const _CharT* __s, streamsize __n);
|
||||
|
||||
// A simple seek function for the external byte sequence, that
|
||||
// does no mucking around with or setting of the pointers or flags
|
||||
// in __c_file_type.
|
||||
virtual streamoff
|
||||
sys_seek(streamoff __off, ios_base::seekdir __way);
|
||||
|
||||
virtual int
|
||||
sys_close();
|
||||
|
||||
virtual int
|
||||
sys_stat(void* __v);
|
||||
|
||||
virtual int
|
||||
showmanyc();
|
||||
|
||||
virtual void
|
||||
imbue(void* __v);
|
||||
};
|
||||
|
||||
// __basic_file<char> specializations
|
||||
template<>
|
||||
__basic_file<char>::__basic_file(__c_lock* __lock);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::overflow(int __c);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::underflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::uflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::pbackfail(int __c);
|
||||
|
||||
template<>
|
||||
streamsize
|
||||
__basic_file<char>::xsputn(const char* __s, streamsize __n);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<char>::seekpos(streamoff __pos, ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streambuf*
|
||||
__basic_file<char>::setbuf(char* __b, int __len);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::sync();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<char>::doallocate();
|
||||
|
||||
// __basic_file<wchar_t> specializations
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
template<>
|
||||
__basic_file<wchar_t>::__basic_file(__c_lock* __lock);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::overflow(int __c);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::underflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::uflow();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::pbackfail(int __c);
|
||||
|
||||
template<>
|
||||
streamsize
|
||||
__basic_file<wchar_t>::xsputn(const wchar_t* __s, streamsize __n);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekoff(streamoff __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streamoff
|
||||
__basic_file<wchar_t>::seekpos(streamoff __pos, ios_base::openmode __mode);
|
||||
|
||||
template<>
|
||||
streambuf*
|
||||
__basic_file<wchar_t>::setbuf(wchar_t* __b, int __len);
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::sync();
|
||||
|
||||
template<>
|
||||
int
|
||||
__basic_file<wchar_t>::doallocate();
|
||||
#endif
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>::~__basic_file()
|
||||
{ _IO_file_finish(this, 0); }
|
||||
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::_M_open_mode(ios_base::openmode __mode,
|
||||
int& __p_mode, int& __rw_mode,
|
||||
char* /*__c_mode*/)
|
||||
{
|
||||
#ifdef O_BINARY
|
||||
bool __testb = __mode & ios_base::binary;
|
||||
#endif
|
||||
bool __testi = __mode & ios_base::in;
|
||||
bool __testo = __mode & ios_base::out;
|
||||
bool __testt = __mode & ios_base::trunc;
|
||||
bool __testa = __mode & ios_base::app;
|
||||
|
||||
if (!__testi && __testo && !__testt && !__testa)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_TRUNC | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS;
|
||||
}
|
||||
if (!__testi && __testo && !__testt && __testa)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_APPEND | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS | _IO_IS_APPENDING;
|
||||
}
|
||||
if (!__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
__p_mode = O_WRONLY | O_TRUNC | O_CREAT;
|
||||
__rw_mode = _IO_NO_READS;
|
||||
}
|
||||
if (__testi && !__testo && !__testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDONLY;
|
||||
__rw_mode = _IO_NO_WRITES;
|
||||
}
|
||||
if (__testi && __testo && !__testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDWR;
|
||||
__rw_mode = 0;
|
||||
}
|
||||
if (__testi && __testo && __testt && !__testa)
|
||||
{
|
||||
__p_mode = O_RDWR | O_TRUNC | O_CREAT;
|
||||
__rw_mode = 0;
|
||||
}
|
||||
#ifdef O_BINARY
|
||||
if (__testb)
|
||||
__p_mode |= O_BINARY;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::sys_open(__c_file_type* __f,
|
||||
ios_base::openmode __mode)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __fd = fileno(__f);
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
|
||||
if (!_IO_file_is_open(this))
|
||||
{
|
||||
_fileno = __fd;
|
||||
_flags &= ~(_IO_NO_READS + _IO_NO_WRITES);
|
||||
_flags |= _IO_DELETE_DONT_CLOSE;
|
||||
_offset = _IO_pos_BAD;
|
||||
int __mask = _IO_NO_READS + _IO_NO_WRITES + _IO_IS_APPENDING;
|
||||
_IO_mask_flags(this, __rw_mode, __mask);
|
||||
}
|
||||
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::open(const char* __name, ios_base::openmode __mode,
|
||||
int __prot)
|
||||
{
|
||||
__basic_file* __ret = NULL;
|
||||
int __p_mode = 0;
|
||||
int __rw_mode = _IO_NO_READS + _IO_NO_WRITES;
|
||||
char __c_mode[4];
|
||||
|
||||
_M_open_mode(__mode, __p_mode, __rw_mode, __c_mode);
|
||||
if (!_IO_file_is_open(this))
|
||||
{
|
||||
__c_file_type* __f;
|
||||
__f = _IO_file_open(this, __name, __p_mode, __prot, __rw_mode, 0);
|
||||
__ret = __f ? this: NULL;
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
bool
|
||||
__basic_file<_CharT>::is_open() { return _fileno >= 0; }
|
||||
|
||||
template<typename _CharT>
|
||||
__basic_file<_CharT>*
|
||||
__basic_file<_CharT>::close()
|
||||
{
|
||||
return _IO_file_close_it(this) ? static_cast<__basic_file*>(NULL) : this;
|
||||
}
|
||||
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::xsgetn(_CharT* __s, streamsize __n)
|
||||
{ return _IO_file_xsgetn(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_read(_CharT* __s, streamsize __n)
|
||||
{ return _IO_file_read(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamsize
|
||||
__basic_file<_CharT>::sys_write(const _CharT* __s, streamsize __n)
|
||||
{ return _IO_file_write(this, __s, __n); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
streamoff
|
||||
__basic_file<_CharT>::sys_seek(streamoff __pos, ios_base::seekdir __way)
|
||||
{ return _IO_file_seek(this, __pos, __way); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_close()
|
||||
{ return _IO_file_close(this); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::sys_stat(void* __v)
|
||||
{ return _IO_file_stat(this, __v); }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
int
|
||||
__basic_file<_CharT>::showmanyc() { return EOF; }
|
||||
|
||||
// NB: Unused.
|
||||
template<typename _CharT>
|
||||
void
|
||||
__basic_file<_CharT>::imbue(void* /*__v*/) { }
|
||||
} // namespace std
|
||||
|
||||
#endif // _CPP_BASIC_FILE
|
@ -1,113 +0,0 @@
|
||||
// underlying io library -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
// c_io_libio.h - Defines for using the GNU libio
|
||||
|
||||
#ifndef _CPP_IO_LIBIO_H
|
||||
#define _CPP_IO_LIBIO_H 1
|
||||
|
||||
#include <libio.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
// from fpos.h
|
||||
typedef _IO_ssize_t streamsize; // Signed integral type
|
||||
typedef _IO_ssize_t wstreamsize;
|
||||
|
||||
#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
|
||||
typedef _IO_off64_t streamoff;
|
||||
typedef _IO_fpos64_t __c_streampos;
|
||||
#else
|
||||
typedef _IO_off_t streamoff;
|
||||
typedef _IO_fpos_t __c_streampos;
|
||||
#endif
|
||||
|
||||
#ifdef _GLIBCPP_USE_THREADS
|
||||
typedef _IO_lock_t __c_lock;
|
||||
#else
|
||||
typedef int __c_lock;
|
||||
#endif
|
||||
|
||||
// from basic_file.h
|
||||
typedef _IO_FILE __c_file_type;
|
||||
typedef _IO_wide_data __c_wfile_type;
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
extern "C" _IO_codecvt __c_libio_codecvt;
|
||||
#endif
|
||||
|
||||
// from ios_base.h
|
||||
struct __ios_flags
|
||||
{
|
||||
typedef short __int_type;
|
||||
|
||||
static const __int_type _S_boolalpha = _IO_BAD_SEEN;
|
||||
static const __int_type _S_dec = _IO_DEC;
|
||||
static const __int_type _S_fixed = _IO_FIXED;
|
||||
static const __int_type _S_hex = _IO_HEX;
|
||||
static const __int_type _S_internal = _IO_INTERNAL;
|
||||
static const __int_type _S_left = _IO_LEFT;
|
||||
static const __int_type _S_oct = _IO_OCT;
|
||||
static const __int_type _S_right = _IO_RIGHT;
|
||||
static const __int_type _S_scientific = _IO_SCIENTIFIC;
|
||||
static const __int_type _S_showbase = _IO_SHOWBASE;
|
||||
static const __int_type _S_showpoint = _IO_SHOWPOINT;
|
||||
static const __int_type _S_showpos = _IO_SHOWPOS;
|
||||
static const __int_type _S_skipws = _IO_SKIPWS;
|
||||
static const __int_type _S_unitbuf = _IO_UNITBUF;
|
||||
static const __int_type _S_uppercase = _IO_UPPERCASE;
|
||||
static const __int_type _S_adjustfield = _IO_LEFT | _IO_RIGHT
|
||||
| _IO_INTERNAL;
|
||||
static const __int_type _S_basefield = _IO_DEC | _IO_OCT | _IO_HEX;
|
||||
static const __int_type _S_floatfield = _IO_SCIENTIFIC | _IO_FIXED;
|
||||
|
||||
// 27.4.2.1.3 Type ios_base::iostate
|
||||
static const __int_type _S_badbit = _IO_BAD_SEEN;
|
||||
static const __int_type _S_eofbit = _IO_EOF_SEEN;
|
||||
static const __int_type _S_failbit = _IO_ERR_SEEN;
|
||||
|
||||
// 27.4.2.1.4 Type openmode
|
||||
static const __int_type _S_app = _IOS_APPEND;
|
||||
static const __int_type _S_ate = _IOS_ATEND;
|
||||
static const __int_type _S_bin = _IOS_BIN;
|
||||
static const __int_type _S_in = _IOS_INPUT;
|
||||
static const __int_type _S_out = _IOS_OUTPUT;
|
||||
static const __int_type _S_trunc = _IOS_TRUNC;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _CPP_IO_LIBIO_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,153 +0,0 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU IO Library.
|
||||
|
||||
This library 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.
|
||||
|
||||
This library 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 this library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA.
|
||||
|
||||
As a special exception, if you link this library with files
|
||||
compiled with a GNU compiler to produce an executable, this does
|
||||
not cause the resulting executable to be covered by the GNU General
|
||||
Public License. This exception does not however invalidate any
|
||||
other reasons why the executable file might be covered by the GNU
|
||||
General Public License. */
|
||||
|
||||
/* Slightly modified from glibc/libio/iofwide.c */
|
||||
|
||||
#include <libio.h>
|
||||
|
||||
#ifdef _GLIBCPP_USE_WCHAR_T
|
||||
|
||||
/* Prototypes of libio's codecvt functions. */
|
||||
static enum __codecvt_result
|
||||
do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop);
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep, char *to_start,
|
||||
char *to_end, char **to_stop);
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop);
|
||||
|
||||
static int
|
||||
do_encoding(struct _IO_codecvt *codecvt);
|
||||
|
||||
static int
|
||||
do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max);
|
||||
|
||||
static int
|
||||
do_max_length(struct _IO_codecvt *codecvt);
|
||||
|
||||
static int
|
||||
do_always_noconv(struct _IO_codecvt *codecvt);
|
||||
|
||||
|
||||
/* The functions used in `codecvt' for libio are always the same. */
|
||||
struct _IO_codecvt __c_libio_codecvt =
|
||||
{
|
||||
.__codecvt_destr = NULL, /* Destructor, never used. */
|
||||
.__codecvt_do_out = do_out,
|
||||
.__codecvt_do_unshift = do_unshift,
|
||||
.__codecvt_do_in = do_in,
|
||||
.__codecvt_do_encoding = do_encoding,
|
||||
.__codecvt_do_always_noconv = do_always_noconv,
|
||||
.__codecvt_do_length = do_length,
|
||||
.__codecvt_do_max_length = do_max_length
|
||||
};
|
||||
|
||||
static enum __codecvt_result
|
||||
do_out(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const wchar_t *from_start, const wchar_t *from_end,
|
||||
const wchar_t **from_stop, char *to_start, char *to_end,
|
||||
char **to_stop)
|
||||
{
|
||||
enum __codecvt_result res = __codecvt_ok;
|
||||
|
||||
while (from_start < from_end)
|
||||
{
|
||||
if (to_start >= to_end)
|
||||
{
|
||||
res = __codecvt_partial;
|
||||
break;
|
||||
}
|
||||
*to_start++ = (char) *from_start++;
|
||||
}
|
||||
|
||||
*from_stop = from_start;
|
||||
*to_stop = to_start;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_unshift(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
char *to_start, char *to_end, char **to_stop)
|
||||
{
|
||||
*to_stop = to_start;
|
||||
return __codecvt_ok;
|
||||
}
|
||||
|
||||
|
||||
static enum __codecvt_result
|
||||
do_in(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, const char **from_stop,
|
||||
wchar_t *to_start, wchar_t *to_end, wchar_t **to_stop)
|
||||
{
|
||||
enum __codecvt_result res = __codecvt_ok;
|
||||
|
||||
while (from_start < from_end)
|
||||
{
|
||||
if (to_start >= to_end)
|
||||
{
|
||||
res = __codecvt_partial;
|
||||
break;
|
||||
}
|
||||
*to_start++ = (wchar_t) *from_start++;
|
||||
}
|
||||
|
||||
*from_stop = from_start;
|
||||
*to_stop = to_start;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
do_encoding(struct _IO_codecvt *codecvt)
|
||||
{ return 1; }
|
||||
|
||||
|
||||
static int
|
||||
do_always_noconv(struct _IO_codecvt *codecvt)
|
||||
{ return 0; }
|
||||
|
||||
|
||||
static int
|
||||
do_length(struct _IO_codecvt *codecvt, __c_mbstate_t *statep,
|
||||
const char *from_start, const char *from_end, _IO_size_t max)
|
||||
{ return from_end - from_start; }
|
||||
|
||||
|
||||
static int
|
||||
do_max_length(struct _IO_codecvt *codecvt)
|
||||
{ return 1; }
|
||||
|
||||
#endif /* _GLIBCPP_USE_WCHAR_T */
|
@ -1,554 +0,0 @@
|
||||
# Process this file with autoconf to produce a configure script, like so:
|
||||
# aclocal && autoconf && autoheader && automake
|
||||
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(src/ios.cc)
|
||||
|
||||
# This works around the fact that libtool configuration may change LD
|
||||
# for this particular configuration, but some shells, instead of
|
||||
# keeping the changes in LD private, export them just because LD is
|
||||
# exported. Only used at the end of this file.
|
||||
ORIGINAL_LD_FOR_MULTILIBS=$LD
|
||||
|
||||
PACKAGE=libstdc++
|
||||
AC_SUBST(PACKAGE)
|
||||
# For libtool versioning info, format is CURRENT:REVISION:AGE
|
||||
libtool_VERSION=5:5:0
|
||||
AC_SUBST(libtool_VERSION)
|
||||
|
||||
GLIBCPP_TOPREL_CONFIGURE
|
||||
|
||||
# Gets build, host, target, *_vendor, *_cpu, *_os, etc.
|
||||
#
|
||||
# You will slowly go insane if you do not grok the following fact: when
|
||||
# building v3 as part of the compiler, the top-level /target/ becomes the
|
||||
# library's /host/. `configure' then causes --target to default to --host,
|
||||
# exactly like any other package using autoconf. Therefore, 'target' and
|
||||
# 'host' will always be the same. This makes sense both for native and
|
||||
# cross compilers, just think about it for a little while. :-)
|
||||
#
|
||||
# Also, if v3 is being configured as part of a cross compiler, the top-level
|
||||
# configure script will pass the "real" host as $with_cross_host.
|
||||
#
|
||||
# AC 2.5x sets target_alias iff the user specified --target, but we use it
|
||||
# everywhere, so we set it here just to be sure. In AC 2.13
|
||||
# AC_CANONICAL_TARGET was known as AC_CANONICAL_SYSTEM.
|
||||
AC_CANONICAL_SYSTEM
|
||||
target_alias=${target_alias-$target}
|
||||
AC_SUBST(target_alias)
|
||||
|
||||
# Runs configure.target, finds CC, CXX and assorted other critical bits.
|
||||
# Must run this before the GLIBCPP_ENABLE_* macros below.
|
||||
GLIBCPP_CONFIGURE(.)
|
||||
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $gcc_version)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_LIBTOOL_DLOPEN
|
||||
AM_PROG_LIBTOOL
|
||||
AC_SUBST(enable_shared)
|
||||
AC_SUBST(enable_static)
|
||||
|
||||
# Check for c++ or library specific bits that don't require linking.
|
||||
#GLIBCPP_CHECK_COMPILER_VERSION
|
||||
GLIBCPP_CHECK_GNU_MAKE
|
||||
|
||||
# Enable all the variable C++ stuff. C_MBCHAR must come early.
|
||||
GLIBCPP_ENABLE_CSTDIO
|
||||
GLIBCPP_ENABLE_CLOCALE
|
||||
GLIBCPP_ENABLE_CHEADERS([$c_model])
|
||||
GLIBCPP_ENABLE_C_MBCHAR([yes])
|
||||
GLIBCPP_ENABLE_C99([yes])
|
||||
GLIBCPP_ENABLE_LONG_LONG([yes])
|
||||
GLIBCPP_ENABLE_THREADS
|
||||
GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
|
||||
GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
|
||||
GLIBCPP_ENABLE_CONCEPT_CHECKS
|
||||
GLIBCPP_ENABLE_CXX_FLAGS
|
||||
GLIBCPP_ENABLE_DEBUG([no])
|
||||
GLIBCPP_ENABLE_DEBUG_FLAGS([none])
|
||||
|
||||
# Check for headers necessary for libsupc++ using dyn-string.c/cxa_demangle.c
|
||||
AC_CHECK_HEADERS(string.h stdlib.h)
|
||||
|
||||
# No surprises, no surprises...
|
||||
if test $ATOMICITYH = cpu/generic ; then
|
||||
AC_MSG_WARN([No native atomic operations are provided yet for this platform.])
|
||||
if test $target_thread_file = single; then
|
||||
AC_MSG_WARN([They cannot be faked when thread support is disabled.])
|
||||
AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
|
||||
else
|
||||
AC_MSG_WARN([They will be faked using a mutex.])
|
||||
AC_MSG_WARN([Performance of certain classes will degrade as a result.])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if test -n "$with_cross_host" || test x"$build" != x"$host"; then
|
||||
|
||||
# We are being configured with some form of cross compiler.
|
||||
GLIBCPP_IS_CROSS_COMPILING=true
|
||||
|
||||
# This lets us hard-code the functionality we know we'll have in the cross
|
||||
# target environment. "Let" is a sugar-coated word placed on an especially
|
||||
# dull and tedious hack, actually.
|
||||
#
|
||||
# Here's why GLIBCPP_CHECK_MATH_SUPPORT, and other autoconf macros
|
||||
# that involve linking, can't be used:
|
||||
# "cannot open sim-crt0.o"
|
||||
# "cannot open crt0.o"
|
||||
# etc. All this is because there currently exists no unified, consistent
|
||||
# way for top level CC information to be passed down to target directories:
|
||||
# newlib includes, newlib linking info, libgloss versus newlib crt0.o, etc.
|
||||
# When all of that is done, all of this hokey, excessive AC_DEFINE junk for
|
||||
# crosses can be removed.
|
||||
|
||||
# If Canadian cross, then don't pick up tools from the build directory.
|
||||
# Used in GLIBCPP_EXPORT_INCLUDES (and nowhere else?).
|
||||
if test -n "$with_cross_host" && test x"$build" != x"$with_cross_host"; then
|
||||
CANADIAN=yes
|
||||
else
|
||||
CANADIAN=no
|
||||
fi
|
||||
|
||||
# Construct crosses by hand, eliminating bits that need ld...
|
||||
# GLIBCPP_CHECK_COMPILER_FEATURES
|
||||
# GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
|
||||
# GLIBCPP_CHECK_MATH_SUPPORT
|
||||
|
||||
case "$target" in
|
||||
*-linux*)
|
||||
os_include_dir="os/gnu-linux"
|
||||
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
|
||||
machine/endian.h machine/param.h sys/machine.h sys/types.h \
|
||||
fp.h locale.h float.h inttypes.h])
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
AC_SUBST(SECTION_FLAGS)
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_FINITE)
|
||||
AC_DEFINE(HAVE_FINITEF)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_HYPOTF)
|
||||
AC_DEFINE(HAVE_ISINF)
|
||||
AC_DEFINE(HAVE_ISINFF)
|
||||
AC_DEFINE(HAVE_ISNAN)
|
||||
AC_DEFINE(HAVE_ISNANF)
|
||||
AC_DEFINE(HAVE_SINCOS)
|
||||
AC_DEFINE(HAVE_SINCOSF)
|
||||
if test x"long_double_math_on_this_cpu" = x"yes"; then
|
||||
AC_DEFINE(HAVE_FINITEL)
|
||||
AC_DEFINE(HAVE_HYPOTL)
|
||||
AC_DEFINE(HAVE_ISINFL)
|
||||
AC_DEFINE(HAVE_ISNANL)
|
||||
fi
|
||||
;;
|
||||
*-hpux*)
|
||||
# Check for available headers.
|
||||
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
|
||||
machine/endian.h machine/param.h sys/machine.h sys/types.h \
|
||||
fp.h locale.h float.h inttypes.h])
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
AC_SUBST(SECTION_FLAGS)
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
os_include_dir="os/hpux"
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_HYPOT)
|
||||
case "$target" in
|
||||
*-hpux10*)
|
||||
AC_DEFINE(HAVE_FINITE)
|
||||
AC_DEFINE(HAVE_FINITEF)
|
||||
AC_DEFINE(HAVE_ISINF)
|
||||
AC_DEFINE(HAVE_ISINFF)
|
||||
AC_DEFINE(HAVE_ISNAN)
|
||||
AC_DEFINE(HAVE_ISNANF)
|
||||
;;
|
||||
esac
|
||||
|
||||
;;
|
||||
*-netbsd*)
|
||||
# Check for available headers.
|
||||
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
|
||||
machine/endian.h machine/param.h sys/machine.h sys/types.h \
|
||||
fp.h locale.h float.h inttypes.h])
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
AC_SUBST(SECTION_FLAGS)
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
os_include_dir="os/bsd/netbsd"
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_FINITEF)
|
||||
AC_DEFINE(HAVE_FINITE)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_HYPOTF)
|
||||
AC_DEFINE(HAVE_ISINF)
|
||||
AC_DEFINE(HAVE_ISINFF)
|
||||
AC_DEFINE(HAVE_ISNAN)
|
||||
AC_DEFINE(HAVE_ISNANF)
|
||||
if test x"long_double_math_on_this_cpu" = x"yes"; then
|
||||
AC_DEFINE(HAVE_FINITEL)
|
||||
AC_DEFINE(HAVE_ISINFL)
|
||||
AC_DEFINE(HAVE_ISNANL)
|
||||
fi
|
||||
;;
|
||||
*-freebsd*)
|
||||
# Check for available headers.
|
||||
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h \
|
||||
machine/endian.h machine/param.h sys/machine.h sys/types.h \
|
||||
fp.h locale.h float.h inttypes.h sys/resource.h sys/stat.h \
|
||||
sys/time.h unistd.h])
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
AC_SUBST(SECTION_FLAGS)
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
os_include_dir="os/bsd/freebsd"
|
||||
AC_DEFINE(HAVE_LC_MESSAGES)
|
||||
AC_DEFINE(HAVE_DRAND48)
|
||||
AC_DEFINE(HAVE_GETPAGESIZE)
|
||||
AC_DEFINE(HAVE_SETENV)
|
||||
AC_DEFINE(HAVE_SIGSETJMP)
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_FINITEF)
|
||||
AC_DEFINE(HAVE_FINITE)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_HYPOT)
|
||||
AC_DEFINE(HAVE_HYPOTF)
|
||||
AC_DEFINE(HAVE_ISINF)
|
||||
AC_DEFINE(HAVE_ISNAN)
|
||||
AC_DEFINE(HAVE_ISNANF)
|
||||
if test x"long_double_math_on_this_cpu" = x"yes"; then
|
||||
AC_DEFINE(HAVE_FINITEL)
|
||||
AC_DEFINE(HAVE_ISINFL)
|
||||
AC_DEFINE(HAVE_ISNANL)
|
||||
fi
|
||||
;;
|
||||
*-mingw32*)
|
||||
AC_CHECK_HEADERS([sys/types.h locale.h float.h])
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
os_include_dir="os/mingw32"
|
||||
;;
|
||||
*-windiss*)
|
||||
os_include_dir="os/windiss"
|
||||
;;
|
||||
changequote(,)dnl
|
||||
*-qnx6.[12]*)
|
||||
changequote([,])dnl
|
||||
SECTION_FLAGS='-ffunction-sections -fdata-sections'
|
||||
AC_SUBST(SECTION_FLAGS)
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
os_include_dir="os/qnx/qnx6.1"
|
||||
AC_DEFINE(HAVE_COSF)
|
||||
AC_DEFINE(HAVE_COSL)
|
||||
AC_DEFINE(HAVE_COSHF)
|
||||
AC_DEFINE(HAVE_COSHL)
|
||||
AC_DEFINE(HAVE_LOGF)
|
||||
AC_DEFINE(HAVE_LOGL)
|
||||
AC_DEFINE(HAVE_LOG10F)
|
||||
AC_DEFINE(HAVE_LOG10L)
|
||||
AC_DEFINE(HAVE_SINF)
|
||||
AC_DEFINE(HAVE_SINL)
|
||||
AC_DEFINE(HAVE_SINHF)
|
||||
AC_DEFINE(HAVE_SINHL)
|
||||
;;
|
||||
*)
|
||||
os_include_dir="os/newlib"
|
||||
AC_DEFINE(HAVE_HYPOT)
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
*-mingw32*)
|
||||
;;
|
||||
*-windiss*)
|
||||
AC_DEFINE(HAVE_ACOSF)
|
||||
AC_DEFINE(HAVE_ASINF)
|
||||
AC_DEFINE(HAVE_ATAN2F)
|
||||
AC_DEFINE(HAVE_ATANF)
|
||||
AC_DEFINE(HAVE_CEILF)
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_COSF)
|
||||
AC_DEFINE(HAVE_COSHF)
|
||||
AC_DEFINE(HAVE_EXPF)
|
||||
AC_DEFINE(HAVE_FABSF)
|
||||
AC_DEFINE(HAVE_FLOORF)
|
||||
AC_DEFINE(HAVE_FMODF)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_LDEXPF)
|
||||
AC_DEFINE(HAVE_LOG10F)
|
||||
AC_DEFINE(HAVE_LOGF)
|
||||
AC_DEFINE(HAVE_MODFF)
|
||||
AC_DEFINE(HAVE_POWF)
|
||||
AC_DEFINE(HAVE_SINF)
|
||||
AC_DEFINE(HAVE_SINHF)
|
||||
AC_DEFINE(HAVE_SQRTF)
|
||||
AC_DEFINE(HAVE_TANF)
|
||||
AC_DEFINE(HAVE_TANHF)
|
||||
;;
|
||||
*-freebsd*)
|
||||
# Must replicate generic section since we don't have strtof or strtold.
|
||||
AC_DEFINE(HAVE_MMAP)
|
||||
AC_DEFINE(HAVE_ACOSF)
|
||||
AC_DEFINE(HAVE_ASINF)
|
||||
AC_DEFINE(HAVE_ATAN2F)
|
||||
AC_DEFINE(HAVE_ATANF)
|
||||
AC_DEFINE(HAVE_CEILF)
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_COSF)
|
||||
AC_DEFINE(HAVE_COSHF)
|
||||
AC_DEFINE(HAVE_EXPF)
|
||||
AC_DEFINE(HAVE_FABSF)
|
||||
AC_DEFINE(HAVE_FLOORF)
|
||||
AC_DEFINE(HAVE_FMODF)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_LDEXPF)
|
||||
AC_DEFINE(HAVE_LOG10F)
|
||||
AC_DEFINE(HAVE_LOGF)
|
||||
AC_DEFINE(HAVE_MODFF)
|
||||
AC_DEFINE(HAVE_POWF)
|
||||
AC_DEFINE(HAVE_SINF)
|
||||
AC_DEFINE(HAVE_SINHF)
|
||||
AC_DEFINE(HAVE_SQRTF)
|
||||
AC_DEFINE(HAVE_TANF)
|
||||
AC_DEFINE(HAVE_TANHF)
|
||||
;;
|
||||
*)
|
||||
# GLIBCPP_CHECK_STDLIB_SUPPORT
|
||||
AC_DEFINE(HAVE_STRTOF)
|
||||
AC_DEFINE(HAVE_STRTOLD)
|
||||
# AC_FUNC_MMAP
|
||||
AC_DEFINE(HAVE_MMAP)
|
||||
|
||||
AC_DEFINE(HAVE_ACOSF)
|
||||
AC_DEFINE(HAVE_ASINF)
|
||||
AC_DEFINE(HAVE_ATAN2F)
|
||||
AC_DEFINE(HAVE_ATANF)
|
||||
AC_DEFINE(HAVE_CEILF)
|
||||
AC_DEFINE(HAVE_COPYSIGN)
|
||||
AC_DEFINE(HAVE_COPYSIGNF)
|
||||
AC_DEFINE(HAVE_COSF)
|
||||
AC_DEFINE(HAVE_COSHF)
|
||||
AC_DEFINE(HAVE_EXPF)
|
||||
AC_DEFINE(HAVE_FABSF)
|
||||
AC_DEFINE(HAVE_FLOORF)
|
||||
AC_DEFINE(HAVE_FMODF)
|
||||
AC_DEFINE(HAVE_FREXPF)
|
||||
AC_DEFINE(HAVE_LDEXPF)
|
||||
AC_DEFINE(HAVE_LOG10F)
|
||||
AC_DEFINE(HAVE_LOGF)
|
||||
AC_DEFINE(HAVE_MODFF)
|
||||
AC_DEFINE(HAVE_POWF)
|
||||
AC_DEFINE(HAVE_SINF)
|
||||
AC_DEFINE(HAVE_SINHF)
|
||||
AC_DEFINE(HAVE_SQRTF)
|
||||
AC_DEFINE(HAVE_TANF)
|
||||
AC_DEFINE(HAVE_TANHF)
|
||||
;;
|
||||
esac
|
||||
|
||||
# At some point, we should differentiate between architectures
|
||||
# like x86, which have long double versions, and alpha/powerpc/etc.,
|
||||
# which don't. For the time being, punt.
|
||||
if test x"long_double_math_on_this_cpu" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ACOSL)
|
||||
AC_DEFINE(HAVE_ASINL)
|
||||
AC_DEFINE(HAVE_ATAN2L)
|
||||
AC_DEFINE(HAVE_ATANL)
|
||||
AC_DEFINE(HAVE_CEILL)
|
||||
AC_DEFINE(HAVE_COPYSIGNL)
|
||||
AC_DEFINE(HAVE_COSL)
|
||||
AC_DEFINE(HAVE_COSHL)
|
||||
AC_DEFINE(HAVE_EXPL)
|
||||
AC_DEFINE(HAVE_FABSL)
|
||||
AC_DEFINE(HAVE_FLOORL)
|
||||
AC_DEFINE(HAVE_FMODL)
|
||||
AC_DEFINE(HAVE_FREXPL)
|
||||
AC_DEFINE(HAVE_LDEXPL)
|
||||
AC_DEFINE(HAVE_LOG10L)
|
||||
AC_DEFINE(HAVE_LOGL)
|
||||
AC_DEFINE(HAVE_MODFL)
|
||||
AC_DEFINE(HAVE_POWL)
|
||||
AC_DEFINE(HAVE_SINCOSL)
|
||||
AC_DEFINE(HAVE_SINL)
|
||||
AC_DEFINE(HAVE_SINHL)
|
||||
AC_DEFINE(HAVE_SQRTL)
|
||||
AC_DEFINE(HAVE_TANL)
|
||||
AC_DEFINE(HAVE_TANHL)
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
# We are being configured natively. We can do more elaborate tests
|
||||
# that include AC_TRY_COMPILE now, as the linker is assumed to be
|
||||
# working.
|
||||
GLIBCPP_IS_CROSS_COMPILING=false
|
||||
CANADIAN=no
|
||||
|
||||
# Check for available headers.
|
||||
AC_CHECK_HEADERS([nan.h ieeefp.h endian.h sys/isa_defs.h machine/endian.h \
|
||||
machine/param.h sys/machine.h fp.h locale.h float.h inttypes.h gconv.h sys/types.h])
|
||||
|
||||
GLIBCPP_CHECK_COMPILER_FEATURES
|
||||
GLIBCPP_CHECK_LINKER_FEATURES
|
||||
GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
|
||||
GLIBCPP_CHECK_WCHAR_T_SUPPORT
|
||||
GLIBCPP_CHECK_STDLIB_SUPPORT
|
||||
GLIBCPP_CHECK_UNISTD_SUPPORT
|
||||
|
||||
# For showmanyc_helper().
|
||||
AC_CHECK_HEADERS(sys/ioctl.h sys/filio.h)
|
||||
GLIBCPP_CHECK_POLL
|
||||
GLIBCPP_CHECK_S_ISREG_OR_S_IFREG
|
||||
|
||||
AC_LC_MESSAGES
|
||||
|
||||
AC_TRY_COMPILE([
|
||||
#include <setjmp.h>
|
||||
], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
|
||||
[AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
|
||||
])
|
||||
|
||||
AC_FUNC_MMAP
|
||||
|
||||
fi
|
||||
|
||||
# This depends on GLIBCPP_CHECK_LINKER_FEATURES, but without it assumes no.
|
||||
GLIBCPP_ENABLE_SYMVERS([yes])
|
||||
|
||||
# This depends on GLIBCPP_ENABLE_SYMVERS and GLIBCPP_IS_CROSS_COMPILING.
|
||||
GLIBCPP_CONFIGURE_TESTSUITE
|
||||
|
||||
# Propagate the target-specific source directories through the build chain.
|
||||
# (Nothing currently uses cpu_include_dir directly; only ATOMICITYH
|
||||
# uses it, and it only gets used in this file.)
|
||||
OS_INC_SRCDIR=config/${os_include_dir}
|
||||
ATOMICITY_INC_SRCDIR=config/${ATOMICITYH}
|
||||
AC_SUBST(OS_INC_SRCDIR)
|
||||
AC_SUBST(ATOMICITY_INC_SRCDIR)
|
||||
|
||||
# Set up cross-compile flags
|
||||
AC_SUBST(GLIBCPP_IS_CROSS_COMPILING) dnl Unused so far.
|
||||
AM_CONDITIONAL(CANADIAN, test "$CANADIAN" = yes)
|
||||
|
||||
AC_CACHE_SAVE
|
||||
|
||||
if test "${multilib}" = "yes"; then
|
||||
multilib_arg="--enable-multilib"
|
||||
else
|
||||
multilib_arg=
|
||||
fi
|
||||
|
||||
# Export all the install information
|
||||
GLIBCPP_EXPORT_INSTALL_INFO
|
||||
|
||||
# Export all the include and flag information to makefiles.
|
||||
GLIBCPP_EXPORT_INCLUDES
|
||||
GLIBCPP_EXPORT_FLAGS
|
||||
|
||||
if ${CONFIG_SHELL-/bin/sh} ./libtool --tag CXX --features |
|
||||
grep "enable shared" > /dev/null; then
|
||||
LIBSUPCXX_PICFLAGS=-prefer-pic
|
||||
else
|
||||
LIBSUPCXX_PICFLAGS=
|
||||
fi
|
||||
AC_SUBST(LIBSUPCXX_PICFLAGS)
|
||||
|
||||
# Generate the various Makefiles, include files, and scripts.
|
||||
# NB: Multilibs need MULTISUBDIR defined correctly in src/Makefile.am
|
||||
# libsupc++/Makefile.am and testsuite/Makefile.am so that multilib installs
|
||||
# will end up installed in the correct place. To work around this not being
|
||||
# passed down from config-ml.in -> top_srcdir/Makefile.am ->
|
||||
# top_srcdir/{src,libsupc++}/Makefile.am, manually append it here.
|
||||
AC_OUTPUT(Makefile \
|
||||
include/Makefile src/Makefile \
|
||||
libmath/Makefile libio/Makefile libsupc++/Makefile \
|
||||
po/Makefile testsuite/Makefile mkcheck testsuite_flags,
|
||||
[if test -n "$CONFIG_FILES"; then
|
||||
LD="${ORIGINAL_LD_FOR_MULTILIBS}"
|
||||
ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
|
||||
grep '^MULTISUBDIR =' Makefile >> src/Makefile
|
||||
grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
|
||||
grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
|
||||
fi
|
||||
chmod +x mkcheck
|
||||
chmod +x testsuite_flags
|
||||
],
|
||||
srcdir=${srcdir}
|
||||
host=${host}
|
||||
target=${target}
|
||||
with_multisubdir=${with_multisubdir}
|
||||
ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
glibcpp_basedir=${glibcpp_basedir}
|
||||
CC="${CC}"
|
||||
CXX="${CXX}"
|
||||
ORIGINAL_LD_FOR_MULTILIBS="${ORIGINAL_LD_FOR_MULTILIBS}"
|
||||
)
|
||||
dnl In autoconf 2.5x, AC_OUTPUT is replaced by three AC_ macros:
|
||||
dnl AC_CONFIG_FILES(Makefile \
|
||||
dnl include/Makefile src/Makefile \
|
||||
dnl libmath/Makefile libio/Makefile libsupc++/Makefile \
|
||||
dnl po/Makefile testsuite/Makefile mkcheck testsuite_flags)
|
||||
dnl AC_CONFIG_COMMANDS([default],
|
||||
dnl [if test -n "$CONFIG_FILES"; then
|
||||
dnl ac_file=Makefile . ${glibcpp_basedir}/../config-ml.in
|
||||
dnl grep '^MULTISUBDIR =' Makefile >> src/Makefile
|
||||
dnl grep '^MULTISUBDIR =' Makefile >> libsupc++/Makefile
|
||||
dnl grep '^MULTISUBDIR =' Makefile >> testsuite/Makefile
|
||||
dnl fi
|
||||
dnl chmod +x mkcheck
|
||||
dnl chmod +x testsuite_flags
|
||||
dnl ],
|
||||
dnl srcdir=${srcdir}
|
||||
dnl host=${host}
|
||||
dnl target=${target}
|
||||
dnl with_multisubdir=${with_multisubdir}
|
||||
dnl ac_configure_args="${multilib_arg} ${ac_configure_args}"
|
||||
dnl CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
dnl glibcpp_basedir=${glibcpp_basedir}
|
||||
dnl CC="${CC}"
|
||||
dnl CXX="${CXX}"
|
||||
dnl )
|
||||
dnl AC_OUTPUT
|
||||
|
||||
|
||||
# Sanity checking & User-visible messages.
|
||||
# Checks down here, otherwise they get scrolled off before
|
||||
# the user will notice.
|
||||
|
||||
# Trying to get more people to read documentation. Possibly remove
|
||||
# check and warn all the time. There is no "informational" AC_MSG_
|
||||
# macro, so these are going to be printed even when --quiet/--silent
|
||||
# is given.
|
||||
if test ! -f stamp-sanity-warned; then
|
||||
touch stamp-sanity-warned
|
||||
echo ""
|
||||
echo "Please make certain that you read the installation information here:"
|
||||
echo " faster => ${srcdir}/docs/html/install.html"
|
||||
echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/install.html>"
|
||||
echo ""
|
||||
echo "and the configuration information here:"
|
||||
echo " faster => ${srcdir}/docs/html/configopts.html"
|
||||
echo " slower => <URL:http://gcc.gnu.org/onlinedocs/libstdc++/configopts.html>"
|
||||
echo ""
|
||||
echo "before proceeding with ${_cv_gnu_make_command}."
|
||||
echo ""
|
||||
fi
|
@ -1,200 +0,0 @@
|
||||
# configure.target
|
||||
#
|
||||
# This shell script handles all target based configuration for libstdc++.
|
||||
# It sets various shell variables based on the the target and the
|
||||
# configuration options. You can modify this shell script without needing
|
||||
# to rerun autoconf/aclocal/etc. This file is "sourced" not executed.
|
||||
#
|
||||
# You should read docs/html/17_intro/porting.* to make sense of this file.
|
||||
#
|
||||
#
|
||||
# It uses the following shell variables as set by config.guess:
|
||||
# target The configuration target (full CPU-vendor-OS triplet)
|
||||
# target_cpu The configuration target CPU
|
||||
# target_os The configuration target OS
|
||||
#
|
||||
#
|
||||
# It sets the following shell variables:
|
||||
#
|
||||
# cpu_include_dir CPU-specific directory, defaults to cpu/generic
|
||||
# if cpu/target_cpu doesn't exist. This is
|
||||
# used to set ATOMICITYH.
|
||||
#
|
||||
# os_include_dir OS-specific directory, defaults to os/generic.
|
||||
#
|
||||
# c_model the model to use for "C" headers, defaults to c_std.
|
||||
#
|
||||
# c_compatibility if "C" compatibility headers are necessary,
|
||||
# defaults to no.
|
||||
#
|
||||
# abi_baseline_pair directory name for ABI compat testing,
|
||||
# defaults to target (as per config.guess)
|
||||
#
|
||||
# ATOMICITYH location of atomicity.h,
|
||||
# defaults to cpu_include_dir
|
||||
#
|
||||
# It possibly modifies the following variables:
|
||||
#
|
||||
# OPT_LDFLAGS extra flags to pass when linking the library, of
|
||||
# the form '-Wl,blah'
|
||||
# (defaults to empty in acinclude.m4)
|
||||
#
|
||||
#
|
||||
# If the defaults will not work for your platform, you need only change the
|
||||
# variables that won't work, i.e., you do not need to explicitly set a
|
||||
# working variable to its default. Most targets only need to change the two
|
||||
# *_include_dir variables.
|
||||
|
||||
|
||||
# DEFAULTS
|
||||
# Try to guess a default cpu_include_dir based on the name of the CPU. We
|
||||
# cannot do this for os_include_dir; there are too many portable operating
|
||||
# systems out there. :-)
|
||||
c_model=c_std
|
||||
c_compatibility=no
|
||||
|
||||
|
||||
# TARGET-SPECIFIC OVERRIDES
|
||||
# Set any CPU-dependent bits.
|
||||
# Here we override defaults and catch more general cases due to naming
|
||||
# conventions (e.g., chip_name* to catch all variants).
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
|
||||
case "${target_cpu}" in
|
||||
alpha*)
|
||||
try_cpu=alpha
|
||||
;;
|
||||
athlon* | i586 | i686 | i786 | x86_64)
|
||||
try_cpu=i486
|
||||
;;
|
||||
hppa*)
|
||||
try_cpu=hppa
|
||||
;;
|
||||
m680[246]0)
|
||||
try_cpu=m68k
|
||||
;;
|
||||
powerpc* | rs6000)
|
||||
try_cpu=powerpc
|
||||
;;
|
||||
s390x)
|
||||
try_cpu=s390
|
||||
;;
|
||||
sparc* | ultrasparc)
|
||||
try_cpu=sparc
|
||||
;;
|
||||
*)
|
||||
if test -d ${glibcpp_srcdir}/config/cpu/${target_cpu}; then
|
||||
try_cpu=${target_cpu}
|
||||
else
|
||||
try_cpu=generic
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Now look for the file(s) usually tied to a CPU model, and make
|
||||
# default choices for those if they haven't been explicitly set
|
||||
# already.
|
||||
cpu_include_dir="cpu/${try_cpu}"
|
||||
ATOMICITYH=$cpu_include_dir
|
||||
abi_baseline_pair=${try_cpu}-${host_os}
|
||||
|
||||
# Set any OS-dependent bits.
|
||||
# Set the os_include_dir.
|
||||
# Set c_model, c_compatibility here.
|
||||
# If atomic ops and/or numeric limits are OS-specific rather than
|
||||
# CPU-specifc, set those here too.
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
case "${target_os}" in
|
||||
aix4.[3456789]* | aix[56789]*)
|
||||
# We set os_include_dir to os/aix only on AIX 4.3 and newer, but
|
||||
# os/aix/atomicity.h works on earlier versions of AIX 4.*, so we
|
||||
# explicitly duplicate the directory for 4.[<3].
|
||||
os_include_dir="os/aix"
|
||||
ATOMICITYH="os/aix"
|
||||
OPT_LDFLAGS="-Wl,-G"
|
||||
;;
|
||||
aix4.*)
|
||||
ATOMICITYH="os/aix"
|
||||
;;
|
||||
aix*)
|
||||
ATOMICITYH="cpu/generic"
|
||||
;;
|
||||
bsd*)
|
||||
# Plain BSD attempts to share FreeBSD files.
|
||||
os_include_dir="os/bsd/freebsd"
|
||||
;;
|
||||
cygwin*)
|
||||
os_include_dir="os/newlib"
|
||||
;;
|
||||
*djgpp*) # leading * picks up "msdosdjgpp"
|
||||
os_include_dir="os/djgpp"
|
||||
;;
|
||||
freebsd*)
|
||||
os_include_dir="os/bsd/freebsd"
|
||||
;;
|
||||
gnu* | linux*)
|
||||
os_include_dir="os/gnu-linux"
|
||||
;;
|
||||
hpux*)
|
||||
os_include_dir="os/hpux"
|
||||
;;
|
||||
irix[1-6] | irix[1-5].* | irix6.[0-4]*)
|
||||
# This is known to work on at least IRIX 5.2 and 6.3.
|
||||
os_include_dir="os/irix/irix5.2"
|
||||
ATOMICITYH=$os_include_dir
|
||||
;;
|
||||
irix6.5*)
|
||||
os_include_dir="os/irix/irix6.5"
|
||||
ATOMICITYH=$os_include_dir
|
||||
;;
|
||||
mingw32*)
|
||||
os_include_dir="os/mingw32"
|
||||
;;
|
||||
netbsd*)
|
||||
os_include_dir="os/bsd/netbsd"
|
||||
;;
|
||||
solaris2.5 | solaris2.5.[0-9])
|
||||
os_include_dir="os/solaris/solaris2.5"
|
||||
;;
|
||||
solaris2.6)
|
||||
os_include_dir="os/solaris/solaris2.6"
|
||||
;;
|
||||
solaris2.[789] | solaris2.1[0-9])
|
||||
os_include_dir="os/solaris/solaris2.7"
|
||||
;;
|
||||
windiss*)
|
||||
os_include_dir="os/windiss"
|
||||
;;
|
||||
qnx6.[12]*)
|
||||
os_include_dir="os/qnx/qnx6.1"
|
||||
c_model=c
|
||||
;;
|
||||
*)
|
||||
os_include_dir="os/generic"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# Set any OS-dependent and CPU-dependent bits.
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
case "${target}" in
|
||||
mips*-*-linux*)
|
||||
ATOMICITYH="cpu/mips"
|
||||
;;
|
||||
x86_64-*-linux*)
|
||||
abi_baseline_pair="x86_64-linux-gnu"
|
||||
;;
|
||||
alpha*-*-freebsd5*)
|
||||
abi_baseline_pair="alpha-freebsd5"
|
||||
;;
|
||||
i*86-*-freebsd4*)
|
||||
abi_baseline_pair="i386-freebsd4"
|
||||
;;
|
||||
i*86-*-freebsd5*)
|
||||
abi_baseline_pair="i386-freebsd5"
|
||||
;;
|
||||
sparc*-*-freebsd5*)
|
||||
abi_baseline_pair="sparc-freebsd5"
|
||||
;;
|
||||
esac
|
@ -1,127 +0,0 @@
|
||||
// File position object and stream types
|
||||
|
||||
// Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
//
|
||||
// ISO C++ 14882: 27 Input/output library
|
||||
//
|
||||
|
||||
/** @file fpos.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BITS_FPOS_H
|
||||
#define _CPP_BITS_FPOS_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
#include <bits/c++io.h>
|
||||
#include <cwchar> // For mbstate_t.
|
||||
|
||||
namespace std
|
||||
{
|
||||
// 27.4.1 Types
|
||||
|
||||
// [27.4.3] template class fpos
|
||||
/**
|
||||
* @doctodo
|
||||
*/
|
||||
template<typename _StateT>
|
||||
class fpos
|
||||
{
|
||||
public:
|
||||
// Types:
|
||||
typedef _StateT __state_type;
|
||||
|
||||
private:
|
||||
streamoff _M_off;
|
||||
__state_type _M_st;
|
||||
|
||||
public:
|
||||
__state_type
|
||||
state() const { return _M_st; }
|
||||
|
||||
void
|
||||
state(__state_type __st) { _M_st = __st; }
|
||||
|
||||
// NB: The standard defines only the implicit copy ctor and the
|
||||
// previous two members. The rest is a "conforming extension".
|
||||
fpos(): _M_off(streamoff()), _M_st(__state_type()) { }
|
||||
|
||||
fpos(streamoff __off, __state_type __st = __state_type())
|
||||
: _M_off(__off), _M_st(__st) { }
|
||||
|
||||
operator streamoff() const { return _M_off; }
|
||||
|
||||
fpos&
|
||||
operator+=(streamoff __off) { _M_off += __off; return *this; }
|
||||
|
||||
fpos&
|
||||
operator-=(streamoff __off) { _M_off -= __off; return *this; }
|
||||
|
||||
fpos
|
||||
operator+(streamoff __off)
|
||||
{
|
||||
fpos __t(*this);
|
||||
__t += __off;
|
||||
return __t;
|
||||
}
|
||||
|
||||
fpos
|
||||
operator-(streamoff __off)
|
||||
{
|
||||
fpos __t(*this);
|
||||
__t -= __off;
|
||||
return __t;
|
||||
}
|
||||
|
||||
bool
|
||||
operator==(const fpos& __pos) const
|
||||
{ return _M_off == __pos._M_off; }
|
||||
|
||||
bool
|
||||
operator!=(const fpos& __pos) const
|
||||
{ return _M_off != __pos._M_off; }
|
||||
|
||||
streamoff
|
||||
_M_position() const { return _M_off; }
|
||||
|
||||
void
|
||||
_M_position(streamoff __off) { _M_off = __off; }
|
||||
};
|
||||
|
||||
/// 27.2, paragraph 10 about fpos/char_traits circularity
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
# ifdef _GLIBCPP_USE_WCHAR_T
|
||||
/// 27.2, paragraph 10 about fpos/char_traits circularity
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
# endif
|
||||
} // namespace std
|
||||
|
||||
#endif
|
@ -1,525 +0,0 @@
|
||||
// POSIX thread-related memory allocation -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file pthread_allocimpl.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BITS_PTHREAD_ALLOCIMPL_H
|
||||
#define _CPP_BITS_PTHREAD_ALLOCIMPL_H 1
|
||||
|
||||
// Pthread-specific node allocator.
|
||||
// This is similar to the default allocator, except that free-list
|
||||
// information is kept separately for each thread, avoiding locking.
|
||||
// This should be reasonably fast even in the presence of threads.
|
||||
// The down side is that storage may not be well-utilized.
|
||||
// It is not an error to allocate memory in thread A and deallocate
|
||||
// it in thread B. But this effectively transfers ownership of the memory,
|
||||
// so that it can only be reallocated by thread B. Thus this can effectively
|
||||
// result in a storage leak if it's done on a regular basis.
|
||||
// It can also result in frequent sharing of
|
||||
// cache lines among processors, with potentially serious performance
|
||||
// consequences.
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <cerrno>
|
||||
#include <bits/stl_alloc.h>
|
||||
#ifndef __RESTRICT
|
||||
# define __RESTRICT
|
||||
#endif
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
#define __STL_DATA_ALIGNMENT 8
|
||||
|
||||
union _Pthread_alloc_obj {
|
||||
union _Pthread_alloc_obj * __free_list_link;
|
||||
char __client_data[__STL_DATA_ALIGNMENT]; /* The client sees this. */
|
||||
};
|
||||
|
||||
// Pthread allocators don't appear to the client to have meaningful
|
||||
// instances. We do in fact need to associate some state with each
|
||||
// thread. That state is represented by
|
||||
// _Pthread_alloc_per_thread_state<_Max_size>.
|
||||
|
||||
template<size_t _Max_size>
|
||||
struct _Pthread_alloc_per_thread_state {
|
||||
typedef _Pthread_alloc_obj __obj;
|
||||
enum { _S_NFREELISTS = _Max_size/__STL_DATA_ALIGNMENT };
|
||||
_Pthread_alloc_obj* volatile __free_list[_S_NFREELISTS];
|
||||
_Pthread_alloc_per_thread_state<_Max_size> * __next;
|
||||
// Free list link for list of available per thread structures.
|
||||
// When one of these becomes available for reuse due to thread
|
||||
// termination, any objects in its free list remain associated
|
||||
// with it. The whole structure may then be used by a newly
|
||||
// created thread.
|
||||
_Pthread_alloc_per_thread_state() : __next(0)
|
||||
{
|
||||
memset((void *)__free_list, 0, (size_t) _S_NFREELISTS * sizeof(__obj *));
|
||||
}
|
||||
// Returns an object of size __n, and possibly adds to size n free list.
|
||||
void *_M_refill(size_t __n);
|
||||
};
|
||||
|
||||
// Pthread-specific allocator.
|
||||
// The argument specifies the largest object size allocated from per-thread
|
||||
// free lists. Larger objects are allocated using malloc_alloc.
|
||||
// Max_size must be a power of 2.
|
||||
template <size_t _Max_size = 128>
|
||||
class _Pthread_alloc_template {
|
||||
|
||||
public: // but only for internal use:
|
||||
|
||||
typedef _Pthread_alloc_obj __obj;
|
||||
|
||||
// Allocates a chunk for nobjs of size size. nobjs may be reduced
|
||||
// if it is inconvenient to allocate the requested number.
|
||||
static char *_S_chunk_alloc(size_t __size, int &__nobjs);
|
||||
|
||||
enum {_S_ALIGN = __STL_DATA_ALIGNMENT};
|
||||
|
||||
static size_t _S_round_up(size_t __bytes) {
|
||||
return (((__bytes) + (int) _S_ALIGN-1) & ~((int) _S_ALIGN - 1));
|
||||
}
|
||||
static size_t _S_freelist_index(size_t __bytes) {
|
||||
return (((__bytes) + (int) _S_ALIGN-1)/(int)_S_ALIGN - 1);
|
||||
}
|
||||
|
||||
private:
|
||||
// Chunk allocation state. And other shared state.
|
||||
// Protected by _S_chunk_allocator_lock.
|
||||
static pthread_mutex_t _S_chunk_allocator_lock;
|
||||
static char *_S_start_free;
|
||||
static char *_S_end_free;
|
||||
static size_t _S_heap_size;
|
||||
static _Pthread_alloc_per_thread_state<_Max_size>* _S_free_per_thread_states;
|
||||
static pthread_key_t _S_key;
|
||||
static bool _S_key_initialized;
|
||||
// Pthread key under which per thread state is stored.
|
||||
// Allocator instances that are currently unclaimed by any thread.
|
||||
static void _S_destructor(void *instance);
|
||||
// Function to be called on thread exit to reclaim per thread
|
||||
// state.
|
||||
static _Pthread_alloc_per_thread_state<_Max_size> *_S_new_per_thread_state();
|
||||
// Return a recycled or new per thread state.
|
||||
static _Pthread_alloc_per_thread_state<_Max_size> *_S_get_per_thread_state();
|
||||
// ensure that the current thread has an associated
|
||||
// per thread state.
|
||||
class _M_lock;
|
||||
friend class _M_lock;
|
||||
class _M_lock {
|
||||
public:
|
||||
_M_lock () { pthread_mutex_lock(&_S_chunk_allocator_lock); }
|
||||
~_M_lock () { pthread_mutex_unlock(&_S_chunk_allocator_lock); }
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/* n must be > 0 */
|
||||
static void * allocate(size_t __n)
|
||||
{
|
||||
__obj * volatile * __my_free_list;
|
||||
__obj * __RESTRICT __result;
|
||||
_Pthread_alloc_per_thread_state<_Max_size>* __a;
|
||||
|
||||
if (__n > _Max_size) {
|
||||
return(malloc_alloc::allocate(__n));
|
||||
}
|
||||
if (!_S_key_initialized ||
|
||||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size>*)
|
||||
pthread_getspecific(_S_key))) {
|
||||
__a = _S_get_per_thread_state();
|
||||
}
|
||||
__my_free_list = __a -> __free_list + _S_freelist_index(__n);
|
||||
__result = *__my_free_list;
|
||||
if (__result == 0) {
|
||||
void *__r = __a -> _M_refill(_S_round_up(__n));
|
||||
return __r;
|
||||
}
|
||||
*__my_free_list = __result -> __free_list_link;
|
||||
return (__result);
|
||||
};
|
||||
|
||||
/* p may not be 0 */
|
||||
static void deallocate(void *__p, size_t __n)
|
||||
{
|
||||
__obj *__q = (__obj *)__p;
|
||||
__obj * volatile * __my_free_list;
|
||||
_Pthread_alloc_per_thread_state<_Max_size>* __a;
|
||||
|
||||
if (__n > _Max_size) {
|
||||
malloc_alloc::deallocate(__p, __n);
|
||||
return;
|
||||
}
|
||||
if (!_S_key_initialized ||
|
||||
!(__a = (_Pthread_alloc_per_thread_state<_Max_size> *)
|
||||
pthread_getspecific(_S_key))) {
|
||||
__a = _S_get_per_thread_state();
|
||||
}
|
||||
__my_free_list = __a->__free_list + _S_freelist_index(__n);
|
||||
__q -> __free_list_link = *__my_free_list;
|
||||
*__my_free_list = __q;
|
||||
}
|
||||
|
||||
static void * reallocate(void *__p, size_t __old_sz, size_t __new_sz);
|
||||
|
||||
} ;
|
||||
|
||||
typedef _Pthread_alloc_template<> pthread_alloc;
|
||||
|
||||
|
||||
template <size_t _Max_size>
|
||||
void _Pthread_alloc_template<_Max_size>::_S_destructor(void * __instance)
|
||||
{
|
||||
_M_lock __lock_instance; // Need to acquire lock here.
|
||||
_Pthread_alloc_per_thread_state<_Max_size>* __s =
|
||||
(_Pthread_alloc_per_thread_state<_Max_size> *)__instance;
|
||||
__s -> __next = _S_free_per_thread_states;
|
||||
_S_free_per_thread_states = __s;
|
||||
}
|
||||
|
||||
template <size_t _Max_size>
|
||||
_Pthread_alloc_per_thread_state<_Max_size> *
|
||||
_Pthread_alloc_template<_Max_size>::_S_new_per_thread_state()
|
||||
{
|
||||
/* lock already held here. */
|
||||
if (0 != _S_free_per_thread_states) {
|
||||
_Pthread_alloc_per_thread_state<_Max_size> *__result =
|
||||
_S_free_per_thread_states;
|
||||
_S_free_per_thread_states = _S_free_per_thread_states -> __next;
|
||||
return __result;
|
||||
} else {
|
||||
return new _Pthread_alloc_per_thread_state<_Max_size>;
|
||||
}
|
||||
}
|
||||
|
||||
template <size_t _Max_size>
|
||||
_Pthread_alloc_per_thread_state<_Max_size> *
|
||||
_Pthread_alloc_template<_Max_size>::_S_get_per_thread_state()
|
||||
{
|
||||
/*REFERENCED*/
|
||||
_M_lock __lock_instance; // Need to acquire lock here.
|
||||
int __ret_code;
|
||||
_Pthread_alloc_per_thread_state<_Max_size> * __result;
|
||||
if (!_S_key_initialized) {
|
||||
if (pthread_key_create(&_S_key, _S_destructor)) {
|
||||
std::__throw_bad_alloc(); // defined in funcexcept.h
|
||||
}
|
||||
_S_key_initialized = true;
|
||||
}
|
||||
__result = _S_new_per_thread_state();
|
||||
__ret_code = pthread_setspecific(_S_key, __result);
|
||||
if (__ret_code) {
|
||||
if (__ret_code == ENOMEM) {
|
||||
std::__throw_bad_alloc();
|
||||
} else {
|
||||
// EINVAL
|
||||
abort();
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
/* We allocate memory in large chunks in order to avoid fragmenting */
|
||||
/* the malloc heap too much. */
|
||||
/* We assume that size is properly aligned. */
|
||||
template <size_t _Max_size>
|
||||
char *_Pthread_alloc_template<_Max_size>
|
||||
::_S_chunk_alloc(size_t __size, int &__nobjs)
|
||||
{
|
||||
{
|
||||
char * __result;
|
||||
size_t __total_bytes;
|
||||
size_t __bytes_left;
|
||||
/*REFERENCED*/
|
||||
_M_lock __lock_instance; // Acquire lock for this routine
|
||||
|
||||
__total_bytes = __size * __nobjs;
|
||||
__bytes_left = _S_end_free - _S_start_free;
|
||||
if (__bytes_left >= __total_bytes) {
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return(__result);
|
||||
} else if (__bytes_left >= __size) {
|
||||
__nobjs = __bytes_left/__size;
|
||||
__total_bytes = __size * __nobjs;
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return(__result);
|
||||
} else {
|
||||
size_t __bytes_to_get =
|
||||
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
|
||||
// Try to make use of the left-over piece.
|
||||
if (__bytes_left > 0) {
|
||||
_Pthread_alloc_per_thread_state<_Max_size>* __a =
|
||||
(_Pthread_alloc_per_thread_state<_Max_size>*)
|
||||
pthread_getspecific(_S_key);
|
||||
__obj * volatile * __my_free_list =
|
||||
__a->__free_list + _S_freelist_index(__bytes_left);
|
||||
|
||||
((__obj *)_S_start_free) -> __free_list_link = *__my_free_list;
|
||||
*__my_free_list = (__obj *)_S_start_free;
|
||||
}
|
||||
# ifdef _SGI_SOURCE
|
||||
// Try to get memory that's aligned on something like a
|
||||
// cache line boundary, so as to avoid parceling out
|
||||
// parts of the same line to different threads and thus
|
||||
// possibly different processors.
|
||||
{
|
||||
const int __cache_line_size = 128; // probable upper bound
|
||||
__bytes_to_get &= ~(__cache_line_size-1);
|
||||
_S_start_free = (char *)memalign(__cache_line_size, __bytes_to_get);
|
||||
if (0 == _S_start_free) {
|
||||
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
|
||||
}
|
||||
}
|
||||
# else /* !SGI_SOURCE */
|
||||
_S_start_free = (char *)malloc_alloc::allocate(__bytes_to_get);
|
||||
# endif
|
||||
_S_heap_size += __bytes_to_get;
|
||||
_S_end_free = _S_start_free + __bytes_to_get;
|
||||
}
|
||||
}
|
||||
// lock is released here
|
||||
return(_S_chunk_alloc(__size, __nobjs));
|
||||
}
|
||||
|
||||
|
||||
/* Returns an object of size n, and optionally adds to size n free list.*/
|
||||
/* We assume that n is properly aligned. */
|
||||
/* We hold the allocation lock. */
|
||||
template <size_t _Max_size>
|
||||
void *_Pthread_alloc_per_thread_state<_Max_size>
|
||||
::_M_refill(size_t __n)
|
||||
{
|
||||
int __nobjs = 128;
|
||||
char * __chunk =
|
||||
_Pthread_alloc_template<_Max_size>::_S_chunk_alloc(__n, __nobjs);
|
||||
__obj * volatile * __my_free_list;
|
||||
__obj * __result;
|
||||
__obj * __current_obj, * __next_obj;
|
||||
int __i;
|
||||
|
||||
if (1 == __nobjs) {
|
||||
return(__chunk);
|
||||
}
|
||||
__my_free_list = __free_list
|
||||
+ _Pthread_alloc_template<_Max_size>::_S_freelist_index(__n);
|
||||
|
||||
/* Build free list in chunk */
|
||||
__result = (__obj *)__chunk;
|
||||
*__my_free_list = __next_obj = (__obj *)(__chunk + __n);
|
||||
for (__i = 1; ; __i++) {
|
||||
__current_obj = __next_obj;
|
||||
__next_obj = (__obj *)((char *)__next_obj + __n);
|
||||
if (__nobjs - 1 == __i) {
|
||||
__current_obj -> __free_list_link = 0;
|
||||
break;
|
||||
} else {
|
||||
__current_obj -> __free_list_link = __next_obj;
|
||||
}
|
||||
}
|
||||
return(__result);
|
||||
}
|
||||
|
||||
template <size_t _Max_size>
|
||||
void *_Pthread_alloc_template<_Max_size>
|
||||
::reallocate(void *__p, size_t __old_sz, size_t __new_sz)
|
||||
{
|
||||
void * __result;
|
||||
size_t __copy_sz;
|
||||
|
||||
if (__old_sz > _Max_size
|
||||
&& __new_sz > _Max_size) {
|
||||
return(realloc(__p, __new_sz));
|
||||
}
|
||||
if (_S_round_up(__old_sz) == _S_round_up(__new_sz)) return(__p);
|
||||
__result = allocate(__new_sz);
|
||||
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
|
||||
memcpy(__result, __p, __copy_sz);
|
||||
deallocate(__p, __old_sz);
|
||||
return(__result);
|
||||
}
|
||||
|
||||
template <size_t _Max_size>
|
||||
_Pthread_alloc_per_thread_state<_Max_size> *
|
||||
_Pthread_alloc_template<_Max_size>::_S_free_per_thread_states = 0;
|
||||
|
||||
template <size_t _Max_size>
|
||||
pthread_key_t _Pthread_alloc_template<_Max_size>::_S_key;
|
||||
|
||||
template <size_t _Max_size>
|
||||
bool _Pthread_alloc_template<_Max_size>::_S_key_initialized = false;
|
||||
|
||||
template <size_t _Max_size>
|
||||
pthread_mutex_t _Pthread_alloc_template<_Max_size>::_S_chunk_allocator_lock
|
||||
= PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
template <size_t _Max_size>
|
||||
char *_Pthread_alloc_template<_Max_size>
|
||||
::_S_start_free = 0;
|
||||
|
||||
template <size_t _Max_size>
|
||||
char *_Pthread_alloc_template<_Max_size>
|
||||
::_S_end_free = 0;
|
||||
|
||||
template <size_t _Max_size>
|
||||
size_t _Pthread_alloc_template<_Max_size>
|
||||
::_S_heap_size = 0;
|
||||
|
||||
|
||||
template <class _Tp>
|
||||
class pthread_allocator {
|
||||
typedef pthread_alloc _S_Alloc; // The underlying allocator.
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template <class _NewType> struct rebind {
|
||||
typedef pthread_allocator<_NewType> other;
|
||||
};
|
||||
|
||||
pthread_allocator() throw() {}
|
||||
pthread_allocator(const pthread_allocator& a) throw() {}
|
||||
template <class _OtherType>
|
||||
pthread_allocator(const pthread_allocator<_OtherType>&)
|
||||
throw() {}
|
||||
~pthread_allocator() throw() {}
|
||||
|
||||
pointer address(reference __x) const { return &__x; }
|
||||
const_pointer address(const_reference __x) const { return &__x; }
|
||||
|
||||
// __n is permitted to be 0. The C++ standard says nothing about what
|
||||
// the return value is when __n == 0.
|
||||
_Tp* allocate(size_type __n, const void* = 0) {
|
||||
return __n != 0 ? static_cast<_Tp*>(_S_Alloc::allocate(__n * sizeof(_Tp)))
|
||||
: 0;
|
||||
}
|
||||
|
||||
// p is not permitted to be a null pointer.
|
||||
void deallocate(pointer __p, size_type __n)
|
||||
{ _S_Alloc::deallocate(__p, __n * sizeof(_Tp)); }
|
||||
|
||||
size_type max_size() const throw()
|
||||
{ return size_t(-1) / sizeof(_Tp); }
|
||||
|
||||
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
|
||||
void destroy(pointer _p) { _p->~_Tp(); }
|
||||
};
|
||||
|
||||
template<>
|
||||
class pthread_allocator<void> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
|
||||
template <class _NewType> struct rebind {
|
||||
typedef pthread_allocator<_NewType> other;
|
||||
};
|
||||
};
|
||||
|
||||
template <size_t _Max_size>
|
||||
inline bool operator==(const _Pthread_alloc_template<_Max_size>&,
|
||||
const _Pthread_alloc_template<_Max_size>&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline bool operator==(const pthread_allocator<_T1>&,
|
||||
const pthread_allocator<_T2>& a2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline bool operator!=(const pthread_allocator<_T1>&,
|
||||
const pthread_allocator<_T2>&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Max_size>
|
||||
struct _Alloc_traits<_Tp, _Pthread_alloc_template<_Max_size> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max_size> > _Alloc_type;
|
||||
typedef __allocator<_Tp, _Pthread_alloc_template<_Max_size> >
|
||||
allocator_type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Atype, size_t _Max>
|
||||
struct _Alloc_traits<_Tp, __allocator<_Atype, _Pthread_alloc_template<_Max> > >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef simple_alloc<_Tp, _Pthread_alloc_template<_Max> > _Alloc_type;
|
||||
typedef __allocator<_Tp, _Pthread_alloc_template<_Max> > allocator_type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Atype>
|
||||
struct _Alloc_traits<_Tp, pthread_allocator<_Atype> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef simple_alloc<_Tp, _Pthread_alloc_template<> > _Alloc_type;
|
||||
typedef pthread_allocator<_Tp> allocator_type;
|
||||
};
|
||||
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif /* _CPP_BITS_PTHREAD_ALLOCIMPL_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
@ -1,974 +0,0 @@
|
||||
// Allocators -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file stl_alloc.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef __GLIBCPP_INTERNAL_ALLOC_H
|
||||
#define __GLIBCPP_INTERNAL_ALLOC_H
|
||||
|
||||
/**
|
||||
* @defgroup Allocators Memory Allocators
|
||||
* @if maint
|
||||
* stl_alloc.h implements some node allocators. These are NOT the same as
|
||||
* allocators in the C++ standard, nor in the original H-P STL. They do not
|
||||
* encapsulate different pointer types; we assume that there is only one
|
||||
* pointer type. The C++ standard allocators are intended to allocate
|
||||
* individual objects, not pools or arenas.
|
||||
*
|
||||
* In this file allocators are of two different styles: "standard" and
|
||||
* "SGI" (quotes included). "Standard" allocators conform to 20.4. "SGI"
|
||||
* allocators differ in AT LEAST the following ways (add to this list as you
|
||||
* discover them):
|
||||
*
|
||||
* - "Standard" allocate() takes two parameters (n_count,hint=0) but "SGI"
|
||||
* allocate() takes one paramter (n_size).
|
||||
* - Likewise, "standard" deallocate()'s argument is a count, but in "SGI"
|
||||
* is a byte size.
|
||||
* - max_size(), construct(), and destroy() are missing in "SGI" allocators.
|
||||
* - reallocate(p,oldsz,newsz) is added in "SGI", and behaves as
|
||||
* if p=realloc(p,newsz).
|
||||
*
|
||||
* "SGI" allocators may be wrapped in __allocator to convert the interface
|
||||
* into a "standard" one.
|
||||
* @endif
|
||||
*
|
||||
* @note The @c reallocate member functions have been deprecated for 3.2
|
||||
* and will be removed in 3.4. You must define @c _GLIBCPP_DEPRECATED
|
||||
* to make this visible in 3.2; see c++config.h.
|
||||
*
|
||||
* The canonical description of these classes is in docs/html/ext/howto.html
|
||||
* or online at http://gcc.gnu.org/onlinedocs/libstdc++/ext/howto.html#3
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <bits/functexcept.h> // For __throw_bad_alloc
|
||||
#include <bits/stl_threads.h>
|
||||
|
||||
#include <bits/atomicity.h>
|
||||
|
||||
namespace std
|
||||
{
|
||||
/**
|
||||
* @if maint
|
||||
* A new-based allocator, as required by the standard. Allocation and
|
||||
* deallocation forward to global new and delete. "SGI" style, minus
|
||||
* reallocate().
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
class __new_alloc
|
||||
{
|
||||
public:
|
||||
static void*
|
||||
allocate(size_t __n)
|
||||
{ return ::operator new(__n); }
|
||||
|
||||
static void
|
||||
deallocate(void* __p, size_t)
|
||||
{ ::operator delete(__p); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* A malloc-based allocator. Typically slower than the
|
||||
* __default_alloc_template (below). Typically thread-safe and more
|
||||
* storage efficient. The template argument is unused and is only present
|
||||
* to permit multiple instantiations (but see __default_alloc_template
|
||||
* for caveats). "SGI" style, plus __set_malloc_handler for OOM conditions.
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<int __inst>
|
||||
class __malloc_alloc_template
|
||||
{
|
||||
private:
|
||||
static void* _S_oom_malloc(size_t);
|
||||
static void* _S_oom_realloc(void*, size_t);
|
||||
static void (* __malloc_alloc_oom_handler)();
|
||||
|
||||
public:
|
||||
static void*
|
||||
allocate(size_t __n)
|
||||
{
|
||||
void* __result = malloc(__n);
|
||||
if (__builtin_expect(__result == 0, 0))
|
||||
__result = _S_oom_malloc(__n);
|
||||
return __result;
|
||||
}
|
||||
|
||||
static void
|
||||
deallocate(void* __p, size_t /* __n */)
|
||||
{ free(__p); }
|
||||
|
||||
static void*
|
||||
reallocate(void* __p, size_t /* old_sz */, size_t __new_sz)
|
||||
{
|
||||
void* __result = realloc(__p, __new_sz);
|
||||
if (__builtin_expect(__result == 0, 0))
|
||||
__result = _S_oom_realloc(__p, __new_sz);
|
||||
return __result;
|
||||
}
|
||||
|
||||
static void (* __set_malloc_handler(void (*__f)()))()
|
||||
{
|
||||
void (* __old)() = __malloc_alloc_oom_handler;
|
||||
__malloc_alloc_oom_handler = __f;
|
||||
return __old;
|
||||
}
|
||||
};
|
||||
|
||||
// malloc_alloc out-of-memory handling
|
||||
template<int __inst>
|
||||
void (* __malloc_alloc_template<__inst>::__malloc_alloc_oom_handler)() = 0;
|
||||
|
||||
template<int __inst>
|
||||
void*
|
||||
__malloc_alloc_template<__inst>::
|
||||
_S_oom_malloc(size_t __n)
|
||||
{
|
||||
void (* __my_malloc_handler)();
|
||||
void* __result;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
__my_malloc_handler = __malloc_alloc_oom_handler;
|
||||
if (__builtin_expect(__my_malloc_handler == 0, 0))
|
||||
__throw_bad_alloc();
|
||||
(*__my_malloc_handler)();
|
||||
__result = malloc(__n);
|
||||
if (__result)
|
||||
return __result;
|
||||
}
|
||||
}
|
||||
|
||||
template<int __inst>
|
||||
void*
|
||||
__malloc_alloc_template<__inst>::
|
||||
_S_oom_realloc(void* __p, size_t __n)
|
||||
{
|
||||
void (* __my_malloc_handler)();
|
||||
void* __result;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
__my_malloc_handler = __malloc_alloc_oom_handler;
|
||||
if (__builtin_expect(__my_malloc_handler == 0, 0))
|
||||
__throw_bad_alloc();
|
||||
(*__my_malloc_handler)();
|
||||
__result = realloc(__p, __n);
|
||||
if (__result)
|
||||
return __result;
|
||||
}
|
||||
}
|
||||
|
||||
// Should not be referenced within the library anymore.
|
||||
typedef __new_alloc __mem_interface;
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* This is used primarily (only?) in _Alloc_traits and other places to
|
||||
* help provide the _Alloc_type typedef. All it does is forward the
|
||||
* requests after some minimal checking.
|
||||
*
|
||||
* This is neither "standard"-conforming nor "SGI". The _Alloc parameter
|
||||
* must be "SGI" style.
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<typename _Tp, typename _Alloc>
|
||||
class __simple_alloc
|
||||
{
|
||||
public:
|
||||
static _Tp*
|
||||
allocate(size_t __n)
|
||||
{
|
||||
_Tp* __ret = 0;
|
||||
if (__n)
|
||||
__ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
|
||||
return __ret;
|
||||
}
|
||||
|
||||
static _Tp*
|
||||
allocate()
|
||||
{ return (_Tp*) _Alloc::allocate(sizeof (_Tp)); }
|
||||
|
||||
static void
|
||||
deallocate(_Tp* __p, size_t __n)
|
||||
{ if (0 != __n) _Alloc::deallocate(__p, __n * sizeof (_Tp)); }
|
||||
|
||||
static void
|
||||
deallocate(_Tp* __p)
|
||||
{ _Alloc::deallocate(__p, sizeof (_Tp)); }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* An adaptor for an underlying allocator (_Alloc) to check the size
|
||||
* arguments for debugging.
|
||||
*
|
||||
* "There is some evidence that this can confuse Purify." - SGI comment
|
||||
*
|
||||
* This adaptor is "SGI" style. The _Alloc parameter must also be "SGI".
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<typename _Alloc>
|
||||
class __debug_alloc
|
||||
{
|
||||
private:
|
||||
// Size of space used to store size. Note that this must be
|
||||
// large enough to preserve alignment.
|
||||
enum {_S_extra = 8};
|
||||
|
||||
public:
|
||||
static void*
|
||||
allocate(size_t __n)
|
||||
{
|
||||
char* __result = (char*)_Alloc::allocate(__n + (int) _S_extra);
|
||||
*(size_t*)__result = __n;
|
||||
return __result + (int) _S_extra;
|
||||
}
|
||||
|
||||
static void
|
||||
deallocate(void* __p, size_t __n)
|
||||
{
|
||||
char* __real_p = (char*)__p - (int) _S_extra;
|
||||
if (*(size_t*)__real_p != __n)
|
||||
abort();
|
||||
_Alloc::deallocate(__real_p, __n + (int) _S_extra);
|
||||
}
|
||||
|
||||
static void*
|
||||
reallocate(void* __p, size_t __old_sz, size_t __new_sz)
|
||||
{
|
||||
char* __real_p = (char*)__p - (int) _S_extra;
|
||||
if (*(size_t*)__real_p != __old_sz)
|
||||
abort();
|
||||
char* __result = (char*) _Alloc::reallocate(__real_p,
|
||||
__old_sz + (int) _S_extra,
|
||||
__new_sz + (int) _S_extra);
|
||||
*(size_t*)__result = __new_sz;
|
||||
return __result + (int) _S_extra;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* Default node allocator. "SGI" style. Uses various allocators to
|
||||
* fulfill underlying requests (and makes as few requests as possible
|
||||
* when in default high-speed pool mode).
|
||||
*
|
||||
* Important implementation properties:
|
||||
* 0. If globally mandated, then allocate objects from __new_alloc
|
||||
* 1. If the clients request an object of size > _MAX_BYTES, the resulting
|
||||
* object will be obtained directly from __new_alloc
|
||||
* 2. In all other cases, we allocate an object of size exactly
|
||||
* _S_round_up(requested_size). Thus the client has enough size
|
||||
* information that we can return the object to the proper free list
|
||||
* without permanently losing part of the object.
|
||||
*
|
||||
* The first template parameter specifies whether more than one thread may
|
||||
* use this allocator. It is safe to allocate an object from one instance
|
||||
* of a default_alloc and deallocate it with another one. This effectively
|
||||
* transfers its ownership to the second one. This may have undesirable
|
||||
* effects on reference locality.
|
||||
*
|
||||
* The second parameter is unused and serves only to allow the creation of
|
||||
* multiple default_alloc instances. Note that containers built on different
|
||||
* allocator instances have different types, limiting the utility of this
|
||||
* approach. If you do not wish to share the free lists with the main
|
||||
* default_alloc instance, instantiate this with a non-zero __inst.
|
||||
*
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<bool __threads, int __inst>
|
||||
class __default_alloc_template
|
||||
{
|
||||
private:
|
||||
enum {_ALIGN = 8};
|
||||
enum {_MAX_BYTES = 128};
|
||||
enum {_NFREELISTS = _MAX_BYTES / _ALIGN};
|
||||
|
||||
union _Obj
|
||||
{
|
||||
union _Obj* _M_free_list_link;
|
||||
char _M_client_data[1]; // The client sees this.
|
||||
};
|
||||
|
||||
static _Obj* volatile _S_free_list[_NFREELISTS];
|
||||
|
||||
// Chunk allocation state.
|
||||
static char* _S_start_free;
|
||||
static char* _S_end_free;
|
||||
static size_t _S_heap_size;
|
||||
|
||||
static _STL_mutex_lock _S_node_allocator_lock;
|
||||
|
||||
static size_t
|
||||
_S_round_up(size_t __bytes)
|
||||
{ return (((__bytes) + (size_t) _ALIGN-1) & ~((size_t) _ALIGN - 1)); }
|
||||
|
||||
static size_t
|
||||
_S_freelist_index(size_t __bytes)
|
||||
{ return (((__bytes) + (size_t)_ALIGN - 1)/(size_t)_ALIGN - 1); }
|
||||
|
||||
// Returns an object of size __n, and optionally adds to size __n
|
||||
// free list.
|
||||
static void*
|
||||
_S_refill(size_t __n);
|
||||
|
||||
// Allocates a chunk for nobjs of size size. nobjs may be reduced
|
||||
// if it is inconvenient to allocate the requested number.
|
||||
static char*
|
||||
_S_chunk_alloc(size_t __size, int& __nobjs);
|
||||
|
||||
// It would be nice to use _STL_auto_lock here. But we need a
|
||||
// test whether threads are in use.
|
||||
struct _Lock
|
||||
{
|
||||
_Lock() { if (__threads) _S_node_allocator_lock._M_acquire_lock(); }
|
||||
~_Lock() { if (__threads) _S_node_allocator_lock._M_release_lock(); }
|
||||
} __attribute__ ((__unused__));
|
||||
friend struct _Lock;
|
||||
|
||||
static _Atomic_word _S_force_new;
|
||||
|
||||
public:
|
||||
// __n must be > 0
|
||||
static void*
|
||||
allocate(size_t __n)
|
||||
{
|
||||
void* __ret = 0;
|
||||
|
||||
// If there is a race through here, assume answer from getenv
|
||||
// will resolve in same direction. Inspired by techniques
|
||||
// to efficiently support threading found in basic_string.h.
|
||||
if (_S_force_new == 0)
|
||||
{
|
||||
if (getenv("GLIBCPP_FORCE_NEW"))
|
||||
__atomic_add(&_S_force_new, 1);
|
||||
else
|
||||
__atomic_add(&_S_force_new, -1);
|
||||
}
|
||||
|
||||
if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0))
|
||||
__ret = __new_alloc::allocate(__n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list = _S_free_list
|
||||
+ _S_freelist_index(__n);
|
||||
// Acquire the lock here with a constructor call. This
|
||||
// ensures that it is released in exit or during stack
|
||||
// unwinding.
|
||||
_Lock __lock_instance;
|
||||
_Obj* __restrict__ __result = *__my_free_list;
|
||||
if (__builtin_expect(__result == 0, 0))
|
||||
__ret = _S_refill(_S_round_up(__n));
|
||||
else
|
||||
{
|
||||
*__my_free_list = __result -> _M_free_list_link;
|
||||
__ret = __result;
|
||||
}
|
||||
if (__builtin_expect(__ret == 0, 0))
|
||||
__throw_bad_alloc();
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
// __p may not be 0
|
||||
static void
|
||||
deallocate(void* __p, size_t __n)
|
||||
{
|
||||
if ((__n > (size_t) _MAX_BYTES) || (_S_force_new > 0))
|
||||
__new_alloc::deallocate(__p, __n);
|
||||
else
|
||||
{
|
||||
_Obj* volatile* __my_free_list = _S_free_list
|
||||
+ _S_freelist_index(__n);
|
||||
_Obj* __q = (_Obj*)__p;
|
||||
|
||||
// Acquire the lock here with a constructor call. This
|
||||
// ensures that it is released in exit or during stack
|
||||
// unwinding.
|
||||
_Lock __lock_instance;
|
||||
__q -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = __q;
|
||||
}
|
||||
}
|
||||
|
||||
static void*
|
||||
reallocate(void* __p, size_t __old_sz, size_t __new_sz);
|
||||
};
|
||||
|
||||
template<bool __threads, int __inst> _Atomic_word
|
||||
__default_alloc_template<__threads, __inst>::_S_force_new = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
inline bool
|
||||
operator==(const __default_alloc_template<__threads,__inst>&,
|
||||
const __default_alloc_template<__threads,__inst>&)
|
||||
{ return true; }
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
inline bool
|
||||
operator!=(const __default_alloc_template<__threads,__inst>&,
|
||||
const __default_alloc_template<__threads,__inst>&)
|
||||
{ return false; }
|
||||
|
||||
|
||||
// We allocate memory in large chunks in order to avoid fragmenting the
|
||||
// heap too much. We assume that __size is properly aligned. We hold
|
||||
// the allocation lock.
|
||||
template<bool __threads, int __inst>
|
||||
char*
|
||||
__default_alloc_template<__threads, __inst>::
|
||||
_S_chunk_alloc(size_t __size, int& __nobjs)
|
||||
{
|
||||
char* __result;
|
||||
size_t __total_bytes = __size * __nobjs;
|
||||
size_t __bytes_left = _S_end_free - _S_start_free;
|
||||
|
||||
if (__bytes_left >= __total_bytes)
|
||||
{
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return __result ;
|
||||
}
|
||||
else if (__bytes_left >= __size)
|
||||
{
|
||||
__nobjs = (int)(__bytes_left/__size);
|
||||
__total_bytes = __size * __nobjs;
|
||||
__result = _S_start_free;
|
||||
_S_start_free += __total_bytes;
|
||||
return __result;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t __bytes_to_get =
|
||||
2 * __total_bytes + _S_round_up(_S_heap_size >> 4);
|
||||
// Try to make use of the left-over piece.
|
||||
if (__bytes_left > 0)
|
||||
{
|
||||
_Obj* volatile* __my_free_list =
|
||||
_S_free_list + _S_freelist_index(__bytes_left);
|
||||
|
||||
((_Obj*)(void*)_S_start_free) -> _M_free_list_link = *__my_free_list;
|
||||
*__my_free_list = (_Obj*)(void*)_S_start_free;
|
||||
}
|
||||
_S_start_free = (char*) __new_alloc::allocate(__bytes_to_get);
|
||||
if (_S_start_free == 0)
|
||||
{
|
||||
size_t __i;
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __p;
|
||||
// Try to make do with what we have. That can't hurt. We
|
||||
// do not try smaller requests, since that tends to result
|
||||
// in disaster on multi-process machines.
|
||||
__i = __size;
|
||||
for (; __i <= (size_t) _MAX_BYTES; __i += (size_t) _ALIGN)
|
||||
{
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__i);
|
||||
__p = *__my_free_list;
|
||||
if (__p != 0)
|
||||
{
|
||||
*__my_free_list = __p -> _M_free_list_link;
|
||||
_S_start_free = (char*)__p;
|
||||
_S_end_free = _S_start_free + __i;
|
||||
return _S_chunk_alloc(__size, __nobjs);
|
||||
// Any leftover piece will eventually make it to the
|
||||
// right free list.
|
||||
}
|
||||
}
|
||||
_S_end_free = 0; // In case of exception.
|
||||
_S_start_free = (char*)__new_alloc::allocate(__bytes_to_get);
|
||||
// This should either throw an exception or remedy the situation.
|
||||
// Thus we assume it succeeded.
|
||||
}
|
||||
_S_heap_size += __bytes_to_get;
|
||||
_S_end_free = _S_start_free + __bytes_to_get;
|
||||
return _S_chunk_alloc(__size, __nobjs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns an object of size __n, and optionally adds to "size
|
||||
// __n"'s free list. We assume that __n is properly aligned. We
|
||||
// hold the allocation lock.
|
||||
template<bool __threads, int __inst>
|
||||
void*
|
||||
__default_alloc_template<__threads, __inst>::_S_refill(size_t __n)
|
||||
{
|
||||
int __nobjs = 20;
|
||||
char* __chunk = _S_chunk_alloc(__n, __nobjs);
|
||||
_Obj* volatile* __my_free_list;
|
||||
_Obj* __result;
|
||||
_Obj* __current_obj;
|
||||
_Obj* __next_obj;
|
||||
int __i;
|
||||
|
||||
if (1 == __nobjs)
|
||||
return __chunk;
|
||||
__my_free_list = _S_free_list + _S_freelist_index(__n);
|
||||
|
||||
// Build free list in chunk.
|
||||
__result = (_Obj*)(void*)__chunk;
|
||||
*__my_free_list = __next_obj = (_Obj*)(void*)(__chunk + __n);
|
||||
for (__i = 1; ; __i++)
|
||||
{
|
||||
__current_obj = __next_obj;
|
||||
__next_obj = (_Obj*)(void*)((char*)__next_obj + __n);
|
||||
if (__nobjs - 1 == __i)
|
||||
{
|
||||
__current_obj -> _M_free_list_link = 0;
|
||||
break;
|
||||
}
|
||||
else
|
||||
__current_obj -> _M_free_list_link = __next_obj;
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
|
||||
template<bool threads, int inst>
|
||||
void*
|
||||
__default_alloc_template<threads, inst>::
|
||||
reallocate(void* __p, size_t __old_sz, size_t __new_sz)
|
||||
{
|
||||
void* __result;
|
||||
size_t __copy_sz;
|
||||
|
||||
if (__old_sz > (size_t) _MAX_BYTES && __new_sz > (size_t) _MAX_BYTES)
|
||||
return(realloc(__p, __new_sz));
|
||||
if (_S_round_up(__old_sz) == _S_round_up(__new_sz))
|
||||
return(__p);
|
||||
__result = allocate(__new_sz);
|
||||
__copy_sz = __new_sz > __old_sz? __old_sz : __new_sz;
|
||||
memcpy(__result, __p, __copy_sz);
|
||||
deallocate(__p, __old_sz);
|
||||
return __result;
|
||||
}
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
_STL_mutex_lock
|
||||
__default_alloc_template<__threads,__inst>::_S_node_allocator_lock
|
||||
__STL_MUTEX_INITIALIZER;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads,__inst>::_S_start_free = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
char* __default_alloc_template<__threads,__inst>::_S_end_free = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
size_t __default_alloc_template<__threads,__inst>::_S_heap_size = 0;
|
||||
|
||||
template<bool __threads, int __inst>
|
||||
typename __default_alloc_template<__threads,__inst>::_Obj* volatile
|
||||
__default_alloc_template<__threads,__inst>::_S_free_list[_NFREELISTS];
|
||||
|
||||
typedef __default_alloc_template<true,0> __alloc;
|
||||
typedef __default_alloc_template<false,0> __single_client_alloc;
|
||||
|
||||
|
||||
/**
|
||||
* @brief The "standard" allocator, as per [20.4].
|
||||
*
|
||||
* The private _Alloc is "SGI" style. (See comments at the top
|
||||
* of stl_alloc.h.)
|
||||
*
|
||||
* The underlying allocator behaves as follows.
|
||||
* - __default_alloc_template is used via two typedefs
|
||||
* - "__single_client_alloc" typedef does no locking for threads
|
||||
* - "__alloc" typedef is threadsafe via the locks
|
||||
* - __new_alloc is used for memory requests
|
||||
*
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<typename _Tp>
|
||||
class allocator
|
||||
{
|
||||
typedef __alloc _Alloc; // The underlying allocator.
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef allocator<_Tp1> other; };
|
||||
|
||||
allocator() throw() {}
|
||||
allocator(const allocator&) throw() {}
|
||||
template<typename _Tp1>
|
||||
allocator(const allocator<_Tp1>&) throw() {}
|
||||
~allocator() throw() {}
|
||||
|
||||
pointer
|
||||
address(reference __x) const { return &__x; }
|
||||
|
||||
const_pointer
|
||||
address(const_reference __x) const { return &__x; }
|
||||
|
||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||
// about what the return value is when __n == 0.
|
||||
_Tp*
|
||||
allocate(size_type __n, const void* = 0)
|
||||
{
|
||||
_Tp* __ret = 0;
|
||||
if (__n)
|
||||
{
|
||||
if (__n <= this->max_size())
|
||||
__ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
|
||||
else
|
||||
__throw_bad_alloc();
|
||||
}
|
||||
return __ret;
|
||||
}
|
||||
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type __n)
|
||||
{ _Alloc::deallocate(__p, __n * sizeof(_Tp)); }
|
||||
|
||||
size_type
|
||||
max_size() const throw() { return size_t(-1) / sizeof(_Tp); }
|
||||
|
||||
void construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
|
||||
void destroy(pointer __p) { __p->~_Tp(); }
|
||||
};
|
||||
|
||||
template<>
|
||||
class allocator<void>
|
||||
{
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef allocator<_Tp1> other; };
|
||||
};
|
||||
|
||||
|
||||
template<typename _T1, typename _T2>
|
||||
inline bool
|
||||
operator==(const allocator<_T1>&, const allocator<_T2>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _T1, typename _T2>
|
||||
inline bool
|
||||
operator!=(const allocator<_T1>&, const allocator<_T2>&)
|
||||
{ return false; }
|
||||
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* Allocator adaptor to turn an "SGI" style allocator (e.g.,
|
||||
* __alloc, __malloc_alloc_template) into a "standard" conforming
|
||||
* allocator. Note that this adaptor does *not* assume that all
|
||||
* objects of the underlying alloc class are identical, nor does it
|
||||
* assume that all of the underlying alloc's member functions are
|
||||
* static member functions. Note, also, that __allocator<_Tp,
|
||||
* __alloc> is essentially the same thing as allocator<_Tp>.
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
template<typename _Tp, typename _Alloc>
|
||||
struct __allocator
|
||||
{
|
||||
_Alloc __underlying_alloc;
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef _Tp* pointer;
|
||||
typedef const _Tp* const_pointer;
|
||||
typedef _Tp& reference;
|
||||
typedef const _Tp& const_reference;
|
||||
typedef _Tp value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef __allocator<_Tp1, _Alloc> other; };
|
||||
|
||||
__allocator() throw() {}
|
||||
__allocator(const __allocator& __a) throw()
|
||||
: __underlying_alloc(__a.__underlying_alloc) {}
|
||||
|
||||
template<typename _Tp1>
|
||||
__allocator(const __allocator<_Tp1, _Alloc>& __a) throw()
|
||||
: __underlying_alloc(__a.__underlying_alloc) {}
|
||||
|
||||
~__allocator() throw() {}
|
||||
|
||||
pointer
|
||||
address(reference __x) const { return &__x; }
|
||||
|
||||
const_pointer
|
||||
address(const_reference __x) const { return &__x; }
|
||||
|
||||
// NB: __n is permitted to be 0. The C++ standard says nothing
|
||||
// about what the return value is when __n == 0.
|
||||
_Tp*
|
||||
allocate(size_type __n, const void* = 0)
|
||||
{
|
||||
_Tp* __ret = 0;
|
||||
if (__n)
|
||||
__ret = static_cast<_Tp*>(_Alloc::allocate(__n * sizeof(_Tp)));
|
||||
return __ret;
|
||||
}
|
||||
|
||||
// __p is not permitted to be a null pointer.
|
||||
void
|
||||
deallocate(pointer __p, size_type __n)
|
||||
{ __underlying_alloc.deallocate(__p, __n * sizeof(_Tp)); }
|
||||
|
||||
size_type
|
||||
max_size() const throw() { return size_t(-1) / sizeof(_Tp); }
|
||||
|
||||
void
|
||||
construct(pointer __p, const _Tp& __val) { new(__p) _Tp(__val); }
|
||||
|
||||
void
|
||||
destroy(pointer __p) { __p->~_Tp(); }
|
||||
};
|
||||
|
||||
template<typename _Alloc>
|
||||
struct __allocator<void, _Alloc>
|
||||
{
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef void* pointer;
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
|
||||
template<typename _Tp1>
|
||||
struct rebind
|
||||
{ typedef __allocator<_Tp1, _Alloc> other; };
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator==(const __allocator<_Tp,_Alloc>& __a1,
|
||||
const __allocator<_Tp,_Alloc>& __a2)
|
||||
{ return __a1.__underlying_alloc == __a2.__underlying_alloc; }
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const __allocator<_Tp, _Alloc>& __a1,
|
||||
const __allocator<_Tp, _Alloc>& __a2)
|
||||
{ return __a1.__underlying_alloc != __a2.__underlying_alloc; }
|
||||
|
||||
|
||||
//@{
|
||||
/** Comparison operators for all of the predifined SGI-style allocators.
|
||||
* This ensures that __allocator<malloc_alloc> (for example) will work
|
||||
* correctly. As required, all allocators compare equal.
|
||||
*/
|
||||
template<int inst>
|
||||
inline bool
|
||||
operator==(const __malloc_alloc_template<inst>&,
|
||||
const __malloc_alloc_template<inst>&)
|
||||
{ return true; }
|
||||
|
||||
template<int __inst>
|
||||
inline bool
|
||||
operator!=(const __malloc_alloc_template<__inst>&,
|
||||
const __malloc_alloc_template<__inst>&)
|
||||
{ return false; }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline bool
|
||||
operator==(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&)
|
||||
{ return true; }
|
||||
|
||||
template<typename _Alloc>
|
||||
inline bool
|
||||
operator!=(const __debug_alloc<_Alloc>&, const __debug_alloc<_Alloc>&)
|
||||
{ return false; }
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* @if maint
|
||||
* Another allocator adaptor: _Alloc_traits. This serves two purposes.
|
||||
* First, make it possible to write containers that can use either "SGI"
|
||||
* style allocators or "standard" allocators. Second, provide a mechanism
|
||||
* so that containers can query whether or not the allocator has distinct
|
||||
* instances. If not, the container can avoid wasting a word of memory to
|
||||
* store an empty object. For examples of use, see stl_vector.h, etc, or
|
||||
* any of the other classes derived from this one.
|
||||
*
|
||||
* This adaptor uses partial specialization. The general case of
|
||||
* _Alloc_traits<_Tp, _Alloc> assumes that _Alloc is a
|
||||
* standard-conforming allocator, possibly with non-equal instances and
|
||||
* non-static members. (It still behaves correctly even if _Alloc has
|
||||
* static member and if all instances are equal. Refinements affect
|
||||
* performance, not correctness.)
|
||||
*
|
||||
* There are always two members: allocator_type, which is a standard-
|
||||
* conforming allocator type for allocating objects of type _Tp, and
|
||||
* _S_instanceless, a static const member of type bool. If
|
||||
* _S_instanceless is true, this means that there is no difference
|
||||
* between any two instances of type allocator_type. Furthermore, if
|
||||
* _S_instanceless is true, then _Alloc_traits has one additional
|
||||
* member: _Alloc_type. This type encapsulates allocation and
|
||||
* deallocation of objects of type _Tp through a static interface; it
|
||||
* has two member functions, whose signatures are
|
||||
*
|
||||
* - static _Tp* allocate(size_t)
|
||||
* - static void deallocate(_Tp*, size_t)
|
||||
*
|
||||
* The size_t parameters are "standard" style (see top of stl_alloc.h) in
|
||||
* that they take counts, not sizes.
|
||||
*
|
||||
* @endif
|
||||
* (See @link Allocators allocators info @endlink for more.)
|
||||
*/
|
||||
//@{
|
||||
// The fully general version.
|
||||
template<typename _Tp, typename _Allocator>
|
||||
struct _Alloc_traits
|
||||
{
|
||||
static const bool _S_instanceless = false;
|
||||
typedef typename _Allocator::template rebind<_Tp>::other allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Allocator>
|
||||
const bool _Alloc_traits<_Tp, _Allocator>::_S_instanceless;
|
||||
|
||||
/// The version for the default allocator.
|
||||
template<typename _Tp, typename _Tp1>
|
||||
struct _Alloc_traits<_Tp, allocator<_Tp1> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __alloc> _Alloc_type;
|
||||
typedef allocator<_Tp> allocator_type;
|
||||
};
|
||||
//@}
|
||||
|
||||
//@{
|
||||
/// Versions for the predefined "SGI" style allocators.
|
||||
template<typename _Tp, int __inst>
|
||||
struct _Alloc_traits<_Tp, __malloc_alloc_template<__inst> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
|
||||
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool __threads, int __inst>
|
||||
struct _Alloc_traits<_Tp, __default_alloc_template<__threads, __inst> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __default_alloc_template<__threads, __inst> >
|
||||
_Alloc_type;
|
||||
typedef __allocator<_Tp, __default_alloc_template<__threads, __inst> >
|
||||
allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Alloc>
|
||||
struct _Alloc_traits<_Tp, __debug_alloc<_Alloc> >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type;
|
||||
typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
|
||||
};
|
||||
//@}
|
||||
|
||||
//@{
|
||||
/// Versions for the __allocator adaptor used with the predefined
|
||||
/// "SGI" style allocators.
|
||||
template<typename _Tp, typename _Tp1, int __inst>
|
||||
struct _Alloc_traits<_Tp,
|
||||
__allocator<_Tp1, __malloc_alloc_template<__inst> > >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __malloc_alloc_template<__inst> > _Alloc_type;
|
||||
typedef __allocator<_Tp, __malloc_alloc_template<__inst> > allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Tp1, bool __thr, int __inst>
|
||||
struct _Alloc_traits<_Tp, __allocator<_Tp1, __default_alloc_template<__thr, __inst> > >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __default_alloc_template<__thr,__inst> >
|
||||
_Alloc_type;
|
||||
typedef __allocator<_Tp, __default_alloc_template<__thr,__inst> >
|
||||
allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, typename _Tp1, typename _Alloc>
|
||||
struct _Alloc_traits<_Tp, __allocator<_Tp1, __debug_alloc<_Alloc> > >
|
||||
{
|
||||
static const bool _S_instanceless = true;
|
||||
typedef __simple_alloc<_Tp, __debug_alloc<_Alloc> > _Alloc_type;
|
||||
typedef __allocator<_Tp, __debug_alloc<_Alloc> > allocator_type;
|
||||
};
|
||||
//@}
|
||||
|
||||
// Inhibit implicit instantiations for required instantiations,
|
||||
// which are defined via explicit instantiations elsewhere.
|
||||
// NB: This syntax is a GNU extension.
|
||||
#if _GLIBCPP_EXTERN_TEMPLATE
|
||||
extern template class allocator<char>;
|
||||
extern template class allocator<wchar_t>;
|
||||
extern template class __default_alloc_template<true,0>;
|
||||
#endif
|
||||
} // namespace std
|
||||
|
||||
#endif
|
@ -1,60 +0,0 @@
|
||||
// Wrapper of pthread allocation header -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/** @file stl_pthread_alloc.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* You should not attempt to use it directly.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BITS_STL_PTHREAD_ALLOC_H
|
||||
#define _CPP_BITS_STL_PTHREAD_ALLOC_H 1
|
||||
|
||||
#include <bits/pthread_allocimpl.h>
|
||||
|
||||
using std::_Pthread_alloc_template;
|
||||
using std::pthread_alloc;
|
||||
|
||||
#endif /* _CPP_BITS_STL_PTHREAD_ALLOC_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
File diff suppressed because it is too large
Load Diff
@ -1,126 +0,0 @@
|
||||
// 'struct hash' from SGI -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-1998
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file ext/stl_hash_fun.h
|
||||
* This file is a GNU extension to the Standard C++ Library (possibly
|
||||
* containing extensions from the HP/SGI STL subset). You should only
|
||||
* include this header if you are using GCC 3 or later.
|
||||
*/
|
||||
|
||||
#ifndef _CPP_BITS_STL_HASH_FUN_H
|
||||
#define _CPP_BITS_STL_HASH_FUN_H 1
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
using std::size_t;
|
||||
|
||||
template <class _Key> struct hash { };
|
||||
|
||||
inline size_t __stl_hash_string(const char* __s)
|
||||
{
|
||||
unsigned long __h = 0;
|
||||
for ( ; *__s; ++__s)
|
||||
__h = 5*__h + *__s;
|
||||
|
||||
return size_t(__h);
|
||||
}
|
||||
|
||||
template<> struct hash<char*>
|
||||
{
|
||||
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
|
||||
};
|
||||
|
||||
template<> struct hash<const char*>
|
||||
{
|
||||
size_t operator()(const char* __s) const { return __stl_hash_string(__s); }
|
||||
};
|
||||
|
||||
template<> struct hash<char> {
|
||||
size_t operator()(char __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<unsigned char> {
|
||||
size_t operator()(unsigned char __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<signed char> {
|
||||
size_t operator()(unsigned char __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<short> {
|
||||
size_t operator()(short __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<unsigned short> {
|
||||
size_t operator()(unsigned short __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<int> {
|
||||
size_t operator()(int __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<unsigned int> {
|
||||
size_t operator()(unsigned int __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<long> {
|
||||
size_t operator()(long __x) const { return __x; }
|
||||
};
|
||||
template<> struct hash<unsigned long> {
|
||||
size_t operator()(unsigned long __x) const { return __x; }
|
||||
};
|
||||
|
||||
} // namespace __gnu_cxx
|
||||
|
||||
#endif /* _CPP_BITS_STL_HASH_FUN_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
@ -1,996 +0,0 @@
|
||||
// Hashtable implementation used by containers -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
// This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996,1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*/
|
||||
|
||||
/** @file ext/stl_hashtable.h
|
||||
* This file is a GNU extension to the Standard C++ Library (possibly
|
||||
* containing extensions from the HP/SGI STL subset). You should only
|
||||
* include this header if you are using GCC 3 or later.
|
||||
*/
|
||||
|
||||
#ifndef __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
#define __SGI_STL_INTERNAL_HASHTABLE_H
|
||||
|
||||
// Hashtable class, used to implement the hashed associative containers
|
||||
// hash_set, hash_map, hash_multiset, and hash_multimap.
|
||||
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <bits/stl_algo.h>
|
||||
#include <bits/stl_function.h>
|
||||
#include <ext/stl_hash_fun.h>
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
using std::size_t;
|
||||
using std::ptrdiff_t;
|
||||
using std::forward_iterator_tag;
|
||||
using std::input_iterator_tag;
|
||||
using std::_Alloc_traits;
|
||||
using std::_Construct;
|
||||
using std::_Destroy;
|
||||
using std::distance;
|
||||
using std::vector;
|
||||
using std::pair;
|
||||
using std::__iterator_category;
|
||||
|
||||
template <class _Val>
|
||||
struct _Hashtable_node
|
||||
{
|
||||
_Hashtable_node* _M_next;
|
||||
_Val _M_val;
|
||||
};
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc = std::__alloc>
|
||||
class hashtable;
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc>
|
||||
struct _Hashtable_iterator;
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc>
|
||||
struct _Hashtable_const_iterator;
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc>
|
||||
struct _Hashtable_iterator {
|
||||
typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
|
||||
_Hashtable;
|
||||
typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
|
||||
_ExtractKey, _EqualKey, _Alloc>
|
||||
iterator;
|
||||
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
|
||||
_ExtractKey, _EqualKey, _Alloc>
|
||||
const_iterator;
|
||||
typedef _Hashtable_node<_Val> _Node;
|
||||
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef _Val value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef _Val& reference;
|
||||
typedef _Val* pointer;
|
||||
|
||||
_Node* _M_cur;
|
||||
_Hashtable* _M_ht;
|
||||
|
||||
_Hashtable_iterator(_Node* __n, _Hashtable* __tab)
|
||||
: _M_cur(__n), _M_ht(__tab) {}
|
||||
_Hashtable_iterator() {}
|
||||
reference operator*() const { return _M_cur->_M_val; }
|
||||
pointer operator->() const { return &(operator*()); }
|
||||
iterator& operator++();
|
||||
iterator operator++(int);
|
||||
bool operator==(const iterator& __it) const
|
||||
{ return _M_cur == __it._M_cur; }
|
||||
bool operator!=(const iterator& __it) const
|
||||
{ return _M_cur != __it._M_cur; }
|
||||
};
|
||||
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc>
|
||||
struct _Hashtable_const_iterator {
|
||||
typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
|
||||
_Hashtable;
|
||||
typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
|
||||
_ExtractKey,_EqualKey,_Alloc>
|
||||
iterator;
|
||||
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
|
||||
_ExtractKey, _EqualKey, _Alloc>
|
||||
const_iterator;
|
||||
typedef _Hashtable_node<_Val> _Node;
|
||||
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
typedef _Val value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef const _Val& reference;
|
||||
typedef const _Val* pointer;
|
||||
|
||||
const _Node* _M_cur;
|
||||
const _Hashtable* _M_ht;
|
||||
|
||||
_Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
|
||||
: _M_cur(__n), _M_ht(__tab) {}
|
||||
_Hashtable_const_iterator() {}
|
||||
_Hashtable_const_iterator(const iterator& __it)
|
||||
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
|
||||
reference operator*() const { return _M_cur->_M_val; }
|
||||
pointer operator->() const { return &(operator*()); }
|
||||
const_iterator& operator++();
|
||||
const_iterator operator++(int);
|
||||
bool operator==(const const_iterator& __it) const
|
||||
{ return _M_cur == __it._M_cur; }
|
||||
bool operator!=(const const_iterator& __it) const
|
||||
{ return _M_cur != __it._M_cur; }
|
||||
};
|
||||
|
||||
// Note: assumes long is at least 32 bits.
|
||||
enum { __stl_num_primes = 28 };
|
||||
|
||||
static const unsigned long __stl_prime_list[__stl_num_primes] =
|
||||
{
|
||||
53ul, 97ul, 193ul, 389ul, 769ul,
|
||||
1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
|
||||
49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
|
||||
1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
|
||||
50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
|
||||
1610612741ul, 3221225473ul, 4294967291ul
|
||||
};
|
||||
|
||||
inline unsigned long __stl_next_prime(unsigned long __n)
|
||||
{
|
||||
const unsigned long* __first = __stl_prime_list;
|
||||
const unsigned long* __last = __stl_prime_list + (int)__stl_num_primes;
|
||||
const unsigned long* pos = std::lower_bound(__first, __last, __n);
|
||||
return pos == __last ? *(__last - 1) : *pos;
|
||||
}
|
||||
|
||||
// Forward declaration of operator==.
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
class hashtable;
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
|
||||
const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2);
|
||||
|
||||
|
||||
// Hashtables handle allocators a bit differently than other containers
|
||||
// do. If we're using standard-conforming allocators, then a hashtable
|
||||
// unconditionally has a member variable to hold its allocator, even if
|
||||
// it so happens that all instances of the allocator type are identical.
|
||||
// This is because, for hashtables, this extra storage is negligible.
|
||||
// Additionally, a base class wouldn't serve any other purposes; it
|
||||
// wouldn't, for example, simplify the exception-handling code.
|
||||
|
||||
template <class _Val, class _Key, class _HashFcn,
|
||||
class _ExtractKey, class _EqualKey, class _Alloc>
|
||||
class hashtable {
|
||||
public:
|
||||
typedef _Key key_type;
|
||||
typedef _Val value_type;
|
||||
typedef _HashFcn hasher;
|
||||
typedef _EqualKey key_equal;
|
||||
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
|
||||
hasher hash_funct() const { return _M_hash; }
|
||||
key_equal key_eq() const { return _M_equals; }
|
||||
|
||||
private:
|
||||
typedef _Hashtable_node<_Val> _Node;
|
||||
|
||||
public:
|
||||
typedef typename _Alloc_traits<_Val,_Alloc>::allocator_type allocator_type;
|
||||
allocator_type get_allocator() const { return _M_node_allocator; }
|
||||
private:
|
||||
typename _Alloc_traits<_Node, _Alloc>::allocator_type _M_node_allocator;
|
||||
_Node* _M_get_node() { return _M_node_allocator.allocate(1); }
|
||||
void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
|
||||
|
||||
private:
|
||||
hasher _M_hash;
|
||||
key_equal _M_equals;
|
||||
_ExtractKey _M_get_key;
|
||||
vector<_Node*,_Alloc> _M_buckets;
|
||||
size_type _M_num_elements;
|
||||
|
||||
public:
|
||||
typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
|
||||
iterator;
|
||||
typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,
|
||||
_Alloc>
|
||||
const_iterator;
|
||||
|
||||
friend struct
|
||||
_Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
|
||||
friend struct
|
||||
_Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
|
||||
|
||||
public:
|
||||
hashtable(size_type __n,
|
||||
const _HashFcn& __hf,
|
||||
const _EqualKey& __eql,
|
||||
const _ExtractKey& __ext,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _M_node_allocator(__a),
|
||||
_M_hash(__hf),
|
||||
_M_equals(__eql),
|
||||
_M_get_key(__ext),
|
||||
_M_buckets(__a),
|
||||
_M_num_elements(0)
|
||||
{
|
||||
_M_initialize_buckets(__n);
|
||||
}
|
||||
|
||||
hashtable(size_type __n,
|
||||
const _HashFcn& __hf,
|
||||
const _EqualKey& __eql,
|
||||
const allocator_type& __a = allocator_type())
|
||||
: _M_node_allocator(__a),
|
||||
_M_hash(__hf),
|
||||
_M_equals(__eql),
|
||||
_M_get_key(_ExtractKey()),
|
||||
_M_buckets(__a),
|
||||
_M_num_elements(0)
|
||||
{
|
||||
_M_initialize_buckets(__n);
|
||||
}
|
||||
|
||||
hashtable(const hashtable& __ht)
|
||||
: _M_node_allocator(__ht.get_allocator()),
|
||||
_M_hash(__ht._M_hash),
|
||||
_M_equals(__ht._M_equals),
|
||||
_M_get_key(__ht._M_get_key),
|
||||
_M_buckets(__ht.get_allocator()),
|
||||
_M_num_elements(0)
|
||||
{
|
||||
_M_copy_from(__ht);
|
||||
}
|
||||
|
||||
hashtable& operator= (const hashtable& __ht)
|
||||
{
|
||||
if (&__ht != this) {
|
||||
clear();
|
||||
_M_hash = __ht._M_hash;
|
||||
_M_equals = __ht._M_equals;
|
||||
_M_get_key = __ht._M_get_key;
|
||||
_M_copy_from(__ht);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
~hashtable() { clear(); }
|
||||
|
||||
size_type size() const { return _M_num_elements; }
|
||||
size_type max_size() const { return size_type(-1); }
|
||||
bool empty() const { return size() == 0; }
|
||||
|
||||
void swap(hashtable& __ht)
|
||||
{
|
||||
std::swap(_M_hash, __ht._M_hash);
|
||||
std::swap(_M_equals, __ht._M_equals);
|
||||
std::swap(_M_get_key, __ht._M_get_key);
|
||||
_M_buckets.swap(__ht._M_buckets);
|
||||
std::swap(_M_num_elements, __ht._M_num_elements);
|
||||
}
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
|
||||
if (_M_buckets[__n])
|
||||
return iterator(_M_buckets[__n], this);
|
||||
return end();
|
||||
}
|
||||
|
||||
iterator end() { return iterator(0, this); }
|
||||
|
||||
const_iterator begin() const
|
||||
{
|
||||
for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
|
||||
if (_M_buckets[__n])
|
||||
return const_iterator(_M_buckets[__n], this);
|
||||
return end();
|
||||
}
|
||||
|
||||
const_iterator end() const { return const_iterator(0, this); }
|
||||
|
||||
template <class _Vl, class _Ky, class _HF, class _Ex, class _Eq, class _Al>
|
||||
friend bool operator== (const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
|
||||
const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
|
||||
public:
|
||||
|
||||
size_type bucket_count() const { return _M_buckets.size(); }
|
||||
|
||||
size_type max_bucket_count() const
|
||||
{ return __stl_prime_list[(int)__stl_num_primes - 1]; }
|
||||
|
||||
size_type elems_in_bucket(size_type __bucket) const
|
||||
{
|
||||
size_type __result = 0;
|
||||
for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
|
||||
__result += 1;
|
||||
return __result;
|
||||
}
|
||||
|
||||
pair<iterator, bool> insert_unique(const value_type& __obj)
|
||||
{
|
||||
resize(_M_num_elements + 1);
|
||||
return insert_unique_noresize(__obj);
|
||||
}
|
||||
|
||||
iterator insert_equal(const value_type& __obj)
|
||||
{
|
||||
resize(_M_num_elements + 1);
|
||||
return insert_equal_noresize(__obj);
|
||||
}
|
||||
|
||||
pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
|
||||
iterator insert_equal_noresize(const value_type& __obj);
|
||||
|
||||
template <class _InputIterator>
|
||||
void insert_unique(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
insert_unique(__f, __l, __iterator_category(__f));
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
void insert_equal(_InputIterator __f, _InputIterator __l)
|
||||
{
|
||||
insert_equal(__f, __l, __iterator_category(__f));
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
void insert_unique(_InputIterator __f, _InputIterator __l,
|
||||
input_iterator_tag)
|
||||
{
|
||||
for ( ; __f != __l; ++__f)
|
||||
insert_unique(*__f);
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
void insert_equal(_InputIterator __f, _InputIterator __l,
|
||||
input_iterator_tag)
|
||||
{
|
||||
for ( ; __f != __l; ++__f)
|
||||
insert_equal(*__f);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type __n = distance(__f, __l);
|
||||
resize(_M_num_elements + __n);
|
||||
for ( ; __n > 0; --__n, ++__f)
|
||||
insert_unique_noresize(*__f);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type __n = distance(__f, __l);
|
||||
resize(_M_num_elements + __n);
|
||||
for ( ; __n > 0; --__n, ++__f)
|
||||
insert_equal_noresize(*__f);
|
||||
}
|
||||
|
||||
reference find_or_insert(const value_type& __obj);
|
||||
|
||||
iterator find(const key_type& __key)
|
||||
{
|
||||
size_type __n = _M_bkt_num_key(__key);
|
||||
_Node* __first;
|
||||
for ( __first = _M_buckets[__n];
|
||||
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
|
||||
__first = __first->_M_next)
|
||||
{}
|
||||
return iterator(__first, this);
|
||||
}
|
||||
|
||||
const_iterator find(const key_type& __key) const
|
||||
{
|
||||
size_type __n = _M_bkt_num_key(__key);
|
||||
const _Node* __first;
|
||||
for ( __first = _M_buckets[__n];
|
||||
__first && !_M_equals(_M_get_key(__first->_M_val), __key);
|
||||
__first = __first->_M_next)
|
||||
{}
|
||||
return const_iterator(__first, this);
|
||||
}
|
||||
|
||||
size_type count(const key_type& __key) const
|
||||
{
|
||||
const size_type __n = _M_bkt_num_key(__key);
|
||||
size_type __result = 0;
|
||||
|
||||
for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next)
|
||||
if (_M_equals(_M_get_key(__cur->_M_val), __key))
|
||||
++__result;
|
||||
return __result;
|
||||
}
|
||||
|
||||
pair<iterator, iterator>
|
||||
equal_range(const key_type& __key);
|
||||
|
||||
pair<const_iterator, const_iterator>
|
||||
equal_range(const key_type& __key) const;
|
||||
|
||||
size_type erase(const key_type& __key);
|
||||
void erase(const iterator& __it);
|
||||
void erase(iterator __first, iterator __last);
|
||||
|
||||
void erase(const const_iterator& __it);
|
||||
void erase(const_iterator __first, const_iterator __last);
|
||||
|
||||
void resize(size_type __num_elements_hint);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
size_type _M_next_size(size_type __n) const
|
||||
{ return __stl_next_prime(__n); }
|
||||
|
||||
void _M_initialize_buckets(size_type __n)
|
||||
{
|
||||
const size_type __n_buckets = _M_next_size(__n);
|
||||
_M_buckets.reserve(__n_buckets);
|
||||
_M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
|
||||
_M_num_elements = 0;
|
||||
}
|
||||
|
||||
size_type _M_bkt_num_key(const key_type& __key) const
|
||||
{
|
||||
return _M_bkt_num_key(__key, _M_buckets.size());
|
||||
}
|
||||
|
||||
size_type _M_bkt_num(const value_type& __obj) const
|
||||
{
|
||||
return _M_bkt_num_key(_M_get_key(__obj));
|
||||
}
|
||||
|
||||
size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
|
||||
{
|
||||
return _M_hash(__key) % __n;
|
||||
}
|
||||
|
||||
size_type _M_bkt_num(const value_type& __obj, size_t __n) const
|
||||
{
|
||||
return _M_bkt_num_key(_M_get_key(__obj), __n);
|
||||
}
|
||||
|
||||
_Node* _M_new_node(const value_type& __obj)
|
||||
{
|
||||
_Node* __n = _M_get_node();
|
||||
__n->_M_next = 0;
|
||||
try {
|
||||
_Construct(&__n->_M_val, __obj);
|
||||
return __n;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
_M_put_node(__n);
|
||||
__throw_exception_again;
|
||||
}
|
||||
}
|
||||
|
||||
void _M_delete_node(_Node* __n)
|
||||
{
|
||||
_Destroy(&__n->_M_val);
|
||||
_M_put_node(__n);
|
||||
}
|
||||
|
||||
void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
|
||||
void _M_erase_bucket(const size_type __n, _Node* __last);
|
||||
|
||||
void _M_copy_from(const hashtable& __ht);
|
||||
|
||||
};
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
|
||||
class _All>
|
||||
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
|
||||
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
|
||||
{
|
||||
const _Node* __old = _M_cur;
|
||||
_M_cur = _M_cur->_M_next;
|
||||
if (!_M_cur) {
|
||||
size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
|
||||
while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
|
||||
_M_cur = _M_ht->_M_buckets[__bucket];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
|
||||
class _All>
|
||||
inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
|
||||
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
|
||||
{
|
||||
iterator __tmp = *this;
|
||||
++*this;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
|
||||
class _All>
|
||||
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
|
||||
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
|
||||
{
|
||||
const _Node* __old = _M_cur;
|
||||
_M_cur = _M_cur->_M_next;
|
||||
if (!_M_cur) {
|
||||
size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
|
||||
while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
|
||||
_M_cur = _M_ht->_M_buckets[__bucket];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
|
||||
class _All>
|
||||
inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
|
||||
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
|
||||
{
|
||||
const_iterator __tmp = *this;
|
||||
++*this;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
|
||||
const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2)
|
||||
{
|
||||
typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node;
|
||||
if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
|
||||
return false;
|
||||
for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n) {
|
||||
_Node* __cur1 = __ht1._M_buckets[__n];
|
||||
_Node* __cur2 = __ht2._M_buckets[__n];
|
||||
// Check same length of lists
|
||||
for ( ; __cur1 && __cur2;
|
||||
__cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
|
||||
{}
|
||||
if (__cur1 || __cur2)
|
||||
return false;
|
||||
// Now check one's elements are in the other
|
||||
for (__cur1 = __ht1._M_buckets[__n] ; __cur1; __cur1 = __cur1->_M_next)
|
||||
{
|
||||
bool _found__cur1 = false;
|
||||
for (_Node* __cur2 = __ht2._M_buckets[__n];
|
||||
__cur2; __cur2 = __cur2->_M_next)
|
||||
{
|
||||
if (__cur1->_M_val == __cur2->_M_val)
|
||||
{
|
||||
_found__cur1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!_found__cur1)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
|
||||
const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) {
|
||||
return !(__ht1 == __ht2);
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
|
||||
class _All>
|
||||
inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
|
||||
hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) {
|
||||
__ht1.swap(__ht2);
|
||||
}
|
||||
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::insert_unique_noresize(const value_type& __obj)
|
||||
{
|
||||
const size_type __n = _M_bkt_num(__obj);
|
||||
_Node* __first = _M_buckets[__n];
|
||||
|
||||
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
|
||||
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
|
||||
return pair<iterator, bool>(iterator(__cur, this), false);
|
||||
|
||||
_Node* __tmp = _M_new_node(__obj);
|
||||
__tmp->_M_next = __first;
|
||||
_M_buckets[__n] = __tmp;
|
||||
++_M_num_elements;
|
||||
return pair<iterator, bool>(iterator(__tmp, this), true);
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::insert_equal_noresize(const value_type& __obj)
|
||||
{
|
||||
const size_type __n = _M_bkt_num(__obj);
|
||||
_Node* __first = _M_buckets[__n];
|
||||
|
||||
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
|
||||
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) {
|
||||
_Node* __tmp = _M_new_node(__obj);
|
||||
__tmp->_M_next = __cur->_M_next;
|
||||
__cur->_M_next = __tmp;
|
||||
++_M_num_elements;
|
||||
return iterator(__tmp, this);
|
||||
}
|
||||
|
||||
_Node* __tmp = _M_new_node(__obj);
|
||||
__tmp->_M_next = __first;
|
||||
_M_buckets[__n] = __tmp;
|
||||
++_M_num_elements;
|
||||
return iterator(__tmp, this);
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
|
||||
{
|
||||
resize(_M_num_elements + 1);
|
||||
|
||||
size_type __n = _M_bkt_num(__obj);
|
||||
_Node* __first = _M_buckets[__n];
|
||||
|
||||
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
|
||||
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
|
||||
return __cur->_M_val;
|
||||
|
||||
_Node* __tmp = _M_new_node(__obj);
|
||||
__tmp->_M_next = __first;
|
||||
_M_buckets[__n] = __tmp;
|
||||
++_M_num_elements;
|
||||
return __tmp->_M_val;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
|
||||
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
|
||||
{
|
||||
typedef pair<iterator, iterator> _Pii;
|
||||
const size_type __n = _M_bkt_num_key(__key);
|
||||
|
||||
for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
|
||||
if (_M_equals(_M_get_key(__first->_M_val), __key)) {
|
||||
for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next)
|
||||
if (!_M_equals(_M_get_key(__cur->_M_val), __key))
|
||||
return _Pii(iterator(__first, this), iterator(__cur, this));
|
||||
for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
|
||||
if (_M_buckets[__m])
|
||||
return _Pii(iterator(__first, this),
|
||||
iterator(_M_buckets[__m], this));
|
||||
return _Pii(iterator(__first, this), end());
|
||||
}
|
||||
return _Pii(end(), end());
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
|
||||
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::equal_range(const key_type& __key) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> _Pii;
|
||||
const size_type __n = _M_bkt_num_key(__key);
|
||||
|
||||
for (const _Node* __first = _M_buckets[__n] ;
|
||||
__first;
|
||||
__first = __first->_M_next) {
|
||||
if (_M_equals(_M_get_key(__first->_M_val), __key)) {
|
||||
for (const _Node* __cur = __first->_M_next;
|
||||
__cur;
|
||||
__cur = __cur->_M_next)
|
||||
if (!_M_equals(_M_get_key(__cur->_M_val), __key))
|
||||
return _Pii(const_iterator(__first, this),
|
||||
const_iterator(__cur, this));
|
||||
for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
|
||||
if (_M_buckets[__m])
|
||||
return _Pii(const_iterator(__first, this),
|
||||
const_iterator(_M_buckets[__m], this));
|
||||
return _Pii(const_iterator(__first, this), end());
|
||||
}
|
||||
}
|
||||
return _Pii(end(), end());
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key)
|
||||
{
|
||||
const size_type __n = _M_bkt_num_key(__key);
|
||||
_Node* __first = _M_buckets[__n];
|
||||
size_type __erased = 0;
|
||||
|
||||
if (__first) {
|
||||
_Node* __cur = __first;
|
||||
_Node* __next = __cur->_M_next;
|
||||
while (__next) {
|
||||
if (_M_equals(_M_get_key(__next->_M_val), __key)) {
|
||||
__cur->_M_next = __next->_M_next;
|
||||
_M_delete_node(__next);
|
||||
__next = __cur->_M_next;
|
||||
++__erased;
|
||||
--_M_num_elements;
|
||||
}
|
||||
else {
|
||||
__cur = __next;
|
||||
__next = __cur->_M_next;
|
||||
}
|
||||
}
|
||||
if (_M_equals(_M_get_key(__first->_M_val), __key)) {
|
||||
_M_buckets[__n] = __first->_M_next;
|
||||
_M_delete_node(__first);
|
||||
++__erased;
|
||||
--_M_num_elements;
|
||||
}
|
||||
}
|
||||
return __erased;
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it)
|
||||
{
|
||||
_Node* __p = __it._M_cur;
|
||||
if (__p) {
|
||||
const size_type __n = _M_bkt_num(__p->_M_val);
|
||||
_Node* __cur = _M_buckets[__n];
|
||||
|
||||
if (__cur == __p) {
|
||||
_M_buckets[__n] = __cur->_M_next;
|
||||
_M_delete_node(__cur);
|
||||
--_M_num_elements;
|
||||
}
|
||||
else {
|
||||
_Node* __next = __cur->_M_next;
|
||||
while (__next) {
|
||||
if (__next == __p) {
|
||||
__cur->_M_next = __next->_M_next;
|
||||
_M_delete_node(__next);
|
||||
--_M_num_elements;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
__cur = __next;
|
||||
__next = __cur->_M_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::erase(iterator __first, iterator __last)
|
||||
{
|
||||
size_type __f_bucket = __first._M_cur ?
|
||||
_M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size();
|
||||
size_type __l_bucket = __last._M_cur ?
|
||||
_M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size();
|
||||
|
||||
if (__first._M_cur == __last._M_cur)
|
||||
return;
|
||||
else if (__f_bucket == __l_bucket)
|
||||
_M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
|
||||
else {
|
||||
_M_erase_bucket(__f_bucket, __first._M_cur, 0);
|
||||
for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
|
||||
_M_erase_bucket(__n, 0);
|
||||
if (__l_bucket != _M_buckets.size())
|
||||
_M_erase_bucket(__l_bucket, __last._M_cur);
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
inline void
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first,
|
||||
const_iterator __last)
|
||||
{
|
||||
erase(iterator(const_cast<_Node*>(__first._M_cur),
|
||||
const_cast<hashtable*>(__first._M_ht)),
|
||||
iterator(const_cast<_Node*>(__last._M_cur),
|
||||
const_cast<hashtable*>(__last._M_ht)));
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
inline void
|
||||
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it)
|
||||
{
|
||||
erase(iterator(const_cast<_Node*>(__it._M_cur),
|
||||
const_cast<hashtable*>(__it._M_ht)));
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::resize(size_type __num_elements_hint)
|
||||
{
|
||||
const size_type __old_n = _M_buckets.size();
|
||||
if (__num_elements_hint > __old_n) {
|
||||
const size_type __n = _M_next_size(__num_elements_hint);
|
||||
if (__n > __old_n) {
|
||||
vector<_Node*, _All> __tmp(__n, (_Node*)(0),
|
||||
_M_buckets.get_allocator());
|
||||
try {
|
||||
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
|
||||
_Node* __first = _M_buckets[__bucket];
|
||||
while (__first) {
|
||||
size_type __new_bucket = _M_bkt_num(__first->_M_val, __n);
|
||||
_M_buckets[__bucket] = __first->_M_next;
|
||||
__first->_M_next = __tmp[__new_bucket];
|
||||
__tmp[__new_bucket] = __first;
|
||||
__first = _M_buckets[__bucket];
|
||||
}
|
||||
}
|
||||
_M_buckets.swap(__tmp);
|
||||
}
|
||||
catch(...) {
|
||||
for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) {
|
||||
while (__tmp[__bucket]) {
|
||||
_Node* __next = __tmp[__bucket]->_M_next;
|
||||
_M_delete_node(__tmp[__bucket]);
|
||||
__tmp[__bucket] = __next;
|
||||
}
|
||||
}
|
||||
__throw_exception_again;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
|
||||
{
|
||||
_Node* __cur = _M_buckets[__n];
|
||||
if (__cur == __first)
|
||||
_M_erase_bucket(__n, __last);
|
||||
else {
|
||||
_Node* __next;
|
||||
for (__next = __cur->_M_next;
|
||||
__next != __first;
|
||||
__cur = __next, __next = __cur->_M_next)
|
||||
;
|
||||
while (__next != __last) {
|
||||
__cur->_M_next = __next->_M_next;
|
||||
_M_delete_node(__next);
|
||||
__next = __cur->_M_next;
|
||||
--_M_num_elements;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::_M_erase_bucket(const size_type __n, _Node* __last)
|
||||
{
|
||||
_Node* __cur = _M_buckets[__n];
|
||||
while (__cur != __last) {
|
||||
_Node* __next = __cur->_M_next;
|
||||
_M_delete_node(__cur);
|
||||
__cur = __next;
|
||||
_M_buckets[__n] = __cur;
|
||||
--_M_num_elements;
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear()
|
||||
{
|
||||
for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
|
||||
_Node* __cur = _M_buckets[__i];
|
||||
while (__cur != 0) {
|
||||
_Node* __next = __cur->_M_next;
|
||||
_M_delete_node(__cur);
|
||||
__cur = __next;
|
||||
}
|
||||
_M_buckets[__i] = 0;
|
||||
}
|
||||
_M_num_elements = 0;
|
||||
}
|
||||
|
||||
|
||||
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
|
||||
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
|
||||
::_M_copy_from(const hashtable& __ht)
|
||||
{
|
||||
_M_buckets.clear();
|
||||
_M_buckets.reserve(__ht._M_buckets.size());
|
||||
_M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
|
||||
try {
|
||||
for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
|
||||
const _Node* __cur = __ht._M_buckets[__i];
|
||||
if (__cur) {
|
||||
_Node* __local_copy = _M_new_node(__cur->_M_val);
|
||||
_M_buckets[__i] = __local_copy;
|
||||
|
||||
for (_Node* __next = __cur->_M_next;
|
||||
__next;
|
||||
__cur = __next, __next = __cur->_M_next) {
|
||||
__local_copy->_M_next = _M_new_node(__next->_M_val);
|
||||
__local_copy = __local_copy->_M_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
_M_num_elements = __ht._M_num_elements;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
clear();
|
||||
__throw_exception_again;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace __gnu_cxx
|
||||
|
||||
#endif /* __SGI_STL_INTERNAL_HASHTABLE_H */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
/* Return quiet nan. */
|
||||
|
||||
/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU ISO C++ Library. This library 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.
|
||||
|
||||
This library 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 this library; see the file COPYING. If not, write to the Free
|
||||
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
USA.
|
||||
|
||||
As a special exception, you may use this file as part of a free software
|
||||
library without restriction. Specifically, if other files instantiate
|
||||
templates or use macros or inline functions from this file, or you compile
|
||||
this file and link it with other files to produce an executable, this
|
||||
file does not by itself cause the resulting executable to be covered by
|
||||
the GNU General Public License. This exception does not however
|
||||
invalidate any other reasons why the executable file might be covered by
|
||||
the GNU General Public License. */
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
double
|
||||
nan ()
|
||||
{ return strtod ("nan", NULL); }
|
@ -1,448 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Script to do automated testing and data collection for various test
|
||||
# files, so that we don't have to do this by hand on every test file.
|
||||
# It attempts to collect some diagnostic info about size and speed that
|
||||
# should be useful in the future as the library gets tuned for size
|
||||
# and speed. In addition, it tests static and shared linkage, iff each
|
||||
# has been enabled.
|
||||
|
||||
# Invocation
|
||||
# mkcheck [01]
|
||||
|
||||
# 1: variables
|
||||
#
|
||||
# WHICH determines if you are
|
||||
# (0) testing the build binary and headers, or
|
||||
# (1) testing the installed binary and headers, or
|
||||
WHICH=$1
|
||||
if [ "$WHICH"x = 0x ]; then
|
||||
echo "running mkcheck"
|
||||
echo "$0: testing the build directory"
|
||||
elif [ "$WHICH"x = 1x ]; then
|
||||
echo "running mkcheck"
|
||||
echo "$0: testing the install directory"
|
||||
else
|
||||
echo 'Usage: mkcheck 0 /* test the build directory */'
|
||||
echo ' mkcheck 1 /* test the install directory */'
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# Now that we've successfully translated the numerical option into
|
||||
# a symbolic one, we can safely ignore it.
|
||||
shift
|
||||
|
||||
# This has been true all along. Found out about it the hard way...
|
||||
case $BASH_VERSION in
|
||||
1*) echo 'You need bash 2.x to run mkcheck. Exiting.'; exit 1 ;;
|
||||
*) ;; # ??
|
||||
esac
|
||||
|
||||
BUILD_DIR=@glibcpp_builddir@
|
||||
SRC_DIR=@glibcpp_srcdir@
|
||||
PREFIX_DIR=@glibcpp_prefixdir@
|
||||
if [ "$WHICH"x = 0x ]; then
|
||||
CXX=`$BUILD_DIR/testsuite_flags --build-cxx`
|
||||
INCLUDES=`$BUILD_DIR/testsuite_flags --build-includes`
|
||||
else
|
||||
CXX=`$BUILD_DIR/testsuite_flags --install-cxx`
|
||||
INCLUDES=`$BUILD_DIR/testsuite_flags --install-includes`
|
||||
fi
|
||||
CXXFLAGS=`$BUILD_DIR/testsuite_flags --cxxflags`
|
||||
LIBTOOL="$BUILD_DIR/libtool"
|
||||
LTEXE="$LIBTOOL --mode=execute"
|
||||
#LTCXX="$LIBTOOL --tag=CXX --mode=link $CXX $CXXFLAGS $INCLUDES"
|
||||
LTCXX="$CXX $CXXFLAGS $INCLUDES"
|
||||
|
||||
# specific libtool flag(s) to use shared libraries, if any
|
||||
SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc -Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
|
||||
|
||||
# specific libtool flag(s) to use static libraries, if any
|
||||
ST_FLAG="-static"
|
||||
#ST_FLAG="-all-static"
|
||||
|
||||
# Set up the testing directory, which should be in a directory called
|
||||
# "testsuite" in the root level of the build directory.
|
||||
TEST_DIR="$BUILD_DIR/testsuite"
|
||||
# help libtool keep quiet
|
||||
if [ ! -d ${TEST_DIR}/.libs ]; then
|
||||
mkdir $TEST_DIR/.libs
|
||||
fi
|
||||
|
||||
# the name of the file that will collect and hold all this useful data:
|
||||
RESULTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheck.txt"
|
||||
|
||||
# the name of the log file that will append compiler diagnostics:
|
||||
LOG_FILE="$TEST_DIR/$(date +%Y%m%d)-mkchecklog.txt"
|
||||
|
||||
# the names of the specific test files to be run
|
||||
TESTS_FILE="$TEST_DIR/$(date +%Y%m%d)-mkcheckfiles.txt"
|
||||
|
||||
|
||||
#
|
||||
# 2: clean, make files, append general test info
|
||||
#
|
||||
|
||||
# Remove old executables.
|
||||
rm -rf "$TEST_DIR"/*exe
|
||||
rm -rf "$TEST_DIR"/compile.out
|
||||
|
||||
# Remove old core files (which now get left in cwd, not $TEST_DIR).
|
||||
rm -rf ./*core*
|
||||
|
||||
if [ -f $RESULTS_FILE ]; then
|
||||
rm $RESULTS_FILE
|
||||
fi
|
||||
if [ -f $LOG_FILE ]; then
|
||||
rm $LOG_FILE
|
||||
fi
|
||||
|
||||
# Make a list of the files we're going to run, or use an old one if it exists.
|
||||
if [ ! -f "$TESTS_FILE" ]; then
|
||||
echo "making file $TESTS_FILE"
|
||||
for LONG_NAME in $SRC_DIR/testsuite/*/*.cc
|
||||
do
|
||||
DIR_NAME=$(dirname $LONG_NAME)
|
||||
SHORT_NAME="`basename $DIR_NAME`/`basename $LONG_NAME`"
|
||||
echo "$SHORT_NAME" >> $TESTS_FILE
|
||||
done
|
||||
fi
|
||||
|
||||
# Nasty solution to replace GNU date(1)'s %s time_t output function.
|
||||
TIMER_COMMAND=$TEST_DIR/printnow.exe
|
||||
if [ ! -x "$TIMER_COMMAND" ]; then
|
||||
echo "making utility $TIMER_COMMAND"
|
||||
gcc -o "$TIMER_COMMAND" "$SRC_DIR/testsuite/printnow.c"
|
||||
strip "$TIMER_COMMAND"
|
||||
fi
|
||||
|
||||
# Copy over the data files for filebufs
|
||||
cp $SRC_DIR/testsuite/27_io/*.txt $TEST_DIR
|
||||
cp $SRC_DIR/testsuite/27_io/*.tst $TEST_DIR
|
||||
chmod u+w $TEST_DIR/*.txt
|
||||
chmod u+w $TEST_DIR/*.tst
|
||||
|
||||
# Emit useful info about compiler and platform
|
||||
echo "host: $(uname -mrsv)" >> $RESULTS_FILE
|
||||
echo "compiler: $($CXX -v 2>&1)" >> $RESULTS_FILE
|
||||
echo "compiler flags: $CXXFLAGS" >> $RESULTS_FILE
|
||||
echo "date: $(date +%Y%m%d)" >> $RESULTS_FILE
|
||||
echo "" >> $RESULTS_FILE
|
||||
|
||||
explanation='+: pass, -b: build failure, -r: run failure, x: disabled'
|
||||
printf "%s\n %s\n" 'p == pass/fail execution test' "$explanation" \
|
||||
>> $RESULTS_FILE
|
||||
echo "ctime == time to compile and link" >> $RESULTS_FILE
|
||||
echo "etime == time for executable to run" >> $RESULTS_FILE
|
||||
echo "text == size of the executable text section" >> $RESULTS_FILE
|
||||
echo "data == size of the executable data section" >> $RESULTS_FILE
|
||||
echo "total == size of the executable" >> $RESULTS_FILE
|
||||
echo "" >> $RESULTS_FILE
|
||||
|
||||
echo "p" | awk '{printf("%s ", $1)}' >> $RESULTS_FILE
|
||||
echo "ctime" "etime" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
|
||||
echo "text" "data" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
|
||||
echo "total" "name" | awk '{printf("%s\t%s\t", $1, $2)}' >> $RESULTS_FILE
|
||||
echo "" >> $RESULTS_FILE
|
||||
|
||||
# Counters. These could be members of an array, but they'd all have to
|
||||
# become individuals anyhow if we ever change this script to super-portable sh.
|
||||
shared_pass=0
|
||||
shared_fail=0
|
||||
static_pass=0
|
||||
static_fail=0
|
||||
|
||||
|
||||
#
|
||||
# 2.5: support functions
|
||||
#
|
||||
|
||||
# Figure out how to extract size information from binaries. We take
|
||||
# the text of the value we want as an argument, and leave the size in
|
||||
# the appropriate variable.
|
||||
#
|
||||
# We discover what kind of size(1) we are using *once* and build a shell
|
||||
# function named 'size_command' to wrap it. (The "function" keyword is
|
||||
# redundant here, but helps me read it, so there.) Previously we were
|
||||
# re-discovering the size(1) arguments three times for each test; sloooow.
|
||||
#
|
||||
# It is VERY IMPORTANT not to compare these numbers across platforms.
|
||||
# Different size(1)'s extract section information differently. For
|
||||
# example, using the native Sun size(1) and GNU size(1) built for Suns
|
||||
# on the exact same binary will give very different numbers, due to all
|
||||
# the variance in command-line options and arbitrary names of ELF sections.
|
||||
#
|
||||
# and suddenly we go to 2-space indentations...
|
||||
setup_size_command()
|
||||
{
|
||||
if size --version 2> /dev/null | grep -c GNU > /dev/null;
|
||||
then # Then we're using a GNU size(1) built for this platform.
|
||||
# We lose .rodata and .data1 and who knows what else... kludge.
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=$(size -B $EXENAME | tail -1 | awk '{print $1}') ;;
|
||||
DATA) DATA=$(size -B $EXENAME | tail -1 | awk '{print $2}') ;;
|
||||
SIZE) SIZE=$(size -B $EXENAME | tail -1 | awk '{print $4}') ;;
|
||||
esac
|
||||
}
|
||||
else
|
||||
# Not using GNU size; check for platform. These numbers seem to match
|
||||
# up to text/data/total, although their meanings seem to be different.
|
||||
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
|
||||
case @host_os@ in
|
||||
*aix*)
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=$(size -X32_64 $EXENAME | awk '{print $2}') ;;
|
||||
DATA) DATA=$(size -X32_64 $EXENAME | awk '{print $4}') ;;
|
||||
SIZE) SIZE=$(size -X32_64 $EXENAME | awk '{print $12}') ;;
|
||||
esac
|
||||
}
|
||||
;;
|
||||
*hpux*)
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;;
|
||||
DATA) DATA=$(size $EXENAME | awk '{print $3}') ;;
|
||||
SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;;
|
||||
esac
|
||||
}
|
||||
;;
|
||||
*irix*)
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=$(size -4 $EXENAME | awk '{print $1}') ;;
|
||||
DATA) DATA=$(size -4 $EXENAME | awk '{print $3}') ;;
|
||||
SIZE) SIZE=$(size -4 $EXENAME | awk '{print $7}') ;;
|
||||
esac
|
||||
}
|
||||
;;
|
||||
*solaris*)
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=$(size $EXENAME | awk '{print $1}') ;;
|
||||
DATA) DATA=$(size $EXENAME | awk '{print $3}') ;;
|
||||
SIZE) SIZE=$(size $EXENAME | awk '{print $7}') ;;
|
||||
esac
|
||||
}
|
||||
;;
|
||||
*)
|
||||
echo ' * Warning! Skipping section sizes!' 1>&2
|
||||
function size_command()
|
||||
{
|
||||
case $1 in
|
||||
TEXT) TEXT=0 ;;
|
||||
DATA) DATA=0 ;;
|
||||
SIZE) SIZE=0 ;;
|
||||
esac
|
||||
}
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# Test for file output
|
||||
test_for_output()
|
||||
{
|
||||
# This checks for emitted output files, which is useful when
|
||||
# testing file-related output. The rules for this working are as
|
||||
# follows: the emitted file must have the ".txt" extension, and be
|
||||
# based on the actual *.cc file's name. For example, 27/filbuf.cc
|
||||
# currently outputs files named 27/filebuf-2.txt and 27/filebuf-3.txt.
|
||||
# Also, the first emitted file must be in the form $NAME-1.txt.
|
||||
# The control file must follow the same constraints, but have a
|
||||
# ".tst" extension. Thus, you have 27/filebuf-2.tst, etc.
|
||||
|
||||
# NAME contains the source name, like 27/filebuf.cc
|
||||
# From that NAME, we want to generate some possible names, using
|
||||
# ls on MATCH, a pattern description generated with sed.
|
||||
|
||||
# this is the name of the resulting diff file, if any
|
||||
DIFF_FILE="`echo $TEST_NAME | sed 's/cc$/diff/'`"
|
||||
# construct wildcard names, ie for $NAME=filebuf.cc, makes "filebuf*.tst"
|
||||
DATA_FILES="`echo $TEST_NAME | sed 's/\.cc/\*\.tst/g'`"
|
||||
# make sure there is at least one, then go
|
||||
ST_E="`echo $TEST_NAME | sed 's/\.cc/\-1\.tst/g'`"
|
||||
if [ -f $ST_E ]; then
|
||||
# list of actual files that match the wildcard above, ie
|
||||
# "filebuf-1.tst"
|
||||
ST_MATCH_LIST="`ls $DATA_FILES`"
|
||||
for i in $ST_MATCH_LIST; do
|
||||
# ST_OUT_FILE is generated in the build directory.
|
||||
PRE_NAME2="$TEST_DIR/`basename $i`"
|
||||
ST_OUT_FILE="`echo $PRE_NAME2 | sed 's/tst$/txt/'`"
|
||||
diff $ST_OUT_FILE $i > $DIFF_FILE
|
||||
if [ -s $DIFF_FILE ]; then
|
||||
RESULT="-r"
|
||||
else
|
||||
RESULT="+"
|
||||
fi
|
||||
rm $DIFF_FILE
|
||||
done
|
||||
else
|
||||
# the file does no output, and didn't abnormally
|
||||
# terminate, so assume passed.
|
||||
RESULT="+"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# 3: compile, link, execute, time
|
||||
#
|
||||
# Abstract out the common code for compiling, linking, executing and printing.
|
||||
test_file()
|
||||
{
|
||||
# NB: S_FLAG has to be last argument because it may be null, and
|
||||
# error checking hasn't been invented yet.
|
||||
NAME=$1
|
||||
EXENAME=$2
|
||||
S_FLAG=$3
|
||||
|
||||
SRC_NAME="$SRC_DIR/testsuite/$1"
|
||||
TEST_NAME="$TEST_DIR/`basename $NAME`"
|
||||
|
||||
# This would be deliciously easy if GNU date's %s were always around.
|
||||
# There are three ways to do this: 1) use the builtin 'time' like we
|
||||
# do later; then getting compiler errors into LOG_FILE is a nightmare.
|
||||
# 2) Grab the output of a formatted date(1) and do the math; harder
|
||||
# and harder as we try compiling at, say, top of the hour; we would
|
||||
# eventually have to calculate time_t anyhow. Or 3) just grab two
|
||||
# time_t's (no more overhead than grabbing two date(1)'s).
|
||||
our_libs="-L$TEST_DIR -lv3test"
|
||||
compiler_invocation="$LTCXX $S_FLAG $SRC_NAME -o $EXENAME $our_libs"
|
||||
echo $compiler_invocation >> compile.out 2>&1
|
||||
COMP_TIME_START=$($TIMER_COMMAND)
|
||||
$compiler_invocation >> compile.out 2>&1
|
||||
COMP_TIME_END=$($TIMER_COMMAND)
|
||||
|
||||
if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then
|
||||
C_TIME=$[ $COMP_TIME_END - $COMP_TIME_START ]
|
||||
else
|
||||
C_TIME="0"
|
||||
fi
|
||||
|
||||
if [ -f $EXENAME ]; then
|
||||
# rm compile.out
|
||||
size_command TEXT
|
||||
size_command DATA
|
||||
size_command SIZE
|
||||
|
||||
# Actually run the executable and time it. Note that output
|
||||
# printed by the executable will be lost and cannot be redirected,
|
||||
# because we need to capture the output of 'time'. Bummer.
|
||||
TIMEFORMAT='timemark %R'
|
||||
E_TIME_TEXT="$(exec 2>&1; time $LTEXE $EXENAME)"
|
||||
E_ABNORMAL_TERMINATION=$?
|
||||
|
||||
if [ "$E_ABNORMAL_TERMINATION" -ne 0 ]; then
|
||||
RESULT='-r'
|
||||
E_TIME="0"
|
||||
rm -f ./*core
|
||||
# sometimes you want to save all core files for review:
|
||||
#mv ./core $EXENAME.core
|
||||
# sometimes the OS allows you to name core files yourself:
|
||||
#mv ./*core $EXENAME.core
|
||||
#mv ./core* $EXENAME.core
|
||||
else
|
||||
test_for_output
|
||||
# XXX This doesn't always result in a number.
|
||||
# E_TIME="$(echo $E_TIME_TEXT | awk '{print $2}')"
|
||||
E_TIME="0"
|
||||
fi
|
||||
|
||||
# sometimes you want to save all failing exe files for review:
|
||||
if [ "$RESULT" = '+' ]; then
|
||||
rm "$EXENAME"
|
||||
fi
|
||||
else
|
||||
# the file did not compile/link.
|
||||
printf "\n" >> $LOG_FILE
|
||||
`cat compile.out >> $LOG_FILE`
|
||||
rm compile.out
|
||||
RESULT="-b"
|
||||
TEXT="0"
|
||||
DATA="0"
|
||||
SIZE="0"
|
||||
fi
|
||||
|
||||
# update the counters
|
||||
if test "$RESULT" = "+" ; then
|
||||
if test x"$S_FLAG" = x"$ST_FLAG"; then
|
||||
static_pass=`expr $static_pass + 1`
|
||||
else
|
||||
shared_pass=`expr $shared_pass + 1`
|
||||
fi
|
||||
else
|
||||
if test x"$S_FLAG" = x"$ST_FLAG"; then
|
||||
static_fail=`expr $static_fail + 1`
|
||||
else
|
||||
shared_fail=`expr $shared_fail + 1`
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "%s\t" "$RESULT"
|
||||
printf "%-2s %d\t%.3f\t%s\t%s\t%s\t%s %s\n" \
|
||||
"$RESULT" $C_TIME $E_TIME $TEXT $DATA $SIZE $NAME >> $RESULTS_FILE
|
||||
}
|
||||
|
||||
setup_size_command
|
||||
echo ""
|
||||
echo "Detailed test results in .${RESULTS_FILE/$BUILD_DIR}"
|
||||
echo $explanation
|
||||
echo "------------------------------------------------------------------------"
|
||||
printf "static\tshared\ttest\n"
|
||||
echo "------------------------------------------------------------------------"
|
||||
|
||||
TEST_TIME_START=$($TIMER_COMMAND)
|
||||
for NAME in `cat $TESTS_FILE`
|
||||
do
|
||||
PRE_NAME="$TEST_DIR/`basename $NAME`"
|
||||
ST_NAME="`echo $PRE_NAME | sed 's/cc$/st-exe/'`"
|
||||
SH_NAME="`echo $PRE_NAME | sed 's/cc$/sh-exe/'`"
|
||||
|
||||
if test @enable_static@ = yes; then
|
||||
test_file $NAME $ST_NAME "$ST_FLAG"
|
||||
else
|
||||
printf "x\t"
|
||||
printf "static skipped\n" >> $RESULTS_FILE
|
||||
fi
|
||||
if test @enable_shared@ = yes; then
|
||||
test_file $NAME $SH_NAME "$SH_FLAG"
|
||||
else
|
||||
printf "x\t"
|
||||
printf "shared skipped\n" >> $RESULTS_FILE
|
||||
fi
|
||||
printf "%s\n" "$NAME"
|
||||
|
||||
echo "" >> $RESULTS_FILE
|
||||
done
|
||||
TEST_TIME_END=$($TIMER_COMMAND)
|
||||
|
||||
|
||||
#
|
||||
# 4: summary
|
||||
#
|
||||
# grep can count faster than we can...
|
||||
total_failures=`expr ${shared_fail} + ${static_fail}`
|
||||
total_successes=`expr ${shared_pass} + ${static_pass}`
|
||||
resultstext="pass/fail results: ${static_pass}/${static_fail} static + ${shared_pass}/${shared_fail} shared = ${total_successes}/${total_failures} total"
|
||||
if [ $total_failures -eq 0 ]; then
|
||||
resultstext="${resultstext}, WIN WIN"
|
||||
fi
|
||||
sed -e "/^date:/a\\
|
||||
$resultstext" $RESULTS_FILE > ${RESULTS_FILE}.tmp
|
||||
mv ${RESULTS_FILE}.tmp $RESULTS_FILE
|
||||
|
||||
if [ $TEST_TIME_START -lt $TEST_TIME_END ]; then
|
||||
TEST_TIME=$[ $TEST_TIME_END - $TEST_TIME_START ]
|
||||
echo "testrun == $TEST_TIME seconds"
|
||||
echo "testrun == $TEST_TIME seconds" >> $RESULTS_FILE
|
||||
fi
|
||||
|
||||
exit 0
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user