Skip to contentSkip to conversation

Register save/restore function build improvements

PATCH In review Nicholas Piggin 3 participants 9 messages May 11, 2017 – May 30, 2017 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

cover Register save/restore function build improvements

These are some minor improvements I came up when investigating "orphan" sections (.sfpr currently is). For 4.13.

Nicholas Piggin (5):
powerpc/64: place sfpr section explicitly with the linker script powerpc/64: do not link crtsavres.o in vmlinux powerpc/64: do not link crtsaveres.o in boot powerpc/64: do not create new section for save/restore functions powerpc/64: Linker on-demand save/restore functions for modules

 arch/powerpc/Makefile             | 10 ++++++++++
 arch/powerpc/boot/Makefile        |  3 ++-
 arch/powerpc/boot/crtsavres.S     |  8 ++++----
 arch/powerpc/kernel/vmlinux.lds.S |  8 ++++++++
 arch/powerpc/lib/Makefile         | 13 ++++++++++---
 arch/powerpc/lib/crtsavres.S      |  6 ++----
 6 files changed, 36 insertions(+), 12 deletions(-)
Signature · 1 line
2.11.0
author reviewer
#1 lore raw

PATCH 1/5 powerpc/64: place sfpr section explicitly with the linker script

---
 arch/powerpc/kernel/vmlinux.lds.S | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/powerpc/kernel/vmlinux.lds.S +8 -0
index 2f793be3d2b1..bcfda21c3179 100644
@@ -115,6 +115,14 @@ SECTIONS
 		KPROBES_TEXT
 		IRQENTRY_TEXT
 		SOFTIRQENTRY_TEXT
+		/*
+		 * -Os builds call FP save/restore functions. The powerpc64
+		 * linker generates those on demand in the .sfpr section.
+		 * .sfpr gets placed at the beginning of a group of input
+		 * sections, which can break start-of-text offset if it is
+		 * included with the main text sections, so put it by itself.
+		 */
+		*(.sfpr);
 		MEM_KEEP(init.text)
 		MEM_KEEP(exit.text)
 
Signature · 1 line
2.11.0
author reviewer
#3 lore raw

PATCH 2/5 powerpc/64: do not link crtsavres.o in vmlinux

In reply to Nicholas Piggin

The 64-bit linker creates save/restore functions on demand with final links, so vmlinux does not require crtsavres.o.

Make crtsavres.o extra-y on 64-bit (it is still required by modules).

---
 arch/powerpc/lib/Makefile | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/lib/Makefile +6 -2
index ed7dfce331e0..0ca405a27ac1 100644
@@ -9,8 +9,12 @@ 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
+
+# 64-bit linker creates .sfpr on demand for final link (vmlinux),
+# so it is only needed for modules.
+obj-$(CONFIG_PPC32) += crtsavres.o
+extra-$(CONFIG_PPC64) += crtsavres.o
 
 obj-$(CONFIG_PPC32)	+= div64.o copy_32.o
 
Signature · 1 line
2.11.0
author reviewer
#4 lore raw

PATCH 3/5 powerpc/64: do not link crtsaveres.o in boot

In reply to Nicholas Piggin

crtsaveres.S is empty with 64-bit builds already, so just don't build and link it to match the vmlinux build.

---
 arch/powerpc/boot/Makefile    | 3 ++-
 arch/powerpc/boot/crtsavres.S | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
arch/powerpc/boot/Makefile +2 -1
index e82f333cc84a..305d4d6b0ce0 100644
@@ -95,13 +95,14 @@ 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
 src-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) +=  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 +4 -4
index f3d9b35c07d4..085fb2b9a8b8 100644
@@ -37,12 +37,13 @@
  *    the executable file might be covered by the GNU General Public License.
  */
 
+#ifdef __powerpc64__
+#error "On PPC64, FPR save/restore functions are provided by the linker."
+#endif
+
 	.file	"crtsavres.S"
 	.section ".text"
 
-/* On PowerPC64 Linux, these functions are provided by the linker.  */
-#ifndef __powerpc64__
-
 #define _GLOBAL(name) \
 	.type name,@function; \
 	.globl name; \
@@ -230,4 +231,3 @@ _GLOBAL(_rest32gpr_31_x)
 	mtlr	0
 	mr	1,11
 	blr
