Patchwork Clean up MD_EXEC_PREFIX and MD_STARTFILE_PREFIX definitions

login
register
mail settings
Submitter Joseph S. Myers
Date Dec. 6, 2010, 4:35 p.m.
Message ID <Pine.LNX.4.64.1012061634470.24133@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/74387/
State New
Headers show

Comments

Joseph S. Myers - Dec. 6, 2010, 4:35 p.m.
This patch, relative to a tree with my AS_NEEDS_DASH_FOR_PIPED_INPUT
patch <http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00362.html>
(pending review) applied, cleans up MD_EXEC_PREFIX and
MD_STARTFILE_PREFIX definitions in GCC, eliminating those in svr4.h.

The definitions in svr4.h would have been inherited by many
configurations that did not undefine the macros - but most of those
were cross-only configurations and the macros are native-only.  As
well as bare-metal configurations, I believe the following affected
target OSes are cross-only (based on the absence of code in
config.guess to generate associated triplets): VxWorks, RTEMS,
uClinux, Symbian, Netware, TPF.  Thus, the definitions in svr4.h were
only relevant to QNX, Solaris and IA64 HP-UX; all other configurations
using svr4.h either undefined those macros, or were cross-only.  This
patch moves the definitions to more specific headers for those
targets, removing #undef directives in other headers that are no
longer needed.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  Also
tested building cc1 and xgcc for crosses to: i686-nto-qnx
ia64-hp-hpux11.23 mips-linux-gnu mips-netbsdelf powerpc-linux-gnu
powerpc64-linux-gnu i686-solaris2.10 sparc-netbsdelf sparc64-openbsd
xtensa-elf.  OK to commit?

2010-12-06  Joseph Myers  <joseph@codesourcery.com>

	* config/i386/nto.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Define.
	* config/ia64/hpux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Define.
	* config/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
	undefine.
	* config/mips/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
	undefine.
	* config/mips/netbsd.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/rs6000/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/rs6000/linux64.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/sol2.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Define.
	* config/sparc/netbsd-elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/sparc/openbsd64.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/sparc/sp64-elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
	Don't undefine.
	* config/svr4.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
	define.
	* config/xtensa/elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
	undefine.
Rainer Orth - Dec. 6, 2010, 6 p.m.
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> This patch, relative to a tree with my AS_NEEDS_DASH_FOR_PIPED_INPUT
> patch <http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00362.html>
> (pending review) applied, cleans up MD_EXEC_PREFIX and
> MD_STARTFILE_PREFIX definitions in GCC, eliminating those in svr4.h.
>
> The definitions in svr4.h would have been inherited by many
> configurations that did not undefine the macros - but most of those
> were cross-only configurations and the macros are native-only.  As
> well as bare-metal configurations, I believe the following affected
> target OSes are cross-only (based on the absence of code in
> config.guess to generate associated triplets): VxWorks, RTEMS,
> uClinux, Symbian, Netware, TPF.  Thus, the definitions in svr4.h were
> only relevant to QNX, Solaris and IA64 HP-UX; all other configurations
> using svr4.h either undefined those macros, or were cross-only.  This
> patch moves the definitions to more specific headers for those
> targets, removing #undef directives in other headers that are no
> longer needed.

I'm not sure this is the right approach, actually: those locations
(/usr/ccs/bin and /usr/ccs/lib) are the generic System Vr4 directories
and it makes perfect sense to me to have them defined in a generic
svr4.h header file.

On the other hand, many other OSes seem to include svr4.h though they
have no business at all doing so.  It seems to me that it would be
better removing those spurious includes rather than duplicating the SVR4
definitions for those systems they are right for.

	Rainer
Joseph S. Myers - Dec. 6, 2010, 6:06 p.m.
On Mon, 6 Dec 2010, Rainer Orth wrote:

> I'm not sure this is the right approach, actually: those locations
> (/usr/ccs/bin and /usr/ccs/lib) are the generic System Vr4 directories
> and it makes perfect sense to me to have them defined in a generic
> svr4.h header file.

Have you read <http://gcc.gnu.org/ml/gcc/2010-12/msg00139.html> which 
describes my reasoning and strategy here?  My claim is there is no such 
thing as generic SVR4 that is supported by GCC and no useful common 
SVR4-ness about GCC targets and that it is best to eliminate this header 
completely, and my strategy is to deal with AS_NEEDS_DASH_FOR_PIPED_INPUT, 
MD_EXEC_PREFIX, MD_STARTFILE_PREFIX, TARGET_POSIX_IO on a per-macro basis 
(as these widely end up being defined for inappropriate targets) and the 
others on a per-target basis (as they are mostly overridden, but exactly 
what gets overridden varies from target to target).

> On the other hand, many other OSes seem to include svr4.h though they
> have no business at all doing so.  It seems to me that it would be
> better removing those spurious includes rather than duplicating the SVR4
> definitions for those systems they are right for.

Removing the includes (for all targets) is what I plan to do once I've 
dealt globally with the macros named above for which I believe the 
definitions are widely inappropriate.  This minimises the number of 
svr4.h-inclusion-removal patches that have any effect on the final macro 
definitions applying to the targets in question.
Ian Taylor - Dec. 9, 2010, 4:28 p.m.
On Mon, Dec 6, 2010 at 8:35 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:

