This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] move bfd/vmsutil.c to gas/config/te-vms.c and don't use gccism


Hi,

this is a long patch for in fact a small change.  The initial issue was
that te-vms.h couldn't be compiled with DEC-C because it uses gcc-isms.  I
replaced the statements as expression with functions (almost obvious).  But
I then remarked that only te-vms.h was using vmsutil.c so I think it is
better to move vmsutil.c out of bfd/ to gas/config/te-vms.c.

So most of this patch consists in changes in configures and makefiles.

Tested using ia64-openvms as target on both a darwin and a native host.

Tristan.

bfd:
2009-09-03  Tristan Gingold  <gingold@adacore.com>

	* bfd.m4 (BFD_HAVE_TIME_TYPE_MEMBER,
	BFD_HAVE_SYS_STAT_TYPE_MEMBER): Moved to gas/acinclude.m4
	* configure.in: Move tests for tm_gmtoff, st_mtim.tv_sec and
	st_mtim.tv_nsec to gas/configure.in
	(bfd_elf64_ia64_vms_vec): Remove vmsutil.lo
	* configure: Regenerate.
	* config.in: Regenerate.
	* vmsutil.c: Moved to gas/config/te-vms.c
	* vmsutil.h: Removed.
	* Makefile.am (BFD32_BACKENDS_CFILES): Remove vmsutil.c
	(BFD32_BACKENDS): Remove vmsutil.lo
	* Makefile.in: Regenerate.

gas/
2009-09-03  Tristan Gingold  <gingold@adacore.com>

	* Makefile.am (TARG_ENV_CFILES): New variable.  Set to te-vms.c
	(POTFILES): Add $(TARG_ENV_CFILES) in definition.
	(EXTRA_as_new_SOURCES): Ditto.
	* Makefile: Regenerate.
	* acinclude.m4 (BFD_HAVE_TIME_TYPE_MEMBER,
	BFD_HAVE_SYS_STAT_TYPE_MEMBER): New macro created from bfd/bfd.m4.
	* configure.in: Add Tests for tm_gmtoff, st_mtim.tv_sec and
	st_mtim.tv_nsec (from bfd/configure.in).  Check for time.h and
	sys/stat.h headers.
	Add te-vms.o in extra_objects if te_file is vms.
	* configure: Regenerate.
	* config.in: Regenerate.
	* config/te-vms.c: New file, from bfd/vmsutil.c
	(vms_dwarf2_file_time_name, vms_dwarf2_file_size_name)
	(vms_dwarf2_file_name): New functions.
	(vms_file_stats_name): Make it static, add a dirname parameter to
	locally create the full pathname.
	* config/te-vms.h: Add a copyright header.
	Declare the above functions.
	(DWARF2_FILE_TIME_NAME, DWARF2_FILE_SIZE_NAME, DWARF2_FILE_NAME): Use
	the above functions in the definition.
	* makefile.vms (OBJS): Add te-vms.obj.
	(te-vms.obj): Create a specific target.
	* configure.com: Create targ-env.h using a per target value.
	Compile te-vms.c for ia64.
  

Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.241
diff -c -r1.241 Makefile.am
*** bfd/Makefile.am	27 Aug 2009 05:24:42 -0000	1.241
--- bfd/Makefile.am	3 Sep 2009 15:27:26 -0000
***************
*** 390,396 ****
  	vms-misc.lo \
  	vms-tir.lo \
  	vms.lo \
- 	vmsutil.lo \
  	xcofflink.lo \
  	xsym.lo \
  	xtensa-isa.lo \
--- 390,395 ----
***************
*** 573,579 ****
  	vms-misc.c \
  	vms-tir.c \
  	vms.c \
- 	vmsutil.c \
  	xcofflink.c \
  	xsym.c \
  	xtensa-isa.c \
