Skip to contentSkip to conversation

kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

PATCH New Arnd Bergmann 2 participants 8 messages Mar 14, 2017 – Mar 31, 2017 1 message not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
Fixed version number in check as pointed out by Namhyung Kim

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 6e7e644a0b84..608727d3e47f 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS	+= -Wextra
 KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS	+= $(call cc-ifversion, -ge,0409,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS	+= $(call cc-option,-fdata-sections,)
 endif
 
Signature · 1 line
2.9.0
#1 lore raw

PATCH 1/1 [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
v2: accidentally resend the same patch as before
v3: actually fixed version number in check as pointed out by Namhyung Kim

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 6e7e644a0b84..608727d3e47f 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS	+= -Wextra
 KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS	+= $(call cc-ifversion, -ge,0409,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS	+= $(call cc-option,-fdata-sections,)
 endif
 
Signature · 1 line
2.9.0
#2 lore raw

PATCH 1/1 [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

In reply to Arnd Bergmann

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
v2: accidentally resend the same patch as before
v3: send the exact same patch once more, without doing the change I wanted
v4: actually fixed version number in check as pointed out by Namhyung Kim (I hope)

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +4 -0
index 6e7e644a0b84..3a964fa3a787 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS	+= -Wextra
 KBUILD_CFLAGS	+= $(call cc-disable-warning,frame-address,)
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS	+= $(call cc-ifversion, -ge,0408,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS	+= $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS	+= $(call cc-option,-fdata-sections,)
 endif
 
Signature · 1 line
2.9.0
#3 lore raw

Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

Hi Arnd,

2017-03-15 6:37 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 26 lines

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
v2: accidentally resend the same patch as before
v3: send the exact same patch once more, without doing the change I wanted
v4: actually fixed version number in check as pointed out by Namhyung Kim (I hope)

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +0 -0
index 6e7e644a0b84..3a964fa3a787 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS      += -Wextra
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)

Makefile KBUILD_CFLAGS += -Wextra · line 672

Quoted 10 lines
Makefile +4 -0
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS  += $(call cc-ifversion, -ge,0408,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
 endif
 

I have two questions.

[1]
How did you produce this warning?
I do not see any architecture that selects this option at this point of time.

Did you edit Kconfig locally to select LD_DEAD_CODE_DATA_ELIMINATION? If so, is this patch not so urgent as the "Fixes" tag claims?

[2]
This question is more technical.

The cause of the problem seems that GCC warns it cannot support the two at the same time,
but it does handle it as an error. So, cc-option assumes this combination is OK.

Is it a good idea to add -Werror to cc-option checking?

In my local test, the following patch solved this specific case.

You contribute a lot for compile-test,
so I'd like you to see if it has side-effects.

Makefile +5 -5
index 231e6a7..5850850 100644
@@ -632,11 +632,6 @@ include arch/$(SRCARCH)/Makefile
 KBUILD_CFLAGS  += $(call cc-option,-fno-delete-null-pointer-checks,)
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)
 
-ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
-KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
-KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
-endif
-
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
 else
@@ -767,6 +762,11 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
 KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
 endif
 
+ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
+KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
+endif
+
 # arch Makefile may override CC so keep this after arch Makefile is included
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 CHECKFLAGS     += $(NOSTDINC_FLAGS)
scripts/Kbuild.include +0 -0
index d6ca649..558d4f1 100644
@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out

$(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
/dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",$(1),$(2))

 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
/dev/null -o "$$TMP",y,n)
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",y,n)
 # cc-option-align
 # Prefix align with either -falign or -malign
Signature · 2 lines
Best Regards
Masahiro Yamada
author Reviewed-by Jan-Simon Möller
#4 lore raw

Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

Quoted 44 lines · Masahiro Yamada

Hi Arnd,

2017-03-15 6:37 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 26 lines

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
v2: accidentally resend the same patch as before
v3: send the exact same patch once more, without doing the change I wanted
v4: actually fixed version number in check as pointed out by Namhyung Kim (I hope)

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +0 -0
index 6e7e644a0b84..3a964fa3a787 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS      += -Wextra
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)

Makefile KBUILD_CFLAGS += -Wextra · line 672

Quoted 10 lines
Makefile +4 -0
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS  += $(call cc-ifversion, -ge,0408,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
 endif
 

I have two questions.

Quoted 3 lines

[1]
How did you produce this warning?
I do not see any architecture that selects this option at this point of time.

I saw it on ARM randconfig builds

Quoted 2 lines

Did you edit Kconfig locally to select LD_DEAD_CODE_DATA_ELIMINATION? If so, is this patch not so urgent as the "Fixes" tag claims?

Good point, I forgot that I had enabled this manually on ARM in an earlier patch in my randconfig-fixup series. I thought this was selected on powerpc, but that part of Nick's series apparently didn't make it in yet.

I don't see the 'Fixes' tag as claiming the patch to be urgent, just documenting what patch introduced the problem, but you could argue here that it only gets introduced by a future patch that actually selects the symbol.

Quoted 9 lines

[2]
This question is more technical.

The cause of the problem seems that GCC warns it cannot support the two at the same time,
but it does handle it as an error. So, cc-option assumes this combination is OK.

Is it a good idea to add -Werror to cc-option checking?

Hmm, I've actually been running with that change as a side-effect of having the llvmlinux patches applied, which contain this one:

commit 03497934e211325fc2913476897daf7a5ddb008a

Author: Mark Charlebois <[email protected]>
Date:   Mon Sep 22 14:33:05 2014 -0700

kbuild, LLVMLinux: Add -Werror to cc-option to support clang

Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed.

Adding -Werror make both compiler behave the same.

scripts/Kbuild.include +0 -0
index 285acc57c0a4..3629bd9c7e79 100644
@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out

$(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

cc-option = $(call try-run,\
- $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
/dev/null -o "$$TMP",$(1),$(2))
+ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",$(1),$(2))

 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
/dev/null -o "$$TMP",y,n)
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",y,n)
 # cc-option-align
 # Prefix align with either -falign or -malign
@@ -131,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\
 # cc-disable-warning
 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
 cc-disable-warning = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1))
-c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip
$(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
 # cc-name
 # Expands to either gcc or clang

This is identical to your version, except it applies the same thing to cc-disable-warning. I think this is good to get merged, and there are probably a couple of other patches in that series that we may want to look at again.

Arnd

#5 lore raw

Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

Hi Arnd,

2017-03-29 18:30 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 60 lines
Quoted 44 lines · Masahiro Yamada

Hi Arnd,

2017-03-15 6:37 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 26 lines

When ftrace is enabled and we build with gcc-4.7 or older, we get a warning for each file on architectures that select CONFIG_LD_DEAD_CODE_DATA_ELIMINATION:

warning: -ffunction-sections disabled; it makes profiling impossible [enabled by default]

This turns off function sections in that specific case, leaving it enabled for all other configurations.

Fixes b67067f1176d ("kbuild: allow archs to select link dead code/data elimination")
Cc Namhyung Kim <[email protected]>

---
v2: accidentally resend the same patch as before
v3: send the exact same patch once more, without doing the change I wanted
v4: actually fixed version number in check as pointed out by Namhyung Kim (I hope)

---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Makefile +0 -0
index 6e7e644a0b84..3a964fa3a787 100644
@@ -662,7 +662,11 @@ KBUILD_CFLAGS      += -Wextra
 KBUILD_CFLAGS  += $(call cc-disable-warning,frame-address,)

Makefile KBUILD_CFLAGS += -Wextra · line 672

Quoted 10 lines
Makefile +4 -0
 
 ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+ifdef CONFIG_FUNCTION_TRACER
+KBUILD_CFLAGS  += $(call cc-ifversion, -ge,0408,$(call cc-option,-ffunction-sections,))
+else
 KBUILD_CFLAGS  += $(call cc-option,-ffunction-sections,)
+endif
 KBUILD_CFLAGS  += $(call cc-option,-fdata-sections,)
 endif
 

I have two questions.

Quoted 3 lines

[1]
How did you produce this warning?
I do not see any architecture that selects this option at this point of time.

I saw it on ARM randconfig builds

Quoted 2 lines

Did you edit Kconfig locally to select LD_DEAD_CODE_DATA_ELIMINATION? If so, is this patch not so urgent as the "Fixes" tag claims?

Good point, I forgot that I had enabled this manually on ARM in an earlier patch in my randconfig-fixup series. I thought this was selected on powerpc, but that part of Nick's series apparently didn't make it in yet.

Quoted 4 lines

I don't see the 'Fixes' tag as claiming the patch to be urgent, just documenting what patch introduced the problem, but you could argue here that it only gets introduced by a future patch that actually selects the symbol.

I won't argue. Fixes is reviewer-friendly
for finding the related commit.

I just personally used the "Fix" keyword as a hint for priority because there are still many kbuild patches piled up, and I have not been able to catch up yet.

Quoted 65 lines
Quoted 9 lines

[2]
This question is more technical.

The cause of the problem seems that GCC warns it cannot support the two at the same time,
but it does handle it as an error. So, cc-option assumes this combination is OK.

Is it a good idea to add -Werror to cc-option checking?

Hmm, I've actually been running with that change as a side-effect of having the llvmlinux patches applied, which contain this one:

commit 03497934e211325fc2913476897daf7a5ddb008a

Author: Mark Charlebois <[email protected]>
Date:   Mon Sep 22 14:33:05 2014 -0700

kbuild, LLVMLinux: Add -Werror to cc-option to support clang

Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed.

Adding -Werror make both compiler behave the same.

scripts/Kbuild.include +1 -3
index 285acc57c0a4..3629bd9c7e79 100644
@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out
 $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
 
 cc-option = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
 /dev/null -o "$$TMP",$(1),$(2))
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",$(1),$(2))
 
 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c

/dev/null -o "$$TMP",y,n)

scripts/Kbuild.include +2 -3
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",y,n)
 
 # cc-option-align
 # Prefix align with either -falign or -malign
@@ -131,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\
 # cc-disable-warning
 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
 cc-disable-warning = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1))
-c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip
 $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
 
 # cc-name
 # Expands to either gcc or clang
Quoted 2 lines

This is identical to your version, except it applies the same thing to cc-disable-warning.

Ah, I see.

I'm also moving
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) below
CC_FLAGS_FTRACE := -pg
to fix the warning.

Quoted 3 lines

I think this is good to get merged,
and there are probably a couple of other patches in that series that we may want to look at again.

I agree.

At least, 03497934e21 looks good to be merged.
(I need to get access to Mark, and ask him to send this patch.)

Then, swap the -ffunction-sections and -pg order.

I hope this will make you and clang guys happy.

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

Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

Quoted 91 lines · Masahiro Yamada

2017-03-29 18:30 GMT+09:00 Arnd Bergmann <[email protected]>:

Quoted 68 lines
Quoted 10 lines · Masahiro Yamada

2017-03-15 6:37 GMT+09:00 Arnd Bergmann <[email protected]>:
[2]
This question is more technical.

The cause of the problem seems that GCC warns it cannot support the two at the same time,
but it does handle it as an error. So, cc-option assumes this combination is OK.

Is it a good idea to add -Werror to cc-option checking?

Hmm, I've actually been running with that change as a side-effect of having the llvmlinux patches applied, which contain this one:

commit 03497934e211325fc2913476897daf7a5ddb008a