> 2010-12-06  Joseph Myers  <joseph@codesourcery.com>
>
>        * config/i386/nto.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Define.
>        * config/ia64/hpux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Define.
>        * config/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
>        undefine.
>        * config/mips/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
>        undefine.
>        * config/mips/netbsd.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/rs6000/linux.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/rs6000/linux64.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/sol2.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Define.
>        * config/sparc/netbsd-elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/sparc/openbsd64.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/sparc/sp64-elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX):
>        Don't undefine.
>        * config/svr4.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
>        define.
>        * config/xtensa/elf.h (MD_EXEC_PREFIX, MD_STARTFILE_PREFIX): Don't
>        undefine.

This is OK.

Thanks.

Ian

Patch

diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/i386/nto.h gcc-mainline/gcc/config/i386/nto.h
--- gcc-mainline-1/gcc/config/i386/nto.h	2010-12-02 09:40:30.000000000 -0800
+++ gcc-mainline/gcc/config/i386/nto.h	2010-12-06 06:49:06.000000000 -0800
@@ -46,6 +46,14 @@  along with GCC; see the file COPYING3.  
 #define SYSROOT_SUFFIX_SPEC "x86"
 #endif
 
+#ifndef CROSS_DIRECTORY_STRUCTURE
+#undef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX "/usr/ccs/bin/"
+
+#undef MD_STARTFILE_PREFIX
+#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
+#endif
+
 #undef STARTFILE_SPEC
 #define STARTFILE_SPEC \
 "%{!shared: \
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/ia64/hpux.h gcc-mainline/gcc/config/ia64/hpux.h
--- gcc-mainline-1/gcc/config/ia64/hpux.h	2010-12-03 15:16:32.000000000 -0800
+++ gcc-mainline/gcc/config/ia64/hpux.h	2010-12-06 06:39:16.000000000 -0800
@@ -72,6 +72,14 @@  do {							\
 #define AS_NEEDS_DASH_FOR_PIPED_INPUT
 #endif
 
+#ifndef CROSS_DIRECTORY_STRUCTURE
+#undef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX "/usr/ccs/bin/"
+
+#undef MD_STARTFILE_PREFIX
+#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
+#endif
+
 #undef ENDFILE_SPEC
 
 #undef STARTFILE_SPEC
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/linux.h gcc-mainline/gcc/config/linux.h
--- gcc-mainline-1/gcc/config/linux.h	2010-11-19 13:18:41.000000000 -0800
+++ gcc-mainline/gcc/config/linux.h	2010-12-06 06:39:42.000000000 -0800
@@ -34,9 +34,6 @@  see the files COPYING3 and COPYING.RUNTI
 #undef ASM_APP_OFF
 #define ASM_APP_OFF "#NO_APP\n"
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux.  Here we add
    the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
    provides part of the support for getting C++ file-scope static
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/mips/linux.h gcc-mainline/gcc/config/mips/linux.h
--- gcc-mainline-1/gcc/config/mips/linux.h	2010-12-02 09:39:19.000000000 -0800
+++ gcc-mainline/gcc/config/mips/linux.h	2010-12-06 06:39:54.000000000 -0800
@@ -34,9 +34,6 @@  along with GCC; see the file COPYING3.  
 #define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)");
 #endif
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* If we don't set MASK_ABICALLS, we can't default to PIC.  */
 #undef TARGET_DEFAULT
 #define TARGET_DEFAULT MASK_ABICALLS
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/mips/netbsd.h gcc-mainline/gcc/config/mips/netbsd.h
--- gcc-mainline-1/gcc/config/mips/netbsd.h	2010-10-24 09:35:29.000000000 -0700
+++ gcc-mainline/gcc/config/mips/netbsd.h	2010-12-06 06:40:24.000000000 -0800
@@ -126,10 +126,6 @@  along with GCC; see the file COPYING3.  
   while (0)
 
 
-/* Clean up after the generic MIPS/ELF configuration.  */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* Extra specs we need.  */
 #undef SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS						\
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/rs6000/linux.h gcc-mainline/gcc/config/rs6000/linux.h
--- gcc-mainline-1/gcc/config/rs6000/linux.h	2010-08-22 05:22:03.000000000 -0700
+++ gcc-mainline/gcc/config/rs6000/linux.h	2010-12-06 06:41:23.000000000 -0800
@@ -1,7 +1,7 @@ 
 /* Definitions of target machine for GNU compiler,
    for PowerPC machines running Linux.
    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
    Contributed by Michael Meissner (meissner@cygnus.com).
 
    This file is part of GCC.
@@ -20,9 +20,6 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
    process.  */
 #define OS_MISSING_POWERPC64 1
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/rs6000/linux64.h gcc-mainline/gcc/config/rs6000/linux64.h
--- gcc-mainline-1/gcc/config/rs6000/linux64.h	2010-12-02 09:39:46.000000000 -0800
+++ gcc-mainline/gcc/config/rs6000/linux64.h	2010-12-06 06:41:42.000000000 -0800
@@ -304,10 +304,6 @@  extern int dot_symbols;
 #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
   (!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE))
 
