Skip to contentSkip to conversation

kbuild: replace deprecated T option with --thin for $(AR)

PATCH In review Masahiro Yamada 2 participants 3 messages May 25, 2025 – Jun 5, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: replace deprecated T option with --thin for $(AR)

According to 'man ar':

T Deprecated alias for --thin. T is not recommended because in
many ar implementations T has a different meaning, as specified by X/Open System Interface.

'man llvm-ar' also states:

T Alias for --thin. In many ar implementations T has a different
meaning, as specified by X/Open System interface.

---

 Makefile               | 6 +++---
 scripts/Makefile.build | 2 +-
 scripts/Makefile.lib   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
Makefile +3 -3
index efbc0966b82a..682a8002b7a1 100644
@@ -1201,12 +1201,12 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS
 KBUILD_MODULES := 1
 endif
 
-# '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
+# '$(AR) mPi' needs --thin to workaround the bug of llvm-ar <= 14
 quiet_cmd_ar_vmlinux.a = AR      $@
       cmd_ar_vmlinux.a = \
 	rm -f $@; \
-	$(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \
-	$(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
+	$(AR) cDPrS --thin $@ $(KBUILD_VMLINUX_OBJS); \
+	$(AR) mPi --thin $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
 
 targets += vmlinux.a
 vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
scripts/Makefile.build +1 -1
index 8d8252229895..284931f2a9a2 100644
@@ -456,7 +456,7 @@ $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
 quiet_cmd_ar_builtin = AR      $@
       cmd_ar_builtin = rm -f $@; \
 	$(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
-	$(AR) cDPrST $@
+	$(AR) cDPrS --thin $@
 
 $(obj)/built-in.a: $(real-obj-y) FORCE
 	$(call if_changed,ar_builtin)
scripts/Makefile.lib +1 -1
index d858a3223bcd..e37e2db5f528 100644
@@ -280,7 +280,7 @@ quiet_cmd_ld = LD      $@
 # ---------------------------------------------------------------------------
 
 quiet_cmd_ar = AR      $@
-      cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
+      cmd_ar = rm -f $@; $(AR) cDPrs --thin $@ $(real-prereqs)
 
 # Objcopy
 # ---------------------------------------------------------------------------
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Masahiro Yamada

According to 'man ar':

T Deprecated alias for --thin. T is not recommended because in
many ar implementations T has a different meaning, as specified by X/Open System Interface.

Quoted 7 lines

'man llvm-ar' also states:

T Alias for --thin. In many ar implementations T has a different
meaning, as specified by X/Open System interface.

---

Yeah, seems reasonable to get ahead of the curve in case either implementation decides to drop it.

Quoted 55 lines
 Makefile               | 6 +++---
 scripts/Makefile.build | 2 +-
 scripts/Makefile.lib   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
Makefile +3 -3
index efbc0966b82a..682a8002b7a1 100644
@@ -1201,12 +1201,12 @@ ifdef CONFIG_TRIM_UNUSED_KSYMS
 KBUILD_MODULES := 1
 endif
 
-# '$(AR) mPi' needs 'T' to workaround the bug of llvm-ar <= 14
+# '$(AR) mPi' needs --thin to workaround the bug of llvm-ar <= 14
 quiet_cmd_ar_vmlinux.a = AR      $@
       cmd_ar_vmlinux.a = \
 	rm -f $@; \
-	$(AR) cDPrST $@ $(KBUILD_VMLINUX_OBJS); \
-	$(AR) mPiT $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
+	$(AR) cDPrS --thin $@ $(KBUILD_VMLINUX_OBJS); \
+	$(AR) mPi --thin $$($(AR) t $@ | sed -n 1p) $@ $$($(AR) t $@ | grep -F -f $(srctree)/scripts/head-object-list.txt)
 
 targets += vmlinux.a
 vmlinux.a: $(KBUILD_VMLINUX_OBJS) scripts/head-object-list.txt FORCE
scripts/Makefile.build +1 -1
index 8d8252229895..284931f2a9a2 100644
@@ -456,7 +456,7 @@ $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
 quiet_cmd_ar_builtin = AR      $@
       cmd_ar_builtin = rm -f $@; \
 	$(if $(real-prereqs), printf "$(obj)/%s " $(patsubst $(obj)/%,%,$(real-prereqs)) | xargs) \
-	$(AR) cDPrST $@
+	$(AR) cDPrS --thin $@
 
 $(obj)/built-in.a: $(real-obj-y) FORCE
 	$(call if_changed,ar_builtin)
scripts/Makefile.lib +1 -1
index d858a3223bcd..e37e2db5f528 100644
@@ -280,7 +280,7 @@ quiet_cmd_ld = LD      $@
 # ---------------------------------------------------------------------------
 
 quiet_cmd_ar = AR      $@
-      cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
+      cmd_ar = rm -f $@; $(AR) cDPrs --thin $@ $(real-prereqs)
 
 # Objcopy
 # ---------------------------------------------------------------------------
Signature · 1 line
2.43.0
#2 lore raw
Quoted 13 lines · Nathan Chancellor
Quoted 11 lines · Masahiro Yamada

According to 'man ar':

T Deprecated alias for --thin. T is not recommended because in
many ar implementations T has a different meaning, as specified by X/Open System Interface.

'man llvm-ar' also states:

T Alias for --thin. In many ar implementations T has a different
meaning, as specified by X/Open System interface.

Quoted 7 lines
Quoted 2 lines

---

Yeah, seems reasonable to get ahead of the curve in case either implementation decides to drop it.

I gave up due to this report:

https://lore.kernel.org/all/[email protected]/

Signature · 2 lines
Best Regards
Masahiro Yamada