2014-04-22 05:40:51

by Behan Webster

[permalink] [raw]
Subject: [PATCH] x86: LLVMLinux: Wrap -mno-80387 with cc-option

From: Behan Webster <[email protected]>

Wrap -mno-80387 gcc options with cc-option so they don't break clang.

Signed-off-by: Behan Webster <[email protected]>
---
arch/x86/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index d1b7c37..ce6ad7e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -83,7 +83,9 @@ else
KBUILD_CFLAGS += -m64

# Don't autogenerate traditional x87, MMX or SSE instructions
- KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
+ KBUILD_CFLAGS += -mno-mmx -mno-sse
+ KBUILD_CFLAGS += $(call cc-option,-mno-80387)
+ KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)

# Use -mpreferred-stack-boundary=3 if supported.
KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
--
1.8.3.2


2014-04-22 06:05:53

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] x86: LLVMLinux: Wrap -mno-80387 with cc-option


* [email protected] <[email protected]> wrote:

> From: Behan Webster <[email protected]>
>
> Wrap -mno-80387 gcc options with cc-option so they don't break clang.
>
> Signed-off-by: Behan Webster <[email protected]>
> ---
> arch/x86/Makefile | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index d1b7c37..ce6ad7e 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -83,7 +83,9 @@ else
> KBUILD_CFLAGS += -m64
>
> # Don't autogenerate traditional x87, MMX or SSE instructions
> - KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
> + KBUILD_CFLAGS += -mno-mmx -mno-sse
> + KBUILD_CFLAGS += $(call cc-option,-mno-80387)
> + KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)

Is there a clang equivalent option that inhibits all things FPU opcode
generation by the compiler?

That's the general purpose of -no-80387.

Thanks,

Ingo

2014-04-22 06:23:54

by Behan Webster

[permalink] [raw]
Subject: Re: [PATCH] x86: LLVMLinux: Wrap -mno-80387 with cc-option

On 04/21/14 23:05, Ingo Molnar wrote:
> * [email protected] <[email protected]> wrote:
>
>> From: Behan Webster <[email protected]>
>>
>> Wrap -mno-80387 gcc options with cc-option so they don't break clang.
>>
>> Signed-off-by: Behan Webster <[email protected]>
>> ---
>> arch/x86/Makefile | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>> index d1b7c37..ce6ad7e 100644
>> --- a/arch/x86/Makefile
>> +++ b/arch/x86/Makefile
>> @@ -83,7 +83,9 @@ else
>> KBUILD_CFLAGS += -m64
>>
>> # Don't autogenerate traditional x87, MMX or SSE instructions
>> - KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
>> + KBUILD_CFLAGS += -mno-mmx -mno-sse
>> + KBUILD_CFLAGS += $(call cc-option,-mno-80387)
>> + KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)
> Is there a clang equivalent option that inhibits all things FPU opcode
> generation by the compiler?
Not that I've found yet. Still investigating.

> That's the general purpose of -no-80387.
Yes, I understand what this is trying to accomplish. At this point I'd
just like this new code not to break the use of clang with v3.15.

I will submit another patch which adds similar functionality when
compiled with clang once I have that answer.

Behan

--
Behan Webster
[email protected]

2014-04-22 09:42:26

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] x86: LLVMLinux: Wrap -mno-80387 with cc-option


* Behan Webster <[email protected]> wrote:

> On 04/21/14 23:05, Ingo Molnar wrote:
> >* [email protected] <[email protected]> wrote:
> >
> >>From: Behan Webster <[email protected]>
> >>
> >>Wrap -mno-80387 gcc options with cc-option so they don't break clang.
> >>
> >>Signed-off-by: Behan Webster <[email protected]>
> >>---
> >> arch/x86/Makefile | 4 +++-
> >> 1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> >>index d1b7c37..ce6ad7e 100644
> >>--- a/arch/x86/Makefile
> >>+++ b/arch/x86/Makefile
> >>@@ -83,7 +83,9 @@ else
> >> KBUILD_CFLAGS += -m64
> >> # Don't autogenerate traditional x87, MMX or SSE instructions
> >>- KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
> >>+ KBUILD_CFLAGS += -mno-mmx -mno-sse
> >>+ KBUILD_CFLAGS += $(call cc-option,-mno-80387)
> >>+ KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)
> >Is there a clang equivalent option that inhibits all things FPU opcode
> >generation by the compiler?
> Not that I've found yet. Still investigating.
>
> >That's the general purpose of -no-80387.
> Yes, I understand what this is trying to accomplish. At this point
> I'd just like this new code not to break the use of clang with
> v3.15.

Agreed.

> I will submit another patch which adds similar functionality when
> compiled with clang once I have that answer.

Thanks!

Ingo

Subject: [tip:x86/urgent] x86: LLVMLinux: Wrap -mno-80387 with cc-option

Commit-ID: 8f2dd677bec68fb55904799a82674c9e64b23be3
Gitweb: http://git.kernel.org/tip/8f2dd677bec68fb55904799a82674c9e64b23be3
Author: Behan Webster <[email protected]>
AuthorDate: Mon, 21 Apr 2014 22:40:27 -0700
Committer: Ingo Molnar <[email protected]>
CommitDate: Tue, 22 Apr 2014 11:41:16 +0200

x86: LLVMLinux: Wrap -mno-80387 with cc-option

Wrap -mno-80387 gcc options with cc-option so they don't break
clang.

Signed-off-by: Behan Webster <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/Makefile | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index d1b7c37..ce6ad7e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -83,7 +83,9 @@ else
KBUILD_CFLAGS += -m64

# Don't autogenerate traditional x87, MMX or SSE instructions
- KBUILD_CFLAGS += -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387
+ KBUILD_CFLAGS += -mno-mmx -mno-sse
+ KBUILD_CFLAGS += $(call cc-option,-mno-80387)
+ KBUILD_CFLAGS += $(call cc-option,-mno-fp-ret-in-387)

# Use -mpreferred-stack-boundary=3 if supported.
KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)