-#endif
Signature · 1 line
2.11.0
#5 lore raw

Re: [PATCH 3/5] powerpc/64: do not link crtsaveres.o in boot

url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Register-save-restore-function-build-improvements/20170512-075435 config: powerpc-defconfig (attached as .config) compiler…

Hi Nicholas,

[auto build test ERROR on next-20170511]
[also build test ERROR on v4.11]
[cannot apply to powerpc/next v4.9-rc8 v4.9-rc7 v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Register-save-restore-function-build-improvements/20170512-075435
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc

All errors (new ones prefixed by >>):

arch/powerpc/boot/of.o: In function `of_try_claim':

>> of.c:(.text+0x88): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/of.o: In function `of_image_hdr':
>> of.c:(.text+0x104): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/of.o: In function `platform_init':
   of.c:(.text+0x1b4): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/epapr.o: In function `platform_fixups':
>> epapr.c:(.text+0xb0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/epapr.o: In function `epapr_platform_init':
   epapr.c:(.text+0x114): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `expand_buf':
>> libfdt-wrapper.c:(.text+0xa0): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finalize':
>> libfdt-wrapper.c:(.text+0xf4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_path':
   libfdt-wrapper.c:(.text+0x180): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_del_node':
   libfdt-wrapper.c:(.text+0x1c4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_compatible':
   libfdt-wrapper.c:(.text+0x20c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_prop_value':
   libfdt-wrapper.c:(.text+0x254): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_create_node':
>> libfdt-wrapper.c:(.text+0x2d0): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_parent':
   libfdt-wrapper.c:(.text+0x320): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_setprop':
>> libfdt-wrapper.c:(.text+0x3e4): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_getprop':
   libfdt-wrapper.c:(.text+0x4a4): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finddevice':
   libfdt-wrapper.c:(.text+0x4e0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_init':
   libfdt-wrapper.c:(.text+0x5d8): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(main.o): In function `prep_kernel':
>> main.c:(.text+0x174): undefined reference to `_restgpr_24_x'
   arch/powerpc/boot/wrapper.a(ofconsole.o): In function `of_console_write':
>> ofconsole.c:(.text+0x44): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(ofconsole.o): In function `of_console_open':
   ofconsole.c:(.text+0xa0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(ofconsole.o): In function `of_console_init':
   ofconsole.c:(.text+0xdc): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_call_prom_ret.constprop.1':
>> oflib.c:(.text+0x104): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_init':
   oflib.c:(.text+0x144): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_call_prom':
>> oflib.c:(.text+0x240): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_exit':
   oflib.c:(.text+0x2d0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_finddevice':
   oflib.c:(.text+0x30c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_getprop':
   oflib.c:(.text+0x354): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_claim':
>> oflib.c:(.text+0x3e8): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_vmlinux_alloc':
>> oflib.c:(.text+0x654): undefined reference to `_restgpr_27_x'
   arch/powerpc/boot/wrapper.a(oflib.o): In function `of_setprop':
   oflib.c:(.text+0x6a8): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_open':
>> serial.c:(.text+0x38): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_write':
>> serial.c:(.text+0x78): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_close':
   serial.c:(.text+0xcc): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_edit_cmdline':
>> serial.c:(.text+0x158): undefined reference to `_restgpr_24_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_get_stdout_devp':
   serial.c:(.text+0x2e4): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_console_init':
   serial.c:(.text+0x31c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_malloc':
>> simple_alloc.c:(.text+0xa0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_find_entry':
   simple_alloc.c:(.text+0x114): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_free':
   simple_alloc.c:(.text+0x16c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_realloc':
>> simple_alloc.c:(.text+0x20c): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_alloc_init':
   simple_alloc.c:(.text+0x2b0): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `number':
>> stdio.c:(.text+0x2ec): undefined reference to `_restgpr_20_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `vsprintf':
>> stdio.c:(.text+0x3e4): undefined reference to `_restgpr_23_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `sprintf':
--
   arch/powerpc/boot/ps3.o: In function `ps3_copy_vectors':
>> ps3.c:(.text+0x90): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `finddevice':
>> devtree.c:(.text+0x3c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `getprop':
   devtree.c:(.text+0x84): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `setprop':
   devtree.c:(.text+0xcc): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `copy_val':
>> devtree.c:(.text+0x12c): undefined reference to `_restgpr_27_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_fixup_memory':
>> devtree.c:(.text+0x2dc): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_fixup_cpu_clocks':
   devtree.c:(.text+0x3c8): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_fixup_clock':
>> devtree.c:(.text+0x4a8): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_fixup_mac_address_by_alias':
   devtree.c:(.text+0x54c): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_fixup_mac_address':
>> devtree.c:(.text+0x5e4): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `__dt_fixup_mac_addresses':
   devtree.c:(.text+0x66c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_get_reg_format':
   devtree.c:(.text+0x704): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_xlate':
>> devtree.c:(.text+0x740): undefined reference to `_restgpr_14_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_is_compatible':
   devtree.c:(.text+0xba8): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(devtree.o): In function `dt_get_virtual_reg':
   devtree.c:(.text+0xc7c): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `expand_buf':
>> libfdt-wrapper.c:(.text+0xa0): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finalize':
>> libfdt-wrapper.c:(.text+0xf4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_path':
   libfdt-wrapper.c:(.text+0x180): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_del_node':
   libfdt-wrapper.c:(.text+0x1c4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_compatible':
   libfdt-wrapper.c:(.text+0x20c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_prop_value':
   libfdt-wrapper.c:(.text+0x254): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_create_node':
>> libfdt-wrapper.c:(.text+0x2d0): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_parent':
   libfdt-wrapper.c:(.text+0x320): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_setprop':
>> libfdt-wrapper.c:(.text+0x3e4): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_getprop':
   libfdt-wrapper.c:(.text+0x4a4): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finddevice':
   libfdt-wrapper.c:(.text+0x4e0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_init':
   libfdt-wrapper.c:(.text+0x5d8): undefined reference to `_restgpr_29_x'
   arch/powerpc/boot/wrapper.a(main.o): In function `prep_kernel':
>> main.c:(.text+0x174): undefined reference to `_restgpr_24_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_malloc':
>> simple_alloc.c:(.text+0xa0): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_find_entry':
   simple_alloc.c:(.text+0x114): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_free':
   simple_alloc.c:(.text+0x16c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_realloc':
>> simple_alloc.c:(.text+0x20c): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_alloc_init':
   simple_alloc.c:(.text+0x2b0): undefined reference to `_restgpr_28_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `number':
>> stdio.c:(.text+0x2ec): undefined reference to `_restgpr_20_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `vsprintf':
>> stdio.c:(.text+0x3e4): undefined reference to `_restgpr_23_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `sprintf':
>> stdio.c:(.text+0xae4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(stdio.o): In function `printf':
   stdio.c:(.text+0xb80): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(decompress.o): In function `malloc':
>> decompress.c:(.text+0x3c): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(decompress.o): In function `free':
   decompress.c:(.text+0x84): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(decompress.o): In function `zlib_adler32':
   decompress.c:(.text+0xc4): undefined reference to `_restgpr_30_x'
   arch/powerpc/boot/wrapper.a(decompress.o): In function `zlib_updatewindow':
>> decompress.c:(.text+0x290): undefined reference to `_restgpr_26_x'
   arch/powerpc/boot/wrapper.a(decompress.o): In function `flush':
>> decompress.c:(.text+0x364): undefined reference to `_restgpr_28_x'

arch/powerpc/boot/wrapper.a(decompress.o): In function `print_err':
decompress.c:(.text+0x41c): undefined reference to _restgpr_30_x' arch/powerpc/boot/wrapper.a(decompress.o): In function zlib_inflate_table':
--
arch/powerpc/boot/epapr.o: In function `platform_fixups':

>> epapr.c:(.text+0xb0): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/epapr.o: In function `epapr_platform_init':
   epapr.c:(.text+0x114): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/epapr-wrapper.o: In function `platform_init':
>> epapr-wrapper.c:(.text+0x28): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `expand_buf':
>> libfdt-wrapper.c:(.text+0xa0): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finalize':
>> libfdt-wrapper.c:(.text+0xf4): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_path':
   libfdt-wrapper.c:(.text+0x180): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_del_node':
   libfdt-wrapper.c:(.text+0x1c4): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_compatible':
   libfdt-wrapper.c:(.text+0x20c): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_find_node_by_prop_value':
   libfdt-wrapper.c:(.text+0x254): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_create_node':
>> libfdt-wrapper.c:(.text+0x2d0): undefined reference to `_restgpr_28_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_get_parent':
   libfdt-wrapper.c:(.text+0x320): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_setprop':
>> libfdt-wrapper.c:(.text+0x3e4): undefined reference to `_restgpr_26_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_getprop':
   libfdt-wrapper.c:(.text+0x4a4): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_wrapper_finddevice':
   libfdt-wrapper.c:(.text+0x4e0): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(libfdt-wrapper.o): In function `fdt_init':
   libfdt-wrapper.c:(.text+0x5d8): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(main.o): In function `prep_kernel':
>> main.c:(.text+0x174): undefined reference to `_restgpr_24_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_open':
>> serial.c:(.text+0x38): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_write':
>> serial.c:(.text+0x78): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_close':
   serial.c:(.text+0xcc): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_edit_cmdline':
>> serial.c:(.text+0x158): undefined reference to `_restgpr_24_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_get_stdout_devp':
   serial.c:(.text+0x2e4): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(serial.o): In function `serial_console_init':
   serial.c:(.text+0x31c): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_malloc':
>> simple_alloc.c:(.text+0xa0): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_find_entry':
   simple_alloc.c:(.text+0x114): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_free':
   simple_alloc.c:(.text+0x16c): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_realloc':
>> simple_alloc.c:(.text+0x20c): undefined reference to `_restgpr_28_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(simple_alloc.o): In function `simple_alloc_init':
   simple_alloc.c:(.text+0x2b0): undefined reference to `_restgpr_28_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(stdio.o): In function `number':
>> stdio.c:(.text+0x2ec): undefined reference to `_restgpr_20_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(stdio.o): In function `vsprintf':
>> stdio.c:(.text+0x3e4): undefined reference to `_restgpr_23_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(stdio.o): In function `sprintf':
>> stdio.c:(.text+0xae4): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(stdio.o): In function `printf':
   stdio.c:(.text+0xb80): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(uartlite.o): In function `uartlite_open':
>> uartlite.c:(.text+0x3c): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(uartlite.o): In function `uartlite_putc':
   uartlite.c:(.text+0x84): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(uartlite.o): In function `uartlite_getc':
   uartlite.c:(.text+0xe4): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(uartlite.o):uartlite.c:(.text+0x134): more undefined references to `_restgpr_30_x' follow
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(uartlite.o): In function `uartlite_console_init':
>> uartlite.c:(.text+0x198): undefined reference to `_restgpr_29_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `cpm1_cmd':
>> cpm-serial.c:(.text+0x70): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `cpm2_cmd':
   cpm-serial.c:(.text+0xe0): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `smc_disable_port':
   cpm-serial.c:(.text+0x138): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `scc_disable_port':
   cpm-serial.c:(.text+0x190): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `smc_enable_port':
   cpm-serial.c:(.text+0x1e8): undefined reference to `_restgpr_30_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o):cpm-serial.c:(.text+0x240): more undefined references to `_restgpr_30_x' follow
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(cpm-serial.o): In function `cpm_console_init':
>> cpm-serial.c:(.text+0x68c): undefined reference to `_restgpr_26_x'
   powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813
   arch/powerpc/boot/wrapper.a(decompress.o): In function `malloc':
>> decompress.c:(.text+0x3c): undefined reference to `_restgpr_30_x'

powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813 arch/powerpc/boot/wrapper.a(decompress.o): In function `free':
decompress.c:(.text+0x84): undefined reference to `_restgpr_30_x'
powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813 arch/powerpc/boot/wrapper.a(decompress.o): In function `zlib_adler32':
decompress.c:(.text+0xc4): undefined reference to `_restgpr_30_x'
powerpc64-linux-gnu-ld: BFD (GNU Binutils for Debian) 2.27 assertion fail ../../bfd/elf32-ppc.c:8813 arch/powerpc/boot/wrapper.a(decompress.o): In function `zlib_updatewindow':

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

author reviewer
#6 lore raw

Re: [PATCH 3/5] powerpc/64: do not link crtsaveres.o in boot

Quoted 16 lines · On Fri, 12 May 2017 22:19:29 +0800 kbuild test robot <[email protected]> wrote:

Hi Nicholas,

[auto build test ERROR on next-20170511]
[also build test ERROR on v4.11]
[cannot apply to powerpc/next v4.9-rc8 v4.9-rc7 v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Nicholas-Piggin/Register-save-restore-function-build-improvements/20170512-075435
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc

Quoted 4 lines

All errors (new ones prefixed by >>):

arch/powerpc/boot/of.o: In function `of_try_claim':

Quoted 1 line
Quoted 1 line

of.c:(.text+0x88): undefined reference to `_restgpr_28_x'

I didn't account for PPC64 && !PPC64_BOOT_WRAPPER case there. Will fix.

author reviewer
#7 lore raw

PATCH 4/5 powerpc/64: do not create new section for save/restore functions

In reply to Nicholas Piggin

There is no need to create a new section for these. Consolidate with 32-bit and just use .text.

---
 arch/powerpc/lib/crtsavres.S | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/lib/crtsavres.S +2 -4
index 18af0b3d3eb2..7e5e1c28e56a 100644
@@ -44,10 +44,10 @@
 
 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 
-#ifndef CONFIG_PPC64
-
 	.section ".text"
 
+#ifndef CONFIG_PPC64
+
 /* Routines for saving integer registers, called by the compiler.  */
 /* Called with r11 pointing to the stack header word of the caller of the */
 /* function, just beyond the end of the integer save area.  */
@@ -314,8 +314,6 @@ _GLOBAL(_restvr_31)
 
 #else /* CONFIG_PPC64 */
 
-	.section ".text.save.restore","ax",@progbits
-
 .globl	_savegpr0_14
 _savegpr0_14:
 	std	r14,-144(r1)
Signature · 1 line
2.11.0
author reviewer
#8 lore raw

PATCH 5/5 powerpc/64: Linker on-demand sfpr functions for modules

In reply to Nicholas Piggin

For final link, the powerpc64 linker generates fpr save/restore functions on-demand, placing them in the .sfpr section. Starting with binutils 2.25, these can be provided for non-final links with --save-restore-funcs. Use that where possible for module links.

This saves about 200 bytes per module (~60kB) on powernv defconfig build.

---
 arch/powerpc/Makefile     | 10 ++++++++++
 arch/powerpc/lib/Makefile | 13 ++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
arch/powerpc/Makefile +10 -0
index 3e0f0e1fadef..eaa1865e4a8d 100644
@@ -189,7 +189,17 @@ else
 CHECKFLAGS	+= -D__LITTLE_ENDIAN__
 endif
 
+ifdef CONFIG_PPC32
 KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+else
+ifeq ($(call ld-ifversion, -ge, 225000000, y),y)
+# Have the linker provide sfpr if possible.
+# There is a corresponding test in arch/powerpc/lib/Makefile
+KBUILD_LDFLAGS_MODULE += --save-restore-funcs
+else
+KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+endif
+endif
 
 ifeq ($(CONFIG_476FPE_ERR46),y)
 	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
arch/powerpc/lib/Makefile +8 -5
index 0ca405a27ac1..2c56f4636c2b 100644
@@ -11,12 +11,15 @@ CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
 obj-y += string.o alloc.o code-patching.o feature-fixups.o
 
-# 64-bit linker creates .sfpr on demand for final link (vmlinux),
-# so it is only needed for modules.
-obj-$(CONFIG_PPC32) += crtsavres.o
-extra-$(CONFIG_PPC64) += crtsavres.o
+obj-$(CONFIG_PPC32)	+= div64.o copy_32.o crtsavres.o
 
-obj-$(CONFIG_PPC32)	+= div64.o copy_32.o
+# See corresponding test in arch/powerpc/Makefile
+# 64-bit linker creates .sfpr on demand for final link (vmlinux),
+# so it is only needed for modules, and only for older linkers which
+# do not support --save-restore-funcs
+ifeq ($(call ld-ifversion, -lt, 225000000, y),y)
+extra-$(CONFIG_PPC64)	+= crtsavres.o
+endif
 
 obj64-y	+= copypage_64.o copyuser_64.o mem_64.o hweight_64.o \
 	   copyuser_power7.o string_64.o copypage_power7.o memcpy_power7.o \
Signature · 1 line
2.11.0