gcov-kernel: Add ARM eABI support
Juha Tukkinen [Tue, 8 Nov 2011 13:40:22 +0000 (15:40 +0200)]
Based on work by George G. Davis <gdavis@mvista.com>.
See http://lwn.net/Articles/390419/

Change-Id: I8df700d20a154e179f8cf6cdfe4015efc5d384f2
Signed-off-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-on: http://git-master/r/62998
Reviewed-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

Rebase-Id: R2607a46c8bd1e521abe44a57a5ccf7317333d6c9

arch/arm/include/asm/elf.h
arch/arm/kernel/module.c
include/asm-generic/vmlinux.lds.h
kernel/gcov/Kconfig
kernel/module.c

index 56211f2..a3264c9 100644 (file)
@@ -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
index 1e9be5d..b22fc22 100644 (file)
@@ -89,6 +89,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;
 
index eb58d2d..b3b1cb2 100644 (file)
 #ifdef CONFIG_CONSTRUCTORS
 #define KERNEL_CTORS() . = ALIGN(8);                      \
                        VMLINUX_SYMBOL(__ctors_start) = .; \
-                       *(.ctors)                          \
+                       *(CONFIG_GCOV_CTORS)                       \
                        VMLINUX_SYMBOL(__ctors_end) = .;
 #else
 #define KERNEL_CTORS()
index d4da55d..5223238 100644 (file)
@@ -35,7 +35,7 @@ config GCOV_KERNEL
 config GCOV_PROFILE_ALL
        bool "Profile entire Kernel"
        depends on GCOV_KERNEL
-       depends on SUPERH || S390 || X86 || PPC || MICROBLAZE
+       depends on SUPERH || S390 || X86 || PPC || MICROBLAZE || ARM
        default n
        ---help---
        This options activates profiling for the entire kernel.
@@ -46,4 +46,10 @@ config GCOV_PROFILE_ALL
        larger and run slower. Also be sure to exclude files from profiling
        which are not linked to the kernel image to prevent linker errors.
 
+config GCOV_CTORS
+       string
+       depends on CONSTRUCTORS
+       default ".init_array" if ARM && AEABI
+       default ".ctors"
+
 endmenu
index fa53db8..3b5a5d6 100644 (file)
@@ -2751,7 +2751,7 @@ static void find_module_sections(struct module *mod, struct load_info *info)
        mod->unused_gpl_crcs = section_addr(info, "__kcrctab_unused_gpl");
 #endif
 #ifdef CONFIG_CONSTRUCTORS
-       mod->ctors = section_objs(info, ".ctors",
+       mod->ctors = section_objs(info, CONFIG_GCOV_CTORS,
                                  sizeof(*mod->ctors), &mod->num_ctors);
 #endif