From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id C50703857C47 for ; Mon, 14 Mar 2022 10:57:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C50703857C47 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.90,180,1643702400"; d="scan'208";a="73131104" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 14 Mar 2022 02:57:21 -0800 IronPort-SDR: VCYLkLMdEjT9FcmVCL5PWP5hRqxEllMeCM65QltWSBuHtf2/smbF+HSJFhW+Hkewi1ts9sWXAG 1CkUN00OgH//xqXwItdwyL9UXxfp7//rYuZYGWWcjMKhcPmZZhuvKoZ5y8pb8fLgsOLXJcpsQe hsZhTjXT8b9G+263fiYBtZ8Uq0u6lAVodaL7y0mYckBfcLhdwGdy29F4XsRPgMso9f26j7yG5G wq7EunI2VtaR3woeA5Dof2hBuni+sNHW7MGHUo94NQexN91CGrBEnhOEaHNSs1EvHiiq76p7Vk zu4= Message-ID: Date: Mon, 14 Mar 2022 11:57:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US To: Binutils , Vladimir Mezentsev , Nick Clifton From: Tobias Burnus Subject: =?UTF-8?Q?Build_issues_due_to_patch_=22gprofng=3a_a_new_GNU_profile?= =?UTF-8?Q?r=22_=e2=80=93_CLOCK=5fMONOTONIC=5fRAW_not_defined?= Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2022 10:57:24 -0000 Hi Vladimir, hi Nick, Friday's commit "gprofng: a new GNU profiler", https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dbb368aad297= fe3ad40cf397e6fc85aa471429a28 broke the build here (build server using on purpose an older Linux/glibc): gprofng/libcollector/gethrtime.c:35:26: error: 'CLOCK_MONOTONIC_RAW' undecl= ared (first use in this function); did you mean 'CLOCK_MONOTONIC'? int r =3D clock_gettime (CLOCK_MONOTONIC_RAW, &tp); ^~~~~~~~~~~~~~~~~~~ CLOCK_MONOTONIC According to https://linux.die.net/man/2/clock_gettime: CLOCK_MONOTONIC_RAW (since Linux 2.6.28; Linux-specific) Similar to CLOCK_MONOTONIC, but provides access to a raw hardware-base= d time that is not subject to NTP adjustments or the incremental adjustments performed by adjtime(3). Thus, it seems as if either a config check or a much simpler patch as the following is needed: --- a/gprofng/libcollector/gethrtime.c +++ b/gprofng/libcollector/gethrtime.c @@ -34,3 +34,7 @@ linux_gethrtime () hrtime_t rc =3D 0; +#ifdef CLOCK_MONOTONIC_RAW int r =3D clock_gettime (CLOCK_MONOTONIC_RAW, &tp); +#else + int r =3D clock_gettime (CLOCK_MONOTONIC, &tp); +#endif if (r =3D=3D 0) --- a/gprofng/src/gethrtime.c +++ b/gprofng/src/gethrtime.c @@ -161,3 +161,7 @@ gethrtime (void) */ +#ifdef CLOCK_MONOTONIC_RAW int r =3D clock_gettime (CLOCK_MONOTONIC_RAW, &tp); +#else + int r =3D clock_gettime (CLOCK_MONOTONIC, &tp); +#endif if (r =3D=3D 0) * * * Additionally, the build fails with the link error: gprofng/src/gethrtime.c:131: undefined reference to `clock_gettime' The problem seems to be what the 'clock_gettime(3)' man page states: Link with -lrt (only for glibc versions before 2.17). Please consider as fix to copy the following check from libbacktrace/config= ure.ac: # Check for the clock_gettime function. AC_CHECK_FUNCS(clock_gettime) ... AC_SUBST(CLOCK_GETTIME_LINK) Thanks, Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955