Skip to contentSkip to conversation

remove the last of incremental linking

PATCH In review Nicholas Piggin 4 participants 15 messages Feb 10, 2018 – Feb 19, 2018

Subsystems (6)
lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

cover remove the last of incremental linking

I don't think there is any point to keeping around the deprecated incremental linking option for too long. So I propose to remove it.

After that is removed, I wonder what people think of changing from built-in.o to built-in.a?

Thanks,
Nick

Nicholas Piggin (2):
kbuild: remove incremental linking option
kbuild: rename built-in.o to built-in.a

 Documentation/kbuild/makefiles.txt | 22 ++++++---
 Documentation/process/changes.rst  |  2 +-
 Makefile                           | 14 +++---
 arch/Kconfig                       |  6 ---
 arch/blackfin/kernel/bfin_ksyms.c  |  2 +-
 arch/powerpc/kernel/Makefile       |  2 +-
 drivers/s390/Makefile              |  2 +-
 lib/Kconfig.debug                  |  4 +-
 scripts/Makefile.build             | 38 ++++++---------
 scripts/Makefile.lib               |  6 +--
 scripts/link-vmlinux.sh            | 99 ++++++++++++++------------------------
 scripts/namespace.pl               |  2 +-
 usr/initramfs_data.S               |  2 +-
 13 files changed, 82 insertions(+), 119 deletions(-)
Signature · 1 line
2.15.1
author reviewer
#1 lore raw

PATCH 1/2 kbuild: remove incremental linking option

This removes the old ld -r incremental link option, which has not been selected by any architecture since June 2017.

---
 Documentation/kbuild/makefiles.txt | 10 ++++-
 arch/Kconfig                       |  6 ---
 scripts/Makefile.build             | 32 +++++---------
 scripts/link-vmlinux.sh            | 91 ++++++++++++++------------------------
 4 files changed, 51 insertions(+), 88 deletions(-)
Documentation/kbuild/makefiles.txt +8 -2
index 71e9feefb63c..750aea9edd35 100644
@@ -153,8 +153,14 @@ more details, with real examples.
 	configuration.
 
 	Kbuild compiles all the $(obj-y) files.  It then calls
-	"$(LD) -r" to merge these files into one built-in.o file.
-	built-in.o is later linked into vmlinux by the parent Makefile.
+	"$(AR) rcSTP" to merge these files into one built-in.o file.
+	This is a thin archive without a symbol table, which makes it
+	unsuitable as a linker input.
+
+	The scripts/link-vmlinux.sh script later makes an aggregate
+	built-in.o with "${AR} rcsTP", which creates the thin archive
+	with a symbol table and an index, making it a valid input for
+	the final vmlinux link passes.
 
 	The order of files in $(obj-y) is significant.  Duplicates in
 	the lists are allowed: the first instance will be linked into
arch/Kconfig +0 -6
index 76c0b54443b1..8e0d665c8d53 100644
@@ -596,12 +596,6 @@ config CC_STACKPROTECTOR_AUTO
 
 endchoice
 
-config THIN_ARCHIVES
-	def_bool y
-	help
-	  Select this if the architecture wants to use thin archives
-	  instead of ld -r to create the built-in.o files.
-
 config LD_DEAD_CODE_DATA_ELIMINATION
 	bool
 	help
scripts/Makefile.build +11 -21
index 47cddf32aeba..c43df53c7cce 100644
@@ -450,15 +450,13 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
 #
 ifdef builtin-target
 
-ifdef CONFIG_THIN_ARCHIVES
-  cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-  cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-  quiet_cmd_link_o_target = AR      $@
-else
-  cmd_make_builtin = $(LD) $(ld_flags) -r -o
-  cmd_make_empty_builtin = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS)
-  quiet_cmd_link_o_target = LD      $@
-endif
+# built-in.o archives are made with no symbol table or index which
+# makes them small and fast, but unable to be used by the linker.
+# scripts/link-vmlinux.sh builds an aggregate built-in.o with a symbol
+# table and index.
+cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
+cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
+quiet_cmd_link_o_target = AR      $@
 
 # If the list of objects to link is empty, just create an empty built-in.o
 cmd_link_o_target = $(if $(strip $(obj-y)),\
@@ -491,11 +489,8 @@ $(modorder-target): $(subdir-ym) FORCE
 ifdef lib-target
 quiet_cmd_link_l_target = AR      $@
 
-ifdef CONFIG_THIN_ARCHIVES
-  cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
-else
-  cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
-endif
+# lib target archives do get a symbol table and index
+cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
 
 $(lib-target): $(lib-y) FORCE
 	$(call if_changed,link_l_target)
@@ -543,13 +538,8 @@ $($(subst $(obj)/,,$(@:.o=-m)))), $^)
 
 cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
 
-ifdef CONFIG_THIN_ARCHIVES
-  quiet_cmd_link_multi-y = AR      $@
-  cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
-else
-  quiet_cmd_link_multi-y = LD      $@
-  cmd_link_multi-y = $(cmd_link_multi-link)
-endif
+quiet_cmd_link_multi-y = AR      $@
+cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
 
 quiet_cmd_link_multi-m = LD [M]  $@
 cmd_link_multi-m = $(cmd_link_multi-link)
scripts/link-vmlinux.sh +32 -59

111 lines not on this page · raw message

Signature · 1 line
2.15.1
#2 lore raw

Re: [PATCH 1/2] kbuild: remove incremental linking option

(+CC Sam)

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 4 lines

This removes the old ld -r incremental link option, which has not been selected by any architecture since June 2017.

Thanks for the last piece work!

