Skip to content

Commit

Permalink
ANDROID: kbuild: don't preprocess module-lto.lds
Browse files Browse the repository at this point in the history
__cfi_check needs to be aligned to 4k, not necessarily PAGE_SIZE.
Furthermore, using arch-specific includes currently breaks `make
scripts`.

Bug: 165591024
Change-Id: Id80fce84d4c111374718d8d84e7c06812a5d4e4b
Signed-off-by: Sami Tolvanen <[email protected]>
Signed-off-by: mrsrimar22 <[email protected]>
  • Loading branch information
samitolvanen authored and mrsrimar22 committed Jun 11, 2024
1 parent 8b6d688 commit a782cba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ LD_FLAGS_LTO_CLANG := -mllvm -import-instr-limit=5
KBUILD_LDFLAGS += $(LD_FLAGS_LTO_CLANG)
KBUILD_LDFLAGS_MODULE += $(LD_FLAGS_LTO_CLANG)

KBUILD_LDFLAGS_MODULE += -T scripts/module-lto.lds
KBUILD_LDFLAGS_MODULE += -T $(srctree)/scripts/module-lto.lds

# allow disabling only clang LTO where needed
DISABLE_LTO_CLANG := -fno-lto
Expand Down
2 changes: 0 additions & 2 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ always := $(hostprogs-y) $(hostprogs-m)
# The following hostprogs-y programs are only build on demand
hostprogs-y += unifdef

extra-$(CONFIG_LTO_CLANG) += module-lto.lds

# These targets are used internally to avoid "is up to date" messages
PHONY += build_unifdef
build_unifdef: $(obj)/unifdef
Expand Down
6 changes: 2 additions & 4 deletions scripts/module-lto.lds.S → scripts/module-lto.lds
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <asm/page.h>

/*
* With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
* -ffunction-sections, which increases the size of the final module.
Expand Down Expand Up @@ -32,9 +30,9 @@ SECTIONS {

/*
* With CFI_CLANG, ensure __cfi_check is at the beginning of the
* .text section, and that the section is aligned to page size.
* .text section, and that the section is aligned to 4k.
*/
.text : ALIGN(PAGE_SIZE) {
.text : ALIGN(4096) {
*(.text.__cfi_check)
*(.text .text.[0-9a-zA-Z_]* .text..L.cfi*)
}
Expand Down

0 comments on commit a782cba

Please sign in to comment.