diff options
author | Nick Clifton <nickc@redhat.com> | 2009-07-01 15:02:28 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-07-01 15:02:28 +0000 |
commit | efde2f2ce489a733f5489325437dfadbf948ea62 (patch) | |
tree | 366ea4da12b0ca2e864b9621025b5003b4e20559 | |
parent | e1ec24c6f31afae5a5175abecdcd9fd4d7893c4b (diff) | |
download | gdb-efde2f2ce489a733f5489325437dfadbf948ea62.zip gdb-efde2f2ce489a733f5489325437dfadbf948ea62.tar.gz gdb-efde2f2ce489a733f5489325437dfadbf948ea62.tar.bz2 |
* bfd/bfd.m4 (BFD_HAVE_TIME_TYPE_MEMBER,
BFD_HAVE_SYS_STAT_TYPE_MEMBER): New config functions.
* bfd/configure.in: Use them.
* bfd/configure: Regenerate.
* bfd/config.in: Regnerate.
* bfd/vmsutil.c: Include sysdep.h, remove ansidecl.h.
#define _BSD_SOURCE. Add comments.
(vms_file_stats_name): Calculate creation date based on available
runtime data. Return 1 for version instead of 0.
-rw-r--r-- | bfd/ChangeLog | 12 | ||||
-rw-r--r-- | bfd/bfd.m4 | 38 | ||||
-rw-r--r-- | bfd/config.in | 9 | ||||
-rwxr-xr-x | bfd/configure | 206 | ||||
-rw-r--r-- | bfd/configure.in | 13 | ||||
-rw-r--r-- | bfd/elf-m10300.c | 2 | ||||
-rw-r--r-- | bfd/reloc.c | 2 | ||||
-rw-r--r-- | bfd/vmsutil.c | 67 |
8 files changed, 332 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index aca27d5..57af98c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2009-07-01 Douglas B Rupp <rupp@gnat.com> + + * bfd/bfd.m4 (BFD_HAVE_TIME_TYPE_MEMBER, + BFD_HAVE_SYS_STAT_TYPE_MEMBER): New config functions. + * bfd/configure.in: Use them. + * bfd/configure: Regenerate. + * bfd/config.in: Regnerate. + * bfd/vmsutil.c: Include sysdep.h, remove ansidecl.h. + #define _BSD_SOURCE. Add comments. + (vms_file_stats_name): Calculate creation date based on available + runtime data. Return 1 for version instead of 0. + 2009-07-01 Nick Clifton <nickc@redhat.com> PR 10072 @@ -20,7 +20,6 @@ AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE], AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1) ]) - dnl Check for existence of member $2 in type $1 in sys/procfs.h AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE_MEMBER], @@ -40,3 +39,40 @@ 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 <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) +]) diff --git a/bfd/config.in b/bfd/config.in index d1797ae..c9137c7 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -192,6 +192,12 @@ /* Define if struct core_dumpx has member c_impl */ #undef HAVE_ST_C_IMPL +/* Define if <sys/stat.h> has struct stat.st_mtim.tv_nsec */ +#undef HAVE_ST_MTIM_TV_NSEC + +/* Define if <sys/stat.h> 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 @@ -221,6 +227,9 @@ /* Define to 1 if you have the <time.h> header file. */ #undef HAVE_TIME_H +/* Define if <time.h> has struct tm.tm_gmtoff. */ +#undef HAVE_TM_GMTOFF + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H diff --git a/bfd/configure b/bfd/configure index c3ef346..91fbd0d 100755 --- a/bfd/configure +++ b/bfd/configure @@ -14119,7 +14119,8 @@ done -for ac_header in fcntl.h sys/file.h sys/time.h + +for ac_header in fcntl.h sys/file.h sys/time.h sys/stat.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -18834,6 +18835,209 @@ fi +# Support for VMS timestamps via cross compile + +if test "$ac_cv_header_time_h" = yes; then + echo "$as_me:$LINENO: checking for struct tm.tm_gmtoff in time.h" >&5 +echo $ECHO_N "checking for struct tm.tm_gmtoff in time.h... $ECHO_C" >&6 + if test "${bfd_cv_have_time_type_member_tm_gmtoff+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include <time.h> +int +main () +{ +struct tm avar; void* aref = (void*) &avar.tm_gmtoff + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bfd_cv_have_time_type_member_tm_gmtoff=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_time_type_member_tm_gmtoff=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $bfd_cv_have_time_type_member_tm_gmtoff = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_TM_GMTOFF 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: $bfd_cv_have_time_type_member_tm_gmtoff" >&5 +echo "${ECHO_T}$bfd_cv_have_time_type_member_tm_gmtoff" >&6 + +fi + +if test "$ac_cv_header_sys_stat_h" = yes; then + echo "$as_me:$LINENO: checking for struct stat.st_mtim.tv_sec in sys/stat.h" >&5 +echo $ECHO_N "checking for struct stat.st_mtim.tv_sec in sys/stat.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include <sys/stat.h> +int +main () +{ +struct stat avar; void* aref = (void*) &avar.st_mtim.tv_sec + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ST_MTIM_TV_SEC 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&5 +echo "${ECHO_T}$bfd_cv_have_sys_stat_type_member_st_mtim_tv_sec" >&6 + + echo "$as_me:$LINENO: checking for struct stat.st_mtim.tv_nsec in sys/stat.h" >&5 +echo $ECHO_N "checking for struct stat.st_mtim.tv_nsec in sys/stat.h... $ECHO_C" >&6 + if test "${bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#define _BSD_SOURCE 1 +#include <sys/stat.h> +int +main () +{ +struct stat avar; void* aref = (void*) &avar.st_mtim.tv_nsec + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + if test $bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_ST_MTIM_TV_NSEC 1 +_ACEOF + + fi + echo "$as_me:$LINENO: result: $bfd_cv_have_sys_stat_type_member_st_mtim_tv_nsec" >&5 +echo "${ECHO_T}$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. echo "$as_me:$LINENO: checking for library containing zlibVersion" >&5 diff --git a/bfd/configure.in b/bfd/configure.in index 146785e..11cc83a 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -197,7 +197,7 @@ AC_SUBST(BFD_HOSTPTR_T) BFD_CC_FOR_BUILD AC_CHECK_HEADERS(alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h) -AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h) +AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h) GCC_HEADER_STDINT(bfd_stdint.h) AC_HEADER_TIME AC_HEADER_DIRENT @@ -223,6 +223,17 @@ 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)]) diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 354a503..015e614 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1493,7 +1493,7 @@ mn10300_elf_relocate_section (bfd *output_bfd, /* _32 relocs in executables force _COPY relocs, such that the address of the symbol ends up being local. */ - && !info->executable + && !info->executable && !SYMBOL_REFERENCES_LOCAL (info, hh) && ((input_section->flags & SEC_ALLOC) != 0 /* DWARF will emit R_MN10300_32 relocations diff --git a/bfd/reloc.c b/bfd/reloc.c index cc20a87..1f105de 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -5190,7 +5190,7 @@ ENUM BFD_RELOC_MACH_O_PAIR ENUMDOC Mach-O generic relocations. - + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT diff --git a/bfd/vmsutil.c b/bfd/vmsutil.c index ff4383a..3dbfb8c 100644 --- a/bfd/vmsutil.c +++ b/bfd/vmsutil.c @@ -17,9 +17,14 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "ansidecl.h" +#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 <vms/starlet.h> @@ -89,12 +94,16 @@ to_vms_file_spec (char *filespec) return vms_filespec; } -#else +#else /* not VMS */ + +#define _BSD_SOURCE 1 #include <sys/stat.h> #include <time.h> -#define VMS_EPOCH_OFFSET 35067168000000000LL -#define VMS_GRANULARITY_FACTOR 10000000 -#endif + +#define VMS_EPOCH_OFFSET 35067168000000000LL +#define VMS_GRANULARITY_FACTOR 10000000 + +#endif /* VMS */ /* Return VMS file date, size, format, version given a name. */ @@ -232,19 +241,50 @@ vms_file_stats_name (const char *filename, (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); + if (ver) *ver = strtol (strrchr (ascnamebuff, ';') + 1, 0, 10); +#else /* not VMS */ - return 0; -#else struct stat buff; + struct tm *ts; + long long gmtoff, secs, nsecs; if ((stat (filename, &buff)) != 0) return 1; if (cdt) { - *cdt = (long long) (buff.st_mtime * VMS_GRANULARITY_FACTOR) - + VMS_EPOCH_OFFSET; + 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) @@ -253,10 +293,13 @@ vms_file_stats_name (const char *filename, 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 = 0; + *ver = 1; +#endif /* VMS */ return 0; -#endif } |