mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
kbuild: use obj-y instead extra-y for objects placed at the head
The objects placed at the head of vmlinux need special treatments: - arch/$(SRCARCH)/Makefile adds them to head-y in order to place them before other archives in the linker command line. - arch/$(SRCARCH)/kernel/Makefile adds them to extra-y instead of obj-y to avoid them going into built-in.a. This commit gets rid of the latter. Create vmlinux.a to collect all the objects that are unconditionally linked to vmlinux. The objects listed in head-y are moved to the head of vmlinux.a by using 'ar m'. With this, arch/$(SRCARCH)/kernel/Makefile can consistently use obj-y for builtin objects. There is no *.o that is directly linked to vmlinux. Drop unneeded code in scripts/clang-tools/gen_compile_commands.py. $(AR) mPi needs 'T' to workaround the llvm-ar bug. The fix was suggested by Nathan Chancellor [1]. [1]: https://lore.kernel.org/llvm/YyjjT5gQ2hGMH0ni@dev-arch.thelio-3990X/ Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
This commit is contained in:
@@ -109,20 +109,6 @@ def to_cmdfile(path):
|
||||
return os.path.join(dir, '.' + base + '.cmd')
|
||||
|
||||
|
||||
def cmdfiles_for_o(obj):
|
||||
"""Generate the iterator of .cmd files associated with the object
|
||||
|
||||
Yield the .cmd file used to build the given object
|
||||
|
||||
Args:
|
||||
obj: The object path
|
||||
|
||||
Yields:
|
||||
The path to .cmd file
|
||||
"""
|
||||
yield to_cmdfile(obj)
|
||||
|
||||
|
||||
def cmdfiles_for_a(archive, ar):
|
||||
"""Generate the iterator of .cmd files associated with the archive.
|
||||
|
||||
@@ -211,13 +197,10 @@ def main():
|
||||
for path in paths:
|
||||
# If 'path' is a directory, handle all .cmd files under it.
|
||||
# Otherwise, handle .cmd files associated with the file.
|
||||
# Most of built-in objects are linked via archives (built-in.a or lib.a)
|
||||
# but some objects are linked to vmlinux directly.
|
||||
# built-in objects are linked via vmlinux.a
|
||||
# Modules are listed in modules.order.
|
||||
if os.path.isdir(path):
|
||||
cmdfiles = cmdfiles_in_dir(path)
|
||||
elif path.endswith('.o'):
|
||||
cmdfiles = cmdfiles_for_o(path)
|
||||
elif path.endswith('.a'):
|
||||
cmdfiles = cmdfiles_for_a(path, ar)
|
||||
elif path.endswith('modules.order'):
|
||||
|
Reference in New Issue
Block a user