BTW, as a loosely related topic,
I guess the following partial section analysis is not working any more.

# Do section mismatch analysis for each module/built-in.a ifdef CONFIG_DEBUG_SECTION_MISMATCH
cmd_secanalysis = ; scripts/mod/modpost $@
endif

If we use thin archive for built-in.o,
this is not ELF, so it is always skipped
by the following code.

if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
    (hdr->e_ident[EI_MAG1] != ELFMAG1) ||
    (hdr->e_ident[EI_MAG2] != ELFMAG2) ||
    (hdr->e_ident[EI_MAG3] != ELFMAG3)) {
        /* Not an ELF file - silently ignore it */
        return 0;

The final analysis is done against vmlinux.o, which is ELF.

Is it better to remove CONFIG_DEBUG_SECTION_MISMATCH? Or, do you have an idea to fix it?

I CCed Sam, the author of commit 91341d4.

Quoted 227 lines
---
 Documentation/kbuild/makefiles.txt | 10 ++++-
 arch/Kconfig                       |  6 ---
 scripts/Makefile.build             | 32 +++++---------
 scripts/link-vmlinux.sh            | 91 ++++++++++++++------------------------
 4 files changed, 51 insertions(+), 88 deletions(-)
Documentation/kbuild/makefiles.txt +8 -2
index 71e9feefb63c..750aea9edd35 100644
@@ -153,8 +153,14 @@ more details, with real examples.
        configuration.
 
        Kbuild compiles all the $(obj-y) files.  It then calls
-       "$(LD) -r" to merge these files into one built-in.o file.
-       built-in.o is later linked into vmlinux by the parent Makefile.
+       "$(AR) rcSTP" to merge these files into one built-in.o file.
+       This is a thin archive without a symbol table, which makes it
+       unsuitable as a linker input.
+
+       The scripts/link-vmlinux.sh script later makes an aggregate
+       built-in.o with "${AR} rcsTP", which creates the thin archive
+       with a symbol table and an index, making it a valid input for
+       the final vmlinux link passes.
 
        The order of files in $(obj-y) is significant.  Duplicates in
        the lists are allowed: the first instance will be linked into
arch/Kconfig +0 -6
index 76c0b54443b1..8e0d665c8d53 100644
@@ -596,12 +596,6 @@ config CC_STACKPROTECTOR_AUTO
 
 endchoice
 
-config THIN_ARCHIVES
-       def_bool y
-       help
-         Select this if the architecture wants to use thin archives
-         instead of ld -r to create the built-in.o files.
-
 config LD_DEAD_CODE_DATA_ELIMINATION
        bool
        help
scripts/Makefile.build +11 -21
index 47cddf32aeba..c43df53c7cce 100644
@@ -450,15 +450,13 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
 #
 ifdef builtin-target
 
-ifdef CONFIG_THIN_ARCHIVES
-  cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-  cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
-  quiet_cmd_link_o_target = AR      $@
-else
-  cmd_make_builtin = $(LD) $(ld_flags) -r -o
-  cmd_make_empty_builtin = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS)
-  quiet_cmd_link_o_target = LD      $@
-endif
+# built-in.o archives are made with no symbol table or index which
+# makes them small and fast, but unable to be used by the linker.
+# scripts/link-vmlinux.sh builds an aggregate built-in.o with a symbol
+# table and index.
+cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
+cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
+quiet_cmd_link_o_target = AR      $@
 
 # If the list of objects to link is empty, just create an empty built-in.o
 cmd_link_o_target = $(if $(strip $(obj-y)),\
@@ -491,11 +489,8 @@ $(modorder-target): $(subdir-ym) FORCE
 ifdef lib-target
 quiet_cmd_link_l_target = AR      $@
 
-ifdef CONFIG_THIN_ARCHIVES
-  cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
-else
-  cmd_link_l_target = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(lib-y)
-endif
+# lib target archives do get a symbol table and index
+cmd_link_l_target = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(lib-y)
 
 $(lib-target): $(lib-y) FORCE
        $(call if_changed,link_l_target)
@@ -543,13 +538,8 @@ $($(subst $(obj)/,,$(@:.o=-m)))), $^)
 
 cmd_link_multi-link = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) $(cmd_secanalysis)
 
-ifdef CONFIG_THIN_ARCHIVES
-  quiet_cmd_link_multi-y = AR      $@
-  cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
-else
-  quiet_cmd_link_multi-y = LD      $@
-  cmd_link_multi-y = $(cmd_link_multi-link)
-endif
+quiet_cmd_link_multi-y = AR      $@
+cmd_link_multi-y = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(link_multi_deps)
 
 quiet_cmd_link_multi-m = LD [M]  $@
 cmd_link_multi-m = $(cmd_link_multi-link)
scripts/link-vmlinux.sh +32 -60
index c0d129d7f430..a55c24a86133 100755
@@ -55,13 +55,11 @@ info()
 #
 archive_builtin()
 {
-       if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-               info AR built-in.o
-               rm -f built-in.o;
-               ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o                 \
-                                       ${KBUILD_VMLINUX_INIT}          \
-                                       ${KBUILD_VMLINUX_MAIN}
-       fi
+       info AR built-in.o
+       rm -f built-in.o;
+       ${AR} rcsTP${KBUILD_ARFLAGS} built-in.o                 \
+                               ${KBUILD_VMLINUX_INIT}          \
+                               ${KBUILD_VMLINUX_MAIN}
 }
 
 # Link of vmlinux.o used for section mismatch analysis