--- 572,577 ----
Index: bfd/bfd.m4
===================================================================
RCS file: /cvs/src/src/bfd/bfd.m4,v
retrieving revision 1.5
diff -c -r1.5 bfd.m4
*** bfd/bfd.m4	1 Jul 2009 15:02:27 -0000	1.5
--- bfd/bfd.m4	3 Sep 2009 15:27:26 -0000
***************
*** 39,78 ****
   AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
  ])
  
- dnl Check for existence of member $2 in type $1 in time.h
- 
- AC_DEFUN([BFD_HAVE_TIME_TYPE_MEMBER],
- [AC_MSG_CHECKING([for $1.$2 in time.h])
-  AC_CACHE_VAL(bfd_cv_have_time_type_member_$2,
-    [AC_TRY_COMPILE([
- #define _BSD_SOURCE 1
- #include <time.h>],
-       [$1 avar; void* aref = (void*) &avar.$2],
-       bfd_cv_have_time_type_member_$2=yes,
-       bfd_cv_have_time_type_member_$2=no
-    )])
-  if test $bfd_cv_have_time_type_member_$2 = yes; then
-    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z]), 1,
- 	     [Define if <time.h> has $1.$2.])
-  fi
-  AC_MSG_RESULT($bfd_cv_have_time_type_member_$2)
- ])
- 
- dnl Check for existence of member $2.$3 in type $1 in sys/stat.h
- 
- AC_DEFUN([BFD_HAVE_SYS_STAT_TYPE_MEMBER],
- [AC_MSG_CHECKING([for $1.$2.$3 in sys/stat.h])
-  AC_CACHE_VAL(bfd_cv_have_sys_stat_type_member_$2_$3,
-    [AC_TRY_COMPILE([
- #define _BSD_SOURCE 1
- #include <sys/stat.h>],
-       [$1 avar; void* aref = (void*) &avar.$2.$3],
-       bfd_cv_have_sys_stat_type_member_$2_$3=yes,
-       bfd_cv_have_sys_stat_type_member_$2_$3=no
-    )])
-  if test $bfd_cv_have_sys_stat_type_member_$2_$3 = yes; then
-    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_]translit($3, [a-z], [A-Z]), 1,
- 	     [Define if <sys/stat.h> has $1.$2.$3])
-  fi
-  AC_MSG_RESULT($bfd_cv_have_sys_stat_type_member_$2_$3)
- ])
--- 39,41 ----
Index: bfd/configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.269
diff -c -r1.269 configure.in
*** bfd/configure.in	11 Aug 2009 02:14:17 -0000	1.269
--- bfd/configure.in	3 Sep 2009 15:27:29 -0000
***************
*** 223,239 ****
  AC_CHECK_DECLS(snprintf)
  AC_CHECK_DECLS(vsnprintf)
  
- # Support for VMS timestamps via cross compile
- 
- if test "$ac_cv_header_time_h" = yes; then
-   BFD_HAVE_TIME_TYPE_MEMBER(struct tm, tm_gmtoff)
- fi
- 
- if test "$ac_cv_header_sys_stat_h" = yes; then
-     BFD_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_sec)
-     BFD_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_nsec)
- fi
- 
  # Link in zlib if we can.  This allows us to read compressed debug sections.
  # This is used only by compress.c.
  AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
--- 223,228 ----
***************
*** 809,815 ****
      bfd_elf64_ia64_big_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
!     bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf vmsutil.lo"; target_size=64 ;;
      bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
      bfd_elf64_mmix_vec) 	tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
--- 798,804 ----
      bfd_elf64_ia64_big_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_ia64_hpux_big_vec) tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_ia64_little_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
!     bfd_elf64_ia64_vms_vec)	tb="$tb elf64-ia64.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_little_generic_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
      bfd_elf64_littlemips_vec) 	tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
      bfd_elf64_mmix_vec) 	tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.182
