Skip to contentSkip to conversation

kbuild: remove cc-option test of -fno-strict-overflow

PATCH In review Masahiro Yamada 3 participants 12 messages Sep 10, 2020 – Sep 14, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 kbuild: remove cc-option test of -fno-strict-overflow

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/odq8h9

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 4b5a305e30d2..059b36f2ea53 100644
@@ -922,7 +922,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
 KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 
 # disable invalid "can't wrap" optimizations for signed / pointers
-KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
+KBUILD_CFLAGS	+= -fno-strict-overflow
 
 # clang sets -fmerge-all-constants by default as optimization, but this
 # is non-conforming behavior for C and in fact breaks the kernel, so we
arch/arm64/kernel/vdso32/Makefile +1 -1
index d6adb4677c25..dfffd55175a3 100644
@@ -90,7 +90,7 @@ VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
-VDSO_CFLAGS += $(call cc32-option,-fno-strict-overflow)
+VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
 VDSO_CFLAGS += $(call cc32-option,-Werror=date-time)
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#7 lore raw

PATCH 4/4 kbuild: remove cc-option test of -Werror=date-time

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/xvjcMa

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 5102c89d3167..1d7c58684fda 100644
@@ -940,7 +940,7 @@ KBUILD_CFLAGS  += -fno-stack-check
 KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
 
 # Prohibit date/time macros, which would make the build non-deterministic
-KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+KBUILD_CFLAGS   += -Werror=date-time
 
 # enforce correct pointer usage
 KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)
arch/arm64/kernel/vdso32/Makefile +1 -1
index dfffd55175a3..1feb4f8e556e 100644
@@ -92,7 +92,7 @@ VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
 VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
-VDSO_CFLAGS += $(call cc32-option,-Werror=date-time)
+VDSO_CFLAGS += -Werror=date-time
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
 
 # The 32-bit compiler does not provide 128-bit integers, which are used in
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 1/4
#4 lore raw
In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/odq8h9

Appeared in clang 3.0.0 in commit 6e50103acda2b918545f30141edeb991d766f2a4.

Quoted 35 lines

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 4b5a305e30d2..059b36f2ea53 100644
@@ -922,7 +922,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
 KBUILD_CFLAGS += $(call cc-disable-warning, maybe-uninitialized)
 
 # disable invalid "can't wrap" optimizations for signed / pointers
-KBUILD_CFLAGS	+= $(call cc-option,-fno-strict-overflow)
+KBUILD_CFLAGS	+= -fno-strict-overflow
 
 # clang sets -fmerge-all-constants by default as optimization, but this
 # is non-conforming behavior for C and in fact breaks the kernel, so we
arch/arm64/kernel/vdso32/Makefile +1 -1
index d6adb4677c25..dfffd55175a3 100644
@@ -90,7 +90,7 @@ VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
-VDSO_CFLAGS += $(call cc32-option,-fno-strict-overflow)
+VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
 VDSO_CFLAGS += $(call cc32-option,-Werror=date-time)
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
Signature · 1 line
2.25.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reviewed-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] kbuild: remove cc-option test of -fno-stack-check

In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/59cK6o

This flag is technically ignored by clang (see commit 05b0798916f01690b5903302e51f3136274e291f) but that obviously does not matter for the sake of this.

Quoted 21 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 1b6abecc5cab..5102c89d3167 100644
@@ -934,7 +934,7 @@ KBUILD_CFLAGS	+= -fno-merge-all-constants
 KBUILD_CFLAGS	+= $(call cc-option,-fmerge-constants)
 
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
-KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
+KBUILD_CFLAGS  += -fno-stack-check
 
 # conserve stack if available
 KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
Signature · 1 line
2.25.1
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] kbuild: remove cc-option test of -fno-merge-all-constants

In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/8T4177

For what it's worth, the commit that introduced this block is going to be reverted:

https://lore.kernel.org/mm-commits/20200903201518.JKrRS%[email protected]/

Regardless, it was introduced in LLVM 2.7.0 in commit f9d41df0930986c52e198292cf875eb5d1761ece.

Quoted 21 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 059b36f2ea53..1b6abecc5cab 100644
@@ -927,7 +927,7 @@ KBUILD_CFLAGS	+= -fno-strict-overflow
 # clang sets -fmerge-all-constants by default as optimization, but this
 # is non-conforming behavior for C and in fact breaks the kernel, so we
 # need to disable it here generally.
-KBUILD_CFLAGS	+= $(call cc-option,-fno-merge-all-constants)
+KBUILD_CFLAGS	+= -fno-merge-all-constants
 
 # for gcc -fno-merge-all-constants disables everything, but it is fine
 # to have actual conforming behavior enabled.
Signature · 1 line
2.25.1
Reviewed-by on v1 4/4
#8 lore raw

Re: [PATCH 4/4] kbuild: remove cc-option test of -Werror=date-time

In reply to Masahiro Yamada
Quoted 6 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/xvjcMa

Introduced in clang 3.5.0, see commit
4f43e554081ecac149fe360bee6eef2ed7dab8ea in LLVM.

Quoted 35 lines

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 5102c89d3167..1d7c58684fda 100644
@@ -940,7 +940,7 @@ KBUILD_CFLAGS  += -fno-stack-check
 KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
 
 # Prohibit date/time macros, which would make the build non-deterministic
-KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+KBUILD_CFLAGS   += -Werror=date-time
 
 # enforce correct pointer usage
 KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)
arch/arm64/kernel/vdso32/Makefile +1 -1
index dfffd55175a3..1feb4f8e556e 100644
@@ -92,7 +92,7 @@ VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
 VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
 VDSO_CFLAGS += -fno-strict-overflow
 VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
-VDSO_CFLAGS += $(call cc32-option,-Werror=date-time)
+VDSO_CFLAGS += -Werror=date-time
 VDSO_CFLAGS += $(call cc32-option,-Werror=incompatible-pointer-types)
 
 # The 32-bit compiler does not provide 128-bit integers, which are used in
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH 2/4] kbuild: remove cc-option test of -fno-merge-all-constants

In reply to Nathan Chancellor
Quoted 7 lines · Nathan Chancellor
Quoted 5 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/8T4177

Quoted 6 lines
Quoted 1 line

For what it's worth, the commit that introduced this block is going to be reverted:

https://lore.kernel.org/mm-commits/20200903201518.JKrRS%[email protected]/

My bad - you are right.
This hunk has already gone by Nick's patch.

Thanks.

Quoted 31 lines

Regardless, it was introduced in LLVM 2.7.0 in commit f9d41df0930986c52e198292cf875eb5d1761ece.

Quoted 19 lines

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -2
index 059b36f2ea53..1b6abecc5cab 100644
@@ -927,7 +927,7 @@ KBUILD_CFLAGS     += -fno-strict-overflow
 # clang sets -fmerge-all-constants by default as optimization, but this
 # is non-conforming behavior for C and in fact breaks the kernel, so we
 # need to disable it here generally.
-KBUILD_CFLAGS        += $(call cc-option,-fno-merge-all-constants)
+KBUILD_CFLAGS        += -fno-merge-all-constants
 
 # for gcc -fno-merge-all-constants disables everything, but it is fine
 # to have actual conforming behavior enabled.
--
Quoted 2 lines

2.25.1

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20200910163311.GB3119896%40ubuntu-n2-xlarge-x86.

Signature · 2 lines
Best Regards
Masahiro Yamada
#1 lore raw

PATCH 2/4 kbuild: remove cc-option test of -fno-merge-all-constants

In reply to Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/8T4177

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 059b36f2ea53..1b6abecc5cab 100644
@@ -927,7 +927,7 @@ KBUILD_CFLAGS	+= -fno-strict-overflow
 # clang sets -fmerge-all-constants by default as optimization, but this
 # is non-conforming behavior for C and in fact breaks the kernel, so we
 # need to disable it here generally.
-KBUILD_CFLAGS	+= $(call cc-option,-fno-merge-all-constants)
+KBUILD_CFLAGS	+= -fno-merge-all-constants
 
 # for gcc -fno-merge-all-constants disables everything, but it is fine
 # to have actual conforming behavior enabled.
Signature · 1 line
2.25.1
#5 lore raw

PATCH 3/4 kbuild: remove cc-option test of -fno-stack-check

In reply to Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/59cK6o

---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 1b6abecc5cab..5102c89d3167 100644
@@ -934,7 +934,7 @@ KBUILD_CFLAGS	+= -fno-merge-all-constants
 KBUILD_CFLAGS	+= $(call cc-option,-fmerge-constants)
 
 # Make sure -fstack-check isn't enabled (like gentoo apparently did)
-KBUILD_CFLAGS  += $(call cc-option,-fno-stack-check,)
+KBUILD_CFLAGS  += -fno-stack-check
 
 # conserve stack if available
 KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
Signature · 1 line
2.25.1
maintainer
#9 lore raw
In reply to Masahiro Yamada
Quoted 11 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/odq8h9

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

This, and the other patch (4/4 -- I didn't see 2 or 3), look good to me. Are you taking them via the kbuild tree, or shall I queue them in the arm64 tree? Please just let me know what you prefer.

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw

Hi Will,

Quoted 14 lines · Will Deacon
Quoted 11 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/odq8h9

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines

This, and the other patch (4/4 -- I didn't see 2 or 3), look good to me. Are you taking them via the kbuild tree, or shall I queue them in the arm64 tree? Please just let me know what you prefer.

Will

I will apply all to the kbuild tree.
Your Ack is appreciated.

Thanks.

Signature · 7 lines
Best Regards
Masahiro Yamada

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by
#11 lore raw
Quoted 14 lines · Masahiro Yamada
Quoted 13 lines · Will Deacon
Quoted 11 lines · Masahiro Yamada

The minimal compiler versions, GCC 4.9 and Clang 10 support this flag.

Here is the godbolt:
https://godbolt.org/z/odq8h9

---

 Makefile                          | 2 +-
 arch/arm64/kernel/vdso32/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 3 lines

This, and the other patch (4/4 -- I didn't see 2 or 3), look good to me. Are you taking them via the kbuild tree, or shall I queue them in the arm64 tree? Please just let me know what you prefer.

I will apply all to the kbuild tree.
Your Ack is appreciated.

For both:

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel