Re: brcmfmac build failure with gcc < 4.3 due to __UNIQUE_ID() clash
From: Kalle Valo
Date: Sat Jan 16 2016 - 07:04:23 EST
Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> writes:
> On Wed, Jan 13, 2016 at 5:55 AM, Linux Kernel Mailing List
> <linux-kernel@xxxxxxxxxxxxxxx> wrote:
>> Commit: 46d703a775394e4724509ff55cdda41d228c028c
>> brcmfmac: Unify methods to define and map firmware files.
>
[...]
> This change breaks the build with gcc < 4.3:
>
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:598:
> error: redefinition of â__UNIQUE_ID_firmware598â
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:598:
> error: previous definition of â__UNIQUE_ID_firmware598â was here
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:599:
> error: redefinition of â__UNIQUE_ID_firmware600â
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:599:
> error: previous definition of â__UNIQUE_ID_firmware600â was here
> ...
>
> The reason is that BRCMF_FW_NVRAM_DEF() expands to two instances of
> MODULE_FIRMWARE():
>
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h
>>
>> +#define BRCMF_FW_NVRAM_DEF(fw_nvram_name, fw, nvram) \
>> +static const char BRCM_ ## fw_nvram_name ## _FIRMWARE_NAME[] = \
>> + BRCMF_FW_DEFAULT_PATH fw; \
>> +static const char BRCM_ ## fw_nvram_name ## _NVRAM_NAME[] = \
>> + BRCMF_FW_DEFAULT_PATH nvram; \
>> +MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw); \
>> +MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH nvram)
>
> When compiling using gcc < 4.3, __UNIQUE_ID() uses __LINE__ instead of
> __COUNTER__, as the latter is not available. Hence it derives a "unique" ID
> from the same source line number, causing a redefinition.
Hante, what should we do? We need to fix this build breakage ASAP.
--
Kalle Valo