[BUG] POWER: undefined reference to `_restgpr_25_x'

Hello Wolfgang,
with powerpc64-linux-gnu-gcc, version 9.2.1, big endian I see the errors below when compiling P2041RDB_defconfig.
post/drivers/memory.c:268: undefined reference to `_restgpr_25_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_lines': post/drivers/memory.c:408: undefined reference to `_restgpr_31_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_patterns': post/drivers/memory.c:436: undefined reference to `_restgpr_29_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_regions': post/drivers/memory.c:453: undefined reference to `_restgpr_29_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test': post/drivers/memory.c:540: undefined reference to `_restgpr_26_x' make: *** [Makefile:1671: u-boot] Error
On Debian Buster I issued the following commands:
make P2041RDB_defconfig sudo apt-get install gcc-powerpc64-linux-gnu export CROSS_COMPILE=powerpc64-linux-gnu- make
I needed the following changes to be able to compile at all:
diff --git a/Makefile b/Makefile index 0766f78dcb..71f98a2615 100644 --- a/Makefile +++ b/Makefile @@ -412,7 +412,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
-KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ +KBUILD_CFLAGS := -Wall -Wstrict-prototypes -Wno-error=address-of-packed-member \ -Wno-format-security \ -fno-builtin -ffreestanding $(CSTD_FLAG) KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing diff --git a/examples/Makefile b/examples/Makefile index d440bc5655..825954c185 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -6,6 +6,6 @@ ifdef FTRACE subdir-ccflags-y += -finstrument-functions -DFTRACE endif
-subdir-y += standalone +#subdir-y += standalone subdir-$(CONFIG_API) += api endif
Best regards
Heinrich

Dear Heinrich,
In message a1f758e3-303e-ce3f-c2d7-8a7e4d425535@gmx.de you wrote:
with powerpc64-linux-gnu-gcc, version 9.2.1, big endian I see the errors below when compiling P2041RDB_defconfig.
I'm not sure if it's a good idea (and supposed to work) to use a 64 bit compiler for a 32 bit application. It might be missing some of the needed gcc libraries.
I needed the following changes to be able to compile at all:
diff --git a/Makefile b/Makefile index 0766f78dcb..71f98a2615 100644 --- a/Makefile +++ b/Makefile @@ -412,7 +412,7 @@ CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
-KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ +KBUILD_CFLAGS := -Wall -Wstrict-prototypes -Wno-error=address-of-packed-member \ -Wno-format-security \ -fno-builtin -ffreestanding $(CSTD_FLAG) KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing
This patch is linewrapped, right?
I can't see how adding -Wno-error=address-of-packed-member would be related to fixing undefined reference to `_restgpr_31_x' errors.
diff --git a/examples/Makefile b/examples/Makefile index d440bc5655..825954c185 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -6,6 +6,6 @@ ifdef FTRACE subdir-ccflags-y += -finstrument-functions -DFTRACE endif
-subdir-y += standalone +#subdir-y += standalone
This is apparently unrelated, too ?
Best regards,
Wolfgang Denk

On 12/16/19 2:10 PM, Wolfgang Denk wrote:
Dear Heinrich,
In message a1f758e3-303e-ce3f-c2d7-8a7e4d425535@gmx.de you wrote:
with powerpc64-linux-gnu-gcc, version 9.2.1, big endian I see the errors below when compiling P2041RDB_defconfig.
I'm not sure if it's a good idea (and supposed to work) to use a 64 bit compiler for a 32 bit application. It might be missing some of the needed gcc libraries.
Thanks for the hint. The reported problem does not occur with
export CROSS_COMPILE=powerpc-linux-gnu-
Best regards
Heinrich

Hi Heinrich,
On Mon, Dec 16, 2019 at 6:06 PM Heinrich Schuchardt xypron.glpk@gmx.de wrote:
Hello Wolfgang,
with powerpc64-linux-gnu-gcc, version 9.2.1, big endian I see the errors below when compiling P2041RDB_defconfig.
post/drivers/memory.c:268: undefined reference to `_restgpr_25_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_lines': post/drivers/memory.c:408: undefined reference to `_restgpr_31_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_patterns': post/drivers/memory.c:436: undefined reference to `_restgpr_29_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test_regions': post/drivers/memory.c:453: undefined reference to `_restgpr_29_x' powerpc64-linux-gnu-ld.bfd: post/built-in.o: in function `memory_post_test': post/drivers/memory.c:540: undefined reference to `_restgpr_26_x' make: *** [Makefile:1671: u-boot] Error
On Debian Buster I issued the following commands:
make P2041RDB_defconfig sudo apt-get install gcc-powerpc64-linux-gnu export CROSS_COMPILE=powerpc64-linux-gnu- make
Could you please paste the output of "powerpc64-linux-gnu-gcc -v <some_source>.c"
Regards, Bin
participants (3)
-
Bin Meng
-
Heinrich Schuchardt
-
Wolfgang Denk