From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 24 Feb 2023 13:03:51 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pVWnn-000oJi-5Y for lore@lore.pengutronix.de; Fri, 24 Feb 2023 13:03:51 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pVWnm-0008UU-Eg; Fri, 24 Feb 2023 13:03:50 +0100 Received: from smtp107.iad3a.emailsrvr.com ([173.203.187.107]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pVWnG-0008UJ-Hu for ptxdist@pengutronix.de; Fri, 24 Feb 2023 13:03:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1677240196; bh=V/dBBAnPmeAh0Ijozu5KHjg4/7ArXxXck6qpKK29N4M=; h=Date:Subject:To:From:From; b=k9rczhcmto47e/ZMCVrzlS0oeHxw3QreHQoCleEMlD/oVtpYl9AnxhQyx+6qXO15I wOyqHW9IANbEOLRkxCGLcVoyPhWBdiR3JybJZiR2GZCqQ07fR5DsrdW3kISM+IcGeW MSNo0nY2Mp5OueWc6i6w5ONdVMWMNatdwOV/zrTA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp14.relay.iad3a.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id CE5FC23AE7 for ; Fri, 24 Feb 2023 07:03:15 -0500 (EST) Message-ID: <9af82edb-4f5f-ee85-681f-bbc2d253829f@mev.co.uk> Date: Fri, 24 Feb 2023 12:03:14 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Content-Language: en-GB To: ptxdist@pengutronix.de References: <20230220134105.28904-1-abbotti@mev.co.uk> From: Ian Abbott Organization: MEV Ltd. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Classification-ID: 6a963a81-53a0-4bd5-b4dd-8338bac9a4ac-1-1 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-3.8 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] [PATCH] libtahu: Change CFLAGS to use 64-bit system time X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On 23/02/2023 15:42, Michael Olbrich wrote: > On Mon, Feb 20, 2023 at 01:41:05PM +0000, Ian Abbott wrote: >> libtahu exposes a library function `get_current_timestamp()` to return >> the real-time clock as the number of milliseconds since the Unix epoch >> as a 64-bit value. It calls `clock_gettime(CLOCK_REALTIME, &ts)` (where >> `ts` is a `struct timespec`) to get the system time and does some simple >> arithmetic on `ts.tv_sec` and `ts.tv_nsec` to convert the time to a >> number of milliseconds. >> >> Ideally, we want `ts.tv_sec` to have a 64-bit type to avoid Y2038 >> problems, but on most 32-bit architectures, `ts.tv_sec` will have a >> 32-bit type by default. Try and select the 64-bit time interface even >> on 32-bit architectures by appending `-D_FILE_OFFSET_BITS=64` and >> `-D_TIME_BITS=64` to the `CFLAGS` variable when invoking `make`. This >> works for glibc 2.34 or later when the system is running on Linux kernel >> 5.1 or later. >> >> Signed-off-by: Ian Abbott >> --- >> rules/libtahu.make | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/rules/libtahu.make b/rules/libtahu.make >> index 26c064c6d..3e392216d 100644 >> --- a/rules/libtahu.make >> +++ b/rules/libtahu.make >> @@ -37,11 +37,12 @@ LIBTAHU_CONF_TOOL := NO >> # Compile >> # ---------------------------------------------------------------------------- >> >> -#LIBTAHU_MAKE_ENV := $(CROSS_ENV) >> - >> +LIBTAHU_CPPFLAGS := -Iinclude -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 >> +LIBTAHU_CFLAGS := -O2 -g -g3 -fPIC > > No need to mess with the existing CFLAGS. You can inject extra CFLAGS > though the toolchain wrappers. And for correctness, make it conditional: > > ifdef PTXCONF_GLOBAL_LARGE_FILE > LIBTAHU_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 > endif > > nothing else is needed. > > Michael Hi Michael, Sorry to be a pain. I'm attempting to inject extra CFLAGS through the toolchain wrappers, but I'm not sure how to do it. Here is one of my attempts that does not work: # ---------------------------------------------------------------------------- # Prepare # ---------------------------------------------------------------------------- LIBTAHU_CONF_TOOL := NO # ---------------------------------------------------------------------------- # Compile # ---------------------------------------------------------------------------- # -D_TIME_BITS=64 requires -D_FILE_OFFSET_BITS=64 LIBTAHU_CPPFLAGS := -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 LIBTAHU_CFLAGS := -O2 LIBTAHU_MAKE_ENV := $(CROSS_ENV) # Just build the dynamic library. LIBTAHU_MAKE_OPT := \ $(CROSS_ENV_PROGS) \ lib/libtahu.so $(STATEDIR)/libtahu.compile: @$(call targetinfo) @$(call world/compile, LIBTAHU) @$(call touch) I'm obviously missing something to pass the properly wrapped CC and CPP variables (incorporating the extra flags) to 'make'. Could you provide a clue how to fix it? Thanks Ian -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-