- Remove relocation information from vmlinux as it is not needed by
other tooling and thus a slimmer binary is generated. This is important for distros who have to distribute vmlinux blobs with their kernel packages too and that extraneous unnecessary data bloats them for no good reason -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmSZv+wACgkQEsHwGGHe VUpdzhAAvUjNy0I0+kezbE1+o0bA1CKQt06oFrJYUZGk0FEjNrgEkr4Tlgrv+blF RU/SNBqvFwsonKtLZkB7nTse+aKu6LO1SKqgw0y67Hi98VL3j6GqTqvuaWALGgAs Zh2hcOLmkVdKoj1vnc2VP8Z6nqifsJhDANAkmrKGypJq+FjEubMfu+/zKTRgi0sv n0yOQNRB0aXtyMwa5nv5y2fU/Cp0ibvdkxEtCuGh8OKG+yth6lGxqR+mnlrqmVxR 2ATdgMZfnPSNs5MoggAY8zahsdG+npWkcyTzXjk4KfFRVQM269JN5uHPPrRkdMAm RDN+4aZmvQ8NxsT2U151IhkAiuGTCGlAe5x97KX+33juUZoc67/UhIdytmU3jNyl 33QnkeB8F+s/iNfFbCg9itThvTcWd0ER5zAaNGeoZTaIhpIU6TmBWuJJnbr/hqLa ckozuIk1wSXKWJheMRPbTBMxCqI3AmP1L3kIgfayHInS/J8QNMT8YmYUDyRb7GkJ bhsiN/GWtMqTt+bJxYkHHNuDBPCH8tKKneO2LG/KFTUnW7FYLOgQZQf0bO3mNe+C SVmGjUuSZhM47RiVEmaaLPppBu82CU0SZkt6pp4FuQWkVnwCZgPA/4MF0vTVc5M+ f2V99h3FkTXi75RP7GfVCKnwsFalu7NOyJer6KIm8Hh8x4RTTHo= =k9Pz -----END PGP SIGNATURE----- Merge tag 'x86_build_for_v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 build update from Borislav Petkov: - Remove relocation information from vmlinux as it is not needed by other tooling and thus a slimmer binary is generated. This is important for distros who have to distribute vmlinux blobs with their kernel packages too and that extraneous unnecessary data bloats them for no good reason * tag 'x86_build_for_v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/build: Avoid relocation information in final vmlinux
This commit is contained in:
commit
59035135b3
47
arch/x86/Makefile.postlink
Normal file
47
arch/x86/Makefile.postlink
Normal file
@ -0,0 +1,47 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# ===========================================================================
|
||||
# Post-link x86 pass
|
||||
# ===========================================================================
|
||||
#
|
||||
# 1. Separate relocations from vmlinux into vmlinux.relocs.
|
||||
# 2. Strip relocations from vmlinux.
|
||||
|
||||
PHONY := __archpost
|
||||
__archpost:
|
||||
|
||||
-include include/config/auto.conf
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
CMD_RELOCS = arch/x86/tools/relocs
|
||||
OUT_RELOCS = arch/x86/boot/compressed
|
||||
quiet_cmd_relocs = RELOCS $(OUT_RELOCS)/$@.relocs
|
||||
cmd_relocs = \
|
||||
mkdir -p $(OUT_RELOCS); \
|
||||
$(CMD_RELOCS) $@ > $(OUT_RELOCS)/$@.relocs; \
|
||||
$(CMD_RELOCS) --abs-relocs $@
|
||||
|
||||
quiet_cmd_strip_relocs = RSTRIP $@
|
||||
cmd_strip_relocs = \
|
||||
$(OBJCOPY) --remove-section='.rel.*' --remove-section='.rel__*' \
|
||||
--remove-section='.rela.*' --remove-section='.rela__*' $@
|
||||
|
||||
# `@true` prevents complaint when there is nothing to be done
|
||||
|
||||
vmlinux: FORCE
|
||||
@true
|
||||
ifeq ($(CONFIG_X86_NEED_RELOCS),y)
|
||||
$(call cmd,relocs)
|
||||
$(call cmd,strip_relocs)
|
||||
endif
|
||||
|
||||
%.ko: FORCE
|
||||
@true
|
||||
|
||||
clean:
|
||||
@rm -f $(OUT_RELOCS)/vmlinux.relocs
|
||||
|
||||
PHONY += FORCE clean
|
||||
|
||||
FORCE:
|
||||
|
||||
.PHONY: $(PHONY)
|
@ -121,11 +121,9 @@ $(obj)/vmlinux.bin: vmlinux FORCE
|
||||
|
||||
targets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs
|
||||
|
||||
CMD_RELOCS = arch/x86/tools/relocs
|
||||
quiet_cmd_relocs = RELOCS $@
|
||||
cmd_relocs = $(CMD_RELOCS) $< > $@;$(CMD_RELOCS) --abs-relocs $<
|
||||
$(obj)/vmlinux.relocs: vmlinux FORCE
|
||||
$(call if_changed,relocs)
|
||||
# vmlinux.relocs is created by the vmlinux postlink step.
|
||||
$(obj)/vmlinux.relocs: vmlinux
|
||||
@true
|
||||
|
||||
vmlinux.bin.all-y := $(obj)/vmlinux.bin
|
||||
vmlinux.bin.all-$(CONFIG_X86_NEED_RELOCS) += $(obj)/vmlinux.relocs
|
||||
|
Loading…
x
Reference in New Issue
Block a user