diff -c -r1.182 Makefile.am
*** gas/Makefile.am	1 Sep 2009 20:56:51 -0000	1.182
--- gas/Makefile.am	3 Sep 2009 15:27:29 -0000
***************
*** 427,432 ****
--- 427,435 ----
  	config/te-vxworks.h \
  	config/te-wince-pe.h
  
+ TARG_ENV_CFILES = \
+ 	config/te-vms.c
+ 
  # Multi files in config
  
  MULTI_CFILES = \
***************
*** 481,487 ****
  
  OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
  
! POTFILES = $(MULTI_CFILES) $(CONFIG_ATOF_CFILES) $(TARG_ENV_HFILES) $(OBJ_FORMAT_HFILES) \
  	$(OBJ_FORMAT_CFILES) $(TARGET_CPU_HFILES) $(TARGET_CPU_CFILES) \
  	$(HFILES) $(CFILES)
  po/POTFILES.in: @MAINT@ Makefile
--- 484,491 ----
  
  OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS)
  
! POTFILES = $(MULTI_CFILES) $(CONFIG_ATOF_CFILES) \
! 	$(TARG_ENV_HFILES) $(TARG_ENV_CFILES) $(OBJ_FORMAT_HFILES) \
  	$(OBJ_FORMAT_CFILES) $(TARGET_CPU_HFILES) $(TARGET_CPU_CFILES) \
  	$(HFILES) $(CFILES)
  po/POTFILES.in: @MAINT@ Makefile
***************
*** 531,537 ****
  	$(extra_objects) $(GASLIBS) $(LIBINTL_DEP)
  EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
  	$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) \
! 	$(CONFIG_ATOF_CFILES) $(MULTI_CFILES)
  
  EXPECT = expect
  RUNTEST = runtest
--- 535,541 ----
  	$(extra_objects) $(GASLIBS) $(LIBINTL_DEP)
  EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \
  	$(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) \
! 	$(TARG_ENV_CFILES) $(CONFIG_ATOF_CFILES) $(MULTI_CFILES)
  
  EXPECT = expect
  RUNTEST = runtest
Index: gas/acinclude.m4
===================================================================
RCS file: /cvs/src/src/gas/acinclude.m4,v
retrieving revision 1.7
diff -c -r1.7 acinclude.m4
*** gas/acinclude.m4	14 Jun 2007 15:31:00 -0000	1.7
--- gas/acinclude.m4	3 Sep 2009 15:27:30 -0000
***************
*** 54,56 ****
--- 54,94 ----
  done
  $1=[$]_gas_uniq_newlist
  ])dnl
+ dnl
+ dnl Check for existence of member $2 in type $1 in time.h
+ dnl
+ AC_DEFUN([GAS_HAVE_TIME_TYPE_MEMBER],
+ [AC_MSG_CHECKING([for $1.$2 in time.h])
+  AC_CACHE_VAL(gas_cv_have_time_type_member_$2,
+    [AC_TRY_COMPILE([
+ #define _BSD_SOURCE 1
+ #include <time.h>],
+       [$1 avar; void* aref = (void*) &avar.$2],
+       gas_cv_have_time_type_member_$2=yes,
+       gas_cv_have_time_type_member_$2=no
+    )])
+  if test $gas_cv_have_time_type_member_$2 = yes; then
+    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z]), 1,
+ 	     [Define if <time.h> has $1.$2.])
+  fi
+  AC_MSG_RESULT($gas_cv_have_time_type_member_$2)
+ ])dnl
+ dnl
+ dnl Check for existence of member $2.$3 in type $1 in sys/stat.h
+ dnl
+ AC_DEFUN([GAS_HAVE_SYS_STAT_TYPE_MEMBER],
+ [AC_MSG_CHECKING([for $1.$2.$3 in sys/stat.h])
+  AC_CACHE_VAL(gas_cv_have_sys_stat_type_member_$2_$3,
+    [AC_TRY_COMPILE([
+ #define _BSD_SOURCE 1
+ #include <sys/stat.h>],
+       [$1 avar; void* aref = (void*) &avar.$2.$3],
+       gas_cv_have_sys_stat_type_member_$2_$3=yes,
+       gas_cv_have_sys_stat_type_member_$2_$3=no
+    )])
+  if test $gas_cv_have_sys_stat_type_member_$2_$3 = yes; then
+    AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_]translit($3, [a-z], [A-Z]), 1,
+ 	     [Define if <sys/stat.h> has $1.$2.$3])
+  fi
+  AC_MSG_RESULT($gas_cv_have_sys_stat_type_member_$2_$3)
+ ])dnl
Index: gas/configure.com
===================================================================
RCS file: /cvs/src/src/gas/configure.com,v
retrieving revision 1.2
diff -c -r1.2 configure.com
*** gas/configure.com	1 Sep 2009 13:37:01 -0000	1.2
--- gas/configure.com	3 Sep 2009 15:27:32 -0000
***************
*** 9,20 ****
--- 9,22 ----
  $ if arch.eqs."alpha"
  $ then
  $   format = "evax"
