Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/resctrl: Fix compilation issues for other global variables

Reinette reported following compilation issue on Fedora 32, gcc version
10.1.1

/usr/bin/ld: resctrl_tests.o:<src_dir>/resctrl.h:65: multiple definition
of `bm_pid'; cache.o:<src_dir>/resctrl.h:65: first defined here

Other variables are ppid, tests_run, llc_occup_path, is_amd. Compiler
isn't happy because these variables are defined globally in two .c files
but are not declared as extern.

To fix issues for the global variables, declare them as extern.

Chang Log:
- Split this patch from v4's patch 1 (Shuah).

Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Fenghua Yu and committed by
Shuah Khan
896016d2 8236c51d

+4 -4
+4 -4
tools/testing/selftests/resctrl/resctrl.h
··· 62 62 int (*setup)(int num, ...); 63 63 }; 64 64 65 - pid_t bm_pid, ppid; 66 - int tests_run; 65 + extern pid_t bm_pid, ppid; 66 + extern int tests_run; 67 67 68 - char llc_occup_path[1024]; 69 - bool is_amd; 68 + extern char llc_occup_path[1024]; 69 + extern bool is_amd; 70 70 71 71 bool check_resctrlfs_support(void); 72 72 int filter_dmesg(void);