From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id 6A043385781C for ; Tue, 16 Feb 2021 13:02:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6A043385781C From: Hans-Peter Nilsson To: Subject: Committed: Complete revert of 2019-08-19, st_atime in libc/include/sys/stat.h MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Message-ID: <20210216130212.24AE2203D1@pchp3.se.axis.com> Date: Tue, 16 Feb 2021 14:02:12 +0100 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2021 13:02:15 -0000 The revert-part of the revert-and-fix commit, b99887c4283f a.k.a. "Revert previous change to sys/stat.h and fix cris libgloss", apparently intending to revert f75aa6785151 a.k.a. "Fix regression in cris-elf caused by sys/stat.h change" and fix it in another way, wasn't complete. Although the fix-part added the prerequisite "#undef st_atime" (et al) to gensyscalls, the revert-part didn't revert the "&& !defined(__cris__)" in sys/stat.h, stopping st_atime (et al) from being defined. The effect of the unreverted change is that accessing the struct stat compatibility member names "st_atime" (et al) as in "struct stat mystat; mystat.st_atime;" yields errors, observable for example when building libgfortran in gcc: /x/gcc/libgfortran/intrinsics/stat.c:114:42: error: 'struct stat' has \ no member named 'st_atime'; did you mean 'st_atim'? 114 | sarray->base_addr[8 * stride] = sb.st_atime; | ^~~~~~~~ | st_atim (etc.) Trivially fixed by completing the reversion, removing the "&& !defined(__cris__)" in sys/stat.h. Beware: the net effect of the earlier related change to struct stat in sys/stat.h, leading up to the fix, *does* change its definition as a type. Thankfully, replacing members like "time_t st_atime; long st_spare1;" by "struct timespec st_atim;", ditto st_mtim and st_ctim, is layout-compatible. To wit, that change is "binary compatible". Incidentally, related to the simulator / Linux ABI, there's a transitional stage (see gensyscalls), reloading between "struct stat" (sys/stat.h) and "struct new_stat" (kernel/simulator) as necessary. Tested by a cris-elf gcc build (including libgfortran). --- newlib/libc/include/sys/stat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index 722ed0eff131..68f839b3515c 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -50,7 +50,7 @@ struct stat #endif }; -#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) && !defined(__cris__) +#if !(defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)) #define st_atime st_atim.tv_sec #define st_ctime st_ctim.tv_sec #define st_mtime st_mtim.tv_sec -- 2.11.0