diff mbox series

powerpc: Handle .text.{hot,unlikely}.* in linker script

Message ID 20210104204850.990966-1-natechancellor@gmail.com
State Accepted
Commit 3ce47d95b7346dcafd9bed3556a8d072cb2b8571
Headers show
Series powerpc: Handle .text.{hot,unlikely}.* in linker script | expand

Commit Message

Nathan Chancellor Jan. 4, 2021, 8:48 p.m. UTC
Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input
sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM
change [1].

After another LLVM change [2], these sections are seen in some PowerPC
builds, where there is a orphan section warning then build failure:

$ make -skj"$(nproc)" \
       ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \
       distclean powernv_defconfig zImage.epapr
ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed in '.text.unlikely.'
...
ld.lld: warning: address (0xc000000000009314) of section .text is not a multiple of alignment (256)
...
ERROR: start_text address is c000000000009400, should be c000000000008000
ERROR: try to enable LD_HEAD_STUB_CATCH config option
ERROR: see comments in arch/powerpc/tools/head_check.sh
...

Explicitly handle these sections like in the main linker script so
there is no more build failure.

Cc: stable@vger.kernel.org
Fixes: 83a092cf95f2 ("powerpc: Link warning for orphan sections")
Link: https://github.com/ClangBuiltLinux/linux/issues/1218
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/powerpc/kernel/vmlinux.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: d8a4f20584d5906093a8fc6aa06622102a501095

Comments

Michael Ellerman Jan. 15, 2021, 12:23 p.m. UTC | #1
On Mon, 4 Jan 2021 13:59:53 -0700, Nathan Chancellor wrote:
> Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input

> sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM

> change [1].

> 

> After another LLVM change [2], these sections are seen in some PowerPC

> builds, where there is a orphan section warning then build failure:

> 

> [...]


Applied to powerpc/fixes.

[1/1] powerpc: Handle .text.{hot,unlikely}.* in linker script
      https://git.kernel.org/powerpc/c/3ce47d95b7346dcafd9bed3556a8d072cb2b8571

cheers
Segher Boessenkool Jan. 16, 2021, 6:44 p.m. UTC | #2
Hi!

Very late of course, and the patch is fine, but:

On Mon, Jan 04, 2021 at 01:59:53PM -0700, Nathan Chancellor wrote:
> Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input

> sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM

> change [1].

> 

> After another LLVM change [2], these sections are seen in some PowerPC

> builds, where there is a orphan section warning then build failure:

> 

> $ make -skj"$(nproc)" \

>        ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \

>        distclean powernv_defconfig zImage.epapr

> ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed in '.text.unlikely.'


Is the section really called ".text.unlikely.", i.e. the name ending in
a dot?  How very unusual, is there some bug elsewhere?


Segher
Nathan Chancellor Jan. 16, 2021, 6:52 p.m. UTC | #3
On Sat, Jan 16, 2021 at 12:44:38PM -0600, Segher Boessenkool wrote:
> Hi!

> 

> Very late of course, and the patch is fine, but:

> 

> On Mon, Jan 04, 2021 at 01:59:53PM -0700, Nathan Chancellor wrote:

> > Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input

> > sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM

> > change [1].

> > 

> > After another LLVM change [2], these sections are seen in some PowerPC

> > builds, where there is a orphan section warning then build failure:

> > 

> > $ make -skj"$(nproc)" \

> >        ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \

> >        distclean powernv_defconfig zImage.epapr

> > ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed in '.text.unlikely.'

> 

> Is the section really called ".text.unlikely.", i.e. the name ending in

> a dot?  How very unusual, is there some bug elsewhere?


No, this was an intention change done by LLVM:
https://reviews.llvm.org/D79600

Cheers,
Nathan
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 0318ba436f34..8e0b1298bf19 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -85,7 +85,7 @@  SECTIONS
 		ALIGN_FUNCTION();
 #endif
 		/* careful! __ftr_alt_* sections need to be close to .text */
-		*(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
+		*(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text);
 #ifdef CONFIG_PPC64
 		*(.tramp.ftrace.text);
 #endif