From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) by mx.groups.io with SMTP id smtpd.web10.6579.1641414992206461872 for ; Wed, 05 Jan 2022 12:36:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=uDoFHcjI; spf=pass (domain: apple.com, ip: 17.171.2.68, mailfrom: afish@apple.com) Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.42/8.16.0.42) with SMTP id 205KXOcl028353; Wed, 5 Jan 2022 12:36:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : content-type : mime-version : subject : message-id : date : cc : to; s=20180706; bh=0KqVSrKqenHQVzyPqg08mTfIMQpjZ3t2EFqXhUAjQQI=; b=uDoFHcjILMyLd5MN6P16UINxnx1s3tw7GoitVLOJxvnaV4MOCppIS0MOKjyd6Z8VaYSK i1ChCFC13nC/IS6IrBcf6hGKERoH/S5GoUSvyKdwNljI+8X6CbGlDjt6It4b8co/367h iyPJifIBw7TeFj6QquY4hng0Kbq9DM9zBx8Wf4AFt2yrqFiNITFHrG772ZPeLCheefFE 129aJpLNlQcTf7DsqzaFvHRk/Pdb+d1gSPCQ0zvGjed6Oyl6ifDl6q5IUnVUu1NPXX+h lkYrR6Nu6v8doAi7wDrxoep+kmyIqgWBWjlcVsEJdJf/0GLYkLs+GD7XFDDOhm3L3E6j ug== Received: from rn-mailsvcp-mta-lapp02.rno.apple.com (rn-mailsvcp-mta-lapp02.rno.apple.com [10.225.203.150]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 3ddgvxh5xe-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 05 Jan 2022 12:36:31 -0800 Received: from rn-mailsvcp-mmp-lapp02.rno.apple.com (rn-mailsvcp-mmp-lapp02.rno.apple.com [17.179.253.15]) by rn-mailsvcp-mta-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.12.20210903 64bit (built Sep 3 2021)) with ESMTPS id <0R5900VLZ7WTB4I0@rn-mailsvcp-mta-lapp02.rno.apple.com>; Wed, 05 Jan 2022 12:36:29 -0800 (PST) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp02.rno.apple.com by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.12.20210903 64bit (built Sep 3 2021)) id <0R5900Q007KWG600@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Wed, 05 Jan 2022 12:36:29 -0800 (PST) X-Va-A: X-Va-T-CD: 5975dd1eaec8696b379f33739df9e0a8 X-Va-E-CD: d0e0f422bf627d39676d5f188ed8ea4d X-Va-R-CD: f3c7c3834de1ba2b96b8dad34b55f4df X-Va-CD: 0 X-Va-ID: 6e6c1286-c75a-401b-af43-cf121ede1442 X-V-A: X-V-T-CD: 5975dd1eaec8696b379f33739df9e0a8 X-V-E-CD: d0e0f422bf627d39676d5f188ed8ea4d X-V-R-CD: f3c7c3834de1ba2b96b8dad34b55f4df X-V-CD: 0 X-V-ID: fe01bd55-0c53-4b53-9586-85c5be3a91b5 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425,18.0.790 definitions=2022-01-05_06:2022-01-04,2022-01-05 signatures=0 Received: from smtpclient.apple (unknown [17.235.2.90]) by rn-mailsvcp-mmp-lapp02.rno.apple.com (Oracle Communications Messaging Server 8.1.0.12.20210903 64bit (built Sep 3 2021)) with ESMTPSA id <0R5900DIU7WREB00@rn-mailsvcp-mmp-lapp02.rno.apple.com>; Wed, 05 Jan 2022 12:36:28 -0800 (PST) From: "Andrew Fish" MIME-version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Subject: AArch64 assembly compatibility for Xcode and GCC Message-id: <962A1DA2-CB34-49F5-A721-AE7E5C82FA04@apple.com> Date: Wed, 05 Jan 2022 12:36:27 -0800 Cc: Leif Lindholm To: edk2-devel-groups-io X-Mailer: Apple Mail (2.3693.20.0.1.32) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.425,18.0.790 definitions=2022-01-05_06:2022-01-04,2022-01-05 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_787663C4-421E-491D-A148-1EE4DF0F0AC2" --Apple-Mail=_787663C4-421E-491D-A148-1EE4DF0F0AC2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I was playing around with getting Xcode to compile AArch64 code and I = hit an interesting compatibility issue. The assembler line continuation = token for GCC (;) is a comment for the Xcode clang assembler. For Xcode = clang you need to use %%. Yikes [1] I was wondering if any one else has hit this in another project and if = there was any cool workaround? The only thing I can think of is the =E2=80=9Cbig hammer=E2=80=9D on = both (well you only need one) ends. We could replace ; with a #define = that matches the assembler. It looks like this issue mostly hits in Code = that is using C pre-processor macros so we could refactor the code. = I=E2=80=99m a little concerned that the C pre processor is getting used = since the macro languages of the assembler might also have some = compatibility issues? Looking for ideas and opinions on the best way to fix this if we want to = add Xcode as an ARM compiler in the future.=20 [1] = https://github.com/tianocore/edk2/blob/master/MdePkg/Library/BaseLib/AArch= 64/SetJumpLongJump.S#L13 #define GPR_LAYOUT \ REG_PAIR (x19, x20, 0); \ REG_PAIR (x21, x22, 16); \ REG_PAIR (x23, x24, 32); \ REG_PAIR (x25, x26, 48); \ REG_PAIR (x27, x28, 64); \ REG_PAIR (x29, x30, 80);/*FP, LR*/ \ REG_ONE (x16, 96) /*IP0*/ I had to change it to: #define GPR_LAYOUT \ REG_PAIR (x19, x20, 0)%% \ REG_PAIR (x21, x22, 16)%% \ REG_PAIR (x23, x24, 32)%% \ REG_PAIR (x25, x26, 48)%% \ REG_PAIR (x27, x28, 64)%% \ REG_PAIR (x29, x30, 80)%%/*FP, LR*/ \ REG_ONE (x16, 96) /*IP0*/ Thanks, Andrew Fish --Apple-Mail=_787663C4-421E-491D-A148-1EE4DF0F0AC2 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 I = was playing around with getting Xcode to compile AArch64 code and I hit = an interesting compatibility issue. The assembler line continuation = token for GCC (;) is a comment for the Xcode clang assembler. For Xcode = clang you need to use %%. Yikes [1]