Author: Mark Charlebois <[email protected]>
Date:   Mon Sep 22 14:33:05 2014 -0700

kbuild, LLVMLinux: Add -Werror to cc-option to support clang

Clang will warn about unknown warnings but will not return false unless -Werror is set. GCC will return false if an unknown warning is passed.

Adding -Werror make both compiler behave the same.

scripts/Kbuild.include +1 -3
index 285acc57c0a4..3629bd9c7e79 100644
@@ -116,12 +116,12 @@ CC_OPTION_CFLAGS = $(filter-out
 $(GCC_PLUGINS_CFLAGS),$(KBUILD_CFLAGS))
 # Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
 
 cc-option = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c
 /dev/null -o "$$TMP",$(1),$(2))
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",$(1),$(2))
 
 # cc-option-yn
 # Usage: flag := $(call cc-option-yn,-march=winchip-c6)
 cc-option-yn = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c -x c

/dev/null -o "$$TMP",y,n)

scripts/Kbuild.include +2 -3
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) $(1) -c
-x c /dev/null -o "$$TMP",y,n)
 
 # cc-option-align
 # Prefix align with either -falign or -malign
@@ -131,7 +131,7 @@ cc-option-align = $(subst -functions=0,,\
 # cc-disable-warning
 # Usage: cflags-y += $(call cc-disable-warning,unused-but-set-variable)
 cc-disable-warning = $(call try-run,\
-       $(CC) $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip $(1))
-c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
+       $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -W$(strip
 $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
 
 # cc-name
 # Expands to either gcc or clang
Quoted 2 lines

This is identical to your version, except it applies the same thing to cc-disable-warning.

Ah, I see.

I'm also moving
KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) below
CC_FLAGS_FTRACE := -pg
to fix the warning.

Quoted 3 lines

I think this is good to get merged,
and there are probably a couple of other patches in that series that we may want to look at again.

I agree.

Quoted 6 lines

At least, 03497934e21 looks good to be merged.
(I need to get access to Mark, and ask him to send this patch.)

Then, swap the -ffunction-sections and -pg order.

I hope this will make you and clang guys happy.

I may have a number of clang related patches in the future, and can also forward this patch. I suspect that Mark (added to Cc) is currently not able to send a tested patch for the latest kernel, he worked on it in 2014, but I don't think he's following llvmlinux at the moment.

Arnd

A message that is not in the archive (sent off-list or not yet received): CAFzeTN3-=a6n-PEKP5ssCUszYYPu5R5_6uf9DEdptPKEuWOsrQ@mail.gmail.com

#8 lore raw

Re: [PATCH] [SUBMITTED 20170314] [v333kbuild: disable -ffunction-sections on gcc-4.7 with ftrace

Quoted 3 lines · Mark Charlebois

What is it you need from me? To rebase 03497934e21, test (on what ARCH) and resend (to who)?. Let me know if Arnd forwarding the patch isn't sufficient. I'm not set up to test this at the moment, but could if needed.

I've just send it, I think that's sufficient and will keep the the patch attributed
correctly.

Arnd