Re: [PATCH] kbuild: remove duplicate dependencies from .mod files

From: Sami Tolvanen
Date: Tue Feb 18 2020 - 14:21:57 EST


Hi Masahiro,

On Sat, Feb 15, 2020 at 8:28 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> masahiro@grover:~/workspace/linux-kbuild$ llvm-nm
> drivers/gpu/drm/nouveau/nouveau.o | sed -n 's/^ *U //p' | sort -u |
> wc
> 572 572 11478

Thank you for testing this!

> Does ACK do this differently?

Yes, the difference is that we use LTO and after looking into this a
bit more, it turns out that when the individual files in the thin
archive are LLVM bitcode, llvm-nm behaves differently and prints out
the symbols for each file separately.

$ llvm-nm drivers/gpu/drm/nouveau/nouveau.o
...
nvif/client.o:
---------------- W __cfi_check
---------------- W __cfi_check_fail
U __cfi_slowpath_diag
U __ubsan_handle_cfi_check_fail
---------------- T nvif_client_fini
---------------- T nvif_client_init
---------------- T nvif_client_ioctl
---------------- T nvif_client_resume
---------------- T nvif_client_suspend
U nvif_object_fini
U nvif_object_init
U strncpy

nvif/device.o:
---------------- W __cfi_check
---------------- W __cfi_check_fail
U __ubsan_handle_cfi_check_fail
U kfree
---------------- T nvif_device_fini
---------------- T nvif_device_init
---------------- T nvif_device_time
U nvif_object_fini
U nvif_object_init
U nvif_object_mthd
U nvif_user_fini
...

While this output format still works for us, it does generate a lot of
duplicates. Anyway, I think we can come back to this when LTO is
closer to getting upstreamed.

Sami