I was wondering if any one else has hit = this in another project and if there was any cool workaround?

The only thing I can = think of is the =E2=80=9Cbig hammer=E2=80=9D on both (well you only need = one) ends. We could replace ; with a #define that matches the assembler. = It looks like this issue mostly hits in Code that is using C = pre-processor macros so we could refactor the code. I=E2=80=99m a little = concerned that the C pre processor is getting used since the macro = languages of the assembler might also have some compatibility = issues?

Looking = for ideas and opinions on the best way to fix this if we want to add = Xcode as an ARM compiler in the future. 



#define GPR_LAYOUT = \
= REG_PAIR (x19, x20, 0); = \
= REG_PAIR (x21, x22, 16); = \
= REG_PAIR (x23, x24, 32); = \
= REG_PAIR (x25, x26, 48); = \
= REG_PAIR (x27, x28, 64); = \
= REG_PAIR (x29, x30, 80);/*FP, LR*/ = \
= REG_ONE (x16, 96) /*IP0*/
I had to change it to:

#define GPR_LAYOUT = \
= REG_PAIR (x19, x20, 0)%% = \
= REG_PAIR (x21, x22, 16)%% = \
= REG_PAIR (x23, x24, 32)%% = \
= REG_PAIR (x25, x26, 48)%% = \
= REG_PAIR (x27, x28, 64)%% = \
= REG_PAIR (x29, x30, 80)%%/*FP, LR*/ = \
= REG_ONE (x16, 96) /*IP0*/
Thanks,

Andrew = Fish

= --Apple-Mail=_787663C4-421E-491D-A148-1EE4DF0F0AC2--