-/* Override svr4.h  */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
    process.  */
 #define OS_MISSING_POWERPC64 !TARGET_64BIT
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/sol2.h gcc-mainline/gcc/config/sol2.h
--- gcc-mainline-1/gcc/config/sol2.h	2010-12-03 14:47:30.000000000 -0800
+++ gcc-mainline/gcc/config/sol2.h	2010-12-06 06:37:58.000000000 -0800
@@ -120,6 +120,14 @@  along with GCC; see the file COPYING3.  
 %(asm_cpu) \
 "
 
+#ifndef CROSS_DIRECTORY_STRUCTURE
+#undef MD_EXEC_PREFIX
+#define MD_EXEC_PREFIX "/usr/ccs/bin/"
+
+#undef MD_STARTFILE_PREFIX
+#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
+#endif
+
 /* We don't use the standard LIB_SPEC only because we don't yet support c++.  */
 #undef LIB_SPEC
 #define LIB_SPEC \
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/sparc/netbsd-elf.h gcc-mainline/gcc/config/sparc/netbsd-elf.h
--- gcc-mainline-1/gcc/config/sparc/netbsd-elf.h	2010-12-02 09:39:52.000000000 -0800
+++ gcc-mainline/gcc/config/sparc/netbsd-elf.h	2010-12-06 06:41:54.000000000 -0800
@@ -36,10 +36,6 @@  along with GCC; see the file COPYING3.  
     }							\
   while (0)
 
-/* Make sure these are undefined.  */
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* CPP defines used by all NetBSD targets.  */
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "%(netbsd_cpp_spec)"
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/sparc/openbsd64.h gcc-mainline/gcc/config/sparc/openbsd64.h
--- gcc-mainline-1/gcc/config/sparc/openbsd64.h	2010-12-02 09:39:18.000000000 -0800
+++ gcc-mainline/gcc/config/sparc/openbsd64.h	2010-12-06 06:42:35.000000000 -0800
@@ -47,9 +47,6 @@  along with GCC; see the file COPYING3.  
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC ""
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 /* Inherited from sp64-elf.  */
 #undef NO_IMPLICIT_EXTERN_C
 
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/sparc/sp64-elf.h gcc-mainline/gcc/config/sparc/sp64-elf.h
--- gcc-mainline-1/gcc/config/sparc/sp64-elf.h	2010-10-24 09:36:44.000000000 -0700
+++ gcc-mainline/gcc/config/sparc/sp64-elf.h	2010-12-06 06:43:00.000000000 -0800
@@ -38,9 +38,6 @@  along with GCC; see the file COPYING3.  
 #undef CPP_SUBTARGET_SPEC
 #define CPP_SUBTARGET_SPEC "-D__svr4__"
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 #undef ASM_SPEC
 #define ASM_SPEC "\
 %{v:-V} -s %{fpic|fPIC|fpie|fPIE:-K PIC} \
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/svr4.h gcc-mainline/gcc/config/svr4.h
--- gcc-mainline-1/gcc/config/svr4.h	2010-12-03 14:48:07.000000000 -0800
+++ gcc-mainline/gcc/config/svr4.h	2010-12-06 06:39:27.000000000 -0800
@@ -72,22 +72,6 @@  see the files COPYING3 and COPYING.RUNTI
 #undef  ASM_SPEC
 #define ASM_SPEC SVR4_ASM_SPEC
 
-/* Under svr4, the normal location of the `ld' and `as' programs is the
-   /usr/ccs/bin directory.  */
-
-#ifndef CROSS_DIRECTORY_STRUCTURE
-#undef  MD_EXEC_PREFIX
-#define MD_EXEC_PREFIX "/usr/ccs/bin/"
-#endif
-
-/* Under svr4, the normal location of the various *crt*.o files is the
-   /usr/ccs/lib directory.  */
-
-#ifndef CROSS_DIRECTORY_STRUCTURE
-#undef  MD_STARTFILE_PREFIX
-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
-#endif
-
 /* Provide a LIB_SPEC appropriate for svr4.  Here we tack on the default
    standard C library (unless we are building a shared library).  */
 
diff -rupN --exclude=.svn gcc-mainline-1/gcc/config/xtensa/elf.h gcc-mainline/gcc/config/xtensa/elf.h
--- gcc-mainline-1/gcc/config/xtensa/elf.h	2010-12-02 09:39:19.000000000 -0800
+++ gcc-mainline/gcc/config/xtensa/elf.h	2010-12-06 06:43:08.000000000 -0800
@@ -29,9 +29,6 @@  along with GCC; see the file COPYING3.  
 #undef ASM_APP_OFF
 #define ASM_APP_OFF "#NO_APP\n"
 
-#undef MD_EXEC_PREFIX
-#undef MD_STARTFILE_PREFIX
-
 #undef TARGET_VERSION
 #define TARGET_VERSION fputs (" (Xtensa/ELF)", stderr);