@@ -70,20 +68,13 @@ modpost_link()
 {
        local objects
 
-       if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-               objects="--whole-archive                                \
-                       built-in.o                                      \
-                       --no-whole-archive                              \
-                       --start-group                                   \
-                       ${KBUILD_VMLINUX_LIBS}                          \
-                       --end-group"
-       else
-               objects="${KBUILD_VMLINUX_INIT}                         \
-                       --start-group                                   \
-                       ${KBUILD_VMLINUX_MAIN}                          \
-                       ${KBUILD_VMLINUX_LIBS}                          \
-                       --end-group"
-       fi
+       objects="--whole-archive                                \
+               built-in.o                                      \
+               --no-whole-archive                              \
+               --start-group                                   \
+               ${KBUILD_VMLINUX_LIBS}                          \
+               --end-group"
+
        ${LD} ${LDFLAGS} -r -o ${1} ${objects}
 }
 
@@ -96,46 +87,28 @@ vmlinux_link()
        local objects
 
        if [ "${SRCARCH}" != "um" ]; then
-               if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-                       objects="--whole-archive                        \
-                               built-in.o                              \
-                               --no-whole-archive                      \
-                               --start-group                           \
-                               ${KBUILD_VMLINUX_LIBS}                  \
-                               --end-group                             \
-                               ${1}"
-               else
-                       objects="${KBUILD_VMLINUX_INIT}                 \
-                               --start-group                           \
-                               ${KBUILD_VMLINUX_MAIN}                  \
-                               ${KBUILD_VMLINUX_LIBS}                  \
-                               --end-group                             \
-                               ${1}"
-               fi
-
-               ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2}             \
+               objects="--whole-archive                        \
+                       built-in.o                              \
+                       --no-whole-archive                      \
+                       --start-group                           \
+                       ${KBUILD_VMLINUX_LIBS}                  \
+                       --end-group                             \
+                       ${1}"
+
+               ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2}     \
                        -T ${lds} ${objects}
        else
-               if [ -n "${CONFIG_THIN_ARCHIVES}" ]; then
-                       objects="-Wl,--whole-archive                    \
-                               built-in.o                              \
-                               -Wl,--no-whole-archive                  \
-                               -Wl,--start-group                       \
-                               ${KBUILD_VMLINUX_LIBS}                  \
-                               -Wl,--end-group                         \
-                               ${1}"
-               else
-                       objects="${KBUILD_VMLINUX_INIT}                 \
-                               -Wl,--start-group                       \
-                               ${KBUILD_VMLINUX_MAIN}                  \
-                               ${KBUILD_VMLINUX_LIBS}                  \
-                               -Wl,--end-group                         \
-                               ${1}"
-               fi
-
-               ${CC} ${CFLAGS_vmlinux} -o ${2}                         \
-                       -Wl,-T,${lds}                                   \
-                       ${objects}                                      \
+               objects="-Wl,--whole-archive                    \
+                       built-in.o                              \
+                       -Wl,--no-whole-archive                  \
+                       -Wl,--start-group                       \
+                       ${KBUILD_VMLINUX_LIBS}                  \
+                       -Wl,--end-group                         \
+                       ${1}"
+
+               ${CC} ${CFLAGS_vmlinux} -o ${2}                 \
+                       -Wl,-T,${lds}                           \
+                       ${objects}                              \
                        -lutil -lrt -lpthread
                rm -f linux
        fi
--

2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw

Re: [PATCH 1/2] kbuild: remove incremental linking option

Hi Masahiro/Nicholas.

Quoted 38 lines · Masahiro Yamada

(+CC Sam)

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 4 lines

This removes the old ld -r incremental link option, which has not been selected by any architecture since June 2017.

Thanks for the last piece work!

BTW, as a loosely related topic,
I guess the following partial section analysis is not working any more.

# Do section mismatch analysis for each module/built-in.a ifdef CONFIG_DEBUG_SECTION_MISMATCH
cmd_secanalysis = ; scripts/mod/modpost $@
endif

If we use thin archive for built-in.o,
this is not ELF, so it is always skipped
by the following code.

if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
    (hdr->e_ident[EI_MAG1] != ELFMAG1) ||
    (hdr->e_ident[EI_MAG2] != ELFMAG2) ||
    (hdr->e_ident[EI_MAG3] != ELFMAG3)) {
        /* Not an ELF file - silently ignore it */
        return 0;

The final analysis is done against vmlinux.o, which is ELF.

Quoted 5 lines

Is it better to remove CONFIG_DEBUG_SECTION_MISMATCH? Or, do you have an idea to fix it?

I CCed Sam, the author of commit 91341d4.

The section mismatch analysis for the individual built-in.o files was added to get warnings on a level close to where the source of the error was.
So the warnings was more precise (the .o file gave a good hint where to look for the error).

And since this has not been missed we should not try to add extra logic to re-introduce the check on this level. It would require an extra link for each directory only for the purpose of the section mismatch detection with better warnings.
So we can safely get rid of this part.

We still do an extra link of vmlinux to support section mismatch analysis.
I wonder if we could do something to avoid this extra link step now where we use thin archieves unconditional. I assume this extra link step is more RAM and CPU consuming now than before thin archieves since it has to process many more .o files.
So there should be some wins in build time if we can drop any extra step.

Sam

author reviewer
#4 lore raw

Re: [PATCH 1/2] kbuild: remove incremental linking option

Quoted 54 lines · On Sun, 18 Feb 2018 15:26:17 +0100 Sam Ravnborg <[email protected]> wrote:

Hi Masahiro/Nicholas.

Quoted 38 lines · Masahiro Yamada

(+CC Sam)

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 4 lines

This removes the old ld -r incremental link option, which has not been selected by any architecture since June 2017.

Thanks for the last piece work!

BTW, as a loosely related topic,
I guess the following partial section analysis is not working any more.

# Do section mismatch analysis for each module/built-in.a ifdef CONFIG_DEBUG_SECTION_MISMATCH
cmd_secanalysis = ; scripts/mod/modpost $@
endif

If we use thin archive for built-in.o,
this is not ELF, so it is always skipped
by the following code.

if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
    (hdr->e_ident[EI_MAG1] != ELFMAG1) ||
    (hdr->e_ident[EI_MAG2] != ELFMAG2) ||
    (hdr->e_ident[EI_MAG3] != ELFMAG3)) {
        /* Not an ELF file - silently ignore it */
        return 0;

The final analysis is done against vmlinux.o, which is ELF.

Quoted 5 lines

Is it better to remove CONFIG_DEBUG_SECTION_MISMATCH? Or, do you have an idea to fix it?

I CCed Sam, the author of commit 91341d4.

The section mismatch analysis for the individual built-in.o files was added to get warnings on a level close to where the source of the error was.
So the warnings was more precise (the .o file gave a good hint where to look for the error).

Quoted 6 lines

And since this has not been missed we should not try to add extra logic to re-introduce the check on this level. It would require an extra link for each directory only for the purpose of the section mismatch detection with better warnings.
So we can safely get rid of this part.

This would be good. Perhaps now that the section mismatch analysis has stamped out most such bugs, it is less trouble to work from the final link analysis when they do appear.

Quoted 9 lines

We still do an extra link of vmlinux to support section mismatch analysis.
I wonder if we could do something to avoid this extra link step now where we use thin archieves unconditional. I assume this extra link step is more RAM and CPU consuming now than before thin archieves since it has to process many more .o files.
So there should be some wins in build time if we can drop any extra step.

For the final link it's not too bad. The final built-in archive that is created in the root directory contains symbol table and a symbol index which the linker seems to process very quickly. I found the difference is very small between thin and incremental.

It would be really nice in general to reduce the number of final link passes though. We currently link it 4 times!

Thanks,
Nick

author reviewer
#5 lore raw

PATCH 2/2 kbuild: rename built-in.o to built-in.a

In reply to Nicholas Piggin

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y))) +libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))

---
 Documentation/kbuild/makefiles.txt | 16 ++++++++--------
 Documentation/process/changes.rst  |  2 +-
 Makefile                           | 14 +++++++-------
 arch/blackfin/kernel/bfin_ksyms.c  |  2 +-
 arch/powerpc/kernel/Makefile       |  2 +-
 drivers/s390/Makefile              |  2 +-
 lib/Kconfig.debug                  |  4 ++--
 scripts/Makefile.build             | 10 +++++-----
 scripts/Makefile.lib               |  6 +++---
 scripts/link-vmlinux.sh            | 20 ++++++++++----------
 scripts/namespace.pl               |  2 +-
 usr/initramfs_data.S               |  2 +-
 12 files changed, 41 insertions(+), 41 deletions(-)
Documentation/kbuild/makefiles.txt +8 -8
index 750aea9edd35..667cd899ada8 100644
@@ -153,18 +153,18 @@ more details, with real examples.
 	configuration.
 
 	Kbuild compiles all the $(obj-y) files.  It then calls
-	"$(AR) rcSTP" to merge these files into one built-in.o file.
+	"$(AR) rcSTP" to merge these files into one built-in.a file.
 	This is a thin archive without a symbol table, which makes it
 	unsuitable as a linker input.
 
 	The scripts/link-vmlinux.sh script later makes an aggregate
-	built-in.o with "${AR} rcsTP", which creates the thin archive
+	built-in.a with "${AR} rcsTP", which creates the thin archive
 	with a symbol table and an index, making it a valid input for
 	the final vmlinux link passes.
 
 	The order of files in $(obj-y) is significant.  Duplicates in
 	the lists are allowed: the first instance will be linked into
-	built-in.o and succeeding instances will be ignored.
+	built-in.a and succeeding instances will be ignored.
 
 	Link order is significant, because certain functions
 	(module_init() / __initcall) will be called during boot in the
@@ -228,7 +228,7 @@ more details, with real examples.
 	Note: Of course, when you are building objects into the kernel,
 	the syntax above will also work. So, if you have CONFIG_EXT2_FS=y,
 	kbuild will build an ext2.o file for you out of the individual
-	parts and then link this into built-in.o, as you would expect.
+	parts and then link this into built-in.a, as you would expect.
 
 --- 3.4 Objects which export symbols
 
@@ -238,7 +238,7 @@ more details, with real examples.
 --- 3.5 Library file goals - lib-y
 
 	Objects listed with obj-* are used for modules, or
-	combined in a built-in.o for that specific directory.
+	combined in a built-in.a for that specific directory.
 	There is also the possibility to list objects that will
 	be included in a library, lib.a.
 	All objects listed with lib-y are combined in a single
@@ -250,7 +250,7 @@ more details, with real examples.
 
 	Note that the same kbuild makefile may list files to be built-in
 	and to be part of a library. Therefore the same directory
-	may contain both a built-in.o and a lib.a file.
+	may contain both a built-in.a and a lib.a file.
 
 	Example:
 		#arch/x86/lib/Makefile
@@ -992,7 +992,7 @@ When kbuild executes, the following steps are followed (roughly):
 
 	$(head-y) lists objects to be linked first in vmlinux.
 	$(libs-y) lists directories where a lib.a archive can be located.
-	The rest list directories where a built-in.o object file can be
+	The rest list directories where a built-in.a object file can be
 	located.
 
 	$(init-y) objects will be located after $(head-y).