+ $   env = "generic"
  $   target_alias = "alpha-dec-openvms"
  $   target_canonical = "alpha-dec-openvms"
  $ endif
  $ if arch.eqs."ia64"
  $ then
  $   format = "elf"
+ $   env = "vms"
  $   target_alias = "ia64-openvms"
  $   target_canonical = "ia64-unknown-openvms"
  $ endif
***************
*** 33,40 ****
  $!
  $ write sys$output "Generate targ-env.h"
  $!
! $ create targ-env.h
! #include "te-generic.h"
  $!
  $ write sys$output "Generate obj-format.[ch]"
  $!
--- 35,43 ----
  $!
  $ write sys$output "Generate targ-env.h"
  $!
! $ open/write outfile targ-env.h
! $ write outfile "#include ""te-''env'.h"""
! $ close outfile
  $!
  $ write sys$output "Generate obj-format.[ch]"
  $!
***************
*** 219,225 ****
--- 222,245 ----
  $ LIBIBERTY = ",[-.libiberty]libiberty.olb/lib"
  $ LIBOPCODES = ",[-.opcodes]libopcodes.olb/lib"
  $!
+ $ AS_OBJS="targ-cpu," + FILES 
+ $!
  $ write sys$output "CFLAGS=",CFLAGS
+ $!
+ $EOD
+ $!
+ $ if arch.eqs."ia64"
+ $ then
+ $   open/append outfile build.com
+ $   write outfile "$ write sys$output ""Compiling te-vms.c"""
+ $   write outfile "$ cc 'CFLAGS /obj=te-vme.obj [.config]te-vms.c + " +-
+       "sys$library:sys$lib_c.tlb/lib"
+ $   write outfile "$ AS_OBJS=AS_OBJS + "",te-vms.obj"""
+ $   close outfile
+ $ endif
+ $!
+ $ append sys$input build.com
+ $DECK
  $ if p1.nes."LINK"
  $ then
  $   write sys$output "Compiling targ-cpu.c (/noopt)"
***************
*** 237,243 ****
  $ purge
  $!
  $ write sys$output "Building as.exe"
! $ AS_OBJS="targ-cpu," + FILES + LIBOPCODES +  LIBBFD +  LIBIBERTY
  $ link/exe=as 'AS_OBJS
  $exit
  
--- 257,264 ----
  $ purge
  $!
  $ write sys$output "Building as.exe"
! $ AS_OBJS=AS_OBJS + LIBOPCODES +  LIBBFD +  LIBIBERTY
  $ link/exe=as 'AS_OBJS
+ $EOD
  $exit
  
Index: gas/configure.in
===================================================================
RCS file: /cvs/src/src/gas/configure.in,v
retrieving revision 1.213
diff -c -r1.213 configure.in
*** gas/configure.in	6 Aug 2009 17:38:02 -0000	1.213
--- gas/configure.in	3 Sep 2009 15:27:32 -0000
***************
*** 386,391 ****
--- 386,395 ----
        te_file=$em
      fi
  
