longsleep / linux-pine64

Pine64 Linux Kernel
Other
111 stars 104 forks source link

__inline issue in net/wireless/rtl* drivers #11

Closed pspoerri closed 8 years ago

pspoerri commented 8 years ago

Compiling the linux-pine64 kernel in a debian arm cross-compilation environment produced the following error:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 LOCALVERSION= modules
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      scripts/mod/devicetable-offsets.s
  CALL    scripts/checksyscalls.sh
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  LD [M]  drivers/net/wireless/rtl8189fs/8189fs.o
drivers/net/wireless/rtl8189fs/core/rtw_security.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_security.o: In function `is_broadcast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: multiple definition of `is_broadcast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_security.o: In function `is_zero_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: multiple definition of `is_zero_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_debug.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_debug.o: In function `is_broadcast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: multiple definition of `is_broadcast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_debug.o: In function `is_zero_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: multiple definition of `is_zero_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_io.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_io.o: In function `is_broadcast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: multiple definition of `is_broadcast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_io.o: In function `is_zero_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: multiple definition of `is_zero_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_query.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_query.o: In function `is_broadcast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: multiple definition of `is_broadcast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_query.o: In function `is_zero_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: multiple definition of `is_zero_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_set.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_set.o: In function `is_broadcast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: multiple definition of `is_broadcast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1330: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ioctl_set.o: In function `is_zero_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: multiple definition of `is_zero_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1336: first defined here
drivers/net/wireless/rtl8189fs/core/rtw_ieee80211.o: In function `is_multicast_mac_addr':
/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: multiple definition of `is_multicast_mac_addr'
drivers/net/wireless/rtl8189fs/core/rtw_cmd.o:/home/pascal/pine64/linux-pine64/drivers/net/wireless/rtl8189fs/include/ieee80211.h:1326: first defined here
[...] 

To resolve this issue I had to add an extern in the __inline functions:

-__inline int is_multicast_mac_addr(const u8 *addr)
+extern __inline int is_multicast_mac_addr(const u8 *addr)
 {
         return ((addr[0] != 0xff) && (0x01 & addr[0]));
 }

-__inline int is_broadcast_mac_addr(const u8 *addr)
+extern __inline int is_broadcast_mac_addr(const u8 *addr)
 {
        return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&   \
                (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
 }

-__inline int is_zero_mac_addr(const u8 *addr)
+extern __inline int is_zero_mac_addr(const u8 *addr)
 {
        return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) &&   \
                (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));

in

drivers/net/wireless/rtl8189fs/include/ieee80211.h
drivers/net/wireless/rtl8723bs/include/ieee80211.h
drivers/net/wireless/rtl8723bs_vq0/include/ieee80211.h

Could it be that __inline is not defined? Or am I using the wrong build environment?

umiddelb commented 8 years ago

It doesn't compile on the pine64, if the 'extern' declaration is present (the extern reference was never resolved), so I removed it, see here.

Which gcc version are you using?

pspoerri commented 8 years ago

I was using aarch64-linux-gnu-gcc (4.9.2-10) 4.9.2 on Debian. I'll see how it behaves on Arch Linux. It's also a bit unclear to me on how the extern behaves in this case.

umiddelb commented 8 years ago

combining __inline (aka assembler code generation) and extern (refer to a library function) doesn't make much sense IMHO.

I'm using gcc version 5.3.1-12 on the PINE64 with Debian Jessie.

longsleep commented 8 years ago

Well, i am using gcc 5.2 and it compiled as it is now. Closing as no further feedback - i suggest you update your tool chain.