diff options
| -rw-r--r-- | arch/x86/Makefile | 35 | ||||
| -rw-r--r-- | arch/x86/Makefile_32.cpu | 18 | ||||
| -rw-r--r-- | arch/x86/kernel/ftrace.c | 6 | ||||
| -rw-r--r-- | scripts/Kbuild.include | 4 |
4 files changed, 41 insertions, 22 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 2d449337a360..a94a4d10f2df 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
| @@ -120,10 +120,6 @@ else | |||
| 120 | # -funit-at-a-time shrinks the kernel .text considerably | 120 | # -funit-at-a-time shrinks the kernel .text considerably |
| 121 | # unfortunately it makes reading oopses harder. | 121 | # unfortunately it makes reading oopses harder. |
| 122 | KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) | 122 | KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) |
| 123 | |||
| 124 | # this works around some issues with generating unwind tables in older gccs | ||
| 125 | # newer gccs do it by default | ||
| 126 | KBUILD_CFLAGS += $(call cc-option,-maccumulate-outgoing-args) | ||
| 127 | endif | 123 | endif |
| 128 | 124 | ||
| 129 | ifdef CONFIG_X86_X32 | 125 | ifdef CONFIG_X86_X32 |
| @@ -147,6 +143,37 @@ ifeq ($(CONFIG_KMEMCHECK),y) | |||
| 147 | KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy) | 143 | KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy) |
| 148 | endif | 144 | endif |
| 149 | 145 | ||
| 146 | # | ||
| 147 | # If the function graph tracer is used with mcount instead of fentry, | ||
| 148 | # '-maccumulate-outgoing-args' is needed to prevent a GCC bug | ||
| 149 | # (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109) | ||
| 150 | # | ||
| 151 | ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
| 152 | ifndef CONFIG_HAVE_FENTRY | ||
| 153 | ACCUMULATE_OUTGOING_ARGS := 1 | ||
| 154 | else | ||
| 155 | ifeq ($(call cc-option-yn, -mfentry), n) | ||
| 156 | ACCUMULATE_OUTGOING_ARGS := 1 | ||
| 157 | endif | ||
| 158 | endif | ||
| 159 | endif | ||
| 160 | |||
| 161 | # | ||
| 162 | # Jump labels need '-maccumulate-outgoing-args' for gcc < 4.5.2 to prevent a | ||
| 163 | # GCC bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46226). There's no way | ||
| 164 | # to test for this bug at compile-time because the test case needs to execute, | ||
| 165 | # which is a no-go for cross compilers. So check the GCC version instead. | ||
| 166 | # | ||
| 167 | ifdef CONFIG_JUMP_LABEL | ||
| 168 | ifneq ($(ACCUMULATE_OUTGOING_ARGS), 1) | ||
| 169 | ACCUMULATE_OUTGOING_ARGS = $(call cc-if-fullversion, -lt, 040502, 1) | ||
| 170 | endif | ||
| 171 | endif | ||
| 172 | |||
| 173 | ifeq ($(ACCUMULATE_OUTGOING_ARGS), 1) | ||
| 174 | KBUILD_CFLAGS += -maccumulate-outgoing-args | ||
| 175 | endif | ||
| 176 | |||
| 150 | # Stackpointer is addressed different for 32 bit and 64 bit x86 | 177 | # Stackpointer is addressed different for 32 bit and 64 bit x86 |
| 151 | sp-$(CONFIG_X86_32) := esp | 178 | sp-$(CONFIG_X86_32) := esp |
| 152 | sp-$(CONFIG_X86_64) := rsp | 179 | sp-$(CONFIG_X86_64) := rsp |
diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu index 6647ed49c66c..a45eb15b7cf2 100644 --- a/arch/x86/Makefile_32.cpu +++ b/arch/x86/Makefile_32.cpu | |||
| @@ -45,24 +45,6 @@ cflags-$(CONFIG_MGEODE_LX) += $(call cc-option,-march=geode,-march=pentium-mmx) | |||
| 45 | # cpu entries | 45 | # cpu entries |
| 46 | cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686)) | 46 | cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686)) |
| 47 | 47 | ||
| 48 | # Work around the pentium-mmx code generator madness of gcc4.4.x which | ||
| 49 | # does stack alignment by generating horrible code _before_ the mcount | ||
| 50 | # prologue (push %ebp, mov %esp, %ebp) which breaks the function graph | ||
| 51 | # tracer assumptions. For i686, generic, core2 this is set by the | ||
| 52 | # compiler anyway | ||
| 53 | ifeq ($(CONFIG_FUNCTION_GRAPH_TRACER), y) | ||
| 54 | ADD_ACCUMULATE_OUTGOING_ARGS := y | ||
| 55 | endif | ||
| 56 | |||
| 57 | # Work around to a bug with asm goto with first implementations of it | ||
| 58 | # in gcc causing gcc to mess up the push and pop of the stack in some | ||
| 59 | # uses of asm goto. | ||
| 60 | ifeq ($(CONFIG_JUMP_LABEL), y) | ||
| 61 | ADD_ACCUMULATE_OUTGOING_ARGS := y | ||
| 62 | endif | ||
| 63 | |||
| 64 | cflags-$(ADD_ACCUMULATE_OUTGOING_ARGS) += $(call cc-option,-maccumulate-outgoing-args) | ||
| 65 | |||
| 66 | # Bug fix for binutils: this option is required in order to keep | 48 | # Bug fix for binutils: this option is required in order to keep |
| 67 | # binutils from generating NOPL instructions against our will. | 49 | # binutils from generating NOPL instructions against our will. |
| 68 | ifneq ($(CONFIG_X86_P6_NOP),y) | 50 | ifneq ($(CONFIG_X86_P6_NOP),y) |
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 8f3d9cf26ff9..cbd73eb42170 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
| @@ -29,6 +29,12 @@ | |||
| 29 | #include <asm/ftrace.h> | 29 | #include <asm/ftrace.h> |
| 30 | #include <asm/nops.h> | 30 | #include <asm/nops.h> |
| 31 | 31 | ||
| 32 | #if defined(CONFIG_FUNCTION_GRAPH_TRACER) && \ | ||
| 33 | !defined(CC_USING_FENTRY) && \ | ||
| 34 | !defined(CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE) | ||
| 35 | # error The following combination is not supported: ((compiler missing -mfentry) || (CONFIG_X86_32 and !CONFIG_DYNAMIC_FTRACE)) && CONFIG_FUNCTION_GRAPH_TRACER && CONFIG_CC_OPTIMIZE_FOR_SIZE | ||
| 36 | #endif | ||
| 37 | |||
| 32 | #ifdef CONFIG_DYNAMIC_FTRACE | 38 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 33 | 39 | ||
| 34 | int ftrace_arch_code_modify_prepare(void) | 40 | int ftrace_arch_code_modify_prepare(void) |
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index d6ca649cb0e9..afe3fd3af1e4 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
| @@ -148,6 +148,10 @@ cc-fullversion = $(shell $(CONFIG_SHELL) \ | |||
| 148 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) | 148 | # Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1) |
| 149 | cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) | 149 | cc-ifversion = $(shell [ $(cc-version) $(1) $(2) ] && echo $(3) || echo $(4)) |
| 150 | 150 | ||
| 151 | # cc-if-fullversion | ||
| 152 | # Usage: EXTRA_CFLAGS += $(call cc-if-fullversion, -lt, 040502, -O1) | ||
| 153 | cc-if-fullversion = $(shell [ $(cc-fullversion) $(1) $(2) ] && echo $(3) || echo $(4)) | ||
| 154 | |||
| 151 | # cc-ldoption | 155 | # cc-ldoption |
| 152 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) | 156 | # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) |
| 153 | cc-ldoption = $(call try-run,\ | 157 | cc-ldoption = $(call try-run,\ |
