From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DB059203564A8 for ; Tue, 28 Nov 2017 05:53:04 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AB1E461D3; Tue, 28 Nov 2017 13:57:27 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-99.rdu2.redhat.com [10.10.120.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4141760C91; Tue, 28 Nov 2017 13:57:25 +0000 (UTC) To: "Gao, Liming" , "Ni, Ruiyu" Cc: "edk2-devel@lists.01.org" , "Zhu, Yonghong" , Ard Biesheuvel , "Justen, Jordan L" References: <20171127013831.294104-1-ruiyu.ni@intel.com> <35fa258e-96ef-5dfb-cc06-287c3488a75b@redhat.com> <4A89E2EF3DFEDB4C8BFDE51014F606A14E18445B@SHSMSX104.ccr.corp.intel.com> From: Laszlo Ersek Message-ID: Date: Tue, 28 Nov 2017 14:57:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E18445B@SHSMSX104.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 28 Nov 2017 13:57:27 +0000 (UTC) Subject: Re: [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Nov 2017 13:53:05 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 11/28/17 11:14, Gao, Liming wrote: > This is VS CL issue. It preprocesses below FixedPcdGet32() to the fixed value, but lost '\'. So, it will cause nasm compiler failure. To avoid it, we need to make sure FixedPcdGet32 (PcdInitValueInTempStack) at one line. > > FixedPcdGet32 ( \ > PcdInitValueInTempStack \ > ) > ==> > > > 0x5AA55AA5U Thank you. Ray, please add the above information from Liming to the commit message: - remove "But build tool doesn't support such usage in Windows OS environment" - add "But, when VS CL.exe preprocesses the FixedPcdGet32() macro invocation to the replacement text, it loses '\', and causes NASM to fail." With that, Reviewed-by: Laszlo Ersek Thanks! Laszlo > > Thanks > Liming >> -----Original Message----- >> From: Laszlo Ersek [mailto:lersek@redhat.com] >> Sent: Monday, November 27, 2017 11:03 PM >> To: Ni, Ruiyu >> Cc: edk2-devel@lists.01.org; Zhu, Yonghong ; Gao, >> Liming ; Ard Biesheuvel ; >> Justen, Jordan L >> Subject: Re: [PATCH] OvmfPkg/Sec: Fix 64bit SEC build failure >> >> Hi Ray, >> >> adding Ard, Jordan, Liming and Yonghong: >> >> On 11/27/17 02:38, Ruiyu Ni wrote: >>> Original code breaks a single assembly code to multiple lines. >>> But build tool doesn't support such usage in Windows OS environment. >>> >>> Changing the multiple lines to one line to resolve the build failure. >>> >>> Contributed-under: TianoCore Contribution Agreement 1.1 >>> Signed-off-by: Ruiyu Ni >>> Cc: Laszlo Ersek >>> --- >>> OvmfPkg/Sec/X64/SecEntry.nasm | 6 ++---- >>> 1 file changed, 2 insertions(+), 4 deletions(-) >>> >>> diff --git a/OvmfPkg/Sec/X64/SecEntry.nasm >> b/OvmfPkg/Sec/X64/SecEntry.nasm >>> index 7c55032ac9..d76adcffd8 100644 >>> --- a/OvmfPkg/Sec/X64/SecEntry.nasm >>> +++ b/OvmfPkg/Sec/X64/SecEntry.nasm >>> @@ -45,10 +45,8 @@ ASM_PFX(_ModuleEntryPoint): >>> ; Fill the temporary RAM with the initial stack value. >>> ; The loop below will seed the heap as well, but that's harmless. >>> ; >>> - mov rax, (FixedPcdGet32 ( \ >>> - PcdInitValueInTempStack \ >>> - ) << 32) | \ >>> - FixedPcdGet32 (PcdInitValueInTempStack) ; qword to store >>> + mov rax, (FixedPcdGet32 (PcdInitValueInTempStack) << 32) | >> FixedPcdGet32 (PcdInitValueInTempStack) >>> + ; qword to store >>> mov rdi, FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) ; base >> address, >>> ; relative to >>> ; ES >>> >> >> I'd like to understand more about the build failure. As far as I understand, the >> NASM tool itself has no problem with the backslash line continuation; before I >> posted the patch, I checked the NASM manual for this feature. >> >> http://www.nasm.us/doc/nasmdoc3.html#section-3.1 >> >> NASM uses backslash (\) as the line continuation character; if a >> line ends with backslash, the next line is considered to be a part >> of the backslash-ended line. >> >> Now, in "BaseTools/Conf/build_rule.template", I see that we have the >> following rule for NASM source files: >> >> [Nasm-Assembly-Code-File.COMMON.COMMON] >> >> ?.nasm >> >> >> $(MAKE_FILE) >> >> >> $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj >> >> >> "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i >> Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii >> ${d_path}(+)${s_base}.i >> "$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst >> ${d_path}(+)${s_base}.iii >> >> I guess it's actually the pre-processor (PP) that splices the broken-up lines >> together, as any C language pre-processor is supposed to do. >> >> Why does that not work with the VS toolchains ("cl.exe")? >> >> Is it perhaps a problem with the _PP_FLAGS? >> >> https://msdn.microsoft.com/en-us/library/3xkfswhy.aspx >> https://msdn.microsoft.com/en-us/library/032xwy55.aspx >> >> "/E" seems right (pre-process). Is /TC the problem? ("C language source >> code"). >> >> If the problem is impossible to fix in BaseTools, I don't mind the patch, but I'd >> like to see more explanation in the commit message. >> >> (Other assembly files use backslash line continuations too, they just haven't >> been exposed to VS toolchains yet, apparently.) >> >> Thanks >> Laszlo