From d711cf67a62351e4722d7b16b1be84899b6b1d82 Mon Sep 17 00:00:00 2001 From: John David Anglin Date: Wed, 25 Aug 2004 17:49:58 +0000 Subject: [PATCH] PR libstdc++/17005 (fix for HP-UX 11.11) PR libstdc++/17005 (fix for HP-UX 11.11) * config.gcc (hppa*-*-*): Move MASK_BIG_SWITCH to target_cpu_default2. (hppa*-*-hpux*): Consolidate hppa1.0-*-* code. Rework handling of tm_file including pa-hpux1010.h or pa-hpux1111.h when appropriate. * config/pa/pa-hpux1010.h, config/pa/pa-hpux1111.h: New files. * config/pa/pa-hpux.h (TARGET_HPUX): Define. (LINK_SPEC): Handle march=1.0 option. * config/pa/pa-hpux10.h (TARGET_OS_CPP_BUILTINS): Predefine _XOPEN_UNIX and _XOPEN_SOURCE_EXTENDED for UNIX 95. (SUBTARGET_OPTIONS): New define. (LINK_SPEC): Handle march=1.0 option. (STARTFILE_SPEC): New define. * config/pa/pa-hpux11.h (TARGET_OS_CPP_BUILTINS): Predefine _XOPEN_UNIX and _XOPEN_SOURCE_EXTENDED for UNIX 95. Additionally, predefine _INCLUDE__STDC_A1_SOURCE and _INCLUDE_XOPEN_SOURCE_500 for UNIX 98. (SUBTARGET_OPTIONS): New define. (LINK_SPEC): Handle march=1.0 option. (STARTFILE_SPEC): New define. * config/pa/pa.c (override_options): Add code to process -munix= option. * config/pa/pa.h (pa_unix_string, flag_pa_unix): Declare. (TARGET_HPUX, TARGET_HPUX_10_10, TARGET_HPUX_11_11): Provide default defines. (TARGET_OPTIONS): Add SUBTARGET_OPTIONS to option list. (SUBTARGET_OPTIONS): Provide default define. * config/pa/pa64-hpux.h (STANDARD_STARTFILE_PREFIX_1, STANDARD_STARTFILE_PREFIX_2): New defines. (STARTFILE_SPEC): Provide unix95.o or unix98.o startfiles as necessary. (ENDFILE_SPEC): Use %O. * doc/install.texi (hppa*-*-hpux*): Reword paragraph on -g and gas. Mention issue caused by changing namespace and runtime to UNIX 95/98. * doc/invoke.texi (HPPA options): Move misplaced text to FRV options. Document -munix=std option. From-SVN: r86561 --- gcc/ChangeLog | 35 +++++++++ gcc/config.gcc | 96 +++++++++++++------------ gcc/config/pa/pa-hpux.h | 6 +- gcc/config/pa/pa-hpux10.h | 99 ++++++++++++++------------ gcc/config/pa/pa-hpux1010.h | 34 +++++++++ gcc/config/pa/pa-hpux11.h | 138 ++++++++++++++++++++---------------- gcc/config/pa/pa-hpux1111.h | 34 +++++++++ gcc/config/pa/pa.c | 36 ++++++++++ gcc/config/pa/pa.h | 30 +++++++- gcc/config/pa/pa64-hpux.h | 22 +++++- gcc/doc/install.texi | 16 ++++- gcc/doc/invoke.texi | 126 ++++++++++++++++++-------------- 12 files changed, 458 insertions(+), 214 deletions(-) create mode 100644 gcc/config/pa/pa-hpux1010.h create mode 100644 gcc/config/pa/pa-hpux1111.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b61c3f9a12d8..1bff6fd98e7f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,38 @@ +2004-08-25 John David Anglin + + PR libstdc++/17005 (fix for HP-UX 11.11) + * config.gcc (hppa*-*-*): Move MASK_BIG_SWITCH to target_cpu_default2. + (hppa*-*-hpux*): Consolidate hppa1.0-*-* code. Rework handling of + tm_file including pa-hpux1010.h or pa-hpux1111.h when appropriate. + * config/pa/pa-hpux1010.h, config/pa/pa-hpux1111.h: New files. + * config/pa/pa-hpux.h (TARGET_HPUX): Define. + (LINK_SPEC): Handle march=1.0 option. + * config/pa/pa-hpux10.h (TARGET_OS_CPP_BUILTINS): Predefine _XOPEN_UNIX + and _XOPEN_SOURCE_EXTENDED for UNIX 95. + (SUBTARGET_OPTIONS): New define. + (LINK_SPEC): Handle march=1.0 option. + (STARTFILE_SPEC): New define. + * config/pa/pa-hpux11.h (TARGET_OS_CPP_BUILTINS): Predefine _XOPEN_UNIX + and _XOPEN_SOURCE_EXTENDED for UNIX 95. Additionally, predefine + _INCLUDE__STDC_A1_SOURCE and _INCLUDE_XOPEN_SOURCE_500 for UNIX 98. + (SUBTARGET_OPTIONS): New define. + (LINK_SPEC): Handle march=1.0 option. + (STARTFILE_SPEC): New define. + * config/pa/pa.c (override_options): Add code to process -munix= option. + * config/pa/pa.h (pa_unix_string, flag_pa_unix): Declare. + (TARGET_HPUX, TARGET_HPUX_10_10, TARGET_HPUX_11_11): Provide default + defines. + (TARGET_OPTIONS): Add SUBTARGET_OPTIONS to option list. + (SUBTARGET_OPTIONS): Provide default define. + * config/pa/pa64-hpux.h (STANDARD_STARTFILE_PREFIX_1, + STANDARD_STARTFILE_PREFIX_2): New defines. + (STARTFILE_SPEC): Provide unix95.o or unix98.o startfiles as necessary. + (ENDFILE_SPEC): Use %O. + * doc/install.texi (hppa*-*-hpux*): Reword paragraph on -g and gas. + Mention issue caused by changing namespace and runtime to UNIX 95/98. + * doc/invoke.texi (HPPA options): Move misplaced text to FRV options. + Document -munix=std option. + 2004-08-25 Steven Bosscher * cse.c (cse_around_loop, cse_check_loop_start, diff --git a/gcc/config.gcc b/gcc/config.gcc index ecb619b91348..6d9abd464c70 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -749,7 +749,7 @@ h8300-*-*) use_fixproto=yes ;; hppa*64*-*-linux* | parisc*64*-*-linux*) - target_cpu_default="(MASK_PA_11 | MASK_PA_20 | MASK_BIG_SWITCH)" + target_cpu_default="MASK_PA_11|MASK_PA_20" tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h svr4.h linux.h \ pa/pa-linux.h pa/pa64-regs.h pa/pa-64.h pa/pa64-linux.h" tmake_file="${tmake_file} pa/t-linux64" @@ -757,7 +757,7 @@ hppa*64*-*-linux* | parisc*64*-*-linux*) need_64bit_hwint=yes ;; hppa*-*-linux* | parisc*-*-linux*) - target_cpu_default="(MASK_PA_11 | MASK_NO_SPACE_REGS | MASK_BIG_SWITCH)" + target_cpu_default="MASK_PA_11|MASK_NO_SPACE_REGS" tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h pa/pa-linux.h \ pa/pa32-regs.h pa/pa32-linux.h" tmake_file="${tmake_file} pa/t-linux" @@ -769,49 +769,45 @@ hppa*-*-linux* | parisc*-*-linux*) ;; # port not yet contributed. #hppa*-*-openbsd*) -# target_cpu_default="(MASK_PA_11 | MASK_BIG_SWITCH)" +# target_cpu_default="MASK_PA_11" # ;; hppa1.1-*-pro*) - target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT | MASK_BIG_SWITCH)" - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h pa/pa-pro-end.h libgloss.h" + target_cpu_default="MASK_PORTABLE_RUNTIME|MASK_NO_SPACE_REGS|MASK_SOFT_FLOAT" + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h \ + pa/pa-pro-end.h libgloss.h" tmake_file="pa/t-pro" ;; hppa1.1-*-osf*) - target_cpu_default="(MASK_PA_11 | MASK_BIG_SWITCH)" + target_cpu_default="MASK_PA_11" tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-osf.h" tmake_file="pa/t-pa" use_collect2=yes ;; hppa1.1-*-rtems*) - target_cpu_default="(MASK_JUMP_IN_DELAY | MASK_PORTABLE_RUNTIME | MASK_GAS | MASK_NO_SPACE_REGS | MASK_SOFT_FLOAT | MASK_BIG_SWITCH)" - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h pa/pa-pro-end.h libgloss.h pa/rtems.h rtems.h" + target_cpu_default="MASK_PORTABLE_RUNTIME|MASK_NO_SPACE_REGS|MASK_SOFT_FLOAT" + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h elfos.h pa/elf.h \ + pa/pa-pro-end.h libgloss.h pa/rtems.h rtems.h" tmake_file="pa/t-pro t-rtems" ;; hppa1.1-*-bsd*) - target_cpu_default="(MASK_PA_11 | MASK_BIG_SWITCH)" + target_cpu_default="MASK_PA_11" tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h" tmake_file="pa/t-pa" use_collect2=yes ;; -hppa1.1-*-hpux10* | hppa2*-*-hpux10*) - target_cpu_default="(MASK_PA_11 | MASK_BIG_SWITCH)" - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h" - tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" - case ${enable_threads} in - "") - if test x$have_pthread_h = xyes ; then - tmake_file="${tmake_file} pa/t-dce-thr" - fi - ;; - yes | dce) - tmake_file="${tmake_file} pa/t-dce-thr" - ;; +hppa[12]*-*-hpux10*) + case ${target} in + hppa1.1-*-* | hppa2*-*-*) + target_cpu_default="MASK_PA_11" + ;; + esac + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \ + pa/pa-hpux.h pa/pa-hpux10.h" + case ${target} in + *-*-hpux10.[1-9]*) + tm_file="${tm_file} pa/pa-hpux1010.h" + ;; esac - use_collect2=yes - use_fixproto=yes - ;; -hppa1.0-*-hpux10*) - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux10.h" tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" case ${enable_threads} in "") @@ -827,22 +823,27 @@ hppa1.0-*-hpux10*) use_fixproto=yes ;; hppa*64*-*-hpux11*) + target_cpu_default="MASK_PA_11|MASK_PA_20" if test x$gnu_ld = xyes then - target_cpu_default="(MASK_PA_11 | MASK_PA_20 | MASK_GAS | MASK_GNU_LD | MASK_BIG_SWITCH)" - else - target_cpu_default="(MASK_PA_11 | MASK_PA_20 | MASK_GAS | MASK_BIG_SWITCH)" + target_cpu_default="${target_cpu_default}|MASK_GNU_LD" fi if test x$gas = xyes then - tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h \ - pa/pa64-regs.h pa/pa-hpux.h \ - pa/pa-hpux11.h pa/pa-64.h pa/pa64-hpux.h" + tm_file="pa/pa64-start.h ${tm_file} dbxelf.h elfos.h \ + pa/pa64-regs.h pa/pa-hpux.h pa/pa-hpux11.h" else tm_file="pa/pa64-start.h ${tm_file} dbxelf.h pa/elf.h \ - pa/pa64-regs.h pa/pa-hpux.h \ - pa/pa-hpux11.h pa/pa-64.h pa/pa64-hpux.h" + pa/pa64-regs.h pa/pa-hpux.h pa/pa-hpux11.h" fi + case ${target} in + *-*-hpux11.11) + tm_file="${tm_file} pa/pa-hpux1111.h pa/pa-64.h pa/pa64-hpux.h" + ;; + *) + tm_file="${tm_file} pa/pa-64.h pa/pa64-hpux.h" + ;; + esac need_64bit_hwint=yes tmake_file="pa/t-pa64 pa/t-pa-hpux" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o" @@ -852,19 +853,19 @@ hppa*64*-*-hpux11*) ;; esac ;; -hppa1.1-*-hpux11* | hppa2*-*-hpux11*) - target_cpu_default="(MASK_PA_11 | MASK_BIG_SWITCH)" - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h" - tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" - case x${enable_threads} in - xyes | xposix ) - thread_file=posix +hppa[12]*-*-hpux11*) + case ${target} in + hppa1.1-*-* | hppa2*-*-*) + target_cpu_default="MASK_PA_11" + ;; + esac + tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h \ + pa/pa-hpux.h pa/pa-hpux11.h" + case ${target} in + *-*-hpux11.[1-9]*) + tm_file="${tm_file} pa/pa-hpux1111.h" ;; esac - use_collect2=yes - ;; -hppa1.0-*-hpux11*) - tm_file="${tm_file} pa/pa32-regs.h dbxelf.h pa/som.h pa/pa-hpux.h pa/pa-hpux11.h" tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" case x${enable_threads} in xyes | xposix ) @@ -2589,9 +2590,10 @@ fi ;; hppa*-*-* | parisc*-*-*) + target_cpu_default2="MASK_BIG_SWITCH" if test x$gas = xyes then - target_cpu_default2="MASK_GAS|MASK_JUMP_IN_DELAY" + target_cpu_default2="${target_cpu_default2}|MASK_GAS|MASK_JUMP_IN_DELAY" fi ;; diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h index 31ac4cbbab68..b8ef0c170995 100644 --- a/gcc/config/pa/pa-hpux.h +++ b/gcc/config/pa/pa-hpux.h @@ -19,6 +19,10 @@ 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. */ +/* HP-UX UNIX features. */ +#undef TARGET_HPUX +#define TARGET_HPUX 1 + #undef TARGET_DEFAULT #define TARGET_DEFAULT MASK_BIG_SWITCH @@ -99,7 +103,7 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SPEC #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) #define LINK_SPEC \ - "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}" + "%{!mpa-risc-1-0:%{!march=1.0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}}%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}" #else #define LINK_SPEC \ "%{mlinker-opt:-O} %{!shared:-u main} %{static:-a archive} %{g*:-a archive} %{shared:-b}" diff --git a/gcc/config/pa/pa-hpux10.h b/gcc/config/pa/pa-hpux10.h index 6c4dbf596d51..d2d66eec0dba 100644 --- a/gcc/config/pa/pa-hpux10.h +++ b/gcc/config/pa/pa-hpux10.h @@ -28,51 +28,62 @@ Boston, MA 02111-1307, USA. */ support). We define __STDCPP__ to get certain system headers (notably assert.h) to assume standard preprocessor behavior in C++. */ #undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_assert ("system=hpux"); \ - builtin_assert ("system=unix"); \ - builtin_define ("__hp9000s800"); \ - builtin_define ("__hp9000s800__"); \ - builtin_define ("__hpux"); \ - builtin_define ("__hpux__"); \ - builtin_define ("__unix"); \ - builtin_define ("__unix__"); \ - if (c_dialect_cxx ()) \ - { \ - builtin_define ("_HPUX_SOURCE"); \ - builtin_define ("_INCLUDE_LONGLONG"); \ - builtin_define ("__STDC_EXT__"); \ - builtin_define ("__STDCPP__"); \ - } \ - else if (!flag_iso) \ - { \ - builtin_define ("_HPUX_SOURCE"); \ - if (preprocessing_trad_p ()) \ - { \ - builtin_define ("hp9000s800"); \ - builtin_define ("hppa"); \ - builtin_define ("hpux"); \ - builtin_define ("unix"); \ - builtin_define ("__CLASSIC_C__"); \ - builtin_define ("_PWB"); \ - builtin_define ("PWB"); \ - } \ - else \ - builtin_define ("__STDC_EXT__"); \ - } \ - if (TARGET_SIO) \ - builtin_define ("_SIO"); \ - else \ - { \ - builtin_define ("__hp9000s700"); \ - builtin_define ("__hp9000s700__"); \ - builtin_define ("_WSIO"); \ - } \ - } \ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_assert ("system=hpux"); \ + builtin_assert ("system=unix"); \ + builtin_define ("__hp9000s800"); \ + builtin_define ("__hp9000s800__"); \ + builtin_define ("__hpux"); \ + builtin_define ("__hpux__"); \ + builtin_define ("__unix"); \ + builtin_define ("__unix__"); \ + if (c_dialect_cxx ()) \ + { \ + builtin_define ("_HPUX_SOURCE"); \ + builtin_define ("_INCLUDE_LONGLONG"); \ + builtin_define ("__STDC_EXT__"); \ + builtin_define ("__STDCPP__"); \ + } \ + else if (!flag_iso) \ + { \ + builtin_define ("_HPUX_SOURCE"); \ + if (preprocessing_trad_p ()) \ + { \ + builtin_define ("hp9000s800"); \ + builtin_define ("hppa"); \ + builtin_define ("hpux"); \ + builtin_define ("unix"); \ + builtin_define ("__CLASSIC_C__"); \ + builtin_define ("_PWB"); \ + builtin_define ("PWB"); \ + } \ + else \ + builtin_define ("__STDC_EXT__"); \ + } \ + if (flag_pa_unix >= 1995) \ + { \ + builtin_define ("_XOPEN_UNIX"); \ + builtin_define ("_XOPEN_SOURCE_EXTENDED"); \ + } \ + if (TARGET_SIO) \ + builtin_define ("_SIO"); \ + else \ + { \ + builtin_define ("__hp9000s700"); \ + builtin_define ("__hp9000s700__"); \ + builtin_define ("_WSIO"); \ + } \ + } \ while (0) +#undef SUBTARGET_OPTIONS +#define SUBTARGET_OPTIONS \ + { "unix=", &pa_unix_string, \ + N_("Specify UNIX standard for predefines and linking.\n" \ + "Supported value is 93."), 0} + #define CPP_SPEC "%{threads: -D_REENTRANT -D_DCE_THREADS}" /* We can debug dynamically linked executables on hpux9; we also want @@ -80,7 +91,7 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SPEC #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) #define LINK_SPEC \ - "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}\ + "%{!mpa-risc-1-0:%{!march=1.0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}}\ %{!shared:%{p:-L/lib/libp %{!static:\ %nWarning: consider linking with `-static' as system libraries with\n\ %n profiling support are only provided in archive format}}}\ diff --git a/gcc/config/pa/pa-hpux1010.h b/gcc/config/pa/pa-hpux1010.h new file mode 100644 index 000000000000..a6bf9b9ddffb --- /dev/null +++ b/gcc/config/pa/pa-hpux1010.h @@ -0,0 +1,34 @@ +/* Definitions of target machine for GNU compiler, for HP PA-RISC + Copyright (C) 2004 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. */ + +/* HP-UX 10.10 UNIX 95 features. */ +#undef TARGET_HPUX_10_10 +#define TARGET_HPUX_10_10 1 + +#undef SUBTARGET_OPTIONS +#define SUBTARGET_OPTIONS \ + { "unix=", &pa_unix_string, \ + N_("Specify UNIX standard for predefines and linking.\n" \ + "Supported values are 93 and 95."), 0} + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \ + %{!munix=93:unix95%O%s}}" diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h index 7450c1db739c..9df9044fccb2 100644 --- a/gcc/config/pa/pa-hpux11.h +++ b/gcc/config/pa/pa-hpux11.h @@ -24,69 +24,80 @@ Boston, MA 02111-1307, USA. */ the definition of __cplusplus. We define _INCLUDE_LONGLONG to prevent nlist.h from defining __STDC_32_MODE__ (no longlong support). We define __STDCPP__ to get certain system headers - (notably assert.h) to assume standard preprocessor behavior in C++. - - The C99 support is incomplete. We define _INCLUDE__STDC_A1_SOURCE - to provide the extended multibyte and wide-character utilities available - under HP-UX 11i. Defining _HPUX_SOURCE would give us some more - features but it also adds stuff that isn't in C99. */ + (notably assert.h) to assume standard preprocessor behavior in C++. */ #undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_assert ("system=hpux"); \ - builtin_assert ("system=unix"); \ - builtin_define ("__hp9000s800"); \ - builtin_define ("__hp9000s800__"); \ - builtin_define ("__hpux"); \ - builtin_define ("__hpux__"); \ - builtin_define ("__unix"); \ - builtin_define ("__unix__"); \ - if (c_dialect_cxx ()) \ - { \ - builtin_define ("_HPUX_SOURCE"); \ - builtin_define ("_INCLUDE_LONGLONG"); \ - builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \ - builtin_define ("__STDC_EXT__"); \ - builtin_define ("__STDCPP__"); \ - } \ - else \ - { \ - if (!flag_iso) \ - { \ - builtin_define ("_HPUX_SOURCE"); \ - builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \ - if (preprocessing_trad_p ()) \ - { \ - builtin_define ("hp9000s800"); \ - builtin_define ("hppa"); \ - builtin_define ("hpux"); \ - builtin_define ("unix"); \ - builtin_define ("__CLASSIC_C__"); \ - builtin_define ("_PWB"); \ - builtin_define ("PWB"); \ - } \ - else \ - builtin_define ("__STDC_EXT__"); \ - } \ - else if (flag_isoc99) \ - { \ - builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \ - } \ - if (!TARGET_64BIT) \ - builtin_define ("_ILP32"); \ - } \ - if (TARGET_SIO) \ - builtin_define ("_SIO"); \ - else \ - { \ - builtin_define ("__hp9000s700"); \ - builtin_define ("__hp9000s700__"); \ - builtin_define ("_WSIO"); \ - } \ - } \ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_assert ("system=hpux"); \ + builtin_assert ("system=unix"); \ + builtin_define ("__hp9000s800"); \ + builtin_define ("__hp9000s800__"); \ + builtin_define ("__hpux"); \ + builtin_define ("__hpux__"); \ + builtin_define ("__unix"); \ + builtin_define ("__unix__"); \ + if (c_dialect_cxx ()) \ + { \ + builtin_define ("_HPUX_SOURCE"); \ + builtin_define ("_INCLUDE_LONGLONG"); \ + builtin_define ("__STDC_EXT__"); \ + builtin_define ("__STDCPP__"); \ + } \ + else \ + { \ + if (!flag_iso) \ + { \ + builtin_define ("_HPUX_SOURCE"); \ + if (preprocessing_trad_p ()) \ + { \ + builtin_define ("hp9000s800"); \ + builtin_define ("hppa"); \ + builtin_define ("hpux"); \ + builtin_define ("unix"); \ + builtin_define ("__CLASSIC_C__"); \ + builtin_define ("_PWB"); \ + builtin_define ("PWB"); \ + } \ + else \ + builtin_define ("__STDC_EXT__"); \ + } \ + } \ + if (!TARGET_64BIT) \ + builtin_define ("_ILP32"); \ + if (flag_pa_unix >= 1995) \ + { \ + builtin_define ("_XOPEN_UNIX"); \ + builtin_define ("_XOPEN_SOURCE_EXTENDED"); \ + } \ + if (TARGET_HPUX_11_11) \ + { \ + if (flag_pa_unix >= 1998) \ + { \ + builtin_define ("_INCLUDE__STDC_A1_SOURCE"); \ + builtin_define ("_INCLUDE_XOPEN_SOURCE_500"); \ + } \ + else if (flag_isoc94 || flag_isoc99 || c_dialect_cxx ()) \ + warning ("-munix=98 option required for C89 " \ + "Amendment 1 features.\n"); \ + } \ + if (TARGET_SIO) \ + builtin_define ("_SIO"); \ + else \ + { \ + builtin_define ("__hp9000s700"); \ + builtin_define ("__hp9000s700__"); \ + builtin_define ("_WSIO"); \ + } \ + } \ while (0) +#undef SUBTARGET_OPTIONS +#define SUBTARGET_OPTIONS \ + { "unix=", &pa_unix_string, \ + N_("Specify UNIX standard for predefines and linking.\n" \ + "Supported values are 93 and 95."), 0} + #undef CPP_SPEC #define CPP_SPEC \ "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}" @@ -99,7 +110,7 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SPEC #if ((TARGET_DEFAULT | TARGET_CPU_DEFAULT) & MASK_PA_11) #define LINK_SPEC \ - "%{!mpa-risc-1-0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}\ + "%{!mpa-risc-1-0:%{!march=1.0:%{!shared:-L/lib/pa1.1 -L/usr/lib/pa1.1 }}}\ %{!shared:%{p:-L/lib/libp -L/usr/lib/libp %{!static:\ %nWarning: consider linking with `-static' as system libraries with\n\ %n profiling support are only provided in archive format}}}\ @@ -127,6 +138,11 @@ Boston, MA 02111-1307, USA. */ %{mt|pthread:-lpthread} -lc \ %{static:%{!nolibdld:-a shared -ldld -a archive -lc}}}" +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \ + %{!munix=93:unix95%O%s}}" + /* Under hpux11, the normal location of the `ld' and `as' programs is the /usr/ccs/bin directory. */ diff --git a/gcc/config/pa/pa-hpux1111.h b/gcc/config/pa/pa-hpux1111.h new file mode 100644 index 000000000000..487807835775 --- /dev/null +++ b/gcc/config/pa/pa-hpux1111.h @@ -0,0 +1,34 @@ +/* Definitions of target machine for GNU compiler, for HP PA-RISC + Copyright (C) 2004 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. */ + +/* HP-UX 11i multibyte and UNIX 98 extensions. */ +#undef TARGET_HPUX_11_11 +#define TARGET_HPUX_11_11 1 + +#undef SUBTARGET_OPTIONS +#define SUBTARGET_OPTIONS \ + { "unix=", &pa_unix_string, \ + N_("Specify UNIX standard for predefines and linking.\n" \ + "Supported values are 93, 95 and 98."), 0} + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC \ + "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \ + %{munix=95:unix95%O%s}%{!munix=93:%{!munix=95:unix98%O%s}}}" diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 0bc755a158a8..401c642481ef 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -166,6 +166,12 @@ enum processor_type pa_cpu; /* String to hold which cpu we are scheduling for. */ const char *pa_cpu_string; +/* String used with the -munix= option. */ +const char *pa_unix_string; + +/* The UNIX standard to use for predefines and linking. */ +int flag_pa_unix; + /* Counts for the number of callee-saved general and floating point registers which were saved by the current function's prologue. */ static int gr_saved, fr_saved; @@ -421,6 +427,36 @@ override_options (void) warning ("unknown -march= option (%s).\nValid options are 1.0, 1.1, and 2.0\n", pa_arch_string); } + if (TARGET_HPUX) + { + /* Set the default UNIX standard for HP-UX. This affects the + predefines and startfiles used for the target. */ + if (pa_unix_string == NULL) + pa_unix_string + = TARGET_HPUX_11_11 ? "98" : (TARGET_HPUX_10_10 ? "95" : "93"); + + if (!strcmp (pa_unix_string, "93")) + flag_pa_unix = 1993; + else if (!strcmp (pa_unix_string, "95")) + flag_pa_unix = 1995; + else if (TARGET_HPUX_11_11) + { + if (!strcmp (pa_unix_string, "98")) + flag_pa_unix = 1998; + else + warning ("unknown -munix= option (%s).\n" + "Valid options are 93, 95 and 98.\n", + pa_unix_string); + } + else if (TARGET_HPUX_10_10) + warning ("unknown -munix= option (%s)." + "\nValid options are 93 and 95.\n", + pa_unix_string); + else + warning ("unknown -munix= option (%s).\nValid option is 93.\n", + pa_unix_string); + } + if (pa_fixed_range_string) fix_range (pa_fixed_range_string); diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index b7e32c46979f..4a6f78cbc627 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -67,6 +67,10 @@ extern const char *pa_fixed_range_string; extern const char *pa_cpu_string; extern enum processor_type pa_cpu; +/* For -munix= option. */ +extern const char *pa_unix_string; +extern int flag_pa_unix; + #define pa_cpu_attr ((enum attr_cpu)pa_cpu) /* Print subsidiary information on the compiler version in use. */ @@ -188,6 +192,21 @@ extern int target_flags; #define TARGET_SOM 0 #endif +/* HP-UX UNIX features. */ +#ifndef TARGET_HPUX +#define TARGET_HPUX 0 +#endif + +/* HP-UX 10.10 UNIX 95 features. */ +#ifndef TARGET_HPUX_10_10 +#define TARGET_HPUX_10_10 0 +#endif + +/* HP-UX 11i multibyte and UNIX 98 extensions. */ +#ifndef TARGET_HPUX_11_11 +#define TARGET_HPUX_11_11 0 +#endif + /* The following three defines are potential target switches. The current defines are optimal given the current capabilities of GAS and GNU ld. */ @@ -310,14 +329,19 @@ extern int target_flags; #define TARGET_OPTIONS \ { \ { "arch=", &pa_arch_string, \ - N_("Specify PA-RISC architecture for code generation. " \ + N_("Specify PA-RISC architecture for code generation.\n" \ "Values are 1.0, 1.1 and 2.0."), 0}, \ { "fixed-range=", &pa_fixed_range_string, \ - N_("Specify range of registers to make fixed"), 0}, \ + N_("Specify range of registers to make fixed."), 0}, \ { "schedule=", &pa_cpu_string, \ - N_("Specify CPU for scheduling purposes"), 0} \ + N_("Specify CPU for scheduling purposes."), 0}, \ + SUBTARGET_OPTIONS \ } +#ifndef SUBTARGET_OPTIONS +#define SUBTARGET_OPTIONS +#endif + /* Support for a compile-time default CPU, et cetera. The rules are: --with-schedule is ignored if -mschedule is specified. --with-arch is ignored if -march is specified. */ diff --git a/gcc/config/pa/pa64-hpux.h b/gcc/config/pa/pa64-hpux.h index f2663c6b2ca8..ba725e5887c3 100644 --- a/gcc/config/pa/pa64-hpux.h +++ b/gcc/config/pa/pa64-hpux.h @@ -95,6 +95,14 @@ Boston, MA 02111-1307, USA. */ #define MD_EXEC_PREFIX "/usr/ccs/bin" #endif +/* Default prefixes. */ + +#undef STANDARD_STARTFILE_PREFIX_1 +#define STANDARD_STARTFILE_PREFIX_1 "/lib/pa20_64/" + +#undef STANDARD_STARTFILE_PREFIX_2 +#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/pa20_64/" + /* Under hpux11 the normal location of the various pa20_64 *crt*.o files is the /usr/ccs/lib/pa20_64 directory. Some files may also be in the /opt/langtools/lib/pa20_64 directory. */ @@ -265,11 +273,19 @@ do { \ /* The following STARTFILE_SPEC and ENDFILE_SPEC defines provide the magic needed to run initializers and finalizers. */ #undef STARTFILE_SPEC +#if TARGET_HPUX_11_11 #define STARTFILE_SPEC \ - "%{!shared: %{!symbolic: crt0.o%s}} %{static:crtbeginT.o%s} \ - %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" + "%{!shared: %{!symbolic: crt0%O%s} %{munix=95:unix95.o%s} \ + %{!munix=93:%{!munix=95:unix98%O%s}}} %{static:crtbeginT%Oos} \ + %{!static:%{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}}" +#else +#define STARTFILE_SPEC \ + "%{!shared: %{!symbolic: crt0%O%s} %{munix=95:unix95%O%s}} \ + %{static:crtbeginT%O%s} %{!static:%{!shared:crtbegin%O%s} \ + %{shared:crtbeginS%O%s}}" +#endif #undef ENDFILE_SPEC -#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s}" +#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" /* Since HP uses the .init and .fini sections for array initializers and finalizers, we need different defines for INIT_SECTION_ASM_OP diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index bc4e8541c741..93e009002e48 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -2608,10 +2608,10 @@ We @emph{highly} recommend using gas/binutils on all hppa platforms; you may encounter a variety of problems when using the HP assembler. Specifically, @option{-g} does not work on HP-UX (since that system -uses a peculiar debugging format which GCC does not know about), unless you -use GAS and GDB and configure GCC with the +uses a peculiar debugging format which GCC does not know about), unless +you use GAS and GDB. It may be helpful to configure GCC with the @uref{./configure.html#with-gnu-as,,@option{--with-gnu-as}} and -@option{--with-as=@dots{}} options. +@option{--with-as=@dots{}} options to ensure that GCC can find GAS. If you wish to use the pa-risc 2.0 architecture support with a 32-bit runtime, you must use either the HP assembler, or gas/binutils 2.11 @@ -2629,6 +2629,16 @@ configuring if you want a model other than PROCESSOR_8000. The macro TARGET_SCHED_DEFAULT can be defined in BOOT_CFLAGS if a different default scheduling model is desired. +As of GCC 3.5, GCC uses the UNIX 95 namespace for HP-UX 10.10 +through 11.00, and the UNIX 98 namespace for HP-UX 11.11 and later. +This namespace change might cause problems when bootstrapping with +an earlier version of GCC or the HP compiler as essentially the same +namespace is required for an entire build. This problem can be avoided +in a number of ways. With HP cc, @env{UNIX_STD} can be set to @samp{95} +or @samp{98}. Another way is to add an appropriate set of predefines +to @env{CC}. The description for the @option{munix=} option contains +a list of the predefines used with each standard. + More specific information to @samp{hppa*-hp-hpux*} targets follows. @html diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e10718901f03..4437699ae8d7 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -475,7 +475,7 @@ Objective-C and Objective-C++ Dialects}. -mno-space-regs -msoft-float -mpa-risc-1-0 @gol -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol --nolibdld -static -threads} +-munix=@var{unix-std} -nolibdld -static -threads} @emph{i386 and x86-64 Options} @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol @@ -7600,6 +7600,53 @@ Use multiply and add/subtract instructions. Do not use multiply and add/subtract instructions. +@item -mfdpic +@opindex mfdpic + +Select the FDPIC ABI, that uses function descriptors to represent +pointers to functions. Without any PIC/PIE-related options, it +implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it +assumes GOT entries and small data are within a 12-bit range from the +GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets +are computed with 32 bits. + +@item -minline-plt +@opindex minline-plt + +Enable inlining of PLT entries in function calls to functions that are +not known to bind locally. It has no effect without @option{-mfdpic}. +It's enabled by default if optimizing for speed and compiling for +shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an +optimization option such as @option{-O3} or above is present in the +command line. + +@item -mgprel-ro +@opindex mgprel-ro + +Enable the use of @code{GPREL} relocations in the FDPIC ABI for data +that is known to be in read-only sections. It's enabled by default, +except for @option{-fpic} or @option{-fpie}: even though it may help +make the global offset table smaller, it trades 1 instruction for 4. +With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, +one of which may be shared by multiple symbols, and it avoids the need +for a GOT entry for the referenced symbol, so it's more likely to be a +win. If it is not, @option{-mno-gprel-ro} can be used to disable it. + +@item -multilib-library-pic +@opindex multilib-library-pic + +Link with the (library, not FD) pic libraries. It's implied by +@option{-mlibrary-pic}, as well as by @option{-fPIC} and +@option{-fpic} without @option{-mfdpic}. You should never have to use +it explicitly. + +@item -mlinked-fp +@opindex mlinked-fp + +Follow the EABI requirement of always creating a frame pointer whenever +a stack frame is allocated. This option is enabled by default and can +be disabled with @option{-mno-linked-fp}. + @item -mlibrary-pic @opindex mlibrary-pic @@ -7800,10 +7847,6 @@ architecture option for your machine. Code compiled for lower numbered architectures will run on higher numbered architectures, but not the other way around. -PA 2.0 support currently requires gas snapshot 19990413 or later. The -next release of binutils (current is 2.9.1) will probably contain PA 2.0 -support. - @item -mpa-risc-1-0 @itemx -mpa-risc-1-1 @itemx -mpa-risc-2-0 @@ -7934,53 +7977,6 @@ configure option, GCC's program search path, and finally by the user's @env{PATH}. The linker used by GCC can be printed using @samp{which `gcc -print-prog-name=ld`}. -@item -mfdpic -@opindex mfdpic - -Select the FDPIC ABI, that uses function descriptors to represent -pointers to functions. Without any PIC/PIE-related options, it -implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it -assumes GOT entries and small data are within a 12-bit range from the -GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets -are computed with 32 bits. - -@item -minline-plt -@opindex minline-plt - -Enable inlining of PLT entries in function calls to functions that are -not known to bind locally. It has no effect without @option{-mfdpic}. -It's enabled by default if optimizing for speed and compiling for -shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an -optimization option such as @option{-O3} or above is present in the -command line. - -@item -mgprel-ro -@opindex mgprel-ro - -Enable the use of @code{GPREL} relocations in the FDPIC ABI for data -that is known to be in read-only sections. It's enabled by default, -except for @option{-fpic} or @option{-fpie}: even though it may help -make the global offset table smaller, it trades 1 instruction for 4. -With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4, -one of which may be shared by multiple symbols, and it avoids the need -for a GOT entry for the referenced symbol, so it's more likely to be a -win. If it is not, @option{-mno-gprel-ro} can be used to disable it. - -@item -multilib-library-pic -@opindex multilib-library-pic - -Link with the (library, not FD) pic libraries. It's implied by -@option{-mlibrary-pic}, as well as by @option{-fPIC} and -@option{-fpic} without @option{-mfdpic}. You should never have to use -it explicitly. - -@item -mlinked-fp -@opindex mlinked-fp - -Follow the EABI requirement of always creating a frame pointer whenever -a stack frame is allocated. This option is enabled by default and can -be disabled with @option{-mno-linked-fp}. - @item -mlong-calls @opindex mno-long-calls Generate code that uses long call sequences. This ensures that a call @@ -8008,6 +8004,32 @@ symbol-difference or pc-relative calls should be relatively small. However, an indirect call is used on 32-bit ELF systems in pic code and it is quite long. +@item -munix=@var{unix-std} +@opindex march +Generate compiler predefines and select a startfile for the specified +UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95} +and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95} +is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX +11.11 and later. The default values are @samp{93} for HP-UX 10.00, +@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11 +and later. + +@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4. +@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX} +and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}. +@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX}, +@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and +@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}. + +It is @emph{important} to note that this option changes the interfaces +for various library routines. It also affects the operational behavior +of the C library. Thus, @emph{extreme} care is needed in using this +option. + +Library code that is intended to operate with more than one UNIX +standard must test, set and restore the variable @var{__xpg4_extended_mask} +as appropriate. Most GNU software doesn't provide this capability. + @item -nolibdld @opindex nolibdld Suppress the generation of link options to search libdld.sl when the -- 2.39.5