This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Allow object suffix other than default in gcc.c
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Dec 01 18:42:29 EST
- Subject: Allow object suffix other than default in gcc.c
This is a patch to allow an explicit .o extension on object files even if
TARGET_OBJECT_SUFFIX is defined. This is mainly for VMS where the default
object extension is .obj, but there are numerous places in the configure and
build process for gcc that require a .o extension. The VMS linker is
perfectly happy with the .o extension so there is no downside. The default
remains .obj except when explicitly specified as .o.
Mon Dec 10 18:37:31 2001 Douglas B. Rupp <rupp@gnat.com>
* gcc.c (convert_filename): Add do_obj parameter. Don't convert
unless do_obj true.
(process_command): Modify calls to convert_filename.
*** gcc.c 2001/12/04 22:26:15 1.274
--- gcc.c 2001/12/10 21:42:24
*************** static void init_gcc_specs
*** 320,326 ****
const char *));
#endif
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
! static const char *convert_filename PARAMS ((const char *, int));
#endif
/* The Specs Language
--- 320,326 ----
const char *));
#endif
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
! static const char *convert_filename PARAMS ((const char *, int, int));
#endif
/* The Specs Language
*************** static int *warn_std_ptr = 0;
*** 2926,2938 ****
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
! /* Convert NAME to a new name if it is the standard suffix. DO_EXE
! is true if we should look for an executable suffix as well. */
static const char *
! convert_filename (name, do_exe)
const char *name;
int do_exe ATTRIBUTE_UNUSED;
{
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
int i;
--- 2926,2940 ----
#if defined(HAVE_TARGET_OBJECT_SUFFIX) || defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
! /* Convert NAME to a new name if it is the standard suffix. DO_EXE
! is true if we should look for an executable suffix. DO_OBJ
! is true if we should look for an object suffix. */
static const char *
! convert_filename (name, do_exe, do_obj)
const char *name;
int do_exe ATTRIBUTE_UNUSED;
+ int do_obj ATTRIBUTE_UNUSED;
{
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX)
int i;
*************** convert_filename (name, do_exe)
*** 2946,2952 ****
#ifdef HAVE_TARGET_OBJECT_SUFFIX
/* Convert x.o to x.obj if TARGET_OBJECT_SUFFIX is ".obj". */
! if (len > 2
&& name[len - 2] == '.'
&& name[len - 1] == 'o')
{
--- 2948,2954 ----
#ifdef HAVE_TARGET_OBJECT_SUFFIX
/* Convert x.o to x.obj if TARGET_OBJECT_SUFFIX is ".obj". */
! if (do_obj && len > 2
&& name[len - 2] == '.'
&& name[len - 1] == 'o')
{
*************** process_command (argc, argv)
*** 3627,3635 ****
#endif
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || defined(HAVE_TARGET_OBJECT_SUFFIX)
if (p[1] == 0)
! argv[i + 1] = convert_filename (argv[i + 1], ! have_c);
else
! argv[i] = convert_filename (argv[i], ! have_c);
#endif
goto normal_switch;
--- 3629,3637 ----
#endif
#if defined(HAVE_TARGET_EXECUTABLE_SUFFIX) || defined(HAVE_TARGET_OBJECT_SUFFIX)
if (p[1] == 0)
! argv[i + 1] = convert_filename (argv[i + 1], ! have_c, 0);
else
! argv[i] = convert_filename (argv[i], ! have_c, 0);
#endif
goto normal_switch;
*************** process_command (argc, argv)
*** 3948,3954 ****
else
{
#ifdef HAVE_TARGET_OBJECT_SUFFIX
! argv[i] = convert_filename (argv[i], 0);
#endif
if (strcmp (argv[i], "-") != 0 && access (argv[i], F_OK) < 0)
--- 3950,3956 ----
else
{
#ifdef HAVE_TARGET_OBJECT_SUFFIX
! argv[i] = convert_filename (argv[i], 0, access (argv[i], F_OK));
#endif
if (strcmp (argv[i], "-") != 0 && access (argv[i], F_OK) < 0)