From: Xiang W Date: Thu, 02 Dec 2021 22:28:21 +0800 Subject: [PATCH v3 1/2] Makefile: Fix -mno-save-restore compile warning with CLANG In-Reply-To: <20211202122929.685756-2-anup.patel@wdc.com> References: <20211202122929.685756-1-anup.patel@wdc.com> <20211202122929.685756-2-anup.patel@wdc.com> Message-ID: <7dfd90c711fd20dc0bcf07082a59c45d7f76ddcd.camel@126.com> List-Id: To: opensbi@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ? 2021-12-02???? 17:59 +0530?Anup Patel??? > The riscv target of CLANG does not support -m(no-)save-restore option > so we get compile warnings. This patch fixes compile warning by using > -m(no-)save-restore option only for GCC. > > Signed-off-by: Anup Patel ? /tmp clang -target riscv64 -mno-save-restore -O2 -S test.c ? /tmp clang -target riscv64 -msave-restore -O2 -S test.c ? /tmp clang --version Debian clang version 11.0.1-2 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin ? /tmp lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye ? /tmp clang supports -m(no-)save-restore option on my computer Regards, Xiang W > --- > ?Makefile | 12 ++++++++---- > ?1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/Makefile b/Makefile > index 8623c1c..1e35dc0 100644 > --- a/Makefile > +++ b/Makefile > @@ -275,8 +275,10 @@ GENFLAGS???+=??????$(platform-genflags-y) > ?GENFLAGS???????+=??????$(firmware-genflags-y) > ? > ?CFLAGS?????????=???????-g -Wall -Werror -ffreestanding -nostdlib - > fno-stack-protector -fno-strict-aliasing -O2 > -CFLAGS?????????+=??????-fno-omit-frame-pointer -fno-optimize- > sibling-calls > -CFLAGS?????????+=??????-mno-save-restore -mstrict-align > +CFLAGS?????????+=??????-fno-omit-frame-pointer -fno-optimize- > sibling-calls -mstrict-align > +ifneq ($(CC_IS_CLANG),y) > +CFLAGS?????????+=??????-mno-save-restore > +endif > ?CFLAGS?????????+=??????-mabi=$(PLATFORM_RISCV_ABI) - > march=$(PLATFORM_RISCV_ISA) > ?CFLAGS?????????+=??????-mcmodel=$(PLATFORM_RISCV_CODE_MODEL) > ?CFLAGS?????????+=??????$(RELAX_FLAG) > @@ -290,8 +292,10 @@ CPPFLAGS???+=??????$(platform-cppflags-y) > ?CPPFLAGS???????+=??????$(firmware-cppflags-y) > ? > ?ASFLAGS????????????????=???????-g -Wall -nostdlib > -ASFLAGS????????????????+=??????-fno-omit-frame-pointer -fno- > optimize-sibling-calls > -ASFLAGS????????????????+=??????-mno-save-restore -mstrict-align > +ASFLAGS????????????????+=??????-fno-omit-frame-pointer -fno- > optimize-sibling-calls -mstrict-align > +ifneq ($(CC_IS_CLANG),y) > +ASFLAGS????????????????+=??????-mno-save-restore > +endif > ?ASFLAGS????????????????+=??????-mabi=$(PLATFORM_RISCV_ABI) - > march=$(PLATFORM_RISCV_ISA) > ?ASFLAGS????????????????+=??????-mcmodel=$(PLATFORM_RISCV_CODE_MODEL) > ?ASFLAGS????????????????+=??????$(RELAX_FLAG) > -- > 2.25.1 > >