+    case ${te_file} in
+       vms) extra_objects="$extra_objects te-vms.o" ;;
+    esac
+  
  # From target name and format, produce a list of supported emulations.
  
      case ${generic_target}-${fmt} in
***************
*** 609,615 ****
  AM_CONDITIONAL(GENINSRC_NEVER, false)
  AC_EXEEXT
  
! AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h limits.h)
  
  # Put this here so that autoconf's "cross-compiling" message doesn't confuse
  # people who are not cross-compiling but are compiling cross-assemblers.
--- 613,619 ----
  AM_CONDITIONAL(GENINSRC_NEVER, false)
  AC_EXEEXT
  
! AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h limits.h time.h sys/stat.h)
  
  # Put this here so that autoconf's "cross-compiling" message doesn't confuse
  # people who are not cross-compiling but are compiling cross-assemblers.
***************
*** 697,702 ****
--- 701,718 ----
  
  BFD_BINARY_FOPEN
  
+ # Support for VMS timestamps via cross compile
+ 
+ if test "$ac_cv_header_time_h" = yes; then
+   GAS_HAVE_TIME_TYPE_MEMBER(struct tm, tm_gmtoff)
+ fi
+ 
+ if test "$ac_cv_header_sys_stat_h" = yes; then
+     GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_sec)
+     GAS_HAVE_SYS_STAT_TYPE_MEMBER(struct stat, st_mtim, tv_nsec)
+ fi
+ 
+ 
  dnl Required for html, pdf, install-pdf and install-html targets.
  AC_SUBST(datarootdir)
  AC_SUBST(docdir)
Index: gas/makefile.vms
===================================================================
RCS file: /cvs/src/src/gas/makefile.vms,v
retrieving revision 1.6
diff -c -r1.6 makefile.vms
*** gas/makefile.vms	1 Sep 2009 13:37:01 -0000	1.6
--- gas/makefile.vms	3 Sep 2009 15:27:32 -0000
***************
*** 21,27 ****
  endif
  
  OBJS=targ-cpu.obj,obj-format.obj,atof-targ.obj,app.obj,as.obj,atof-generic.obj,\
!   cond.obj,depend.obj,expr.obj,flonum-konst.obj,\
    flonum-copy.obj,flonum-mult.obj,frags.obj,hash.obj,input-file.obj,\
    input-scrub.obj,literal.obj,messages.obj,output-file.obj,read.obj,\
    subsegs.obj,symbols.obj,write.obj,listing.obj,ecoff.obj,stabs.obj,sb.obj,\
--- 21,27 ----
  endif
  
  OBJS=targ-cpu.obj,obj-format.obj,atof-targ.obj,app.obj,as.obj,atof-generic.obj,\
!   te-vms.obj,cond.obj,depend.obj,expr.obj,flonum-konst.obj,\
    flonum-copy.obj,flonum-mult.obj,frags.obj,hash.obj,input-file.obj,\
    input-scrub.obj,literal.obj,messages.obj,output-file.obj,read.obj,\
    subsegs.obj,symbols.obj,write.obj,listing.obj,ecoff.obj,stabs.obj,sb.obj,\
***************
*** 42,47 ****
--- 42,50 ----
  	      $(COMPILE.c) /noopt/obj=$@ $<
  endif
  
+ te-vms.obj: [.config]te-vms.c
+ 	      $(COMPILE.c) /obj=$@ $< + sys$$library:sys$$lib_c.tlb/lib
+ 
  clean:
  	$$ purge
  	$(RM) *.obj;
