Skip to contentSkip to conversation

drm: Make DRM_FBDEV_EMULATION deps more robust to fix linker errors

PATCH In review Javier Martinez Canillas 2 participants 2 messages Oct 27, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Make DRM_FBDEV_EMULATION deps more robust to fix linker errors

Enabling the CONFIG_DRM_FBDEV_EMULATION Kconfig symbol can lead to linker errors, if CONFIG_DRM_KMS_HELPER is built-in but CONFIG_FB as a module.

Because in that case the drm_kms_helper.o object will have references to symbols that are defined in the fb.ko module, i.e:

  $ make bzImage modules
    DESCEND objtool
    CALL    scripts/atomic/check-atomics.sh
    CALL    scripts/checksyscalls.sh
    CHK     include/generated/compile.h
    GEN     .version
    CHK     include/generated/compile.h
    UPD     include/generated/compile.h
    CC      init/version.o
    AR      init/built-in.a
    LD      vmlinux.o
    MODPOST vmlinux.symvers
    MODINFO modules.builtin.modinfo
    GEN     modules.builtin
    LD      .tmp_vmlinux.kallsyms1
  ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker':
  drm_fb_helper.c:(.text+0x2a0): undefined reference to `fb_set_suspend'
  ...

To prevent this, make following changes to the config option dependencies:

* Depend on FB && !(DRM_KMS_HELPER=y && FB=m), to avoid invalid configs.
* Depend on DRM_KMS_HELPER instead selecting it, to avoid circular deps.

---

This fixes linker errors found when building the Fedora kernel package for the s390x architecture:

https://kojipkgs.fedoraproject.org//work/tasks/9849/77859849/build.log

 drivers/gpu/drm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/Kconfig +2 -2
index cea777ae7fb9..9a21e57b4a0d 100644
@@ -103,8 +103,8 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
 config DRM_FBDEV_EMULATION
 	bool "Enable legacy fbdev support for your modesetting driver"
 	depends on DRM
-	depends on FB
-	select DRM_KMS_HELPER
+	depends on FB && !(DRM_KMS_HELPER=y && FB=m)
+	depends on DRM_KMS_HELPER
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
2.31.1
#1 lore raw
Quoted 25 lines · Javier Martinez Canillas

Enabling the CONFIG_DRM_FBDEV_EMULATION Kconfig symbol can lead to linker errors, if CONFIG_DRM_KMS_HELPER is built-in but CONFIG_FB as a module.

Because in that case the drm_kms_helper.o object will have references to symbols that are defined in the fb.ko module, i.e:

  $ make bzImage modules
    DESCEND objtool
    CALL    scripts/atomic/check-atomics.sh
    CALL    scripts/checksyscalls.sh
    CHK     include/generated/compile.h
    GEN     .version
    CHK     include/generated/compile.h
    UPD     include/generated/compile.h
    CC      init/version.o
    AR      init/built-in.a
    LD      vmlinux.o
    MODPOST vmlinux.symvers
    MODINFO modules.builtin.modinfo
    GEN     modules.builtin
    LD      .tmp_vmlinux.kallsyms1
  ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker':
  drm_fb_helper.c:(.text+0x2a0): undefined reference to `fb_set_suspend'
  ...
Quoted 7 lines

To prevent this, make following changes to the config option dependencies:

* Depend on FB && !(DRM_KMS_HELPER=y && FB=m), to avoid invalid configs.
* Depend on DRM_KMS_HELPER instead selecting it, to avoid circular deps.

Please see [1]. I think it's a big mess. I don't think this is the fix either.

BR,
Jani.

[1] https://lore.kernel.org/r/[email protected]

Quoted 25 lines

---

This fixes linker errors found when building the Fedora kernel package for the s390x architecture:

https://kojipkgs.fedoraproject.org//work/tasks/9849/77859849/build.log

 drivers/gpu/drm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/Kconfig +2 -2
index cea777ae7fb9..9a21e57b4a0d 100644
@@ -103,8 +103,8 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
 config DRM_FBDEV_EMULATION
 	bool "Enable legacy fbdev support for your modesetting driver"
 	depends on DRM
-	depends on FB
-	select DRM_KMS_HELPER
+	depends on FB && !(DRM_KMS_HELPER=y && FB=m)
+	depends on DRM_KMS_HELPER
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center