0001-use-LDFLAGS.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. kernel: use LDFLAGS when linking modules
  2. Currently, linking module objects is simply using $(LD), assuming that
  3. the default emulation is correct for the current architecture.
  4. However, that might not be the case when the toolchain default is not
  5. the same as the current arch. For example, if the toolchain defaults to
  6. i386 and is capable of x86_64, and we're targetting x86_64 (or the
  7. opposite), the link would fail because the ld emulation is incorrect:
  8. .../i686-pc-linux-gnu-ld: Relocatable linking with relocations from
  9. format elf64-x86-64 (.../nvidia-driver-370.23/kernel/nvidia/nv-frontend.o)
  10. to format elf32-i386 (.../nvidia-driver-370.23/kernel/nvidia/nv-interface.o)
  11. is not supported
  12. Add use of $(LDFLAGS) when doing the link, as the kernel provides the
  13. proper emulation in those.
  14. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
  15. [Dario: make the patch to be applied with fuzz factor 0]
  16. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
  17. ---
  18. Issue reported upstream:
  19. https://devtalk.nvidia.com/default/topic/958653/
  20. diff -durN nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild
  21. --- nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild 2016-08-09 01:57:50.000000000 +0200
  22. +++ nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild 2016-08-20 12:25:02.780233423 +0200
  23. @@ -93,7 +93,7 @@
  24. always-y += $(NVIDIA_INTERFACE)
  25. $(obj)/$(NVIDIA_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_OBJECTS))
  26. - $(LD) -r -o $@ $^
  27. + $(LD) $(LDFLAGS) -r -o $@ $^
  28. #
  29. diff -durN nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild
  30. --- nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-09 01:43:19.000000000 +0200
  31. +++ nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-20 12:25:39.596772662 +0200
  32. @@ -75,7 +75,7 @@
  33. always-y += $(NVIDIA_MODESET_INTERFACE)
  34. $(obj)/$(NVIDIA_MODESET_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_MODESET_OBJECTS))
  35. - $(LD) -r -o $@ $^
  36. + $(LD) $(LDFLAGS) -r -o $@ $^
  37. #
  38. # Register the conftests needed by nvidia-modeset.ko