The previous change to __gnat_copy_attribs led to relying on utimes for
timestamp propagation on VxWorks 6 as well, which results in undefined
symbol references at runtime in most configurations for such targets.

Restore the previous code for such environments, based on utime instead.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

        * adaint.c (__gnat_copy_attribs): Reinstate code based on utime
        for timestamp processing on VxWorks 6.
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3267,7 +3267,22 @@ __gnat_copy_attribs (char *from ATTRIBUTE_UNUSED, char *to ATTRIBUTE_UNUSED,
      return -1;
   }
 
-#if _POSIX_C_SOURCE >= 200809L
+#if (defined (__vxworks) && _WRS_VXWORKS_MAJOR < 7)
+
+  /* VxWorks prior to 7 only has utime.  */
+
+  /* Do we need to copy the timestamp ?  */
+  if (mode != 2) {
+    struct utimbuf tbuf;
+
+    tbuf.actime = fbuf.st_atime;
+    tbuf.modtime = fbuf.st_mtime;
+
+    if (utime (to, &tbuf) == -1)
+      return -1;
+  }
+
+#elif _POSIX_C_SOURCE >= 200809L
   struct timespec tbuf[2];
 
   if (mode != 2) {


Reply via email to