Re: [PATCH 2/7] x86: Add an option to compile with -ffunction-sections-fdata-sections

From: Anders Kaseorg
Date: Wed Feb 04 2009 - 05:26:38 EST


On Wed, 4 Feb 2009, Rusty Russell wrote:
> You need to make this depend on X86, otherwise allmodconfig will turn it on
> and break other archs.

Okay.

> What's the conflict with FTRACE?

This actually should have changed from FTRACE to FUNCTION_TRACER as of
commit 606576ce816603d9fe1fb453a88bc6eea16ca709 in v2.6.28-rc3.

The conflict is that FUNCTION_TRACER enables KBUILD_CFLAGS += -pg, and
passing -pg to current gcc causes it to emit a warning and disable
-ffunction-sections:
<http://gcc.gnu.org/ml/gcc-help/2008-11/msg00128.html>

(If this gcc problem is resolved in the future, the code should work fine
with FUNCTION_TRACER. A small amount of extra matching code is needed to
handle DYNAMIC_FTRACE.)

Patch for these two issues:

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6e23e10..1d63b5f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -29,6 +29,7 @@ config X86
select HAVE_KSPLICE
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_WANT_FRAME_POINTERS
+ select HAVE_FUNCTION_DATA_SECTIONS
select HAVE_KRETPROBES
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_DYNAMIC_FTRACE
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 6d64083..c6a2674 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -591,9 +591,13 @@ config FRAME_POINTER
larger and slower, but it gives very useful debugging information
in case of kernel bugs. (precise oopses/stacktraces/warnings)

+config HAVE_FUNCTION_DATA_SECTIONS
+ bool
+
config FUNCTION_DATA_SECTIONS
bool "Compile with -ffunction-sections -fdata-sections"
- depends on !FTRACE
+ depends on HAVE_FUNCTION_DATA_SECTIONS
+ depends on !FUNCTION_TRACER
help
If you say Y here the compiler will give each function
and data structure its own ELF section.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/