From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c06::241; helo=mail-io0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C522C222EDCF7 for ; Tue, 2 Jan 2018 07:04:07 -0800 (PST) Received: by mail-io0-x241.google.com with SMTP id g70so36633130ioj.6 for ; Tue, 02 Jan 2018 07:09:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sHhFAO7PFj9sl44z0lgM36u29Lb85Pao1AT9N+Eow/M=; b=b0TxgccK7wX7wnDVN+8butYMmmxChvevhdHDjBFjl6+QCg+8ewbRULBzBAoS+ESPXr GJie4I39qRKLGJVqr2qYaUuKEhNuP54DxLtXGQAkadCmKvSOwiKTNDIdtB/AFSSXACQF hHOXVNO6ysFqQNBAnhkQvbFkfBpg7dUoy04qs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sHhFAO7PFj9sl44z0lgM36u29Lb85Pao1AT9N+Eow/M=; b=PiUgDrzVSmmS3jpSN24pHh0laqXjiJQhSF1KjZnQt5ctOT+Hr2GF7crlUYQYjqI8h5 e56K/lqDFDGY2JBFokVVJoXrkBekv7WPH7Zn3+esA/CgEplVxutyog5FyrClpS0AScds Fwt5TMfpR8hUb4dMs0HPgl1cnLtxh1qWz1jbXXWr2bOnOmidCeJRjywDQD4RV0/FPHxW mLzBgtaCfpiGOryp6TqhbtLq7x/bvzUIzM182WvYByQ2KFXH6Huhb4FPOn8XapScAkA7 4zCp9pNAik/E7bpVA+A6SOCEXFIl7HHb5aHkWa6C71EoWmpYg0WjOiEm38Xx3wzm8peI ZcfQ== X-Gm-Message-State: AKGB3mL4d9MaYm1cCMtkngYnSs20yBDhpkdPibFuCp9tMKB4lOBuP89u cAkkAiWqCsx0s57y0m1SulKypA7FTq8AFfh2rSw5FA== X-Google-Smtp-Source: ACJfBov9Q2VSVhzZKnf6FU4wkWW07N0mTC85kbn/AZY4r4zPAjWql3iRTnif++fv7p5oj3CWSpwF2HYAxBKTF7IGaCQ= X-Received: by 10.107.151.142 with SMTP id z136mr61229707iod.248.1514905749294; Tue, 02 Jan 2018 07:09:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.37.197 with HTTP; Tue, 2 Jan 2018 07:09:08 -0800 (PST) In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E19D21E@SHSMSX104.ccr.corp.intel.com> References: <7baf6db5ebfdef045c69aed44d86aada99a7f4ff.1514491125.git.theracermaster@gmail.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E19AED0@SHSMSX104.ccr.corp.intel.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E19D21E@SHSMSX104.ccr.corp.intel.com> From: Ard Biesheuvel Date: Tue, 2 Jan 2018 15:09:08 +0000 Message-ID: To: "Gao, Liming" Cc: Alex James , "edk2-devel@lists.01.org" Subject: Re: [PATCH] BaseTools/PcdValueCommon: Fix PcdDataTypeUint64 format string X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2018 15:04:08 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On 2 January 2018 at 12:18, Gao, Liming wrote: > Ard: > The issue is related to UINT64 definition in the different ARCHs. In Ba= seTools X64 and IA32, typedef uint64_t UINT64. uint64_t doesn't work with= %llx. To support all archs and tool chain, I propose to use below style to= print X64 value. > > sprintf(PcdList[Index].Value, "0x%016llx", (unsigned long long) Value= ); > Yes, that looks like the best way forward. Some projects address this by adding arch-dependent #defines of the format specifier string, but I think that is overkill here. --=20 Ard. >> -----Original Message----- >> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >> Sent: Tuesday, January 2, 2018 5:26 PM >> To: Alex James >> Cc: Gao, Liming ; edk2-devel@lists.01.org >> Subject: Re: [edk2] [PATCH] BaseTools/PcdValueCommon: Fix PcdDataTypeUin= t64 format string >> >> On 2 January 2018 at 09:25, Ard Biesheuvel w= rote: >> > On 29 December 2017 at 02:58, Alex James wr= ote: >> >> Hi Liming, >> >> >> >> I was able to reproduce this, will send out the v2 patch shortly. >> >> >> > >> > This is still broken in today's tree. Could we get a fix please? >> > >> >> Ehm, hold on. It is the other way around: on AARCH64, I now get >> >> PcdValueCommon.c: In function =E2=80=98__PcdSet=E2=80=99: >> PcdValueCommon.c:270:43: error: format =E2=80=98%lx=E2=80=99 expects arg= ument of type >> =E2=80=98long unsigned int=E2=80=99, but argument 3 has type =E2=80=98UI= NT64 {aka long long >> unsigned int}=E2=80=99 [-Werror=3Dformat=3D] >> sprintf(PcdList[Index].Value, "0x%016lx", Value); >> >> >> >> >> >> >> >> On Thu, Dec 28, 2017 at 7:46 PM Gao, Liming wr= ote: >> >> >> >>> This fix will trig GCC build warning. >> >>> >> >>> PcdValueCommon.c: In function '__PcdSet': >> >>> PcdValueCommon.c:269:35: error: format '%llx' expects argument of ty= pe >> >>> 'long long unsigned int', but argument 3 has type 'UINT64 {aka long >> >>> unsigned int}' [-Werror=3Dformat=3D] >> >>> sprintf(PcdList[Index].Value, "0x%016llx", Value); >> >>> ^ >> >>> >> >>> Thanks >> >>> Liming >> >>> > -----Original Message----- >> >>> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behal= f Of >> >>> Alex James >> >>> > Sent: Friday, December 29, 2017 4:00 AM >> >>> > To: edk2-devel@lists.01.org >> >>> > Cc: Alex James >> >>> > Subject: [edk2] [PATCH] BaseTools/PcdValueCommon: Fix PcdDataTypeU= int64 >> >>> format string >> >>> > >> >>> > Always specify unsigned long long for PcdDataTypeUint64. This is n= eeded >> >>> > to fix building with XCODE5. >> >>> > >> >>> > Contributed-under: TianoCore Contribution Agreement 1.1 >> >>> > Signed-off-by: Alex James >> >>> > --- >> >>> > BaseTools/Source/C/Common/PcdValueCommon.c | 4 ---- >> >>> > 1 file changed, 4 deletions(-) >> >>> > >> >>> > diff --git a/BaseTools/Source/C/Common/PcdValueCommon.c >> >>> b/BaseTools/Source/C/Common/PcdValueCommon.c >> >>> > index 6ca0994744..f5d68e79e0 100644 >> >>> > --- a/BaseTools/Source/C/Common/PcdValueCommon.c >> >>> > +++ b/BaseTools/Source/C/Common/PcdValueCommon.c >> >>> > @@ -266,11 +266,7 @@ Returns: >> >>> > sprintf(PcdList[Index].Value, "0x%08x", (UINT32)(Value & >> >>> 0xffffffff)); >> >>> > break; >> >>> > case PcdDataTypeUint64: >> >>> > -#ifdef __GNUC__ >> >>> > - sprintf(PcdList[Index].Value, "0x%016lx", Value); >> >>> > -#else >> >>> > sprintf(PcdList[Index].Value, "0x%016llx", Value); >> >>> > -#endif >> >>> > break; >> >>> > case PcdDataTypePointer: >> >>> > fprintf (stderr, "PCD %s.%s.%s.%s is structure. Use >> >>> PcdSetPtr()\n", SkuName, DefaultValueName, TokenSpaceGuidName, >> >>> > TokenName); >> >>> > -- >> >>> > 2.15.1 >> >>> > >> >>> > _______________________________________________ >> >>> > edk2-devel mailing list >> >>> > edk2-devel@lists.01.org >> >>> > https://lists.01.org/mailman/listinfo/edk2-devel >> >>> >> >> _______________________________________________ >> >> edk2-devel mailing list >> >> edk2-devel@lists.01.org >> >> https://lists.01.org/mailman/listinfo/edk2-devel