>From 2a55028da8c8567de6a8223e753e1de440bb3e8f Mon Sep 17 00:00:00 2001 From: George G. Davis Date: Tue, 27 Apr 2010 16:47:16 -0400 Subject: [PATCH] gcov: Add ARM eABI support Initially based on linux-2.6.30-gcov-arm-eabi.patch [1] and linux-2.6.30-gcov-arm-hack.patch [2] with fixups to resolve forward port conflicts. Improved on [1] by making the constructors section name a kernel config variable so the correct section name is automatically selected based on the build target. [1] http://ltp.cvs.sourceforge.net/viewvc/*checkout*/ltp/utils/analysis/gcov-kernel/linux-2.6.30-gcov-arm-eabi.patch?revision=1.1 [2] http://ltp.cvs.sourceforge.net/viewvc/*checkout*/ltp/utils/analysis/gcov-kernel/linux-2.6.30-gcov-arm-hack.patch?revision=1.1 Signed-off-by: David Singleton Signed-off-by: George G. Davis --- arch/arm/boot/bootp/Makefile | 2 ++ arch/arm/boot/compressed/Makefile | 2 ++ arch/arm/include/asm/elf.h | 1 + arch/arm/kernel/module.c | 1 + include/asm-generic/vmlinux.lds.h | 2 +- init/Kconfig | 6 ++++++ kernel/gcov/Kconfig | 2 +- kernel/module.c | 2 +- 8 files changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/bootp/Makefile b/arch/arm/boot/bootp/Makefile index c394e30..5761f00 100644 --- a/arch/arm/boot/bootp/Makefile +++ b/arch/arm/boot/bootp/Makefile @@ -5,6 +5,8 @@ # architecture-specific flags and dependencies. # +GCOV_PROFILE := n + LDFLAGS_bootp :=-p --no-undefined -X \ --defsym initrd_phys=$(INITRD_PHYS) \ --defsym params_phys=$(PARAMS_PHYS) -T diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 864a002..4ecb1ba 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -8,6 +8,8 @@ HEAD = head.o OBJS = misc.o decompress.o FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c +GCOV_PROFILE := n + # # Architecture dependencies # diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 51662fe..6b19f46 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -52,6 +52,7 @@ typedef struct user_fp elf_fpregset_t; #define R_ARM_ABS32 2 #define R_ARM_CALL 28 #define R_ARM_JUMP24 29 +#define R_ARM_TARGET1 38 #define R_ARM_V4BX 40 #define R_ARM_PREL31 42 #define R_ARM_MOVW_ABS_NC 43 diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index c628bdf..2e04a98 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -129,6 +129,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, break; case R_ARM_ABS32: + case R_ARM_TARGET1: *(u32 *)loc += sym->st_value; break; diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 030a954..ef62639 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -452,7 +452,7 @@ #ifdef CONFIG_CONSTRUCTORS #define KERNEL_CTORS() . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ - *(.ctors) \ + *(CONFIG_CTORS) \ VMLINUX_SYMBOL(__ctors_end) = .; #else #define KERNEL_CTORS() diff --git a/init/Kconfig b/init/Kconfig index 5cff9a9..eb3ad6e 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -21,6 +21,12 @@ config CONSTRUCTORS depends on !UML default y +config CTORS + string + depends on CONSTRUCTORS + default ".init_array" if ARM && AEABI + default ".ctors" + menu "General setup" config EXPERIMENTAL diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index 70a298d..c62fb42 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig @@ -34,7 +34,7 @@ config GCOV_KERNEL config GCOV_PROFILE_ALL bool "Profile entire Kernel" depends on GCOV_KERNEL - depends on S390 || X86 || (PPC && EXPERIMENTAL) || MICROBLAZE + depends on S390 || X86 || (PPC && EXPERIMENTAL) || MICROBLAZE || ARM default n ---help--- This options activates profiling for the entire kernel. diff --git a/kernel/module.c b/kernel/module.c index 6c56282..26885e1 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2405,7 +2405,7 @@ static noinline struct module *load_module(void __user *umod, "__kcrctab_unused_gpl"); #endif #ifdef CONFIG_CONSTRUCTORS - mod->ctors = section_objs(hdr, sechdrs, secstrings, ".ctors", + mod->ctors = section_objs(hdr, sechdrs, secstrings, CONFIG_CTORS, sizeof(*mod->ctors), &mod->num_ctors); #endif -- 1.6.3.3.334.g800a0