Index: gas/config/te-vms.h
===================================================================
RCS file: /cvs/src/src/gas/config/te-vms.h,v
retrieving revision 1.1
diff -c -r1.1 te-vms.h
*** gas/config/te-vms.h	15 Jan 2009 12:42:52 -0000	1.1
--- gas/config/te-vms.h	3 Sep 2009 15:27:32 -0000
***************
*** 1,42 ****
  #define TE_VMS
  #include "obj-format.h"
  
! extern int vms_file_stats_name (const char *, long long *, long *, char *, int *);
  
  /* VMS debugger expects a separator.  */
  #define DWARF2_DIR_SHOULD_END_WITH_SEPARATOR 1
  
  /* VMS debugger needs the file timestamp.  */
  #define DWARF2_FILE_TIME_NAME(FILENAME,DIRNAME)                       \
!  ({                                                                   \
!    long long cdt;                                                     \
!    char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\
!    strcpy (filename, DIRNAME);                                        \
!    strcat (filename, FILENAME);                                       \
!    ((vms_file_stats_name (filename, &cdt, 0, 0, 0) == 0) ? cdt : 0);  \
!  })
  
  /* VMS debugger needs the file size.  */
  #define DWARF2_FILE_SIZE_NAME(FILENAME,DIRNAME)                       \
!  ({                                                                   \
!    long siz;                                                          \
!    char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\
!    strcpy (filename, DIRNAME);                                        \
!    strcat (filename, FILENAME);                                       \
!    ((vms_file_stats_name (filename, 0, &siz, 0, 0) == 0) ? siz : 0);  \
!  })
  
  /* VMS debugger needs the filename with version appended.  */
  /* Longest filename on VMS is 255 characters. Largest version is 32768.  */
  #define DWARF2_FILE_NAME(FILENAME,DIRNAME)                            \
!  ({                                                                   \
!    int ver;                                                           \
!    char buff [255 + 7];                                               \
!    char *filename = (char *) alloca (strlen (FILENAME) + strlen (DIRNAME) + 1);\
!    strcpy (filename, DIRNAME);                                        \
!    strcat (filename, FILENAME);                                       \
!    vms_file_stats_name (filename, 0, 0, 0, &ver);                     \
!    snprintf (buff, 255 + 7, "%s;%d", FILENAME, ver);                  \
!    buff;                                                              \
!  })
! 
--- 1,41 ----
+ /* Copyright 2009 Free Software Foundation, Inc.
+ 
+    This file is part of GAS, the GNU Assembler.
+ 
+    GAS 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 3,
+    or (at your option) any later version.
+ 
+    GAS 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 GAS; see the file COPYING.  If not, write to the Free
+    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+    02110-1301, USA.  */
+ 
  #define TE_VMS
  #include "obj-format.h"
  
! extern bfd_uint64_t vms_dwarf2_file_time_name (const char *, const char *);
! extern long vms_dwarf2_file_size_name (const char *, const char *);
! extern char *vms_dwarf2_file_name (const char *, const char *);
  
  /* VMS debugger expects a separator.  */
  #define DWARF2_DIR_SHOULD_END_WITH_SEPARATOR 1
  
  /* VMS debugger needs the file timestamp.  */
  #define DWARF2_FILE_TIME_NAME(FILENAME,DIRNAME)                       \
!   vms_dwarf2_file_time_name(FILENAME, DIRNAME)
  
  /* VMS debugger needs the file size.  */
  #define DWARF2_FILE_SIZE_NAME(FILENAME,DIRNAME)                       \
!   vms_dwarf2_file_size_name(FILENAME, DIRNAME)
  
  /* VMS debugger needs the filename with version appended.  */
  /* Longest filename on VMS is 255 characters. Largest version is 32768.  */
  #define DWARF2_FILE_NAME(FILENAME,DIRNAME)                            \
