forked from microsoft/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
50 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters