From: Tristan Gingold Date: Mon, 7 Sep 2009 09:15:31 +0000 (+0000) Subject: bfd/: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b11d79f2b289c401770bbb05c82fbd761e4657a4;p=binutils-gdb.git bfd/: 2009-09-07 Tristan Gingold * 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-07 Tristan Gingold * 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5668d919cb8..e79185c040e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,18 @@ +2009-09-07 Tristan Gingold + + * 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. + 2009-09-05 Eli Zaretskii * coffcode.h: Include libiberty.h. @@ -822,7 +837,7 @@ BFD_HAVE_SYS_STAT_TYPE_MEMBER): New config functions. * configure.in: Use them. * configure: Regenerate. - * config.in: Regnerate. + * config.in: Regenerate. * vmsutil.c: Include sysdep.h, remove ansidecl.h. #define _BSD_SOURCE. Add comments. (vms_file_stats_name): Calculate creation date based on available diff --git a/bfd/Makefile.am b/bfd/Makefile.am index f6142dc517e..13ace292176 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -390,7 +390,6 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ vms.lo \ - vmsutil.lo \ xcofflink.lo \ xsym.lo \ xtensa-isa.lo \ @@ -573,7 +572,6 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ vms.c \ - vmsutil.c \ xcofflink.c \ xsym.c \ xtensa-isa.c \ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 04e23168408..721069f05e7 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -686,7 +686,6 @@ BFD32_BACKENDS = \ vms-misc.lo \ vms-tir.lo \ vms.lo \ - vmsutil.lo \ xcofflink.lo \ xsym.lo \ xtensa-isa.lo \ @@ -869,7 +868,6 @@ BFD32_BACKENDS_CFILES = \ vms-misc.c \ vms-tir.c \ vms.c \ - vmsutil.c \ xcofflink.c \ xsym.c \ xtensa-isa.c \ @@ -1477,7 +1475,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-tir.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vmsutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcofflink.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsym.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtensa-isa.Plo@am__quote@ diff --git a/bfd/bfd.m4 b/bfd/bfd.m4 index 96f03d4d1ab..55cc2bebbb8 100644 --- a/bfd/bfd.m4 +++ b/bfd/bfd.m4 @@ -39,40 +39,3 @@ AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER], 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 ], - [$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 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 ], - [$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 has $1.$2.$3]) - fi - AC_MSG_RESULT($bfd_cv_have_sys_stat_type_member_$2_$3) -]) diff --git a/bfd/config.in b/bfd/config.in index f70f2b301b3..3cb2bfc675f 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -192,12 +192,6 @@ /* Define if struct core_dumpx has member c_impl */ #undef HAVE_ST_C_IMPL -/* Define if has struct stat.st_mtim.tv_nsec */ -#undef HAVE_ST_MTIM_TV_NSEC - -/* Define if has struct stat.st_mtim.tv_sec */ -#undef HAVE_ST_MTIM_TV_SEC - /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF @@ -227,9 +221,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H -/* Define if has struct tm.tm_gmtoff. */ -#undef HAVE_TM_GMTOFF - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/bfd/configure b/bfd/configure index 0c06a609876..865ef6964bd 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13583,119 +13583,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -# Support for VMS timestamps via cross compile - -if test "$ac_cv_header_time_h" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct tm.tm_gmtoff in time.h" >&5 -$as_echo_n "checking for struct tm.tm_gmtoff in time.h... " >&6; } - if test "${bfd_cv_have_time_type_member_tm_gmtoff+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _BSD_SOURCE 1 -#include -int -main () -{ -struct tm avar; void* aref = (void*) &avar.tm_gmtoff - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - bfd_cv_have_time_type_member_tm_gmtoff=yes -else - bfd_cv_have_time_type_member_tm_gmtoff=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - if test $bfd_cv_have_time_type_member_tm_gmtoff = yes; then - -$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_time_type_member_tm_gmtoff" >&5 -$as_echo "$bfd_cv_have_time_type_member_tm_gmtoff" >&6; } - -fi - -if test "$ac_cv_header_sys_stat_h" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_sec in sys/stat.h" >&5 -$as_echo_n "checking for struct stat.st_mtim.tv_sec in sys/stat.h... " >&6; } - if test "${bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _BSD_SOURCE 1 -#include -int -main () -{ -struct stat avar; void* aref = (void*) &avar.st_mtim.tv_sec - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec=yes -else - bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - if test $bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec = yes; then - -$as_echo "#define HAVE_ST_MTIM_TV_SEC 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&5 -$as_echo "$bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_nsec in sys/stat.h" >&5 -$as_echo_n "checking for struct stat.st_mtim.tv_nsec in sys/stat.h... " >&6; } - if test "${bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _BSD_SOURCE 1 -#include -int -main () -{ -struct stat avar; void* aref = (void*) &avar.st_mtim.tv_nsec - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec=yes -else - bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi - - if test $bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec = yes; then - -$as_echo "#define HAVE_ST_MTIM_TV_NSEC 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec" >&5 -$as_echo "$bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec" >&6; } - -fi - # Link in zlib if we can. This allows us to read compressed debug sections. # This is used only by compress.c. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing zlibVersion" >&5 @@ -15023,7 +14910,7 @@ do 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_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 ;; diff --git a/bfd/configure.in b/bfd/configure.in index a3cc89ad119..bf4dc6cfe12 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -223,17 +223,6 @@ AC_CHECK_DECLS(strstr) 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)]) @@ -809,7 +798,7 @@ do 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_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 ;; diff --git a/bfd/vmsutil.c b/bfd/vmsutil.c deleted file mode 100644 index 3dbfb8cfc05..00000000000 --- a/bfd/vmsutil.c +++ /dev/null @@ -1,305 +0,0 @@ -/* vmsutil.c -- Utilities for VMS. - Copyright 2009 Free Software Foundation, Inc. - - Written by Douglas B Rupp - - 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 3 of the License, 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, 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 - (Unix Server/VMS client). The main issue being to generate the special - VMS file timestamps for the debug info. */ - -#ifdef VMS -#define __NEW_STARLET 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAXPATH 256 - -/* Descrip.h doesn't have everything... */ -typedef struct fibdef * __fibdef_ptr32 __attribute__ (( mode (SI) )); - -struct dsc$descriptor_fib -{ - unsigned int fib$l_len; - __fibdef_ptr32 fib$l_addr; -}; - -/* I/O Status Block. */ -struct IOSB -{ - unsigned short status, count; - unsigned int devdep; -}; - -static char *tryfile; - -/* Variable length string. */ -struct vstring -{ - short length; - char string[NAM$C_MAXRSS+1]; -}; - -static char filename_buff [MAXPATH]; -static char vms_filespec [MAXPATH]; - -/* Callback function for filespec style conversion. */ - -static int -translate_unix (char *name, int type ATTRIBUTE_UNUSED) -{ - strncpy (filename_buff, name, MAXPATH); - filename_buff [MAXPATH - 1] = (char) 0; - return 0; -} - -/* Wrapper for DECC function that converts a Unix filespec - to VMS style filespec. */ - -static char * -to_vms_file_spec (char *filespec) -{ - strncpy (vms_filespec, "", MAXPATH); - decc$to_vms (filespec, translate_unix, 1, 1); - strncpy (vms_filespec, filename_buff, MAXPATH); - - vms_filespec [MAXPATH - 1] = (char) 0; - - return vms_filespec; -} - -#else /* not VMS */ - -#define _BSD_SOURCE 1 -#include -#include - -#define VMS_EPOCH_OFFSET 35067168000000000LL -#define VMS_GRANULARITY_FACTOR 10000000 - -#endif /* VMS */ - -/* 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; - - unsigned long long create; - FAT recattr; - char ascnamebuff [256]; - - ATRDEF atrlst[] - = { - { ATR$S_CREDATE, ATR$C_CREDATE, &create }, - { ATR$S_RECATTR, ATR$C_RECATTR, &recattr }, - { ATR$S_ASCNAME, ATR$C_ASCNAME, &ascnamebuff }, - { 0, 0, 0} - }; - - FIBDEF fib; - struct dsc$descriptor_fib fibdsc = {sizeof (fib), (void *) &fib}; - - struct IOSB iosb; - - long status; - unsigned short chan; - - struct vstring file; - struct dsc$descriptor_s filedsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) file.string}; - struct vstring device; - struct dsc$descriptor_s devicedsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) device.string}; - struct vstring result; - struct dsc$descriptor_s resultdsc - = {NAM$C_MAXRSS, DSC$K_DTYPE_VT, DSC$K_CLASS_VS, (void *) result.string}; - - if (strcmp (filename, "") == 0 - || strcmp (filename, "") == 0) - { - if (cdt) - *cdt = 0; - - if (siz) - *siz = 0; - - if (rfo) - *rfo = 0; - - if (ver) - *ver = 0; - - return 0; - } - - tryfile = to_vms_file_spec ((char *) filename); - - /* Allocate and initialize a FAB and NAM structures. */ - fab = cc$rms_fab; - nam = cc$rms_nam; - - nam.nam$l_esa = file.string; - nam.nam$b_ess = NAM$C_MAXRSS; - nam.nam$l_rsa = result.string; - nam.nam$b_rss = NAM$C_MAXRSS; - fab.fab$l_fna = tryfile; - fab.fab$b_fns = strlen (tryfile); - fab.fab$l_nam = &nam; - - /* Validate filespec syntax and device existence. */ - status = SYS$PARSE (&fab, 0, 0); - if ((status & 1) != 1) - return 1; - - file.string[nam.nam$b_esl] = 0; - - /* Find matching filespec. */ - status = SYS$SEARCH (&fab, 0, 0); - if ((status & 1) != 1) - return 1; - - file.string[nam.nam$b_esl] = 0; - result.string[result.length=nam.nam$b_rsl] = 0; - - /* Get the device name and assign an IO channel. */ - strncpy (device.string, nam.nam$l_dev, nam.nam$b_dev); - devicedsc.dsc$w_length = nam.nam$b_dev; - chan = 0; - status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0); - if ((status & 1) != 1) - return 1; - - /* Initialize the FIB and fill in the directory id field. */ - memset (&fib, 0, sizeof (fib)); - fib.fib$w_did[0] = nam.nam$w_did[0]; - fib.fib$w_did[1] = nam.nam$w_did[1]; - fib.fib$w_did[2] = nam.nam$w_did[2]; - fib.fib$l_acctl = 0; - fib.fib$l_wcc = 0; - strcpy (file.string, (strrchr (result.string, ']') + 1)); - filedsc.dsc$w_length = strlen (file.string); - result.string[result.length = 0] = 0; - - /* Open and close the file to fill in the attributes. */ - status - = SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0, - &fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0); - if ((status & 1) != 1) - return 1; - if ((iosb.status & 1) != 1) - return 1; - - result.string[result.length] = 0; - status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0, - &atrlst, 0); - if ((status & 1) != 1) - return 1; - if ((iosb.status & 1) != 1) - return 1; - - /* Deassign the channel and exit. */ - status = SYS$DASSGN (chan); - if ((status & 1) != 1) - return 1; - - if (cdt) *cdt = create; - if (siz) *siz = (512 * 65536 * recattr.fat$w_efblkh) + - (512 * (recattr.fat$w_efblkl - 1)) + - recattr.fat$w_ffbyte; - if (rfo) *rfo = recattr.fat$v_rtype; - if (ver) *ver = strtol (strrchr (ascnamebuff, ';') + 1, 0, 10); -#else /* not VMS */ - - struct stat buff; - struct tm *ts; - long long gmtoff, secs, nsecs; - - if ((stat (filename, &buff)) != 0) - return 1; - - if (cdt) - { - ts = localtime (& buff.st_mtime); - -#ifdef HAVE_TM_GMTOFF - gmtoff = ts->tm_gmtoff; -#else - { - extern long timezone; - - if (ts->tm_isdst == 1) - gmtoff = - (timezone - 3600); - else - gmtoff = - timezone; - } -#endif - -#ifdef HAVE_ST_MTIM_TV_SEC - secs = buff.st_mtim.tv_sec; -#else - secs = buff.st_mtime; -#endif - -#ifdef HAVE_ST_MTIM_TV_NSEC - nsecs = buff.st_mtim.tv_nsec; -#else - nsecs = 0; -#endif - - /* VMS timestamps are stored in local time to 100 nsec accuracy, but by - experiment I found timestamps truncated to (at least) microseconds - on an NFS mounted filesystem, hence the adjustment below. DBR. */ - *cdt = ((secs + gmtoff) * VMS_GRANULARITY_FACTOR) - + (nsecs / 1000 * 10) + VMS_EPOCH_OFFSET; - } - - if (siz) - *siz = buff.st_size; - - if (rfo) - *rfo = 2; /* Stream LF format. */ - - /* Returning a file version of 0 is never correct for debug info, version 1 - will be correct if file editing is done only on the Unix side. If editing - is done on the VMS side, then its TBD. */ - if (ver) - *ver = 1; -#endif /* VMS */ - - return 0; -} - diff --git a/bfd/vmsutil.h b/bfd/vmsutil.h deleted file mode 100644 index 6eda5720866..00000000000 --- a/bfd/vmsutil.h +++ /dev/null @@ -1,20 +0,0 @@ -/* vmsutil.h -- Header file for utilities for VMS. - Copyright 2009 Free Software Foundation, Inc. - - Written by Douglas B Rupp - - 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 3 of the License, 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, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -extern int vms_file_stats_name (const char *, long long *, long *, char *, int *); diff --git a/gas/ChangeLog b/gas/ChangeLog index f5253a8990c..ab9eb978cd0 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,31 @@ +2009-09-07 Tristan Gingold + + * 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. + 2009-09-05 Jie Zhang * doc/as.texinfo: Document that Blackfin GAS does not diff --git a/gas/Makefile.am b/gas/Makefile.am index b7852768505..d3e88366781 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -427,6 +427,9 @@ TARG_ENV_HFILES = \ config/te-vxworks.h \ config/te-wince-pe.h +TARG_ENV_CFILES = \ + config/te-vms.c + # Multi files in config MULTI_CFILES = \ @@ -481,7 +484,8 @@ CONFIG_ATOF_CFILES = \ OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS) -POTFILES = $(MULTI_CFILES) $(CONFIG_ATOF_CFILES) $(TARG_ENV_HFILES) $(OBJ_FORMAT_HFILES) \ +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,7 +535,7 @@ as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \ $(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) + $(TARG_ENV_CFILES) $(CONFIG_ATOF_CFILES) $(MULTI_CFILES) EXPECT = expect RUNTEST = runtest diff --git a/gas/Makefile.in b/gas/Makefile.in index 5e762787468..e31368609ad 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -691,6 +691,9 @@ TARG_ENV_HFILES = \ config/te-vxworks.h \ config/te-wince-pe.h +TARG_ENV_CFILES = \ + config/te-vms.c + # Multi files in config MULTI_CFILES = \ @@ -744,7 +747,8 @@ CONFIG_ATOF_CFILES = \ config/atof-vax.c OBJS = $(CONFIG_OBJS) $(GENERIC_OBJS) -POTFILES = $(MULTI_CFILES) $(CONFIG_ATOF_CFILES) $(TARG_ENV_HFILES) $(OBJ_FORMAT_HFILES) \ +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) @@ -787,8 +791,8 @@ as_new_DEPENDENCIES = $(TARG_CPU_O) $(OBJ_FORMAT_O) $(ATOF_TARG_O) \ # The m68k operand parser. EXTRA_as_new_SOURCES = $(CFILES) $(HFILES) $(TARGET_CPU_CFILES) \ $(TARGET_CPU_HFILES) $(OBJ_FORMAT_CFILES) $(OBJ_FORMAT_HFILES) \ - $(CONFIG_ATOF_CFILES) $(MULTI_CFILES) config/m68k-parse.y \ - config/bfin-parse.y + $(TARG_ENV_CFILES) $(CONFIG_ATOF_CFILES) $(MULTI_CFILES) \ + config/m68k-parse.y config/bfin-parse.y EXPECT = expect RUNTEST = runtest RUNTESTFLAGS = @@ -1001,6 +1005,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-xtensa.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-z80.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-z8k.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/te-vms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtensa-relax.Po@am__quote@ @@ -2005,6 +2010,20 @@ obj-som.obj: config/obj-som.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o obj-som.obj `if test -f 'config/obj-som.c'; then $(CYGPATH_W) 'config/obj-som.c'; else $(CYGPATH_W) '$(srcdir)/config/obj-som.c'; fi` +te-vms.o: config/te-vms.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT te-vms.o -MD -MP -MF $(DEPDIR)/te-vms.Tpo -c -o te-vms.o `test -f 'config/te-vms.c' || echo '$(srcdir)/'`config/te-vms.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/te-vms.Tpo $(DEPDIR)/te-vms.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/te-vms.c' object='te-vms.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o te-vms.o `test -f 'config/te-vms.c' || echo '$(srcdir)/'`config/te-vms.c + +te-vms.obj: config/te-vms.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT te-vms.obj -MD -MP -MF $(DEPDIR)/te-vms.Tpo -c -o te-vms.obj `if test -f 'config/te-vms.c'; then $(CYGPATH_W) 'config/te-vms.c'; else $(CYGPATH_W) '$(srcdir)/config/te-vms.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/te-vms.Tpo $(DEPDIR)/te-vms.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/te-vms.c' object='te-vms.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o te-vms.obj `if test -f 'config/te-vms.c'; then $(CYGPATH_W) 'config/te-vms.c'; else $(CYGPATH_W) '$(srcdir)/config/te-vms.c'; fi` + atof-ieee.o: config/atof-ieee.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT atof-ieee.o -MD -MP -MF $(DEPDIR)/atof-ieee.Tpo -c -o atof-ieee.o `test -f 'config/atof-ieee.c' || echo '$(srcdir)/'`config/atof-ieee.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/atof-ieee.Tpo $(DEPDIR)/atof-ieee.Po diff --git a/gas/acinclude.m4 b/gas/acinclude.m4 index fa4c1bc6e9f..40722c6888a 100644 --- a/gas/acinclude.m4 +++ b/gas/acinclude.m4 @@ -54,3 +54,41 @@ for _gas_uniq_i in _gas_uniq_dummy [$]_gas_uniq_list ; do 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 ], + [$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 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 ], + [$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 has $1.$2.$3]) + fi + AC_MSG_RESULT($gas_cv_have_sys_stat_type_member_$2_$3) +])dnl diff --git a/gas/config.in b/gas/config.in index a50666a9dc5..9493de72427 100644 --- a/gas/config.in +++ b/gas/config.in @@ -89,12 +89,24 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define if has struct stat.st_mtim.tv_nsec */ +#undef HAVE_ST_MTIM_TV_NSEC + +/* Define if has struct stat.st_mtim.tv_sec */ +#undef HAVE_ST_MTIM_TV_SEC + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define if has struct tm.tm_gmtoff. */ +#undef HAVE_TM_GMTOFF + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/gas/config/te-vms.c b/gas/config/te-vms.c new file mode 100644 index 00000000000..42f965ae412 --- /dev/null +++ b/gas/config/te-vms.c @@ -0,0 +1,347 @@ +/* te-vms.c -- Utilities for VMS. + Copyright 2009 Free Software Foundation, Inc. + + Written by Douglas B Rupp + + 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 3 of the License, 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, 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 + (Unix Server/VMS client). The main issue being to generate the special + VMS file timestamps for the debug info. */ + +#ifdef VMS +#define __NEW_STARLET 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXPATH 256 + +/* Descrip.h doesn't have everything... */ +typedef struct fibdef * __fibdef_ptr32 __attribute__ (( mode (SI) )); + +struct dsc$descriptor_fib +{ + unsigned int fib$l_len; + __fibdef_ptr32 fib$l_addr; +}; + +/* I/O Status Block. */ +struct IOSB +{ + unsigned short status, count; + unsigned int devdep; +}; + +static char *tryfile; + +/* Variable length string. */ +struct vstring +{ + short length; + char string[NAM$C_MAXRSS+1]; +}; + +static char filename_buff [MAXPATH]; +static char vms_filespec [MAXPATH]; + +/* Callback function for filespec style conversion. */ + +static int +translate_unix (char *name, int type ATTRIBUTE_UNUSED) +{ + strncpy (filename_buff, name, MAXPATH); + filename_buff [MAXPATH - 1] = (char) 0; + return 0; +} + +/* Wrapper for DECC function that converts a Unix filespec + to VMS style filespec. */ + +static char * +to_vms_file_spec (char *filespec) +{ + strncpy (vms_filespec, "", MAXPATH); + decc$to_vms (filespec, translate_unix, 1, 1); + strncpy (vms_filespec, filename_buff, MAXPATH); + + vms_filespec [MAXPATH - 1] = (char) 0; + + return vms_filespec; +} + +#else /* not VMS */ + +#define _BSD_SOURCE 1 +#include +#include + +#define VMS_EPOCH_OFFSET 35067168000000000LL +#define VMS_GRANULARITY_FACTOR 10000000 + +#endif /* VMS */ + +/* 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; + + unsigned long long create; + FAT recattr; + char ascnamebuff [256]; + + ATRDEF atrlst[] + = { + { ATR$S_CREDATE, ATR$C_CREDATE, &create }, + { ATR$S_RECATTR, ATR$C_RECATTR, &recattr }, + { ATR$S_ASCNAME, ATR$C_ASCNAME, &ascnamebuff }, + { 0, 0, 0} + }; + + FIBDEF fib; + struct dsc$descriptor_fib fibdsc = {sizeof (fib), (void *) &fib}; + + struct IOSB iosb; + + long status; + unsigned short chan; + + struct vstring file; + struct dsc$descriptor_s filedsc + = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) file.string}; + struct vstring device; + struct dsc$descriptor_s devicedsc + = {NAM$C_MAXRSS, DSC$K_DTYPE_T, DSC$K_CLASS_S, (void *) device.string}; + struct vstring result; + struct dsc$descriptor_s resultdsc + = {NAM$C_MAXRSS, DSC$K_DTYPE_VT, DSC$K_CLASS_VS, (void *) result.string}; + + if (strcmp (filename, "") == 0 + || strcmp (filename, "") == 0) + { + if (cdt) + *cdt = 0; + + if (siz) + *siz = 0; + + if (rfo) + *rfo = 0; + + if (ver) + *ver = 0; + + 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; + nam = cc$rms_nam; + + nam.nam$l_esa = file.string; + nam.nam$b_ess = NAM$C_MAXRSS; + nam.nam$l_rsa = result.string; + nam.nam$b_rss = NAM$C_MAXRSS; + fab.fab$l_fna = tryfile; + fab.fab$b_fns = strlen (tryfile); + fab.fab$l_nam = &nam; + + /* Validate filespec syntax and device existence. */ + status = SYS$PARSE (&fab, 0, 0); + if ((status & 1) != 1) + return 1; + + file.string[nam.nam$b_esl] = 0; + + /* Find matching filespec. */ + status = SYS$SEARCH (&fab, 0, 0); + if ((status & 1) != 1) + return 1; + + file.string[nam.nam$b_esl] = 0; + result.string[result.length=nam.nam$b_rsl] = 0; + + /* Get the device name and assign an IO channel. */ + strncpy (device.string, nam.nam$l_dev, nam.nam$b_dev); + devicedsc.dsc$w_length = nam.nam$b_dev; + chan = 0; + status = SYS$ASSIGN (&devicedsc, &chan, 0, 0, 0); + if ((status & 1) != 1) + return 1; + + /* Initialize the FIB and fill in the directory id field. */ + memset (&fib, 0, sizeof (fib)); + fib.fib$w_did[0] = nam.nam$w_did[0]; + fib.fib$w_did[1] = nam.nam$w_did[1]; + fib.fib$w_did[2] = nam.nam$w_did[2]; + fib.fib$l_acctl = 0; + fib.fib$l_wcc = 0; + strcpy (file.string, (strrchr (result.string, ']') + 1)); + filedsc.dsc$w_length = strlen (file.string); + result.string[result.length = 0] = 0; + + /* Open and close the file to fill in the attributes. */ + status + = SYS$QIOW (0, chan, IO$_ACCESS|IO$M_ACCESS, &iosb, 0, 0, + &fibdsc, &filedsc, &result.length, &resultdsc, &atrlst, 0); + if ((status & 1) != 1) + return 1; + if ((iosb.status & 1) != 1) + return 1; + + result.string[result.length] = 0; + status = SYS$QIOW (0, chan, IO$_DEACCESS, &iosb, 0, 0, &fibdsc, 0, 0, 0, + &atrlst, 0); + if ((status & 1) != 1) + return 1; + if ((iosb.status & 1) != 1) + return 1; + + /* Deassign the channel and exit. */ + status = SYS$DASSGN (chan); + if ((status & 1) != 1) + return 1; + + if (cdt) *cdt = create; + if (siz) *siz = (512 * 65536 * recattr.fat$w_efblkh) + + (512 * (recattr.fat$w_efblkl - 1)) + + recattr.fat$w_ffbyte; + if (rfo) *rfo = recattr.fat$v_rtype; + if (ver) *ver = strtol (strrchr (ascnamebuff, ';') + 1, 0, 10); +#else /* not VMS */ + + struct stat buff; + struct tm *ts; + long long gmtoff, secs, nsecs; + + strcpy (fullname, dirname); + strcat (fullname, filename); + + if ((stat (fullname, &buff)) != 0) + return 1; + + if (cdt) + { + ts = localtime (& buff.st_mtime); + +#ifdef HAVE_TM_GMTOFF + gmtoff = ts->tm_gmtoff; +#else + { + extern long timezone; + + if (ts->tm_isdst == 1) + gmtoff = - (timezone - 3600); + else + gmtoff = - timezone; + } +#endif + +#ifdef HAVE_ST_MTIM_TV_SEC + secs = buff.st_mtim.tv_sec; +#else + secs = buff.st_mtime; +#endif + +#ifdef HAVE_ST_MTIM_TV_NSEC + nsecs = buff.st_mtim.tv_nsec; +#else + nsecs = 0; +#endif + + /* VMS timestamps are stored in local time to 100 nsec accuracy, but by + experiment I found timestamps truncated to (at least) microseconds + on an NFS mounted filesystem, hence the adjustment below. DBR. */ + *cdt = ((secs + gmtoff) * VMS_GRANULARITY_FACTOR) + + (nsecs / 1000 * 10) + VMS_EPOCH_OFFSET; + } + + if (siz) + *siz = buff.st_size; + + if (rfo) + *rfo = 2; /* Stream LF format. */ + + /* Returning a file version of 0 is never correct for debug info, version 1 + will be correct if file editing is done only on the Unix side. If editing + is done on the VMS side, then its TBD. */ + if (ver) + *ver = 1; +#endif /* VMS */ + + 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; +} diff --git a/gas/config/te-vms.h b/gas/config/te-vms.h index 7c352ac1d9f..0c3a1940659 100644 --- a/gas/config/te-vms.h +++ b/gas/config/te-vms.h @@ -1,42 +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 int vms_file_stats_name (const char *, long long *, long *, char *, int *); +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) \ - ({ \ - 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_dwarf2_file_time_name(FILENAME, DIRNAME) /* 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_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) \ - ({ \ - 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; \ - }) - + vms_dwarf2_file_name(FILENAME, DIRNAME) diff --git a/gas/configure b/gas/configure index e4ed8c4f919..a0d17636fa3 100755 --- a/gas/configure +++ b/gas/configure @@ -12062,6 +12062,10 @@ _ACEOF 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 @@ -12976,7 +12980,7 @@ fi -for ac_header in string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h limits.h +for ac_header in 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 do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -13790,6 +13794,120 @@ $as_echo "#define USE_BINARY_FOPEN 1" >>confdefs.h ;; esac +# Support for VMS timestamps via cross compile + +if test "$ac_cv_header_time_h" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct tm.tm_gmtoff in time.h" >&5 +$as_echo_n "checking for struct tm.tm_gmtoff in time.h... " >&6; } + if test "${gas_cv_have_time_type_member_tm_gmtoff+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include +int +main () +{ +struct tm avar; void* aref = (void*) &avar.tm_gmtoff + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gas_cv_have_time_type_member_tm_gmtoff=yes +else + gas_cv_have_time_type_member_tm_gmtoff=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $gas_cv_have_time_type_member_tm_gmtoff = yes; then + +$as_echo "#define HAVE_TM_GMTOFF 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gas_cv_have_time_type_member_tm_gmtoff" >&5 +$as_echo "$gas_cv_have_time_type_member_tm_gmtoff" >&6; } + +fi + +if test "$ac_cv_header_sys_stat_h" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_sec in sys/stat.h" >&5 +$as_echo_n "checking for struct stat.st_mtim.tv_sec in sys/stat.h... " >&6; } + if test "${gas_cv_have_sys_stat_type_member_st_mtim_tv_sec+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include +int +main () +{ +struct stat avar; void* aref = (void*) &avar.st_mtim.tv_sec + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gas_cv_have_sys_stat_type_member_st_mtim_tv_sec=yes +else + gas_cv_have_sys_stat_type_member_st_mtim_tv_sec=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $gas_cv_have_sys_stat_type_member_st_mtim_tv_sec = yes; then + +$as_echo "#define HAVE_ST_MTIM_TV_SEC 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gas_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&5 +$as_echo "$gas_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct stat.st_mtim.tv_nsec in sys/stat.h" >&5 +$as_echo_n "checking for struct stat.st_mtim.tv_nsec in sys/stat.h... " >&6; } + if test "${gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include +int +main () +{ +struct stat avar; void* aref = (void*) &avar.st_mtim.tv_nsec + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec=yes +else + gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec = yes; then + +$as_echo "#define HAVE_ST_MTIM_TV_NSEC 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec" >&5 +$as_echo "$gas_cv_have_sys_stat_type_member_st_mtim_tv_nsec" >&6; } + +fi + + diff --git a/gas/configure.com b/gas/configure.com index 611b142014d..615dc2277b5 100644 --- a/gas/configure.com +++ b/gas/configure.com @@ -9,12 +9,14 @@ $ arch=F$EDIT(arch,"LOWERCASE") $ 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,8 +35,9 @@ $ close outfile $! $ write sys$output "Generate targ-env.h" $! -$ create targ-env.h -#include "te-generic.h" +$ open/write outfile targ-env.h +$ write outfile "#include ""te-''env'.h""" +$ close outfile $! $ write sys$output "Generate obj-format.[ch]" $! @@ -219,7 +222,24 @@ $ LIBBFD = ",[-.bfd]libbfd.olb/lib" $ 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,7 +257,8 @@ $ endif $ purge $! $ write sys$output "Building as.exe" -$ AS_OBJS="targ-cpu," + FILES + LIBOPCODES + LIBBFD + LIBIBERTY +$ AS_OBJS=AS_OBJS + LIBOPCODES + LIBBFD + LIBIBERTY $ link/exe=as 'AS_OBJS +$EOD $exit diff --git a/gas/configure.in b/gas/configure.in index 7d4da951d09..2c456e0a6ab 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -386,6 +386,10 @@ changequote([,])dnl 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,7 +613,7 @@ AM_MAINTAINER_MODE 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) +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,6 +701,18 @@ AC_CHECK_DECLS([vsnprintf]) 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) diff --git a/gas/makefile.vms b/gas/makefile.vms index a34f4a1f1a2..1cf4407a00f 100644 --- a/gas/makefile.vms +++ b/gas/makefile.vms @@ -21,7 +21,7 @@ CFLAGS=/names=(as_is,shortened)\ 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,\ + 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,6 +42,9 @@ targ-cpu.obj: targ-cpu.c targ-cpu.h $(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;