!   vms_dwarf2_file_name(FILENAME, DIRNAME)
*** bfd/vmsutil.c	Sun Aug 23 18:41:29 2009
--- gas/config/te-vms.c	Thu Sep  3 15:26:29 2009
***************
*** 1,4 ****
! /* vmsutil.c -- Utilities for VMS.
     Copyright 2009 Free Software Foundation, Inc.
  
     Written by Douglas B Rupp <rupp@gnat.com>
--- 1,4 ----
! /* te-vms.c -- Utilities for VMS.
     Copyright 2009 Free Software Foundation, Inc.
  
     Written by Douglas B Rupp <rupp@gnat.com>
***************
*** 17,24 ****
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
  
! #include "sysdep.h"
! #include "vmsutil.h"
  
  /* The purspose of the two alternate versions below is to have one that
     works for native VMS and one that works on an NFS mounted filesystem
--- 17,24 ----
     along with this program; if not, write to the Free Software
     Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
  
! #include "as.h"
! #include "te-vms.h"
  
  /* The purspose of the two alternate versions below is to have one that
     works for native VMS and one that works on an NFS mounted filesystem
***************
*** 107,119 ****
  
  /* Return VMS file date, size, format, version given a name.  */
  
! int
! vms_file_stats_name (const char *filename,
  		     long long *cdt,
  		     long *siz,
  		     char *rfo,
  		     int *ver)
  {
  #ifdef VMS
    struct FAB fab;
    struct NAM nam;
--- 107,121 ----
  
  /* Return VMS file date, size, format, version given a name.  */
  
! static int
! vms_file_stats_name (const char *dirname,
!                      const char *filename,
  		     long long *cdt,
  		     long *siz,
  		     char *rfo,
  		     int *ver)
  {
+   char fullname[strlen (dirname) + strlen (filename) + 1];
  #ifdef VMS
    struct FAB fab;
    struct NAM nam;
***************
*** 166,172 ****
        return 0;
      }
  
!   tryfile = to_vms_file_spec ((char *) filename);
  
    /* Allocate and initialize a FAB and NAM structures.  */
    fab = cc$rms_fab;
--- 168,177 ----
        return 0;
      }
  
!   strcpy (fullname, dirname);
!   strcat (fullname, filename);
! 
!   tryfile = to_vms_file_spec (fullname);
  
    /* Allocate and initialize a FAB and NAM structures.  */
    fab = cc$rms_fab;
***************
*** 248,254 ****
    struct tm *ts;
    long long gmtoff, secs, nsecs;
  
!   if ((stat (filename, &buff)) != 0)
       return 1;
  
    if (cdt)
--- 253,262 ----
    struct tm *ts;
    long long gmtoff, secs, nsecs;
  
!   strcpy (fullname, dirname);
!   strcat (fullname, filename);
! 
!   if ((stat (fullname, &buff)) != 0)
       return 1;
  
    if (cdt)
***************
*** 303,305 ****
--- 311,347 ----
    return 0;
  }
  
+ bfd_uint64_t
+ vms_dwarf2_file_time_name (const char *filename, const char *dirname)
+ {
+   long long cdt;
+ 
+   if (vms_file_stats_name (dirname, filename, &cdt, 0, 0, 0) == 0)
+     return cdt;
+   else
+     return 0;
+ }
+ 
+ long
+ vms_dwarf2_file_size_name (const char *filename, const char *dirname)
+ {
+   long siz;
+ 
+   if (vms_file_stats_name (dirname, filename, 0, &siz, 0, 0) == 0)
+     return siz;
+   else
+     return 0;
+ }
+ 
+ /* VMS debugger needs the filename with version appended.  */
+ /* Longest filename on VMS is 255 characters. Largest version is 32768.  */
+ char *
+ vms_dwarf2_file_name (const char *filename, const char *dirname)
+ {
+   int ver;
+   static char buff [255 + 7];
+ 
+   vms_file_stats_name (dirname, filename, 0, 0, 0, &ver);
+   snprintf (buff, 255 + 7, "%s;%d", filename, ver);     
+   return buff;
+ }


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