Skip to contentSkip to conversation

powerpc64-linux-gnu-ld: warning: orphan section `.text.save.restore' from `arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.

PATCH New kbuild test robot 2 participants 3 messages Oct 22, 2016 – Oct 24, 2016 PowerPC

lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git test
head:   8a4fd950c8ac67ad98135db4107ed6cae412606c
commit: b09fa228be430ba2745102ac8e668ad869320bd9 [24/28] powerpc: link warning for orphan sections
config: powerpc-ps3_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout b09fa228be430ba2745102ac8e668ad869320bd9
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

>> powerpc64-linux-gnu-ld: warning: orphan section `.text.save.restore' from `arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
>> powerpc64-linux-gnu-ld: warning: orphan section `.text.save.restore' from `arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
>> powerpc64-linux-gnu-ld: warning: orphan section `.text.save.restore' from `arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#1 lore raw
Quoted 5 lines · On Sat, 22 Oct 2016 15:53:03 +0800 kbuild test robot <[email protected]>…
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git test
head:   8a4fd950c8ac67ad98135db4107ed6cae412606c
commit: b09fa228be430ba2745102ac8e668ad869320bd9 [24/28] powerpc: link warning for orphan sections
config: powerpc-ps3_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
Quoted 12 lines

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout b09fa228be430ba2745102ac8e668ad869320bd9
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.

On powerpc64, ld creates these for us when required, and puts them into section ".sfpr". So we can avoid compiling in lib/crtsavres.S entirely there, I think.

When I do that, I see the save/restore functions getting located at 0x8000. That actually works with my .linker_stub_catch patch, but there is probably no good reason to put those sections there, so I'll change .sfpr in the linker script to be near the end of the main text output section.

Thanks,
Nick

#2 lore raw

PATCH 1/1 powerpc: fpr save/restore function cleanups (was Re: [powerpc:test 24/28] powerpc64-linux-gnu-ld: warning: orphan section `.text.save.restore' from `arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.)

Quoted 25 lines · On Mon, 24 Oct 2016 12:57:34 +1100 Nicholas Piggin <[email protected]> wrote:
Quoted 5 lines · On Sat, 22 Oct 2016 15:53:03 +0800 kbuild test robot <[email protected]>…
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git test
head:   8a4fd950c8ac67ad98135db4107ed6cae412606c
commit: b09fa228be430ba2745102ac8e668ad869320bd9 [24/28] powerpc: link warning for orphan sections
config: powerpc-ps3_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
Quoted 12 lines

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
git checkout b09fa228be430ba2745102ac8e668ad869320bd9
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All warnings (new ones prefixed by >>):

Quoted 3 lines
Quoted 3 lines

powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.
powerpc64-linux-gnu-ld: warning: orphan section .text.save.restore' from arch/powerpc/lib/built-in.o' being placed in section `.text.save.restore'.

On powerpc64, ld creates these for us when required, and puts them into section ".sfpr". So we can avoid compiling in lib/crtsavres.S entirely there, I think.

Quoted 5 lines

When I do that, I see the save/restore functions getting located at 0x8000. That actually works with my .linker_stub_catch patch, but there is probably no good reason to put those sections there, so I'll change .sfpr in the linker script to be near the end of the main text output section.

Something like this (appropriately split up and tested) might be the go for 4.10. I just have to work out why these were added for 64-bit in 7fca5dc8aa7 ("powerpc: Fix module building for gcc 4.5 and 64 bit"). Must have been some issues with early toolchains.

The powerpc64 linker generates fpr save/restore functions on-demand, placing them in the .sfpr section. so 64 does not require these functions, so remove them from the 64 build.

However the linker places .sfpr at the beginning of a group of input sections, so the current linker script ends up locating them at the start of main .text (right after head text), which is not necessary. Move those to the end of the .text output section.

Have 32-bit put save/restore functions into .sfpr section, to match 64-bit.

---
 arch/powerpc/Makefile             |   2 +
 arch/powerpc/boot/Makefile        |   3 +-
 arch/powerpc/boot/crtsavres.S     |   3 +-
 arch/powerpc/kernel/vmlinux.lds.S |   3 +-
 arch/powerpc/lib/Makefile         |   5 +-
 arch/powerpc/lib/crtsavres.S      | 238 +-------------------------------------
 6 files changed, 12 insertions(+), 242 deletions(-)
arch/powerpc/Makefile +2 -0
index 093094c..113e057 100644
@@ -180,7 +180,9 @@ else
 CHECKFLAGS	+= -D__LITTLE_ENDIAN__
 endif
 
+ifeq ($(CONFIG_PPC32),y)
 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+endif
 
 ifeq ($(CONFIG_476FPE_ERR46),y)
 	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
arch/powerpc/boot/Makefile +2 -1
index eae2dc8..6abee93 100644
@@ -95,12 +95,13 @@ libfdtheader := fdt.h libfdt.h libfdt_internal.h
 $(addprefix $(obj)/,$(libfdt) libfdt-wrapper.o simpleboot.o epapr.o opal.o): \
 	$(addprefix $(obj)/,$(libfdtheader))
 
-src-wlib-y := string.S crt0.S crtsavres.S stdio.c decompress.c main.c \
+src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \
 		$(libfdt) libfdt-wrapper.c \
 		ns16550.c serial.c simple_alloc.c div64.S util.S \
 		elf_util.c $(zlib-y) devtree.c stdlib.c \
 		oflib.c ofconsole.c cuboot.c mpsc.c cpm-serial.c \
 		uartlite.c mpc52xx-psc.c opal.c opal-calls.S
+src-wlib-$(CONFIG_PPC32) += crtsavres.S
 src-wlib-$(CONFIG_40x) += 4xx.c planetcore.c
 src-wlib-$(CONFIG_44x) += 4xx.c ebony.c bamboo.c
 src-wlib-$(CONFIG_8xx) += mpc8xx.c planetcore.c fsl-soc.c
arch/powerpc/boot/crtsavres.S +1 -2
index f3d9b35..8c77437 100644
@@ -38,10 +38,9 @@
  */
 
 	.file	"crtsavres.S"
-	.section ".text"
+	.section ".sfpr","ax",@progbits
 
 /* On PowerPC64 Linux, these functions are provided by the linker.  */
-#ifndef __powerpc64__
 
 #define _GLOBAL(name) \
 	.type name,@function; \
arch/powerpc/kernel/vmlinux.lds.S +2 -1
index 534c8df..01d09e9 100644
@@ -76,13 +76,14 @@ SECTIONS
 		*(.linker_stub_catch);
 		. = . ;
 		/* careful! __ftr_alt_* sections need to be close to .text */
-		*(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text .sfpr);
+		*(.text.hot .text .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
 		SCHED_TEXT
 		CPUIDLE_TEXT
 		LOCK_TEXT
 		KPROBES_TEXT
 		IRQENTRY_TEXT
 		SOFTIRQENTRY_TEXT
+		*(.sfpr);
 		MEM_KEEP(init.text)
 		MEM_KEEP(exit.text)
 
arch/powerpc/lib/Makefile +2 -3
index 309361e8..b1304113 100644
@@ -9,10 +9,9 @@ ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
-obj-y += string.o alloc.o crtsavres.o code-patching.o \
-	 feature-fixups.o
+obj-y += string.o alloc.o code-patching.o feature-fixups.o
 
-obj-$(CONFIG_PPC32)	+= div64.o copy_32.o
+obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o
 
 obj64-y	+= copypage_64.o copyuser_64.o usercopy_64.o mem_64.o hweight_64.o \
 	   copyuser_power7.o string_64.o copypage_power7.o memcpy_power7.o \
arch/powerpc/lib/crtsavres.S +3 -235

250 lines not on this page · raw message

Signature · 1 line
2.9.3