Re: [PATCH] Fix multiple definition error under lto

From: Zhang Rui
Date: Sun Dec 11 2016 - 22:45:19 EST


On Sat, 2016-11-26 at 17:25 -0500, Peter Foley wrote:
> drivers/thermal/built-in.o: In function `type_show.lto_priv.33':
> (.text+0x3d80): multiple definition of `type_show.lto_priv.33'
> drivers/base/built-in.o:(.text+0x2a40): first defined here
>
can you illustrate how to reproduce this problem?

thanks,
rui
> Signed-off-by: Peter Foley <pefoley2@xxxxxxxxxxx>
> ---
> Âdrivers/thermal/thermal_core.c | 4 ++--
> Â1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index 226b0b4aced6..23ec1dd2ff3b 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -643,7 +643,7 @@ static void thermal_zone_device_check(struct
> work_struct *work)
> Â container_of(_dev, struct thermal_zone_device, device)
> Â
> Âstatic ssize_t
> -type_show(struct device *dev, struct device_attribute *attr, char
> *buf)
> +thermal_type_show(struct device *dev, struct device_attribute *attr,
> char *buf)
> Â{
> Â struct thermal_zone_device *tz = to_thermal_zone(dev);
> Â
> @@ -1159,7 +1159,7 @@ int power_actor_set_power(struct
> thermal_cooling_device *cdev,
> Â return 0;
> Â}
> Â
> -static DEVICE_ATTR(type, 0444, type_show, NULL);
> +static DEVICE_ATTR(type, 0444, thermal_type_show, NULL);
> Âstatic DEVICE_ATTR(temp, 0444, temp_show, NULL);
> Âstatic DEVICE_ATTR(mode, 0644, mode_show, mode_store);
> Âstatic DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show,
> passive_store);