Skip to contentSkip to conversation

drivers/phy/tegra/xusb.c:941: undefined reference to `usb_get_maximum_speed'

PATCH Chen 1 participant 1 message Mar 28, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20200327203436.GA54333@ubuntu-m2-xlarge-x86

Chen

#1 lore raw
Quoted 26 lines · Nathan Chancellor
Quoted 4 lines · Nick Desaulniers' via Clang Built Linux

This is a known bug in bfd; it doesn't seem to emit "range extending thunks" for 32b ARM; it's very easy to trigger this for large kernel images. When using LD=ld.lld, lld emits the range extending thunks, so this issue doesn't occur.

This does not apply this situation as this is not an arm32 build, it's an arm64 randconfig build. This is not a ClangBuiltLinux issue, it happens with GCC and binutils.

The issue is that usb_get_maximum_speed is in the USB common folder but CONFIG_USB_COMMON is not selected by PHY_TEGRA_XUSB. This should fix it but I don't know if it is proper or not:

drivers/phy/tegra/Kconfig +1 -0
index a208aca4ba7b..4b0df6e90d25 100644
@@ -2,6 +2,7 @@
  config PHY_TEGRA_XUSB
  	tristate "NVIDIA Tegra XUSB pad controller driver"
  	depends on ARCH_TEGRA
+	select USB_COMMON
  	select USB_CONN_GPIO
  	select USB_PHY
  	help
Quoted 5 lines
Quoted 3 lines

Philip, I'm trying to simplify the llvm builds a bit, but if your build with make CC=clang LD=ld.lld then we don't observe these. We should circle back on that once I've simplified the build.

This does not take away from the fact that ld.lld should be used wherever possible.

Hi,

Thanks you all, we'll add LD=ld.lld.

Best Regards,
Rong Chen

Quoted 85 lines

Cheers,
Nathan

Quoted 81 lines · kbuild test robot
Quoted 75 lines

Hi Stephen,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   89295c59c1f063b533d071ca49d0fa0c0783ca6f
commit: bf5dea0572a06529edc5429263b23d05d30c78a5 [11818/12026] Merge remote-tracking branch 'tegra/for-next'
config: arm64-randconfig-a001-20200327 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 2a43a1610db335afcccd1a179a33a0886a5a2c4d)

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout bf5dea0572a06529edc5429263b23d05d30c78a5
# save the attached .config to linux build tree
COMPILER=clang make.cross ARCH=arm64

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

aarch64-linux-gnu-ld: drivers/phy/tegra/xusb.o: in function `tegra_xusb_usb3_port_parse_dt':

Quoted 1 line
Quoted 1 line

drivers/phy/tegra/xusb.c:941: undefined reference to `usb_get_maximum_speed'

    drivers/phy/tegra/xusb.c:941:(.text+0x166c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `usb_get_maximum_speed'

vim +941 drivers/phy/tegra/xusb.c

e78fdbad1e902f Thierry Reding 2020-03-19  921
53d2a715c24034 Thierry Reding 2015-11-11  922  static int tegra_xusb_usb3_port_parse_dt(struct tegra_xusb_usb3_port *usb3)
53d2a715c24034 Thierry Reding 2015-11-11  923  {
53d2a715c24034 Thierry Reding 2015-11-11  924   struct tegra_xusb_port *port = &usb3->base;
53d2a715c24034 Thierry Reding 2015-11-11  925   struct device_node *np = port->dev.of_node;
1ef535c6ba8ebc JC Kuo         2020-02-12  926   enum usb_device_speed maximum_speed;
53d2a715c24034 Thierry Reding 2015-11-11  927   u32 value;
53d2a715c24034 Thierry Reding 2015-11-11  928   int err;
53d2a715c24034 Thierry Reding 2015-11-11  929
53d2a715c24034 Thierry Reding 2015-11-11  930   err = of_property_read_u32(np, "nvidia,usb2-companion", &value);
53d2a715c24034 Thierry Reding 2015-11-11  931   if (err < 0) {
53d2a715c24034 Thierry Reding 2015-11-11  932           dev_err(&port->dev, "failed to read port: %d\n", err);
53d2a715c24034 Thierry Reding 2015-11-11  933           return err;
53d2a715c24034 Thierry Reding 2015-11-11  934   }
53d2a715c24034 Thierry Reding 2015-11-11  935
53d2a715c24034 Thierry Reding 2015-11-11  936   usb3->port = value;
53d2a715c24034 Thierry Reding 2015-11-11  937
53d2a715c24034 Thierry Reding 2015-11-11  938   usb3->internal = of_property_read_bool(np, "nvidia,internal");
53d2a715c24034 Thierry Reding 2015-11-11  939
1ef535c6ba8ebc JC Kuo         2020-02-12  940   if (device_property_present(&port->dev, "maximum-speed")) {
1ef535c6ba8ebc JC Kuo         2020-02-12 @941           maximum_speed =  usb_get_maximum_speed(&port->dev);
1ef535c6ba8ebc JC Kuo         2020-02-12  942           if (maximum_speed == USB_SPEED_SUPER)
1ef535c6ba8ebc JC Kuo         2020-02-12  943                   usb3->disable_gen2 = true;
1ef535c6ba8ebc JC Kuo         2020-02-12  944           else if (maximum_speed == USB_SPEED_SUPER_PLUS)
1ef535c6ba8ebc JC Kuo         2020-02-12  945                   usb3->disable_gen2 = false;
1ef535c6ba8ebc JC Kuo         2020-02-12  946           else
1ef535c6ba8ebc JC Kuo         2020-02-12  947                   return -EINVAL;
1ef535c6ba8ebc JC Kuo         2020-02-12  948   }
1ef535c6ba8ebc JC Kuo         2020-02-12  949
2f8da84def73e1 Thierry Reding 2020-03-18  950   usb3->supply = regulator_get(&port->dev, "vbus");
045ef3115382fa Vivek Gautam   2016-10-20  951   return PTR_ERR_OR_ZERO(usb3->supply);
53d2a715c24034 Thierry Reding 2015-11-11  952  }
53d2a715c24034 Thierry Reding 2015-11-11  953

:::::: The code at line 941 was first introduced by commit
:::::: 1ef535c6ba8ebcad1ced47a9d382b162c34fba3a phy: tegra: xusb: Add Tegra194 support

:::::: TO: JC Kuo <[email protected]>
:::::: CC: Thierry Reding <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

--
You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe(a)googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202003280210.EVgWpDIL%25lkp%40intel.com.

Signature · 2 lines
Thanks,
~Nick Desaulniers