* [PATCH] cpupower: avoid multiple definition with gcc -fno-common
@ 2020-02-01 17:50 Mike Gilbert
2020-02-24 20:20 ` [PATCH v2] " Mike Gilbert
0 siblings, 1 reply; 7+ messages in thread
From: Mike Gilbert @ 2020-02-01 17:50 UTC (permalink / raw)
To: linux-pm; +Cc: Mike Gilbert
The -fno-common option will be enabled by default in GCC 10.
Bug: https://bugs.gentoo.org/707462
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 33dc34db4f3c..1b69f25a1281 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
static struct pci_dev *amd_fam14h_pci_dev;
static int nbp1_entered;
-struct timespec start_time;
+extern struct timespec start_time;
static unsigned long long timediff;
#ifdef DEBUG
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index 6d44fec55ad5..7c77045fef52 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
0
};
+int cpu_count;
+
static struct cpuidle_monitor *monitors[MONITORS_MAX];
static unsigned int avail_monitors;
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
index 5b5eb1da0cce..c559d3115330 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
@@ -25,7 +25,7 @@
#endif
#define CSTATE_DESC_LEN 60
-int cpu_count;
+extern int cpu_count;
/* Hard to define the right names ...: */
enum power_range_e {
--
2.25.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] cpupower: avoid multiple definition with gcc -fno-common
2020-02-01 17:50 [PATCH] cpupower: avoid multiple definition with gcc -fno-common Mike Gilbert
@ 2020-02-24 20:20 ` Mike Gilbert
2020-02-24 22:26 ` shuah
2020-02-26 19:33 ` [PATCH v3] " Mike Gilbert
0 siblings, 2 replies; 7+ messages in thread
From: Mike Gilbert @ 2020-02-24 20:20 UTC (permalink / raw)
To: linux-pm; +Cc: trenn, shuah, Mike Gilbert
The -fno-common option will be enabled by default in GCC 10.
Bug: https://bugs.gentoo.org/707462
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
v2: Made start_time static instead of extern.
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 33dc34db4f3c..20f46348271b 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
static struct pci_dev *amd_fam14h_pci_dev;
static int nbp1_entered;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
#ifdef DEBUG
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index 3c4cee160b0e..a65f7d011513 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
static unsigned long long **previous_count;
static unsigned long long **current_count;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
static int cpuidle_get_count_percent(unsigned int id, double *percent,
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index 6d44fec55ad5..7c77045fef52 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
0
};
+int cpu_count;
+
static struct cpuidle_monitor *monitors[MONITORS_MAX];
static unsigned int avail_monitors;
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
index 5b5eb1da0cce..c559d3115330 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
@@ -25,7 +25,7 @@
#endif
#define CSTATE_DESC_LEN 60
-int cpu_count;
+extern int cpu_count;
/* Hard to define the right names ...: */
enum power_range_e {
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] cpupower: avoid multiple definition with gcc -fno-common
2020-02-24 20:20 ` [PATCH v2] " Mike Gilbert
@ 2020-02-24 22:26 ` shuah
2020-02-25 17:48 ` Mike Gilbert
2020-02-26 19:33 ` [PATCH v3] " Mike Gilbert
1 sibling, 1 reply; 7+ messages in thread
From: shuah @ 2020-02-24 22:26 UTC (permalink / raw)
To: Mike Gilbert, linux-pm; +Cc: trenn, shuah
Hi Mike,
On 2/24/20 1:20 PM, Mike Gilbert wrote:
> The -fno-common option will be enabled by default in GCC 10.
Great. It landed in my inbox now.
Please include the message you are seeing in the change log.
>
> Bug: https://bugs.gentoo.org/707462
> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
> --- >> v2: Made start_time static instead of extern.
>
> tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
> tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
> tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
> tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
> 4 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> index 33dc34db4f3c..20f46348271b 100644
> --- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> @@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
> static struct pci_dev *amd_fam14h_pci_dev;
> static int nbp1_entered;
>
> -struct timespec start_time;
> +static struct timespec start_time;
> static unsigned long long timediff;
Does it make sense to move start_time and timediff defines to
cpupower-monitor.c and adding externs for them in
cpupower-monitor.h?
>
> #ifdef DEBUG
> diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
> index 3c4cee160b0e..a65f7d011513 100644
> --- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
> +++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
> @@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
>
> static unsigned long long **previous_count;
> static unsigned long long **current_count;
> -struct timespec start_time;
> +static struct timespec start_time;
> static unsigned long long timediff;
>
> static int cpuidle_get_count_percent(unsigned int id, double *percent,
> diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
> index 6d44fec55ad5..7c77045fef52 100644
> --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
> +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
> @@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
> 0
> };
>
> +int cpu_count;
> +
> static struct cpuidle_monitor *monitors[MONITORS_MAX];
> static unsigned int avail_monitors;
>
> diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
> index 5b5eb1da0cce..c559d3115330 100644
> --- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
> +++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
> @@ -25,7 +25,7 @@
> #endif
> #define CSTATE_DESC_LEN 60
>
> -int cpu_count;
> +extern int cpu_count;
>
> /* Hard to define the right names ...: */
> enum power_range_e {
>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] cpupower: avoid multiple definition with gcc -fno-common
2020-02-24 22:26 ` shuah
@ 2020-02-25 17:48 ` Mike Gilbert
2020-02-25 21:51 ` shuah
0 siblings, 1 reply; 7+ messages in thread
From: Mike Gilbert @ 2020-02-25 17:48 UTC (permalink / raw)
To: shuah; +Cc: linux-pm, trenn
On Mon, Feb 24, 2020 at 5:26 PM shuah <shuah@kernel.org> wrote:
>
> Hi Mike,
>
> On 2/24/20 1:20 PM, Mike Gilbert wrote:
> > The -fno-common option will be enabled by default in GCC 10.
>
> Great. It landed in my inbox now.
> Please include the message you are seeing in the change log.
Sure, I will roll a v3 shortly.
> > diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> > index 33dc34db4f3c..20f46348271b 100644
> > --- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> > +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
> > @@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
> > static struct pci_dev *amd_fam14h_pci_dev;
> > static int nbp1_entered;
> >
> > -struct timespec start_time;
> > +static struct timespec start_time;
> > static unsigned long long timediff;
>
> Does it make sense to move start_time and timediff defines to
> cpupower-monitor.c and adding externs for them in
> cpupower-monitor.h?
I don't think that makes a lot of sense. start_time is really an
internal value and does not need to be shared between the two object
files.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] cpupower: avoid multiple definition with gcc -fno-common
2020-02-25 17:48 ` Mike Gilbert
@ 2020-02-25 21:51 ` shuah
0 siblings, 0 replies; 7+ messages in thread
From: shuah @ 2020-02-25 21:51 UTC (permalink / raw)
To: Mike Gilbert; +Cc: linux-pm, trenn, shuah
On 2/25/20 10:48 AM, Mike Gilbert wrote:
> On Mon, Feb 24, 2020 at 5:26 PM shuah <shuah@kernel.org> wrote:
>>
>> Hi Mike,
>>
>> On 2/24/20 1:20 PM, Mike Gilbert wrote:
>>> The -fno-common option will be enabled by default in GCC 10.
>>
>> Great. It landed in my inbox now.
>> Please include the message you are seeing in the change log.
>
> Sure, I will roll a v3 shortly.
Great.
>
>>> diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
>>> index 33dc34db4f3c..20f46348271b 100644
>>> --- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
>>> +++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
>>> @@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
>>> static struct pci_dev *amd_fam14h_pci_dev;
>>> static int nbp1_entered;
>>>
>>> -struct timespec start_time;
>>> +static struct timespec start_time;
>>> static unsigned long long timediff;
>>
>> Does it make sense to move start_time and timediff defines to
>> cpupower-monitor.c and adding externs for them in
>> cpupower-monitor.h?
>
> I don't think that makes a lot of sense. start_time is really an
> internal value and does not need to be shared between the two object
> files.
>
Makes sense.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] cpupower: avoid multiple definition with gcc -fno-common
2020-02-24 20:20 ` [PATCH v2] " Mike Gilbert
2020-02-24 22:26 ` shuah
@ 2020-02-26 19:33 ` Mike Gilbert
1 sibling, 0 replies; 7+ messages in thread
From: Mike Gilbert @ 2020-02-26 19:33 UTC (permalink / raw)
To: shuah; +Cc: linux-pm, Mike Gilbert
Building cpupower with -fno-common in CFLAGS results in errors due to
multiple definitions of the 'cpu_count' and 'start_time' variables.
./utils/idle_monitor/snb_idle.o:./utils/idle_monitor/cpupower-monitor.h:28:
multiple definition of `cpu_count';
./utils/idle_monitor/nhm_idle.o:./utils/idle_monitor/cpupower-monitor.h:28:
first defined here
...
./utils/idle_monitor/cpuidle_sysfs.o:./utils/idle_monitor/cpuidle_sysfs.c:22:
multiple definition of `start_time';
./utils/idle_monitor/amd_fam14h_idle.o:./utils/idle_monitor/amd_fam14h_idle.c:85:
first defined here
The -fno-common option will be enabled by default in GCC 10.
Bug: https://bugs.gentoo.org/707462
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 33dc34db4f3c..20f46348271b 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
static struct pci_dev *amd_fam14h_pci_dev;
static int nbp1_entered;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
#ifdef DEBUG
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index 3c4cee160b0e..a65f7d011513 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
static unsigned long long **previous_count;
static unsigned long long **current_count;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
static int cpuidle_get_count_percent(unsigned int id, double *percent,
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index 6d44fec55ad5..7c77045fef52 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
0
};
+int cpu_count;
+
static struct cpuidle_monitor *monitors[MONITORS_MAX];
static unsigned int avail_monitors;
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
index 5b5eb1da0cce..c559d3115330 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
@@ -25,7 +25,7 @@
#endif
#define CSTATE_DESC_LEN 60
-int cpu_count;
+extern int cpu_count;
/* Hard to define the right names ...: */
enum power_range_e {
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] cpupower: avoid multiple definition with gcc -fno-common
@ 2020-02-11 0:57 Mike Gilbert
0 siblings, 0 replies; 7+ messages in thread
From: Mike Gilbert @ 2020-02-11 0:57 UTC (permalink / raw)
To: linux-pm
The -fno-common option will be enabled by default in GCC 10.
Bug: https://bugs.gentoo.org/707462
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c | 2 +-
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c | 2 ++
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h | 2 +-
4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
index 33dc34db4f3c..20f46348271b 100644
--- a/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
+++ b/tools/power/cpupower/utils/idle_monitor/amd_fam14h_idle.c
@@ -82,7 +82,7 @@ static struct pci_access *pci_acc;
static struct pci_dev *amd_fam14h_pci_dev;
static int nbp1_entered;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
#ifdef DEBUG
diff --git a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
index 3c4cee160b0e..a65f7d011513 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpuidle_sysfs.c
@@ -19,7 +19,7 @@ struct cpuidle_monitor cpuidle_sysfs_monitor;
static unsigned long long **previous_count;
static unsigned long long **current_count;
-struct timespec start_time;
+static struct timespec start_time;
static unsigned long long timediff;
static int cpuidle_get_count_percent(unsigned int id, double *percent,
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
index 6d44fec55ad5..7c77045fef52 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
@@ -27,6 +27,8 @@ struct cpuidle_monitor *all_monitors[] = {
0
};
+int cpu_count;
+
static struct cpuidle_monitor *monitors[MONITORS_MAX];
static unsigned int avail_monitors;
diff --git a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
index 5b5eb1da0cce..c559d3115330 100644
--- a/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
+++ b/tools/power/cpupower/utils/idle_monitor/cpupower-monitor.h
@@ -25,7 +25,7 @@
#endif
#define CSTATE_DESC_LEN 60
-int cpu_count;
+extern int cpu_count;
/* Hard to define the right names ...: */
enum power_range_e {
--
2.25.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-02-26 19:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-01 17:50 [PATCH] cpupower: avoid multiple definition with gcc -fno-common Mike Gilbert
2020-02-24 20:20 ` [PATCH v2] " Mike Gilbert
2020-02-24 22:26 ` shuah
2020-02-25 17:48 ` Mike Gilbert
2020-02-25 21:51 ` shuah
2020-02-26 19:33 ` [PATCH v3] " Mike Gilbert
2020-02-11 0:57 [PATCH v2] " Mike Gilbert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.