* [PATCH] Makefile: Don't specify mabi or march
@ 2020-10-19 22:41 Alistair Francis
2020-10-19 22:56 ` Jessica Clarke
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Alistair Francis @ 2020-10-19 22:41 UTC (permalink / raw)
To: opensbi
To avoid
can't link double-float modules with soft-float modules
errors when building 32-bit openSBI don't specify mabi or march.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
Makefile | 2 --
1 file changed, 2 deletions(-)
diff --git a/Makefile b/Makefile
index a231881..3f819d9 100644
--- a/Makefile
+++ b/Makefile
@@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
CFLAGS += -mno-save-restore -mstrict-align
-CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
CFLAGS += $(GENFLAGS)
CFLAGS += $(platform-cflags-y)
@@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
ASFLAGS += -mno-save-restore -mstrict-align
-ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
ASFLAGS += $(GENFLAGS)
ASFLAGS += $(platform-asflags-y)
--
2.28.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 22:41 [PATCH] Makefile: Don't specify mabi or march Alistair Francis
@ 2020-10-19 22:56 ` Jessica Clarke
2020-10-19 23:02 ` Alistair Francis
2020-10-20 3:52 ` Anup Patel
2020-10-20 7:30 ` Andreas Schwab
2 siblings, 1 reply; 12+ messages in thread
From: Jessica Clarke @ 2020-10-19 22:56 UTC (permalink / raw)
To: opensbi
On 19 Oct 2020, at 23:41, Alistair Francis <alistair.francis@wdc.com> wrote:
>
> To avoid
> can't link double-float modules with soft-float modules
> errors when building 32-bit openSBI don't specify mabi or march.
What happens if you want to build for a different ABI or ISA string
deliberately? Especially with something like Clang where every compiler
is a cross-compiler. Users should be able to specify an ABI or ISA
string if they want and have it honoured, either via
PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere rather than
overwriting it entirely (which is the more standard thing to do for
software that isn't RISC-V-specific).
Jess
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> Makefile | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index a231881..3f819d9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
> CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
> CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> CFLAGS += -mno-save-restore -mstrict-align
> -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> CFLAGS += $(GENFLAGS)
> CFLAGS += $(platform-cflags-y)
> @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
> ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
> ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> ASFLAGS += -mno-save-restore -mstrict-align
> -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> ASFLAGS += $(GENFLAGS)
> ASFLAGS += $(platform-asflags-y)
> --
> 2.28.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 22:56 ` Jessica Clarke
@ 2020-10-19 23:02 ` Alistair Francis
2020-10-19 23:05 ` Jessica Clarke
0 siblings, 1 reply; 12+ messages in thread
From: Alistair Francis @ 2020-10-19 23:02 UTC (permalink / raw)
To: opensbi
On Mon, 2020-10-19 at 23:56 +0100, Jessica Clarke wrote:
> On 19 Oct 2020, at 23:41, Alistair Francis <alistair.francis@wdc.com>
> wrote:
> > To avoid
> > can't link double-float modules with soft-float modules
> > errors when building 32-bit openSBI don't specify mabi or march.
>
> What happens if you want to build for a different ABI or ISA string
> deliberately? Especially with something like Clang where every
> compiler
> is a cross-compiler. Users should be able to specify an ABI or ISA
> string if they want and have it honoured, either via
> PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere rather
> than
> overwriting it entirely (which is the more standard thing to do for
> software that isn't RISC-V-specific).
A user could do that by specifying their own CFLAGS when building to
allow them to specify a ISA or ABI.
Currently no platform set PLATFORM_RISCV_ABI as it defaults to ilp32 or
lp64.
No platform also sets PLATFORM_RISCV_ISA which is always rv32/64imafdc.
Alistair
>
> Jess
>
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> > Makefile | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index a231881..3f819d9 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
> > CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib
> > -fno-strict-aliasing -O2
> > CFLAGS += -fno-omit-frame-pointer -fno-optimize-
> > sibling-calls
> > CFLAGS += -mno-save-restore -mstrict-align
> > -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
> > -march=$(PLATFORM_RISCV_ISA)
> > CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > CFLAGS += $(GENFLAGS)
> > CFLAGS += $(platform-cflags-y)
> > @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
> > ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
> > ASFLAGS += -fno-omit-frame-pointer -fno-optimize-
> > sibling-calls
> > ASFLAGS += -mno-save-restore -mstrict-align
> > -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
> > -march=$(PLATFORM_RISCV_ISA)
> > ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > ASFLAGS += $(GENFLAGS)
> > ASFLAGS += $(platform-asflags-y)
> > --
> > 2.28.0
> >
> >
> > --
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 23:02 ` Alistair Francis
@ 2020-10-19 23:05 ` Jessica Clarke
2020-10-19 23:32 ` Alistair Francis
0 siblings, 1 reply; 12+ messages in thread
From: Jessica Clarke @ 2020-10-19 23:05 UTC (permalink / raw)
To: opensbi
On 20 Oct 2020, at 00:02, Alistair Francis <alistair.francis@wdc.com> wrote:
>
> On Mon, 2020-10-19 at 23:56 +0100, Jessica Clarke wrote:
>> On 19 Oct 2020, at 23:41, Alistair Francis <alistair.francis@wdc.com>
>> wrote:
>>> To avoid
>>> can't link double-float modules with soft-float modules
>>> errors when building 32-bit openSBI don't specify mabi or march.
>>
>> What happens if you want to build for a different ABI or ISA string
>> deliberately? Especially with something like Clang where every
>> compiler
>> is a cross-compiler. Users should be able to specify an ABI or ISA
>> string if they want and have it honoured, either via
>> PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere rather
>> than
>> overwriting it entirely (which is the more standard thing to do for
>> software that isn't RISC-V-specific).
>
> A user could do that by specifying their own CFLAGS when building to
> allow them to specify a ISA or ABI.
Makefile:196:CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
That doesn't work so well with user-supplied CFLAGS.
> Currently no platform set PLATFORM_RISCV_ABI as it defaults to ilp32 or
> lp64.
We do. We have new ABIs for our extension (see cheri-cpu.org).
> No platform also sets PLATFORM_RISCV_ISA which is always rv32/64imafdc.
We do.
Jess
>>> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
>>> ---
>>> Makefile | 2 --
>>> 1 file changed, 2 deletions(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index a231881..3f819d9 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
>>> CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib
>>> -fno-strict-aliasing -O2
>>> CFLAGS += -fno-omit-frame-pointer -fno-optimize-
>>> sibling-calls
>>> CFLAGS += -mno-save-restore -mstrict-align
>>> -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
>>> -march=$(PLATFORM_RISCV_ISA)
>>> CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
>>> CFLAGS += $(GENFLAGS)
>>> CFLAGS += $(platform-cflags-y)
>>> @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
>>> ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
>>> ASFLAGS += -fno-omit-frame-pointer -fno-optimize-
>>> sibling-calls
>>> ASFLAGS += -mno-save-restore -mstrict-align
>>> -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
>>> -march=$(PLATFORM_RISCV_ISA)
>>> ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
>>> ASFLAGS += $(GENFLAGS)
>>> ASFLAGS += $(platform-asflags-y)
>>> --
>>> 2.28.0
>>>
>>>
>>> --
>>> opensbi mailing list
>>> opensbi at lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 23:05 ` Jessica Clarke
@ 2020-10-19 23:32 ` Alistair Francis
2020-10-19 23:38 ` Jessica Clarke
2020-10-20 7:27 ` Andreas Schwab
0 siblings, 2 replies; 12+ messages in thread
From: Alistair Francis @ 2020-10-19 23:32 UTC (permalink / raw)
To: opensbi
On Tue, 2020-10-20 at 00:05 +0100, Jessica Clarke wrote:
> On 20 Oct 2020, at 00:02, Alistair Francis <alistair.francis@wdc.com>
> wrote:
> > On Mon, 2020-10-19 at 23:56 +0100, Jessica Clarke wrote:
> > > On 19 Oct 2020, at 23:41, Alistair Francis <
> > > alistair.francis at wdc.com>
> > > wrote:
> > > > To avoid
> > > > can't link double-float modules with soft-float modules
> > > > errors when building 32-bit openSBI don't specify mabi or
> > > > march.
> > >
> > > What happens if you want to build for a different ABI or ISA
> > > string
> > > deliberately? Especially with something like Clang where every
> > > compiler
> > > is a cross-compiler. Users should be able to specify an ABI or
> > > ISA
> > > string if they want and have it honoured, either via
> > > PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere
> > > rather
> > > than
> > > overwriting it entirely (which is the more standard thing to do
> > > for
> > > software that isn't RISC-V-specific).
> >
> > A user could do that by specifying their own CFLAGS when building
> > to
> > allow them to specify a ISA or ABI.
>
> Makefile:196:CFLAGS = -g -Wall -Werror -ffreestanding
> -nostdlib -fno-strict-aliasing -O2
Ah, I didn't realise this. I'll change it to a +=
>
> That doesn't work so well with user-supplied CFLAGS.
>
> > Currently no platform set PLATFORM_RISCV_ABI as it defaults to
> > ilp32 or
> > lp64.
>
> We do. We have new ABIs for our extension (see cheri-cpu.org).
Ah ok. Maybe it's worth upstreamign the cheri implementaiton then?
Alistair
>
> > No platform also sets PLATFORM_RISCV_ISA which is always
> > rv32/64imafdc.
>
> We do.
>
> Jess
>
> > > > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > > > ---
> > > > Makefile | 2 --
> > > > 1 file changed, 2 deletions(-)
> > > >
> > > > diff --git a/Makefile b/Makefile
> > > > index a231881..3f819d9 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
> > > > CFLAGS = -g -Wall -Werror -ffreestanding
> > > > -nostdlib
> > > > -fno-strict-aliasing -O2
> > > > CFLAGS += -fno-omit-frame-pointer -fno-optimize-
> > > > sibling-calls
> > > > CFLAGS += -mno-save-restore -mstrict-align
> > > > -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
> > > > -march=$(PLATFORM_RISCV_ISA)
> > > > CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > > > CFLAGS += $(GENFLAGS)
> > > > CFLAGS += $(platform-cflags-y)
> > > > @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
> > > > ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
> > > > ASFLAGS += -fno-omit-frame-pointer -fno-optimize-
> > > > sibling-calls
> > > > ASFLAGS += -mno-save-restore -mstrict-align
> > > > -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI)
> > > > -march=$(PLATFORM_RISCV_ISA)
> > > > ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > > > ASFLAGS += $(GENFLAGS)
> > > > ASFLAGS += $(platform-asflags-y)
> > > > --
> > > > 2.28.0
> > > >
> > > >
> > > > --
> > > > opensbi mailing list
> > > > opensbi at lists.infradead.org
> > > > http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 23:32 ` Alistair Francis
@ 2020-10-19 23:38 ` Jessica Clarke
2020-10-21 0:55 ` Alistair Francis
2020-10-20 7:27 ` Andreas Schwab
1 sibling, 1 reply; 12+ messages in thread
From: Jessica Clarke @ 2020-10-19 23:38 UTC (permalink / raw)
To: opensbi
On 20 Oct 2020, at 00:32, Alistair Francis <Alistair.Francis@wdc.com> wrote:
> On Tue, 2020-10-20 at 00:05 +0100, Jessica Clarke wrote:
>> On 20 Oct 2020, at 00:02, Alistair Francis <alistair.francis@wdc.com>
>> wrote:
>>> On Mon, 2020-10-19 at 23:56 +0100, Jessica Clarke wrote:
>>>> On 19 Oct 2020, at 23:41, Alistair Francis <
>>>> alistair.francis at wdc.com>
>>>> wrote:
>>>>> To avoid
>>>>> can't link double-float modules with soft-float modules
>>>>> errors when building 32-bit openSBI don't specify mabi or
>>>>> march.
>>>>
>>>> What happens if you want to build for a different ABI or ISA
>>>> string
>>>> deliberately? Especially with something like Clang where every
>>>> compiler
>>>> is a cross-compiler. Users should be able to specify an ABI or
>>>> ISA
>>>> string if they want and have it honoured, either via
>>>> PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere
>>>> rather
>>>> than
>>>> overwriting it entirely (which is the more standard thing to do
>>>> for
>>>> software that isn't RISC-V-specific).
>>>
>>> A user could do that by specifying their own CFLAGS when building
>>> to
>>> allow them to specify a ISA or ABI.
>>
>> Makefile:196:CFLAGS = -g -Wall -Werror -ffreestanding
>> -nostdlib -fno-strict-aliasing -O2
>
> Ah, I didn't realise this. I'll change it to a +=
Thanks. Same goes for AFLAGS, and I didn't check LDFLAGS etc.
>> That doesn't work so well with user-supplied CFLAGS.
>>
>>> Currently no platform set PLATFORM_RISCV_ABI as it defaults to
>>> ilp32 or
>>> lp64.
>>
>> We do. We have new ABIs for our extension (see cheri-cpu.org).
>
> Ah ok. Maybe it's worth upstreamign the cheri implementaiton then?
We never really finished it properly and have been stuck on BBL. Well,
in theory it works, but it just hasn't seen the same amount of testing
as it's not in day-to-day use. I don't think it makes much sense to
upstream the very CHERI-specific bits (instructions, configuration,
etc) since it's ultimately a research architecture for now and we do
want to be able to make breaking changes, but there may well be things
we can upstream that make our fork's diff smaller (the nature of the
architecture and software model means that we routinely find
integer/pointer confusion in projects and can upstream many of our
diffs as simple code quality improvements to use the right type). I do
know it required substantially less hacking than BBL though to get
something that booted, especially in the build system.
Jess
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 22:41 [PATCH] Makefile: Don't specify mabi or march Alistair Francis
2020-10-19 22:56 ` Jessica Clarke
@ 2020-10-20 3:52 ` Anup Patel
2020-10-20 4:33 ` Anup Patel
2020-10-20 7:30 ` Andreas Schwab
2 siblings, 1 reply; 12+ messages in thread
From: Anup Patel @ 2020-10-20 3:52 UTC (permalink / raw)
To: opensbi
On Tue, Oct 20, 2020 at 4:22 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
>
> To avoid
> can't link double-float modules with soft-float modules
> errors when building 32-bit openSBI don't specify mabi or march.
We have a lot of users (including me) who use multilib toolchain to compile
OpenSBI for desired mabi and march. In fact, I have one common toolchain
for ilp32, ilp32d, lp64, and lp64d.
By removing "-mabi" and "-march", we are enforcing users to depend on
default mabi and march of toolchain. This means we can't use multilib
toolchain for OpenSBI.
I would suggest to add a separate makefile option (e.g.
PLATFORM_USE_TOOLCHAIN_MABI, PLATFORM_USE_TOOLCHAIN_MARCH)
which when enabled will skip specifying "-mabi" and "-march" in various
compiler/assembler/linker flags.
Regards,
Anup
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
> Makefile | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index a231881..3f819d9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
> CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
> CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> CFLAGS += -mno-save-restore -mstrict-align
> -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> CFLAGS += $(GENFLAGS)
> CFLAGS += $(platform-cflags-y)
> @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
> ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
> ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> ASFLAGS += -mno-save-restore -mstrict-align
> -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> ASFLAGS += $(GENFLAGS)
> ASFLAGS += $(platform-asflags-y)
> --
> 2.28.0
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-20 3:52 ` Anup Patel
@ 2020-10-20 4:33 ` Anup Patel
0 siblings, 0 replies; 12+ messages in thread
From: Anup Patel @ 2020-10-20 4:33 UTC (permalink / raw)
To: opensbi
On Tue, Oct 20, 2020 at 9:22 AM Anup Patel <anup@brainfault.org> wrote:
>
> On Tue, Oct 20, 2020 at 4:22 AM Alistair Francis
> <alistair.francis@wdc.com> wrote:
> >
> > To avoid
> > can't link double-float modules with soft-float modules
> > errors when building 32-bit openSBI don't specify mabi or march.
>
> We have a lot of users (including me) who use multilib toolchain to compile
> OpenSBI for desired mabi and march. In fact, I have one common toolchain
> for ilp32, ilp32d, lp64, and lp64d.
>
> By removing "-mabi" and "-march", we are enforcing users to depend on
> default mabi and march of toolchain. This means we can't use multilib
> toolchain for OpenSBI.
>
> I would suggest to add a separate makefile option (e.g.
> PLATFORM_USE_TOOLCHAIN_MABI, PLATFORM_USE_TOOLCHAIN_MARCH)
> which when enabled will skip specifying "-mabi" and "-march" in various
> compiler/assembler/linker flags.
Here's a change which will work for your case as well as with multilib
toolchains:
diff --git a/Makefile b/Makefile
index a231881..dd5f4ce 100644
--- a/Makefile
+++ b/Makefile
@@ -94,6 +94,8 @@ DTC = dtc
# Guess the compillers xlen
OPENSBI_CC_XLEN := $(shell TMP=`$(CC) -dumpmachine | sed
's/riscv\([0-9][0-9]\).*/\1/'`; echo $${TMP})
+OPENSBI_CC_ABI := $(shell TMP=`$(CC) -v 2>&1 | sed -n
's/.*\(with\-abi=\([a-zA-Z0-9]*\)\).*/\2/p'`; echo $${TMP})
+OPENSBI_CC_ISA := $(shell TMP=`$(CC) -v 2>&1 | sed -n
's/.*\(with\-arch=\([a-zA-Z0-9]*\)\).*/\2/p'`; echo $${TMP})
# Setup platform XLEN
ifndef PLATFORM_RISCV_XLEN
@@ -143,14 +145,22 @@ deps-y+=$(firmware-objs-path-y:.o=.dep)
# Setup platform ABI, ISA and Code Model
ifndef PLATFORM_RISCV_ABI
- ifeq ($(PLATFORM_RISCV_XLEN), 32)
- PLATFORM_RISCV_ABI = ilp$(PLATFORM_RISCV_XLEN)
+ ifndef PLATFORM_USE_TOOLCHAIN_ABI
+ ifeq ($(PLATFORM_RISCV_XLEN), 32)
+ PLATFORM_RISCV_ABI = ilp$(PLATFORM_RISCV_XLEN)
+ else
+ PLATFORM_RISCV_ABI = lp$(PLATFORM_RISCV_XLEN)
+ endif
else
- PLATFORM_RISCV_ABI = lp$(PLATFORM_RISCV_XLEN)
+ PLATFORM_RISCV_ABI = $(OPENSBI_CC_ABI)
endif
endif
ifndef PLATFORM_RISCV_ISA
- PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc
+ ifndef PLATFORM_USE_TOOLCHAIN_ISA
+ PLATFORM_RISCV_ISA = rv$(PLATFORM_RISCV_XLEN)imafdc
+ else
+ PLATFORM_RISCV_ISA = $(OPENSBI_CC_ISA)
+ endif
endif
ifndef PLATFORM_RISCV_CODE_MODEL
PLATFORM_RISCV_CODE_MODEL = medany
Regards,
Anup
>
> Regards,
> Anup
>
> >
> > Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> > ---
> > Makefile | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index a231881..3f819d9 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -196,7 +196,6 @@ GENFLAGS += $(firmware-genflags-y)
> > CFLAGS = -g -Wall -Werror -ffreestanding -nostdlib -fno-strict-aliasing -O2
> > CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> > CFLAGS += -mno-save-restore -mstrict-align
> > -CFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> > CFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > CFLAGS += $(GENFLAGS)
> > CFLAGS += $(platform-cflags-y)
> > @@ -210,7 +209,6 @@ CPPFLAGS += $(firmware-cppflags-y)
> > ASFLAGS = -g -Wall -nostdlib -D__ASSEMBLY__
> > ASFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
> > ASFLAGS += -mno-save-restore -mstrict-align
> > -ASFLAGS += -mabi=$(PLATFORM_RISCV_ABI) -march=$(PLATFORM_RISCV_ISA)
> > ASFLAGS += -mcmodel=$(PLATFORM_RISCV_CODE_MODEL)
> > ASFLAGS += $(GENFLAGS)
> > ASFLAGS += $(platform-asflags-y)
> > --
> > 2.28.0
> >
> >
> > --
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 23:32 ` Alistair Francis
2020-10-19 23:38 ` Jessica Clarke
@ 2020-10-20 7:27 ` Andreas Schwab
1 sibling, 0 replies; 12+ messages in thread
From: Andreas Schwab @ 2020-10-20 7:27 UTC (permalink / raw)
To: opensbi
On Okt 19 2020, Alistair Francis wrote:
> On Tue, 2020-10-20 at 00:05 +0100, Jessica Clarke wrote:
>> Makefile:196:CFLAGS = -g -Wall -Werror -ffreestanding
>> -nostdlib -fno-strict-aliasing -O2
>
> Ah, I didn't realise this. I'll change it to a +=
That won't work with `make CFLAGS=foo'.
Andreas.
--
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 22:41 [PATCH] Makefile: Don't specify mabi or march Alistair Francis
2020-10-19 22:56 ` Jessica Clarke
2020-10-20 3:52 ` Anup Patel
@ 2020-10-20 7:30 ` Andreas Schwab
2020-10-21 0:53 ` Alistair Francis
2 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2020-10-20 7:30 UTC (permalink / raw)
To: opensbi
On Okt 19 2020, Alistair Francis wrote:
> To avoid
> can't link double-float modules with soft-float modules
> errors when building 32-bit openSBI don't specify mabi or march.
What version of binutils are you using?
Andreas.
--
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-20 7:30 ` Andreas Schwab
@ 2020-10-21 0:53 ` Alistair Francis
0 siblings, 0 replies; 12+ messages in thread
From: Alistair Francis @ 2020-10-21 0:53 UTC (permalink / raw)
To: opensbi
On Tue, 2020-10-20 at 09:30 +0200, Andreas Schwab wrote:
> On Okt 19 2020, Alistair Francis wrote:
>
> > To avoid
> > can't link double-float modules with soft-float modules
> > errors when building 32-bit openSBI don't specify mabi or march.
>
> What version of binutils are you using?
I'm using 2.35.
Alistair
>
> Andreas.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Makefile: Don't specify mabi or march
2020-10-19 23:38 ` Jessica Clarke
@ 2020-10-21 0:55 ` Alistair Francis
0 siblings, 0 replies; 12+ messages in thread
From: Alistair Francis @ 2020-10-21 0:55 UTC (permalink / raw)
To: opensbi
On Tue, 2020-10-20 at 00:38 +0100, Jessica Clarke wrote:
> On 20 Oct 2020, at 00:32, Alistair Francis <Alistair.Francis@wdc.com>
> wrote:
> > On Tue, 2020-10-20 at 00:05 +0100, Jessica Clarke wrote:
> > > On 20 Oct 2020, at 00:02, Alistair Francis <
> > > alistair.francis at wdc.com>
> > > wrote:
> > > > On Mon, 2020-10-19 at 23:56 +0100, Jessica Clarke wrote:
> > > > > On 19 Oct 2020, at 23:41, Alistair Francis <
> > > > > alistair.francis at wdc.com>
> > > > > wrote:
> > > > > > To avoid
> > > > > > can't link double-float modules with soft-float modules
> > > > > > errors when building 32-bit openSBI don't specify mabi or
> > > > > > march.
> > > > >
> > > > > What happens if you want to build for a different ABI or ISA
> > > > > string
> > > > > deliberately? Especially with something like Clang where
> > > > > every
> > > > > compiler
> > > > > is a cross-compiler. Users should be able to specify an ABI
> > > > > or
> > > > > ISA
> > > > > string if they want and have it honoured, either via
> > > > > PLATFORM_RISCV_ABI/ISA or by using += for CFLAGS everywhere
> > > > > rather
> > > > > than
> > > > > overwriting it entirely (which is the more standard thing to
> > > > > do
> > > > > for
> > > > > software that isn't RISC-V-specific).
> > > >
> > > > A user could do that by specifying their own CFLAGS when
> > > > building
> > > > to
> > > > allow them to specify a ISA or ABI.
> > >
> > > Makefile:196:CFLAGS = -g -Wall -Werror
> > > -ffreestanding
> > > -nostdlib -fno-strict-aliasing -O2
> >
> > Ah, I didn't realise this. I'll change it to a +=
>
> Thanks. Same goes for AFLAGS, and I didn't check LDFLAGS etc.
>
> > > That doesn't work so well with user-supplied CFLAGS.
> > >
> > > > Currently no platform set PLATFORM_RISCV_ABI as it defaults to
> > > > ilp32 or
> > > > lp64.
> > >
> > > We do. We have new ABIs for our extension (see cheri-cpu.org).
> >
> > Ah ok. Maybe it's worth upstreamign the cheri implementaiton then?
>
> We never really finished it properly and have been stuck on BBL.
That is annoying.
> Well,
> in theory it works, but it just hasn't seen the same amount of
> testing
> as it's not in day-to-day use. I don't think it makes much sense to
> upstream the very CHERI-specific bits (instructions, configuration,
> etc) since it's ultimately a research architecture for now and we do
> want to be able to make breaking changes, but there may well be
Agreed, but I'm sure at least some of it could be upstreamed. That
helps us at least build test other platforms.
> things
> we can upstream that make our fork's diff smaller (the nature of the
> architecture and software model means that we routinely find
> integer/pointer confusion in projects and can upstream many of our
> diffs as simple code quality improvements to use the right type). I
That would be great!
> do
> know it required substantially less hacking than BBL though to get
> something that booted, especially in the build system.
I'm glad to hear that :)
Alistair
>
> Jess
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-10-21 0:55 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-19 22:41 [PATCH] Makefile: Don't specify mabi or march Alistair Francis
2020-10-19 22:56 ` Jessica Clarke
2020-10-19 23:02 ` Alistair Francis
2020-10-19 23:05 ` Jessica Clarke
2020-10-19 23:32 ` Alistair Francis
2020-10-19 23:38 ` Jessica Clarke
2020-10-21 0:55 ` Alistair Francis
2020-10-20 7:27 ` Andreas Schwab
2020-10-20 3:52 ` Anup Patel
2020-10-20 4:33 ` Anup Patel
2020-10-20 7:30 ` Andreas Schwab
2020-10-21 0:53 ` Alistair Francis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox