From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: devel@edk2.groups.io, michael.d.kinney@intel.com
Cc: Tuan Phan <tphan@ventanamicro.com>,
"sunilvl@ventanamicro.com" <sunilvl@ventanamicro.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Wang, Jian J" <jian.j.wang@intel.com>,
"Lu, Xiaoyu1" <xiaoyu1.lu@intel.com>,
"Jiang, Guomin" <guomin.jiang@intel.com>
Subject: Re: [edk2-devel] [PATCH v2] CryptoPkg/IntrinsicLib: RiscV: Provide implementation of memcpy and __ctzdi2
Date: Sat, 17 Dec 2022 01:59:29 +0000 [thread overview]
Message-ID: <CAKbZUD0SwkaH7SXbJcu4Lmxm8tF8NKf4Lfk_DXFCATOvzOu6OQ@mail.gmail.com> (raw)
In-Reply-To: <CO1PR11MB4929D1053231BFEA9A13774FD2E79@CO1PR11MB4929.namprd11.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1435 bytes --]
On Sat, Dec 17, 2022 at 12:06 AM Michael D Kinney <
michael.d.kinney@intel.com> wrote:
> If that intrinsic is specific to RISCV, then should CompilerHelper.c go
> into a RiscV64 subdir?
Mike and Tuan,
Two comments:
1) __ctzdi2 is not riscv specific and is a part of the standard functions
provided by libgcc/compiler-rt (read: the compiler can call it as it
pleases)
> Forcing to use CopyMem of EDK2 as memcpy buildin disabled for RiscV
> > with -fno-builtin-memcpy flag.
>
2) Using -fno-builtin-memcpy doesn't stop GCC/clang from trying to call
memcpy (see https://godbolt.org/z/xYsYEq6En for an example). In fact,
fno-builtin-memcpy will call memcpy more,
as GCC stops assuming normal behavior from memcpy and generates calls
instead of e.g inlining memcpy code.
GCC and clang require memcpy, memmove, memset and memcmp (with standard C
library behavior) to compile code. AFAIK no option can change this.
GCC and clang also require libgcc/compiler-rt (although getting around this
is saner and way more reliable, done in e.g operating system kernels such
as linux itself).
The only way to reliably generate code with GCC/clang is to have the
CompilerIntrinsicsLib as a dependency for every platform compiled with GCC
(or have BaseTools inject that).
I actually ran into this issue a few weeks back when trying to add security
features (https://github.com/heatd/edk2/commits/toolchain-fixes). Can we
properly fix this?
Pedro
[-- Attachment #2: Type: text/html, Size: 2227 bytes --]
next prev parent reply other threads:[~2022-12-17 1:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 18:47 [PATCH v2] CryptoPkg/IntrinsicLib: RiscV: Provide implementation of memcpy and __ctzdi2 Tuan Phan
2022-12-17 0:06 ` Michael D Kinney
2022-12-17 1:59 ` Pedro Falcato [this message]
2022-12-17 2:15 ` [edk2-devel] " Tuan Phan
2022-12-21 2:56 ` Pedro Falcato
2022-12-19 18:26 ` Tuan Phan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKbZUD0SwkaH7SXbJcu4Lmxm8tF8NKf4Lfk_DXFCATOvzOu6OQ@mail.gmail.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox