Re: gpu: drm_fb_cma_helper.c:46: undefined reference to `drm_gem_fb_get_obj'

From: Randy Dunlap
Date: Tue Oct 26 2021 - 20:58:56 EST


On 10/26/21 11:21 AM, Thomas Zimmermann wrote:
Hi

Am 25.10.21 um 14:13 schrieb Naresh Kamboju:
Regression found on arm gcc-11 built with multi_v5_defconfig
Following build warnings / errors reported on linux next 20211025.

metadata:
     git_describe: next-20211025
     git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
     git_short_log: 9ae1fbdeabd3 (\"Add linux-next specific files for 20211025\")
     target_arch: arm
     toolchain: gcc-11
     config: multi_v5_defconfig

build error :
--------------
arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.o: in
function `drm_fb_cma_get_gem_obj':
drivers/gpu/drm/drm_fb_cma_helper.c:46: undefined reference to
`drm_gem_fb_get_obj'
arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:46:
undefined reference to `drm_gem_fb_get_obj'
arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:46:
undefined reference to `drm_gem_fb_get_obj'
arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.o: in
function `drm_fb_cma_sync_non_coherent':
drivers/gpu/drm/drm_fb_cma_helper.c:133: undefined reference to
`drm_atomic_helper_damage_iter_init'
arm-linux-gnueabihf-ld: drivers/gpu/drm/drm_fb_cma_helper.c:135:
undefined reference to `drm_atomic_helper_damage_iter_next'
make[1]: *** [Makefile:1252: vmlinux] Error 1
make[1]: Target '__all' not remade because of errors.
make: *** [Makefile:226: __sub-make] Error 2

Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>


build link:
-----------
https://builds.tuxbuild.com/1zzgFZBGjpQ5R0lawQFW9iJ39Hp/build.log

build config:
-------------
https://builds.tuxbuild.com/1zzgFZBGjpQ5R0lawQFW9iJ39Hp/config

Looking at this config, there is:

CONFIG_DRM=y
# CONFIG_DRM_DP_AUX_CHARDEV is not set
# CONFIG_DRM_DEBUG_MM is not set
# CONFIG_DRM_DEBUG_SELFTEST is not set
CONFIG_DRM_KMS_HELPER=m
# CONFIG_DRM_LOAD_EDID_FIRMWARE is not set
# CONFIG_DRM_DP_CEC is not set
CONFIG_DRM_GEM_CMA_HELPER=y
CONFIG_DRM_KMS_CMA_HELPER=y

GEM_CMA_HELPER depends on KMS_HELPER, but the latter is a module. That's probably the cause of the problem. Is it intentionally set this way?


The only drivers that select DRM_KMS_HELPER are both =m, so that's how
DRM_KMS_HELPER is set also.

Symbol: DRM_KMS_HELPER [=m]
Type : tristate
Defined at drivers/gpu/drm/Kconfig:82
Depends on: HAS_IOMEM [=y] && DRM [=y]
Selected by [m]:
- DRM_ATMEL_HLCDC [=m] && HAS_IOMEM [=y] && DRM [=y] && OF [=y] && COMMON_CLK [=y] && MFD_ATMEL_HLCDC [=y] && ARM [=y]
- DRM_ASPEED_GFX [=m] && HAS_IOMEM [=y] && DRM [=y] && OF [=y] && (COMPILE_TEST [=n] || ARCH_ASPEED [=y]) && MMU [=y]


I did the ARM cross-build and also see the linker error.
I didn't understand why -- and still don't, but here is a little
speculation:

In the past (e.g. 10 years ago), we have to move some .o files
in lib/ from lib-y to obj-y so that they would always be included
in the final object file and not cause their user/caller object
files to suffer from undefined references.
These happened because unused functions(?) in lib-y files are
stripped out of the final object files.
The same thing could be happening here (still just guessing).

Does that help any? I dunno.

Adding Arnd to Cc: to see if he has any ideas...


# To install tuxmake on your system globally
# sudo pip3 install -U tuxmake
tuxmake --runtime podman --target-arch arm --toolchain gcc-11
--kconfig multi_v5_defconfig

--
Linaro LKFT
https://lkft.linaro.org



--
~Randy