Skip to content

Commit

Permalink
lto: Enable Clang specific LTO feature into GCC
Browse files Browse the repository at this point in the history
Signed-off-by: Diaz1401 <[email protected]>
  • Loading branch information
Diaz1401 committed Jun 26, 2023
1 parent 25be2d4 commit cdf3885
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
* RODATA_MAIN is not used because existing code already defines .rodata.x
* sections to be brought in with rodata.
*/
#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO)
#define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
#define TEXT_CFI_MAIN .text.[0-9a-zA-Z_]*.cfi
#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral*
Expand Down
2 changes: 1 addition & 1 deletion include/linux/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ extern bool initcall_debug;
".long " #fn " - . \n" \
".previous \n");
#else
#ifdef CONFIG_LTO_CLANG
#ifdef CONFIG_LTO
/*
* With LTO, the compiler doesn't necessarily obey link order for
* initcalls, and the initcall variable needs to be globally unique
Expand Down
6 changes: 3 additions & 3 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ archive_builtin()
fi
}

# If CONFIG_LTO_CLANG is selected, generate a linker script to ensure correct
# If CONFIG_LTO is selected, generate a linker script to ensure correct
# ordering of initcalls, and with CONFIG_MODVERSIONS also enabled, collect the
# previously generated symbol versions into the same script.
lto_lds()
{
if [ -z "${CONFIG_LTO_CLANG}" ]; then
if [ -z "${CONFIG_LTO}" ]; then
return
fi

Expand Down Expand Up @@ -107,7 +107,7 @@ modpost_link()
${KBUILD_VMLINUX_LIBS} \
--end-group"

if [ -n "${CONFIG_LTO_CLANG}" ]; then
if [ -n "${CONFIG_LTO}" ]; then
# This might take a while, so indicate that we're doing
# an LTO link
info LTO vmlinux.o
Expand Down

0 comments on commit cdf3885

Please sign in to comment.