@@ -1077,7 +1077,7 @@ When kbuild executes, the following steps are followed (roughly):
 		extra-y := head.o init_task.o
 
 	In this example, extra-y is used to list object files that
-	shall be built, but shall not be linked as part of built-in.o.
+	shall be built, but shall not be linked as part of built-in.a.
 
 
 --- 6.7 Commands useful for building a boot image
Documentation/process/changes.rst +1 -1
index 81cdb528ad46..4f19a9725f76 100644
@@ -78,7 +78,7 @@ Binutils
 --------
 
 The build system has, as of 4.13, switched to using thin archives (`ar T`)
-rather than incremental linking (`ld -r`) for built-in.o intermediate steps.
+rather than incremental linking (`ld -r`) for built-in.a intermediate steps.
 This requires binutils 2.20 or newer.
 
 Flex
Makefile +7 -7
index cd9145c0878d..174ec0addf92 100644
@@ -35,7 +35,7 @@ unexport GREP_OPTIONS
 # Most importantly: sub-Makefiles should only ever modify files in
 # their own directory. If in some directory we have a dependency on
 # a file in another dir (which doesn't happen often, but it's often
-# unavoidable when linking the built-in.o targets which finally
+# unavoidable when linking the built-in.a targets which finally
 # turn into vmlinux), we will call a sub make in that other dir, and
 # after that we are sure that everything which is in that other dir
 # is now up to date.
@@ -979,13 +979,13 @@ vmlinux-dirs	:= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
 vmlinux-alldirs	:= $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \
 		     $(init-) $(core-) $(drivers-) $(net-) $(libs-) $(virt-))))
 
-init-y		:= $(patsubst %/, %/built-in.o, $(init-y))
-core-y		:= $(patsubst %/, %/built-in.o, $(core-y))
-drivers-y	:= $(patsubst %/, %/built-in.o, $(drivers-y))
-net-y		:= $(patsubst %/, %/built-in.o, $(net-y))
+init-y		:= $(patsubst %/, %/built-in.a, $(init-y))
+core-y		:= $(patsubst %/, %/built-in.a, $(core-y))
+drivers-y	:= $(patsubst %/, %/built-in.a, $(drivers-y))
+net-y		:= $(patsubst %/, %/built-in.a, $(net-y))
 libs-y1		:= $(patsubst %/, %/lib.a, $(libs-y))
-libs-y2		:= $(filter-out %.a, $(patsubst %/, %/built-in.o, $(libs-y)))
-virt-y		:= $(patsubst %/, %/built-in.o, $(virt-y))
+libs-y2		:= $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
+virt-y		:= $(patsubst %/, %/built-in.a, $(virt-y))
 
 # Externally visible symbols (used by link-vmlinux.sh)
 export KBUILD_VMLINUX_INIT := $(head-y) $(init-y)
arch/blackfin/kernel/bfin_ksyms.c +1 -1
index 68096e8f787f..c0038eeb9e29 100644
@@ -36,7 +36,7 @@ EXPORT_SYMBOL(memchr);
 /*
  * Because string functions are both inline and exported functions and
  * folder arch/blackfin/lib is configured as a library path in Makefile,
- * symbols exported in folder lib  is not linked into built-in.o but
+ * symbols exported in folder lib  is not linked into built-in.a but
  * inlined only. In order to export string symbols to kernel module
  * properly, they should be exported here.
  */
arch/powerpc/kernel/Makefile +1 -1
index 1b6bc7fba996..2358f97d62ec 100644
@@ -165,7 +165,7 @@ systbl_chk: $(src)/systbl_chk.sh $(obj)/systbl_chk.i
 	$(call cmd,systbl_chk)
 
 ifeq ($(CONFIG_PPC_OF_BOOT_TRAMPOLINE),y)
-$(obj)/built-in.o:		prom_init_check
+$(obj)/built-in.a:		prom_init_check
 
 quiet_cmd_prom_init_check = CALL    $<
       cmd_prom_init_check = $(CONFIG_SHELL) $< "$(NM)" "$(obj)/prom_init.o"
drivers/s390/Makefile +1 -1
index 2fdab400c1fe..a863b0462b43 100644
@@ -5,5 +5,5 @@
 
 obj-y += cio/ block/ char/ crypto/ net/ scsi/ virtio/
 
-drivers-y += drivers/s390/built-in.o
+drivers-y += drivers/s390/built-in.a
 
lib/Kconfig.debug +2 -2
index 6088408ef26c..7c66b7152578 100644
@@ -324,11 +324,11 @@ config DEBUG_SECTION_MISMATCH
 	    the analysis would not catch the illegal reference.
 	    This option tells gcc to inline less (but it does result in
 	    a larger kernel).
-	  - Run the section mismatch analysis for each module/built-in.o file.
+	  - Run the section mismatch analysis for each module/built-in.a file.
 	    When we run the section mismatch analysis on vmlinux.o, we
 	    lose valuable information about where the mismatch was
 	    introduced.
-	    Running the analysis for each module/built-in.o file
+	    Running the analysis for each module/built-in.a file
 	    tells where the mismatch happens much closer to the
 	    source. The drawback is that the same mismatch is
 	    reported at least twice.
scripts/Makefile.build +5 -5
index c43df53c7cce..03c2c2964d22 100644
@@ -77,7 +77,7 @@ obj-y += $(obj)/lib-ksyms.o
 endif
 
 ifneq ($(strip $(obj-y) $(need-builtin)),)
-builtin-target := $(obj)/built-in.o
+builtin-target := $(obj)/built-in.a
 endif
 
 modorder-target := $(obj)/modules.order
@@ -104,7 +104,7 @@ ifneq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
   cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $< ;
 endif
 
-# Do section mismatch analysis for each module/built-in.o
+# Do section mismatch analysis for each module/built-in.a
 ifdef CONFIG_DEBUG_SECTION_MISMATCH
   cmd_secanalysis = ; scripts/mod/modpost $@
 endif
@@ -450,15 +450,15 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
 #
 ifdef builtin-target
 
-# built-in.o archives are made with no symbol table or index which
+# built-in.a archives are made with no symbol table or index which
 # makes them small and fast, but unable to be used by the linker.
-# scripts/link-vmlinux.sh builds an aggregate built-in.o with a symbol
+# scripts/link-vmlinux.sh builds an aggregate built-in.a with a symbol
 # table and index.
 cmd_make_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
 cmd_make_empty_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS)
 quiet_cmd_link_o_target = AR      $@
 
-# If the list of objects to link is empty, just create an empty built-in.o
+# If the list of objects to link is empty, just create an empty built-in.a
 cmd_link_o_target = $(if $(strip $(obj-y)),\
 		      $(cmd_make_builtin) $@ $(filter $(obj-y), $^) \
 		      $(cmd_secanalysis),\
scripts/Makefile.lib +3 -3
index 5589bae34af6..3b151bb390cb 100644
@@ -27,7 +27,7 @@ modorder	:= $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) $(obj-m:.o=.ko
 
 # Handle objects in subdirs
 # ---------------------------------------------------------------------------
-# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o
+# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a
 #   and add the directory to the list of dirs to descend into: $(subdir-y)
 # o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
 #   and add the directory to the list of dirs to descend into: $(subdir-m)
@@ -35,7 +35,7 @@ __subdir-y	:= $(patsubst %/,%,$(filter %/, $(obj-y)))
 subdir-y	+= $(__subdir-y)
 __subdir-m	:= $(patsubst %/,%,$(filter %/, $(obj-m)))
 subdir-m	+= $(__subdir-m)
-obj-y		:= $(patsubst %/, %/built-in.o, $(obj-y))
+obj-y		:= $(patsubst %/, %/built-in.a, $(obj-y))
 obj-m		:= $(filter-out %/, $(obj-m))
 
 # Subdirectories we need to descend into
@@ -54,7 +54,7 @@ multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
 
 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
 # tell kbuild to descend
-subdir-obj-y := $(filter %/built-in.o, $(obj-y))
+subdir-obj-y := $(filter %/built-in.a, $(obj-y))
 
 # Replace multi-part objects by their individual parts, look at local dir only
 real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
scripts/link-vmlinux.sh +10 -10
index a55c24a86133..bf9a24e51b9b 100755
@@ -4,7 +4,7 @@
 # link vmlinux
 #
 # vmlinux is linked from the objects selected by $(KBUILD_VMLINUX_INIT) and
-# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.o files
+# $(KBUILD_VMLINUX_MAIN) and $(KBUILD_VMLINUX_LIBS). Most are built-in.a files
 # from top-level directories in the kernel tree, others are specified in
 # arch/$(ARCH)/Makefile. Ordering when linking is important, and
 # $(KBUILD_VMLINUX_INIT) must be first. $(KBUILD_VMLINUX_LIBS) are archives
@@ -18,7 +18,7 @@
 #   |   +--< init/version.o + more
 #   |
 #   +--< $(KBUILD_VMLINUX_MAIN)
-#   |    +--< drivers/built-in.o mm/built-in.o + more
+#   |    +--< drivers/built-in.a mm/built-in.a + more
 #   |
 #   +--< $(KBUILD_VMLINUX_LIBS)
 #   |    +--< lib/lib.a + more
@@ -51,13 +51,13 @@ info()
 #
 # Traditional incremental style of link does not require this step
 #
-# built-in.o output file
+# built-in.a output file
 #
 archive_builtin()
 {
-	info AR built-in.o
-	rm -f built-in.o;
-	${AR} rcsTP${KBUILD_ARFLAGS} built-in.o			\
+	info AR built-in.a
+	rm -f built-in.a;
+	${AR} rcsTP${KBUILD_ARFLAGS} built-in.a			\
 				${KBUILD_VMLINUX_INIT}		\
 				${KBUILD_VMLINUX_MAIN}
 }
@@ -69,7 +69,7 @@ modpost_link()
 	local objects
 
 	objects="--whole-archive				\
-		built-in.o					\
+		built-in.a					\
 		--no-whole-archive				\
 		--start-group					\
 		${KBUILD_VMLINUX_LIBS}				\
@@ -88,7 +88,7 @@ vmlinux_link()
 
 	if [ "${SRCARCH}" != "um" ]; then
 		objects="--whole-archive			\
-			built-in.o				\
+			built-in.a				\
 			--no-whole-archive			\
 			--start-group				\
 			${KBUILD_VMLINUX_LIBS}			\
@@ -99,7 +99,7 @@ vmlinux_link()
 			-T ${lds} ${objects}
 	else
 		objects="-Wl,--whole-archive			\
-			built-in.o				\
+			built-in.a				\
 			-Wl,--no-whole-archive			\
 			-Wl,--start-group			\
 			${KBUILD_VMLINUX_LIBS}			\
@@ -164,7 +164,7 @@ cleanup()
 	rm -f .tmp_System.map
 	rm -f .tmp_kallsyms*
 	rm -f .tmp_vmlinux*
-	rm -f built-in.o
+	rm -f built-in.a
 	rm -f System.map
 	rm -f vmlinux
 	rm -f vmlinux.o
scripts/namespace.pl +1 -1
index 729c547fc9e1..6135574a6f39 100755
@@ -164,7 +164,7 @@ sub linux_objects
 	s:^\./::;
 	if (/.*\.o$/ &&
 		! (
-		m:/built-in.o$:
+		m:/built-in.a$:
 		|| m:arch/x86/vdso/:
 		|| m:arch/x86/boot/:
 		|| m:arch/ia64/ia32/ia32.o$:
usr/initramfs_data.S +1 -1
index 10d325e24566..b28da799f6a6 100644
@@ -10,7 +10,7 @@
 
   ld -m elf_i386  --format binary --oformat elf32-i386 -r \
   -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
-   ld -m elf_i386  -r -o built-in.o initramfs_data.o
+   ld -m elf_i386  -r -o built-in.a initramfs_data.o
 
   For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
 
Signature · 1 line
2.15.1
#6 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 13 lines

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

(quoted diff) +1 -1
-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
Quoted 1 line

I think this is the right thing to do, but I have no idea why 'less kernel/built-in.a' shows strange output. Do you have a clue?

Without this patch,
'emacs kernel/built-in.o'
'cat kernel/built-in.o'
'less kernel/built-in.o'

showed me the same content.

$ less kernel/built-in.o | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/

After applying this patch,
'less kernel/built-in.a' is strange.

$ less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o

However, 'cat kernel/built-in.a' works as I expect.

$ cat  kernel/built-in.a | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Signature · 2 lines
Best Regards
Masahiro Yamada
author reviewer
#7 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

Quoted 77 lines · On Sun, 11 Feb 2018 13:38:04 +0900 Masahiro Yamada…

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 13 lines

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

(quoted diff) +1 -1
-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
Quoted 1 line

I think this is the right thing to do, but I have no idea why 'less kernel/built-in.a' shows strange output. Do you have a clue?

Without this patch,
'emacs kernel/built-in.o'
'cat kernel/built-in.o'
'less kernel/built-in.o'

showed me the same content.

$ less kernel/built-in.o | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/

After applying this patch,
'less kernel/built-in.a' is strange.

$ less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o

However, 'cat kernel/built-in.a' works as I expect.

$ cat  kernel/built-in.a | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/
Quoted 2 lines

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Interesting, my less does not do that. Instead of the raw contents of the file, yours is providing output of ar tv, which is reconstructing more of the archive metadata. I guess it is keyed on the filename extension.

Do you have an alias for it, or maybe the distro patches the tool? It seems a bit rude for your less tool to reformat data for you.

Thanks,
Nick

#8 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

2018-02-11 20:15 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 80 lines
Quoted 77 lines · On Sun, 11 Feb 2018 13:38:04 +0900 Masahiro Yamada…

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 13 lines

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

(quoted diff) +1 -1
-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
Quoted 1 line

I think this is the right thing to do, but I have no idea why 'less kernel/built-in.a' shows strange output. Do you have a clue?

Without this patch,
'emacs kernel/built-in.o'
'cat kernel/built-in.o'
'less kernel/built-in.o'

showed me the same content.

$ less kernel/built-in.o | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/

After applying this patch,
'less kernel/built-in.a' is strange.

$ less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o

However, 'cat kernel/built-in.a' works as I expect.

$ cat  kernel/built-in.a | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/
Quoted 7 lines
Quoted 2 lines

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Interesting, my less does not do that. Instead of the raw contents of the file, yours is providing output of ar tv, which is reconstructing more of the archive metadata. I guess it is keyed on the filename extension.

Ah, I see. 'ar tv' and 'less' gave me the same output.

Quoted 1 line

Do you have an alias for it, or maybe the distro patches the tool?

I use Ubuntu 16.04 LTS.

Not alias'ed

$ type less
less is hashed (/usr/bin/less)
$ /usr/bin/less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o

Could be patched by the disto.

Quoted 8 lines

It seems a bit rude for your less tool to reformat data for you.

Thanks,
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#9 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

Quoted 35 lines · Masahiro Yamada

2018-02-11 20:15 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 10 lines
Quoted 2 lines · On Sun, 11 Feb 2018 13:38:04 +0900 Masahiro Yamada…

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Interesting, my less does not do that. Instead of the raw contents of the file, yours is providing output of ar tv, which is reconstructing more of the archive metadata. I guess it is keyed on the filename extension.

Ah, I see. 'ar tv' and 'less' gave me the same output.

Quoted 1 line

Do you have an alias for it, or maybe the distro patches the tool?

I use Ubuntu 16.04 LTS.

Not alias'ed

$ type less
less is hashed (/usr/bin/less)
$ /usr/bin/less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o
Quoted 1 line

Could be patched by the disto.

What do you get from:

$ echo $LESSOPEN

?

Nicolas

#10 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

2018-02-12 10:26 GMT+09:00 Nicolas Pitre <[email protected]>:

Quoted 37 lines · Masahiro Yamada
Quoted 36 lines

2018-02-11 20:15 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 10 lines
Quoted 2 lines · On Sun, 11 Feb 2018 13:38:04 +0900 Masahiro Yamada…

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Interesting, my less does not do that. Instead of the raw contents of the file, yours is providing output of ar tv, which is reconstructing more of the archive metadata. I guess it is keyed on the filename extension.

Ah, I see. 'ar tv' and 'less' gave me the same output.

Quoted 1 line

Do you have an alias for it, or maybe the distro patches the tool?

I use Ubuntu 16.04 LTS.

Not alias'ed

$ type less
less is hashed (/usr/bin/less)
$ /usr/bin/less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o
Quoted 8 lines
Quoted 1 line

Could be patched by the disto.

What do you get from:

$ echo $LESSOPEN

?

You are right.
If I reset LESSOPEN, I got what I expect.

$ echo $LESSOPEN
| /usr/bin/lesspipe %s
$ LESSOPEN=  less kernel/built-in.a | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/
Signature · 2 lines
Best Regards
Masahiro Yamada
#11 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

2018-02-12 12:00 GMT+09:00 Masahiro Yamada <[email protected]>:

Quoted 52 lines

2018-02-12 10:26 GMT+09:00 Nicolas Pitre <[email protected]>:

Quoted 37 lines · Masahiro Yamada
Quoted 36 lines

2018-02-11 20:15 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 10 lines
Quoted 2 lines · On Sun, 11 Feb 2018 13:38:04 +0900 Masahiro Yamada…

Is my 'less' insane?
Or, is this intentional behavior of 'less'?

Interesting, my less does not do that. Instead of the raw contents of the file, yours is providing output of ar tv, which is reconstructing more of the archive metadata. I guess it is keyed on the filename extension.

Ah, I see. 'ar tv' and 'less' gave me the same output.

Quoted 1 line

Do you have an alias for it, or maybe the distro patches the tool?

I use Ubuntu 16.04 LTS.

Not alias'ed

$ type less
less is hashed (/usr/bin/less)
$ /usr/bin/less kernel/built-in.a | head -n 10
rw-r--r-- 0/0  60216 Jan  1 09:00 1970 kernel/fork.o
rw-r--r-- 0/0   3648 Jan  1 09:00 1970 kernel/exec_domain.o
rw-r--r-- 0/0  20552 Jan  1 09:00 1970 kernel/panic.o
rw-r--r-- 0/0  87752 Jan  1 09:00 1970 kernel/cpu.o
rw-r--r-- 0/0  34136 Jan  1 09:00 1970 kernel/exit.o
rw-r--r-- 0/0  41448 Jan  1 09:00 1970 kernel/softirq.o
rw-r--r-- 0/0  40904 Jan  1 09:00 1970 kernel/resource.o
rw-r--r-- 0/0  60968 Jan  1 09:00 1970 kernel/sysctl.o
rw-r--r-- 0/0   4472 Jan  1 09:00 1970 kernel/sysctl_binary.o
rw-r--r-- 0/0  12472 Jan  1 09:00 1970 kernel/capability.o
Quoted 8 lines
Quoted 1 line

Could be patched by the disto.

What do you get from:

$ echo $LESSOPEN

?

You are right.
If I reset LESSOPEN, I got what I expect.

Quoted 15 lines
$ echo $LESSOPEN
| /usr/bin/lesspipe %s
$ LESSOPEN=  less kernel/built-in.a | head -n 10
!<thin>
//                                              2964      `
fork.o/
exec_domain.o/
panic.o/
cpu.o/
exit.o/
softirq.o/
resource.o/
sysctl.o/

If I open /usr/bin/lesspipe,
probably this line

                # Decode file for less
                case `echo "$1" | tr '[:upper:]' '[:lower:]'` in
                        *.a)
                                if [ -x "`which ar`" ]; then ar tv "$1"
                                else echo "No ar available"; fi ;;
Signature · 2 lines
Best Regards
Masahiro Yamada
Acked-by on v1 2/2
#12 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

In reply to Nicholas Piggin

Hi Nicholas.

Quoted 13 lines · Nicholas Piggin

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

(quoted diff) +1 -1
-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
Quoted 1 line

Renaming is welcome - .o files should not list files.

Did you check that make clean / make mrproper continue to do the right thing?

I recalled we had "*.o" hardcoded somewhere but grep did not reveal any places that should matter. So likely it does.

Sam

author reviewer
#13 lore raw

Re: [PATCH 2/2] kbuild: rename built-in.o to built-in.a

Quoted 19 lines · On Sun, 18 Feb 2018 18:10:05 +0100 Sam Ravnborg <[email protected]> wrote:

Hi Nicholas.

Quoted 13 lines · Nicholas Piggin

Incremental linking is gone, so rename built-in.o to built-in.a, which is the usual extension for archive files.

This patch does two things, first is a simple search/replace:

git grep -l 'built-in\.o' | xargs sed -i 's/built-in\.o/built-in\.a/g'

The second is to invert nesting of nested text manipulations to avoid filtering built-in.a out from libs-y2:

(quoted diff) +1 -1
-libs-y2 := $(filter-out %.a, $(patsubst %/, %/built-in.a, $(libs-y)))
+libs-y2 := $(patsubst %/, %/built-in.a, $(filter-out %.a, $(libs-y)))
Quoted 1 line

Renaming is welcome - .o files should not list files.

Quoted 8 lines

Did you check that make clean / make mrproper continue to do the right thing?

I recalled we had "*.o" hardcoded somewhere but grep did not reveal any places that should matter. So likely it does.

Yes it seemed to just work. I guess .a files are already removed in subdirectories. built-in.o was hard coded in the final link cleanup, but the rename catches that.

Thanks,
Nick

#14 lore raw
In reply to Nicholas Piggin

2018-02-10 23:25 GMT+09:00 Nicholas Piggin <[email protected]>:

Quoted 6 lines

I don't think there is any point to keeping around the deprecated incremental linking option for too long. So I propose to remove it.

After that is removed, I wonder what people think of changing from built-in.o to built-in.a?

Quoted 6 lines

Thanks,
Nick

Nicholas Piggin (2):
kbuild: remove incremental linking option
kbuild: rename built-in.o to built-in.a

Both applied to linux-kbuild/kbuild.

Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada