0001-use-LDFLAGS.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 targeting 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. ---
  16. Issue reported upstream:
  17. https://devtalk.nvidia.com/default/topic/958653/
  18. diff -durN nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild
  19. --- nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild 2016-08-09 01:57:50.000000000 +0200
  20. +++ nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild 2016-08-20 12:25:02.780233423 +0200
  21. @@ -87,7 +87,7 @@
  22. always += $(NVIDIA_INTERFACE)
  23. $(obj)/$(NVIDIA_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_OBJECTS))
  24. - $(LD) -r -o $@ $^
  25. + $(LD) $(LDFLAGS) -r -o $@ $^
  26. #
  27. diff -durN nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild
  28. --- nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-09 01:43:19.000000000 +0200
  29. +++ nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-20 12:25:39.596772662 +0200
  30. @@ -70,7 +70,7 @@
  31. always += $(NVIDIA_MODESET_INTERFACE)
  32. $(obj)/$(NVIDIA_MODESET_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_MODESET_OBJECTS))
  33. - $(LD) -r -o $@ $^
  34. + $(LD) $(LDFLAGS) -r -o $@ $^
  35. #
  36. # Register the conftests needed by nvidia-modeset.ko