oprofile: fix linker errors
PATCH 2/2 oprofile: fix linker errors
Commit e9677b3ce (oprofile, ARM: Use oprofile_arch_exit() to cleanup on failure) caused oprofile_perf_exit to be called in the cleanup path of oprofile_perf_init. The __exit tag for oprofile_perf_exit should therefore be dropped.
The same has to be done for exit_driverfs as well, as this function is called from oprofile_perf_exit. Else, we get the following two linker errors.
LD .tmp_vmlinux1oprofile_perf_exit' referenced in section .init.text' of arch/arm/oprofile/built-in.o: defined in discarded section `.exit.text' of arch/arm/oprofile/built-in.o
make: *** [.tmp_vmlinux1] Error 1
LD .tmp_vmlinux1exit_driverfs' referenced in section .text' of arch/arm/oprofile/built-in.o: defined in discarded section `.exit.text' of arch/arm/oprofile/built-in.o
make: *** [.tmp_vmlinux1] Error 1
---
drivers/oprofile/oprofile_perf.c | 2 +- include/linux/oprofile.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/oprofile/oprofile_perf.c +1 -1
@@ -236,7 +236,7 @@ static int __init init_driverfs(void)return ret; } -static void __exit exit_driverfs(void) +static void exit_driverfs (void ) {platform_device_unregister (oprofile_pdev);platform_driver_unregister (&oprofile_driver);
include/linux/oprofile.h +1 -1
@@ -188,7 +188,7 @@ int oprofile_write_commit(struct op_entr#ifdef CONFIG_PERF_EVENTS int __init oprofile_perf_init (struct oprofile_operations *ops); -void __exit oprofile_perf_exit(void); +void oprofile_perf_exit (void );char *op_name_from_perf_id (void );#endif /* CONFIG_PERF_EVENTS */
PATCH 1/2 oprofile: include platform_device.h to fix build break
oprofile_perf.c needs to include platform_device.h Otherwise we get the following build break.
CC arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.oarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:192: warning: 'struct platform_device' declared inside parameter list arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:192: warning: its scope is only this definition or declaration, which is probably not what you want arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:201: warning: 'struct platform_device' declared inside parameter list arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:210: error: variable 'oprofile_driver' has initializer but incomplete type arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: unknown field 'driver' specified in initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: extra brace group at end of initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: (near initialization for 'oprofile_driver') arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:213: warning: excess elements in struct initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:213: warning: (near initialization for 'oprofile_driver') arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: error: unknown field 'resume' specified in initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: warning: excess elements in struct initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: warning: (near initialization for 'oprofile_driver') arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: error: unknown field 'suspend' specified in initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: warning: excess elements in struct initializer arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: warning: (near initialization for 'oprofile_driver') arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c: In function 'init_driverfs':
---
This build break was seen on linux-next as of 20101014, with a custom config for OMAP4
drivers/oprofile/oprofile_perf.c | 1 + 1 file changed, 1 insertion(+)
drivers/oprofile/oprofile_perf.c +1 -0
@@ -4,6 +4,7 @@* Perf-events backend for OProfile. */ #include <linux/perf_event.h> +#include <linux/platform_device.h> #include <linux/oprofile.h> #include <linux/slab.h>
Robert Richter
AppliedRe: [PATCH 1/2] oprofile: include platform_device.h to fix build break
Quoted 21 lines · Anand Gadiyar
oprofile_perf.cneeds to includeplatform_device.hOtherwise we get the following build break.CC
arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.oarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:192: warning: 'structplatform_device' declared inside parameter listarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:192: warning: its scope is only this definition or declaration, which is probably not what you wantarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:201: warning: 'structplatform_device' declared inside parameter listarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:210: error: variable 'oprofile_driver' has initializer but incomplete typearch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: unknown field 'driver' specified in initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: extra brace group at end of initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:211: error: (near initialization for 'oprofile_driver')arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:213: warning: excess elements in struct initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:213: warning: (near initialization for 'oprofile_driver')arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: error: unknown field 'resume' specified in initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: warning: excess elements in struct initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:214: warning: (near initialization for 'oprofile_driver')arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: error: unknown field 'suspend' specified in initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: warning: excess elements in struct initializerarch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c:215: warning: (near initialization for 'oprofile_driver')arch/arm/oprofile/../../../drivers/oprofile/oprofile_perf.c: In function 'init_driverfs':
Quoted 4 lines
Signed-off-by Anand Gadiyar <[email protected]>Cc Matt Fleming <[email protected]>Cc Will Deacon <[email protected]>Cc Robert Richter <[email protected]>
I applied both patches to the oprofile/core branch. Thanks Anand.
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center