linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
       [not found] <CAMuHMdUw9LMVb-8RSNVBEcDMVB9SFOdfF+kb20=gxJiWF1x8sQ@mail.gmail.com>
@ 2019-01-09 23:16 ` Paul Burton
  2019-01-10  2:00   ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Burton @ 2019-01-09 23:16 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-mips, linux-kernel, Paul Burton, Geert Uytterhoeven,
	Masahiro Yamada, Nicholas Piggin, stable

When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
used by ftrace are incompatible. This causes warnings or build failures
(where -Werror applies) such as the following:

  arch/mips/generic/init.c:
    error: -ffunction-sections disabled; it makes profiling impossible

This used to be taken into account by the ordering of calls to cc-option
from within the top-level Makefile, which was introduced by commit
90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
-pg on gcc-4.7"). Unfortunately this was broken when the
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
support in Kconfig"), because the flags used by this check no longer
include -pg.

Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
using GCC 4.7 or older.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: stable@vger.kernel.org # v4.19+
---
 init/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/init/Kconfig b/init/Kconfig
index d47cb77a220e..c787f782148d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1124,6 +1124,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION
 	bool "Dead code and data elimination (EXPERIMENTAL)"
 	depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
 	depends on EXPERT
+	depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
 	depends on $(cc-option,-ffunction-sections -fdata-sections)
 	depends on $(ld-option,--gc-sections)
 	help
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  2019-01-09 23:16 ` [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7 Paul Burton
@ 2019-01-10  2:00   ` Masahiro Yamada
  2019-01-10 18:11     ` Paul Burton
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2019-01-10  2:00 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-kbuild, linux-mips, linux-kernel, Paul Burton,
	Geert Uytterhoeven, Nicholas Piggin, stable

On Thu, Jan 10, 2019 at 8:16 AM Paul Burton <paul.burton@mips.com> wrote:
>
> When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
> used by ftrace are incompatible. This causes warnings or build failures
> (where -Werror applies) such as the following:
>
>   arch/mips/generic/init.c:
>     error: -ffunction-sections disabled; it makes profiling impossible
>
> This used to be taken into account by the ordering of calls to cc-option
> from within the top-level Makefile, which was introduced by commit
> 90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
> -pg on gcc-4.7"). Unfortunately this was broken when the
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
> Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
> support in Kconfig"), because the flags used by this check no longer
> include -pg.
>
> Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
> enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
> using GCC 4.7 or older.
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: stable@vger.kernel.org # v4.19+
> ---
>  init/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/init/Kconfig b/init/Kconfig
> index d47cb77a220e..c787f782148d 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1124,6 +1124,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION
>         bool "Dead code and data elimination (EXPERIMENTAL)"
>         depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
>         depends on EXPERT
> +       depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
>         depends on $(cc-option,-ffunction-sections -fdata-sections)
>         depends on $(ld-option,--gc-sections)
>         help


Thanks for the fix.

I prefer this explicit 'depends on'.

Relying on the order of $(call cc-option, ...) in Makefile is fragile.

We raise the compiler minimum version from time to time.
So, this 'depends on' will eventually go away in the future.


BTW, which one do you think more readable?


depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800

    OR

depends on !(FUNCTION_TRACER && CC_IS_GCC && GCC_VERSION < 40800)


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  2019-01-10  2:00   ` Masahiro Yamada
@ 2019-01-10 18:11     ` Paul Burton
  2019-01-11  2:15       ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Burton @ 2019-01-10 18:11 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kbuild, linux-mips, linux-kernel, Paul Burton,
	Geert Uytterhoeven, Nicholas Piggin, stable

Hi Masahiro,

On Thu, Jan 10, 2019 at 11:00:49AM +0900, Masahiro Yamada wrote:
> On Thu, Jan 10, 2019 at 8:16 AM Paul Burton <paul.burton@mips.com> wrote:
> > When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
> > used by ftrace are incompatible. This causes warnings or build failures
> > (where -Werror applies) such as the following:
> >
> >   arch/mips/generic/init.c:
> >     error: -ffunction-sections disabled; it makes profiling impossible
> >
> > This used to be taken into account by the ordering of calls to cc-option
> > from within the top-level Makefile, which was introduced by commit
> > 90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
> > -pg on gcc-4.7"). Unfortunately this was broken when the
> > CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
> > Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
> > support in Kconfig"), because the flags used by this check no longer
> > include -pg.
> >
> > Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
> > enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
> > using GCC 4.7 or older.
> >
> > Signed-off-by: Paul Burton <paul.burton@mips.com>
> > Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Cc: Nicholas Piggin <npiggin@gmail.com>
> > Cc: stable@vger.kernel.org # v4.19+
> > ---
> >  init/Kconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/init/Kconfig b/init/Kconfig
> > index d47cb77a220e..c787f782148d 100644
> > --- a/init/Kconfig
> > +++ b/init/Kconfig
> > @@ -1124,6 +1124,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION
> >         bool "Dead code and data elimination (EXPERIMENTAL)"
> >         depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> >         depends on EXPERT
> > +       depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
> >         depends on $(cc-option,-ffunction-sections -fdata-sections)
> >         depends on $(ld-option,--gc-sections)
> >         help
> 
> Thanks for the fix.
> 
> I prefer this explicit 'depends on'.
> 
> Relying on the order of $(call cc-option, ...) in Makefile is fragile.
> 
> We raise the compiler minimum version from time to time.
> So, this 'depends on' will eventually go away in the future.
> 
> BTW, which one do you think more readable?
> 
> depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
> 
>     OR
> 
> depends on !(FUNCTION_TRACER && CC_IS_GCC && GCC_VERSION < 40800)

Thanks - yes I agree it's nice that this is more explicit than the
ordering we previously relied upon.

I personally don't mind either of the 2 options above - let me know if
you'd like me to submit a v2 using your second option.

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  2019-01-10 18:11     ` Paul Burton
@ 2019-01-11  2:15       ` Masahiro Yamada
  2019-01-11 19:06         ` [PATCH v2] " Paul Burton
  0 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2019-01-11  2:15 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-kbuild, linux-mips, linux-kernel, Paul Burton,
	Geert Uytterhoeven, Nicholas Piggin, stable

On Fri, Jan 11, 2019 at 3:11 AM Paul Burton <paul.burton@mips.com> wrote:
>
> Hi Masahiro,
>
> On Thu, Jan 10, 2019 at 11:00:49AM +0900, Masahiro Yamada wrote:
> > On Thu, Jan 10, 2019 at 8:16 AM Paul Burton <paul.burton@mips.com> wrote:
> > > When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
> > > used by ftrace are incompatible. This causes warnings or build failures
> > > (where -Werror applies) such as the following:
> > >
> > >   arch/mips/generic/init.c:
> > >     error: -ffunction-sections disabled; it makes profiling impossible
> > >
> > > This used to be taken into account by the ordering of calls to cc-option
> > > from within the top-level Makefile, which was introduced by commit
> > > 90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
> > > -pg on gcc-4.7"). Unfortunately this was broken when the
> > > CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
> > > Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
> > > support in Kconfig"), because the flags used by this check no longer
> > > include -pg.
> > >
> > > Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
> > > enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
> > > using GCC 4.7 or older.
> > >
> > > Signed-off-by: Paul Burton <paul.burton@mips.com>
> > > Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
> > > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > > Cc: Nicholas Piggin <npiggin@gmail.com>
> > > Cc: stable@vger.kernel.org # v4.19+
> > > ---
> > >  init/Kconfig | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/init/Kconfig b/init/Kconfig
> > > index d47cb77a220e..c787f782148d 100644
> > > --- a/init/Kconfig
> > > +++ b/init/Kconfig
> > > @@ -1124,6 +1124,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION
> > >         bool "Dead code and data elimination (EXPERIMENTAL)"
> > >         depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
> > >         depends on EXPERT
> > > +       depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
> > >         depends on $(cc-option,-ffunction-sections -fdata-sections)
> > >         depends on $(ld-option,--gc-sections)
> > >         help
> >
> > Thanks for the fix.
> >
> > I prefer this explicit 'depends on'.
> >
> > Relying on the order of $(call cc-option, ...) in Makefile is fragile.
> >
> > We raise the compiler minimum version from time to time.
> > So, this 'depends on' will eventually go away in the future.
> >
> > BTW, which one do you think more readable?
> >
> > depends on !FUNCTION_TRACER || !CC_IS_GCC || GCC_VERSION >= 40800
> >
> >     OR
> >
> > depends on !(FUNCTION_TRACER && CC_IS_GCC && GCC_VERSION < 40800)
>
> Thanks - yes I agree it's nice that this is more explicit than the
> ordering we previously relied upon.
>
> I personally don't mind either of the 2 options above - let me know if
> you'd like me to submit a v2 using your second option.
>
> Thanks,
>     Paul



Personally, I slightly prefer this:
   depends on !(FUNCTION_TRACER && CC_IS_GCC && GCC_VERSION < 40800)


It is more consistent with your patch title:
   "Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7"


May I ask v2?



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  2019-01-11  2:15       ` Masahiro Yamada
@ 2019-01-11 19:06         ` Paul Burton
  2019-01-13  3:54           ` Masahiro Yamada
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Burton @ 2019-01-11 19:06 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linux-mips, linux-kernel, Paul Burton, Geert Uytterhoeven,
	Masahiro Yamada, Nicholas Piggin, stable

When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
used by ftrace are incompatible. This causes warnings or build failures
(where -Werror applies) such as the following:

  arch/mips/generic/init.c:
    error: -ffunction-sections disabled; it makes profiling impossible

This used to be taken into account by the ordering of calls to cc-option
from within the top-level Makefile, which was introduced by commit
90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
-pg on gcc-4.7"). Unfortunately this was broken when the
CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
support in Kconfig"), because the flags used by this check no longer
include -pg.

Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
using GCC 4.7 or older.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: stable@vger.kernel.org # v4.19+
Cc: linux-kbuild@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Changes in v2:
- Invert the dependency as Masahiro suggested.
---
 init/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/init/Kconfig b/init/Kconfig
index d47cb77a220e..513fa544a134 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1124,6 +1124,7 @@ config LD_DEAD_CODE_DATA_ELIMINATION
 	bool "Dead code and data elimination (EXPERIMENTAL)"
 	depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION
 	depends on EXPERT
+	depends on !(FUNCTION_TRACER && CC_IS_GCC && GCC_VERSION < 40800)
 	depends on $(cc-option,-ffunction-sections -fdata-sections)
 	depends on $(ld-option,--gc-sections)
 	help
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7
  2019-01-11 19:06         ` [PATCH v2] " Paul Burton
@ 2019-01-13  3:54           ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2019-01-13  3:54 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-kbuild, linux-mips, linux-kernel, Paul Burton,
	Geert Uytterhoeven, Nicholas Piggin, stable

On Sat, Jan 12, 2019 at 6:00 AM Paul Burton <paul.burton@mips.com> wrote:
>
> When building using GCC 4.7 or older, -ffunction-sections & the -pg flag
> used by ftrace are incompatible. This causes warnings or build failures
> (where -Werror applies) such as the following:
>
>   arch/mips/generic/init.c:
>     error: -ffunction-sections disabled; it makes profiling impossible
>
> This used to be taken into account by the ordering of calls to cc-option
> from within the top-level Makefile, which was introduced by commit
> 90ad4052e85c ("kbuild: avoid conflict between -ffunction-sections and
> -pg on gcc-4.7"). Unfortunately this was broken when the
> CONFIG_LD_DEAD_CODE_DATA_ELIMINATION cc-option check was moved to
> Kconfig in commit e85d1d65cd8a ("kbuild: test dead code/data elimination
> support in Kconfig"), because the flags used by this check no longer
> include -pg.
>
> Fix this by not allowing CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be
> enabled at the same time as ftrace/CONFIG_FUNCTION_TRACER when building
> using GCC 4.7 or older.
>
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Fixes: e85d1d65cd8a ("kbuild: test dead code/data elimination support in Kconfig")
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: stable@vger.kernel.org # v4.19+
> Cc: linux-kbuild@vger.kernel.org
> Cc: linux-mips@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> Changes in v2:
> - Invert the dependency as Masahiro suggested.


Applied to linux-kbuild/fixes.


Thanks!


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-13  3:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAMuHMdUw9LMVb-8RSNVBEcDMVB9SFOdfF+kb20=gxJiWF1x8sQ@mail.gmail.com>
2019-01-09 23:16 ` [PATCH] kbuild: Disable LD_DEAD_CODE_DATA_ELIMINATION with ftrace & GCC <= 4.7 Paul Burton
2019-01-10  2:00   ` Masahiro Yamada
2019-01-10 18:11     ` Paul Burton
2019-01-11  2:15       ` Masahiro Yamada
2019-01-11 19:06         ` [PATCH v2] " Paul Burton
2019-01-13  3:54           ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).