* barebox compilation with gcc 4.5.2 and ptxdist @ 2011-07-26 13:56 Andre Naujoks 2011-07-26 14:20 ` Marc Kleine-Budde 0 siblings, 1 reply; 10+ messages in thread From: Andre Naujoks @ 2011-07-26 13:56 UTC (permalink / raw) To: barebox Hello. We are currently trying to compile a barebox with the git version of ptxdist and the git version of the OSELAS generic Toolchain for powerpc. Also the current 2011.07.0 release of barebox. We are having some problems during the build, which I think are a result of some changes in gcc's optimizations (since 4.4.something). GCC uses some functions on the ppc platform to optimze the size of the resulting binary, which are only present in the libgcc.a. The compile stage works fine up tp the last linker step: CC arch/ppc/lib/time.o AS arch/ppc/lib/misc.o CC arch/ppc/lib/ppclinux.o CC arch/ppc/lib/board_data.o LD arch/ppc/lib/built-in.o LD barebox common/built-in.o: In function `mapset': hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' common/built-in.o: In function `syntax_err': hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' common/built-in.o: In function `done_command': hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' common/built-in.o: In function `done_pipe': hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' common/built-in.o: In function `is_assignment': hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' common/built-in.o: In function `b_addchr': hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' common/built-in.o: In function `b_addqchr': hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' ... This goes on for a few pages. As far as I can see, the possibilities I have here, is to either integrate the missing functions out of the gcc sources into barebox, or make barebox link with libgcc, which seems surprisingly difficult, due to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. -L.. did not help here. Am I right with this assumption, or am I missing something else here? Any help would really be appreciated. Regards Andre Naujoks _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-26 13:56 barebox compilation with gcc 4.5.2 and ptxdist Andre Naujoks @ 2011-07-26 14:20 ` Marc Kleine-Budde 2011-07-26 14:35 ` Jean-Christophe PLAGNIOL-VILLARD 2011-07-27 6:40 ` Andre Naujoks 0 siblings, 2 replies; 10+ messages in thread From: Marc Kleine-Budde @ 2011-07-26 14:20 UTC (permalink / raw) To: Andre Naujoks; +Cc: barebox [-- Attachment #1.1: Type: text/plain, Size: 2549 bytes --] On 07/26/2011 03:56 PM, Andre Naujoks wrote: > Hello. > > We are currently trying to compile a barebox with the git version of > ptxdist and the git version of the OSELAS generic Toolchain for powerpc. > > Also the current 2011.07.0 release of barebox. > > We are having some problems during the build, which I think are a result > of some changes in gcc's optimizations (since 4.4.something). GCC uses > some functions on the ppc platform to optimze the size of the resulting > binary, which are only present in the libgcc.a. > > The compile stage works fine up tp the last linker step: > > CC arch/ppc/lib/time.o > AS arch/ppc/lib/misc.o > CC arch/ppc/lib/ppclinux.o > CC arch/ppc/lib/board_data.o > LD arch/ppc/lib/built-in.o > LD barebox > common/built-in.o: In function `mapset': > hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' > common/built-in.o: In function `syntax_err': > hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' > common/built-in.o: In function `done_command': > hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' > common/built-in.o: In function `done_pipe': > hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' > common/built-in.o: In function `is_assignment': > hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' > common/built-in.o: In function `b_addchr': > hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' > common/built-in.o: In function `b_addqchr': > hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' > ... > > > This goes on for a few pages. > > As far as I can see, the possibilities I have here, is to either > integrate the missing functions out of the gcc sources into barebox, or > make barebox link with libgcc, which seems surprisingly difficult, due > to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. > -L.. did not help here. > > Am I right with this assumption, or am I missing something else here? We don't want to link barebox against libgcc, that's bad style. I suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to barebox. cheers, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 262 bytes --] [-- Attachment #2: Type: text/plain, Size: 149 bytes --] _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-26 14:20 ` Marc Kleine-Budde @ 2011-07-26 14:35 ` Jean-Christophe PLAGNIOL-VILLARD 2011-07-27 6:40 ` Andre Naujoks 1 sibling, 0 replies; 10+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-26 14:35 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox On 16:20 Tue 26 Jul , Marc Kleine-Budde wrote: > On 07/26/2011 03:56 PM, Andre Naujoks wrote: > > Hello. > > > > We are currently trying to compile a barebox with the git version of > > ptxdist and the git version of the OSELAS generic Toolchain for powerpc. > > > > Also the current 2011.07.0 release of barebox. > > > > We are having some problems during the build, which I think are a result > > of some changes in gcc's optimizations (since 4.4.something). GCC uses > > some functions on the ppc platform to optimze the size of the resulting > > binary, which are only present in the libgcc.a. > > > > The compile stage works fine up tp the last linker step: > > > > CC arch/ppc/lib/time.o > > AS arch/ppc/lib/misc.o > > CC arch/ppc/lib/ppclinux.o > > CC arch/ppc/lib/board_data.o > > LD arch/ppc/lib/built-in.o > > LD barebox > > common/built-in.o: In function `mapset': > > hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' > > common/built-in.o: In function `syntax_err': > > hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' > > common/built-in.o: In function `done_command': > > hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' > > common/built-in.o: In function `done_pipe': > > hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' > > common/built-in.o: In function `is_assignment': > > hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' > > common/built-in.o: In function `b_addchr': > > hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' > > common/built-in.o: In function `b_addqchr': > > hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' > > ... > > > > > > This goes on for a few pages. > > > > As far as I can see, the possibilities I have here, is to either > > integrate the missing functions out of the gcc sources into barebox, or > > make barebox link with libgcc, which seems surprisingly difficult, due > > to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. > > -L.. did not help here. > > > > Am I right with this assumption, or am I missing something else here? > > We don't want to link barebox against libgcc, that's bad style. I > suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to > barebox. > agreed at 100% Best Regards, J. _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-26 14:20 ` Marc Kleine-Budde 2011-07-26 14:35 ` Jean-Christophe PLAGNIOL-VILLARD @ 2011-07-27 6:40 ` Andre Naujoks 2011-07-27 9:50 ` Andre Naujoks 1 sibling, 1 reply; 10+ messages in thread From: Andre Naujoks @ 2011-07-27 6:40 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox Am 26.07.2011 16:20, schrieb Marc Kleine-Budde: > On 07/26/2011 03:56 PM, Andre Naujoks wrote: >> Hello. >> >> We are currently trying to compile a barebox with the git version of >> ptxdist and the git version of the OSELAS generic Toolchain for powerpc. >> >> Also the current 2011.07.0 release of barebox. >> >> We are having some problems during the build, which I think are a result >> of some changes in gcc's optimizations (since 4.4.something). GCC uses >> some functions on the ppc platform to optimze the size of the resulting >> binary, which are only present in the libgcc.a. >> >> The compile stage works fine up tp the last linker step: >> >> CC arch/ppc/lib/time.o >> AS arch/ppc/lib/misc.o >> CC arch/ppc/lib/ppclinux.o >> CC arch/ppc/lib/board_data.o >> LD arch/ppc/lib/built-in.o >> LD barebox >> common/built-in.o: In function `mapset': >> hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' >> common/built-in.o: In function `syntax_err': >> hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' >> common/built-in.o: In function `done_command': >> hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' >> common/built-in.o: In function `done_pipe': >> hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' >> common/built-in.o: In function `is_assignment': >> hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' >> common/built-in.o: In function `b_addchr': >> hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' >> common/built-in.o: In function `b_addqchr': >> hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' >> ... >> >> >> This goes on for a few pages. >> >> As far as I can see, the possibilities I have here, is to either >> integrate the missing functions out of the gcc sources into barebox, or >> make barebox link with libgcc, which seems surprisingly difficult, due >> to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. >> -L.. did not help here. >> >> Am I right with this assumption, or am I missing something else here? > > We don't want to link barebox against libgcc, that's bad style. I > suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to > barebox. Thanks. I will give this a shot and see how far I get. If it works I will come back with a patch. > > cheers, Marc > Regards Andre _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-27 6:40 ` Andre Naujoks @ 2011-07-27 9:50 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 1/2] " Andre Naujoks ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Andre Naujoks @ 2011-07-27 9:50 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox Am 27.07.2011 08:40, schrieb Andre Naujoks: > Am 26.07.2011 16:20, schrieb Marc Kleine-Budde: >> On 07/26/2011 03:56 PM, Andre Naujoks wrote: >>> Hello. >>> >>> We are currently trying to compile a barebox with the git version of >>> ptxdist and the git version of the OSELAS generic Toolchain for powerpc. >>> >>> Also the current 2011.07.0 release of barebox. >>> >>> We are having some problems during the build, which I think are a result >>> of some changes in gcc's optimizations (since 4.4.something). GCC uses >>> some functions on the ppc platform to optimze the size of the resulting >>> binary, which are only present in the libgcc.a. >>> >>> The compile stage works fine up tp the last linker step: >>> >>> CC arch/ppc/lib/time.o >>> AS arch/ppc/lib/misc.o >>> CC arch/ppc/lib/ppclinux.o >>> CC arch/ppc/lib/board_data.o >>> LD arch/ppc/lib/built-in.o >>> LD barebox >>> common/built-in.o: In function `mapset': >>> hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' >>> common/built-in.o: In function `syntax_err': >>> hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' >>> common/built-in.o: In function `done_command': >>> hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' >>> common/built-in.o: In function `done_pipe': >>> hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' >>> common/built-in.o: In function `is_assignment': >>> hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' >>> common/built-in.o: In function `b_addchr': >>> hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' >>> common/built-in.o: In function `b_addqchr': >>> hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' >>> ... >>> >>> >>> This goes on for a few pages. >>> >>> As far as I can see, the possibilities I have here, is to either >>> integrate the missing functions out of the gcc sources into barebox, or >>> make barebox link with libgcc, which seems surprisingly difficult, due >>> to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. >>> -L.. did not help here. >>> >>> Am I right with this assumption, or am I missing something else here? >> >> We don't want to link barebox against libgcc, that's bad style. I >> suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to >> barebox. > > Thanks. I will give this a shot and see how far I get. If it works I > will come back with a patch. Hi. With a little help from a collegue, we came up with the patches in the followong mails. Basically the kernel files without the 64 bit parts. The second patch was another part of libgcc, which seemed to fit best in the misc.S file, which was already present. Regards Andre > >> >> cheers, Marc >> > > Regards > Andre _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-27 9:50 ` Andre Naujoks @ 2011-07-27 9:51 ` Andre Naujoks 2011-07-27 9:53 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 2/2] " Andre Naujoks 2011-07-28 11:52 ` Sascha Hauer 2 siblings, 1 reply; 10+ messages in thread From: Andre Naujoks @ 2011-07-27 9:51 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox From c479527616c5fc79c608e21573373a5a324f6e9b Mon Sep 17 00:00:00 2001 From: Andre Naujoks <nautsch2@googlemail.com> Date: Wed, 27 Jul 2011 11:28:35 +0200 Subject: [PATCH 1/2] Ported crtsavres from linux kernel to barebox --- arch/ppc/lib/Makefile | 1 + arch/ppc/lib/crtsavres.S | 239 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 arch/ppc/lib/crtsavres.S diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile index 0844d56..c35fd08 100644 --- a/arch/ppc/lib/Makefile +++ b/arch/ppc/lib/Makefile @@ -10,4 +10,5 @@ obj-y += misc.o obj-$(CONFIG_CMD_BOOTM) += ppclinux.o obj-y += board_data.o obj-$(CONFIG_MODULES) += module.o +obj-y += crtsavres.o diff --git a/arch/ppc/lib/crtsavres.S b/arch/ppc/lib/crtsavres.S new file mode 100644 index 0000000..f9d7cb6 --- /dev/null +++ b/arch/ppc/lib/crtsavres.S @@ -0,0 +1,239 @@ +/* + * Special support for eabi and SVR4 + * + * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. + * Copyright 2008 Freescale Semiconductor, Inc. + * Written By Michael Meissner + * + * Based on gcc/config/rs6000/crtsavres.asm from gcc + * 64 bit additions from reading the PPC elf64abi document. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * In addition to the permissions in the GNU General Public License, the + * Free Software Foundation gives you unlimited permission to link the + * compiled version of this file with other programs, and to distribute + * those programs without any restriction coming from the use of this + * file. (The General Public License restrictions do apply in other + * respects; for example, they cover modification of the file, and + * distribution when not linked into another program.) + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * As a special exception, if you link this library with files + * compiled with GCC to produce an executable, this does not cause + * the resulting executable to be covered by the GNU General Public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + */ + +#include <asm/ppc_asm.tmpl> + +#define N_FUN 36 + +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x) + +#define _GLOBAL(n) \ + .text; \ + .stabs __stringify(n:F-1),N_FUN,0,0,n;\ + .globl n; \ +n: + + .file "crtsavres.S" + .section ".text" + +/* 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. */ + +_GLOBAL(_savegpr_14) +_GLOBAL(_save32gpr_14) + stw 14,-72(11) /* save gp registers */ +_GLOBAL(_savegpr_15) +_GLOBAL(_save32gpr_15) + stw 15,-68(11) +_GLOBAL(_savegpr_16) +_GLOBAL(_save32gpr_16) + stw 16,-64(11) +_GLOBAL(_savegpr_17) +_GLOBAL(_save32gpr_17) + stw 17,-60(11) +_GLOBAL(_savegpr_18) +_GLOBAL(_save32gpr_18) + stw 18,-56(11) +_GLOBAL(_savegpr_19) +_GLOBAL(_save32gpr_19) + stw 19,-52(11) +_GLOBAL(_savegpr_20) +_GLOBAL(_save32gpr_20) + stw 20,-48(11) +_GLOBAL(_savegpr_21) +_GLOBAL(_save32gpr_21) + stw 21,-44(11) +_GLOBAL(_savegpr_22) +_GLOBAL(_save32gpr_22) + stw 22,-40(11) +_GLOBAL(_savegpr_23) +_GLOBAL(_save32gpr_23) + stw 23,-36(11) +_GLOBAL(_savegpr_24) +_GLOBAL(_save32gpr_24) + stw 24,-32(11) +_GLOBAL(_savegpr_25) +_GLOBAL(_save32gpr_25) + stw 25,-28(11) +_GLOBAL(_savegpr_26) +_GLOBAL(_save32gpr_26) + stw 26,-24(11) +_GLOBAL(_savegpr_27) +_GLOBAL(_save32gpr_27) + stw 27,-20(11) +_GLOBAL(_savegpr_28) +_GLOBAL(_save32gpr_28) + stw 28,-16(11) +_GLOBAL(_savegpr_29) +_GLOBAL(_save32gpr_29) + stw 29,-12(11) +_GLOBAL(_savegpr_30) +_GLOBAL(_save32gpr_30) + stw 30,-8(11) +_GLOBAL(_savegpr_31) +_GLOBAL(_save32gpr_31) + stw 31,-4(11) + blr + +/* Routines for restoring 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 restore area. */ + +_GLOBAL(_restgpr_14) +_GLOBAL(_rest32gpr_14) + lwz 14,-72(11) /* restore gp registers */ +_GLOBAL(_restgpr_15) +_GLOBAL(_rest32gpr_15) + lwz 15,-68(11) +_GLOBAL(_restgpr_16) +_GLOBAL(_rest32gpr_16) + lwz 16,-64(11) +_GLOBAL(_restgpr_17) +_GLOBAL(_rest32gpr_17) + lwz 17,-60(11) +_GLOBAL(_restgpr_18) +_GLOBAL(_rest32gpr_18) + lwz 18,-56(11) +_GLOBAL(_restgpr_19) +_GLOBAL(_rest32gpr_19) + lwz 19,-52(11) +_GLOBAL(_restgpr_20) +_GLOBAL(_rest32gpr_20) + lwz 20,-48(11) +_GLOBAL(_restgpr_21) +_GLOBAL(_rest32gpr_21) + lwz 21,-44(11) +_GLOBAL(_restgpr_22) +_GLOBAL(_rest32gpr_22) + lwz 22,-40(11) +_GLOBAL(_restgpr_23) +_GLOBAL(_rest32gpr_23) + lwz 23,-36(11) +_GLOBAL(_restgpr_24) +_GLOBAL(_rest32gpr_24) + lwz 24,-32(11) +_GLOBAL(_restgpr_25) +_GLOBAL(_rest32gpr_25) + lwz 25,-28(11) +_GLOBAL(_restgpr_26) +_GLOBAL(_rest32gpr_26) + lwz 26,-24(11) +_GLOBAL(_restgpr_27) +_GLOBAL(_rest32gpr_27) + lwz 27,-20(11) +_GLOBAL(_restgpr_28) +_GLOBAL(_rest32gpr_28) + lwz 28,-16(11) +_GLOBAL(_restgpr_29) +_GLOBAL(_rest32gpr_29) + lwz 29,-12(11) +_GLOBAL(_restgpr_30) +_GLOBAL(_rest32gpr_30) + lwz 30,-8(11) +_GLOBAL(_restgpr_31) +_GLOBAL(_rest32gpr_31) + lwz 31,-4(11) + blr + +/* Routines for restoring 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 restore area. */ + +_GLOBAL(_restgpr_14_x) +_GLOBAL(_rest32gpr_14_x) + lwz 14,-72(11) /* restore gp registers */ +_GLOBAL(_restgpr_15_x) +_GLOBAL(_rest32gpr_15_x) + lwz 15,-68(11) +_GLOBAL(_restgpr_16_x) +_GLOBAL(_rest32gpr_16_x) + lwz 16,-64(11) +_GLOBAL(_restgpr_17_x) +_GLOBAL(_rest32gpr_17_x) + lwz 17,-60(11) +_GLOBAL(_restgpr_18_x) +_GLOBAL(_rest32gpr_18_x) + lwz 18,-56(11) +_GLOBAL(_restgpr_19_x) +_GLOBAL(_rest32gpr_19_x) + lwz 19,-52(11) +_GLOBAL(_restgpr_20_x) +_GLOBAL(_rest32gpr_20_x) + lwz 20,-48(11) +_GLOBAL(_restgpr_21_x) +_GLOBAL(_rest32gpr_21_x) + lwz 21,-44(11) +_GLOBAL(_restgpr_22_x) +_GLOBAL(_rest32gpr_22_x) + lwz 22,-40(11) +_GLOBAL(_restgpr_23_x) +_GLOBAL(_rest32gpr_23_x) + lwz 23,-36(11) +_GLOBAL(_restgpr_24_x) +_GLOBAL(_rest32gpr_24_x) + lwz 24,-32(11) +_GLOBAL(_restgpr_25_x) +_GLOBAL(_rest32gpr_25_x) + lwz 25,-28(11) +_GLOBAL(_restgpr_26_x) +_GLOBAL(_rest32gpr_26_x) + lwz 26,-24(11) +_GLOBAL(_restgpr_27_x) +_GLOBAL(_rest32gpr_27_x) + lwz 27,-20(11) +_GLOBAL(_restgpr_28_x) +_GLOBAL(_rest32gpr_28_x) + lwz 28,-16(11) +_GLOBAL(_restgpr_29_x) +_GLOBAL(_rest32gpr_29_x) + lwz 29,-12(11) +_GLOBAL(_restgpr_30_x) +_GLOBAL(_rest32gpr_30_x) + lwz 30,-8(11) +_GLOBAL(_restgpr_31_x) +_GLOBAL(_rest32gpr_31_x) + lwz 0,4(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr + -- 1.7.5.3 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-27 9:51 ` [PATCH 1/2] " Andre Naujoks @ 2011-07-27 9:53 ` Andre Naujoks 0 siblings, 0 replies; 10+ messages in thread From: Andre Naujoks @ 2011-07-27 9:53 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox Sorry. line wrap was on in the first one. From c479527616c5fc79c608e21573373a5a324f6e9b Mon Sep 17 00:00:00 2001 From: Andre Naujoks <nautsch2@googlemail.com> Date: Wed, 27 Jul 2011 11:28:35 +0200 Subject: [PATCH 1/2] Ported crtsavres from linux kernel to barebox --- arch/ppc/lib/Makefile | 1 + arch/ppc/lib/crtsavres.S | 239 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 240 insertions(+), 0 deletions(-) create mode 100644 arch/ppc/lib/crtsavres.S diff --git a/arch/ppc/lib/Makefile b/arch/ppc/lib/Makefile index 0844d56..c35fd08 100644 --- a/arch/ppc/lib/Makefile +++ b/arch/ppc/lib/Makefile @@ -10,4 +10,5 @@ obj-y += misc.o obj-$(CONFIG_CMD_BOOTM) += ppclinux.o obj-y += board_data.o obj-$(CONFIG_MODULES) += module.o +obj-y += crtsavres.o diff --git a/arch/ppc/lib/crtsavres.S b/arch/ppc/lib/crtsavres.S new file mode 100644 index 0000000..f9d7cb6 --- /dev/null +++ b/arch/ppc/lib/crtsavres.S @@ -0,0 +1,239 @@ +/* + * Special support for eabi and SVR4 + * + * Copyright (C) 1995, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. + * Copyright 2008 Freescale Semiconductor, Inc. + * Written By Michael Meissner + * + * Based on gcc/config/rs6000/crtsavres.asm from gcc + * 64 bit additions from reading the PPC elf64abi document. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * In addition to the permissions in the GNU General Public License, the + * Free Software Foundation gives you unlimited permission to link the + * compiled version of this file with other programs, and to distribute + * those programs without any restriction coming from the use of this + * file. (The General Public License restrictions do apply in other + * respects; for example, they cover modification of the file, and + * distribution when not linked into another program.) + * + * This file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * As a special exception, if you link this library with files + * compiled with GCC to produce an executable, this does not cause + * the resulting executable to be covered by the GNU General Public License. + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + */ + +#include <asm/ppc_asm.tmpl> + +#define N_FUN 36 + +#define __stringify_1(x...) #x +#define __stringify(x...) __stringify_1(x) + +#define _GLOBAL(n) \ + .text; \ + .stabs __stringify(n:F-1),N_FUN,0,0,n;\ + .globl n; \ +n: + + .file "crtsavres.S" + .section ".text" + +/* 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. */ + +_GLOBAL(_savegpr_14) +_GLOBAL(_save32gpr_14) + stw 14,-72(11) /* save gp registers */ +_GLOBAL(_savegpr_15) +_GLOBAL(_save32gpr_15) + stw 15,-68(11) +_GLOBAL(_savegpr_16) +_GLOBAL(_save32gpr_16) + stw 16,-64(11) +_GLOBAL(_savegpr_17) +_GLOBAL(_save32gpr_17) + stw 17,-60(11) +_GLOBAL(_savegpr_18) +_GLOBAL(_save32gpr_18) + stw 18,-56(11) +_GLOBAL(_savegpr_19) +_GLOBAL(_save32gpr_19) + stw 19,-52(11) +_GLOBAL(_savegpr_20) +_GLOBAL(_save32gpr_20) + stw 20,-48(11) +_GLOBAL(_savegpr_21) +_GLOBAL(_save32gpr_21) + stw 21,-44(11) +_GLOBAL(_savegpr_22) +_GLOBAL(_save32gpr_22) + stw 22,-40(11) +_GLOBAL(_savegpr_23) +_GLOBAL(_save32gpr_23) + stw 23,-36(11) +_GLOBAL(_savegpr_24) +_GLOBAL(_save32gpr_24) + stw 24,-32(11) +_GLOBAL(_savegpr_25) +_GLOBAL(_save32gpr_25) + stw 25,-28(11) +_GLOBAL(_savegpr_26) +_GLOBAL(_save32gpr_26) + stw 26,-24(11) +_GLOBAL(_savegpr_27) +_GLOBAL(_save32gpr_27) + stw 27,-20(11) +_GLOBAL(_savegpr_28) +_GLOBAL(_save32gpr_28) + stw 28,-16(11) +_GLOBAL(_savegpr_29) +_GLOBAL(_save32gpr_29) + stw 29,-12(11) +_GLOBAL(_savegpr_30) +_GLOBAL(_save32gpr_30) + stw 30,-8(11) +_GLOBAL(_savegpr_31) +_GLOBAL(_save32gpr_31) + stw 31,-4(11) + blr + +/* Routines for restoring 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 restore area. */ + +_GLOBAL(_restgpr_14) +_GLOBAL(_rest32gpr_14) + lwz 14,-72(11) /* restore gp registers */ +_GLOBAL(_restgpr_15) +_GLOBAL(_rest32gpr_15) + lwz 15,-68(11) +_GLOBAL(_restgpr_16) +_GLOBAL(_rest32gpr_16) + lwz 16,-64(11) +_GLOBAL(_restgpr_17) +_GLOBAL(_rest32gpr_17) + lwz 17,-60(11) +_GLOBAL(_restgpr_18) +_GLOBAL(_rest32gpr_18) + lwz 18,-56(11) +_GLOBAL(_restgpr_19) +_GLOBAL(_rest32gpr_19) + lwz 19,-52(11) +_GLOBAL(_restgpr_20) +_GLOBAL(_rest32gpr_20) + lwz 20,-48(11) +_GLOBAL(_restgpr_21) +_GLOBAL(_rest32gpr_21) + lwz 21,-44(11) +_GLOBAL(_restgpr_22) +_GLOBAL(_rest32gpr_22) + lwz 22,-40(11) +_GLOBAL(_restgpr_23) +_GLOBAL(_rest32gpr_23) + lwz 23,-36(11) +_GLOBAL(_restgpr_24) +_GLOBAL(_rest32gpr_24) + lwz 24,-32(11) +_GLOBAL(_restgpr_25) +_GLOBAL(_rest32gpr_25) + lwz 25,-28(11) +_GLOBAL(_restgpr_26) +_GLOBAL(_rest32gpr_26) + lwz 26,-24(11) +_GLOBAL(_restgpr_27) +_GLOBAL(_rest32gpr_27) + lwz 27,-20(11) +_GLOBAL(_restgpr_28) +_GLOBAL(_rest32gpr_28) + lwz 28,-16(11) +_GLOBAL(_restgpr_29) +_GLOBAL(_rest32gpr_29) + lwz 29,-12(11) +_GLOBAL(_restgpr_30) +_GLOBAL(_rest32gpr_30) + lwz 30,-8(11) +_GLOBAL(_restgpr_31) +_GLOBAL(_rest32gpr_31) + lwz 31,-4(11) + blr + +/* Routines for restoring 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 restore area. */ + +_GLOBAL(_restgpr_14_x) +_GLOBAL(_rest32gpr_14_x) + lwz 14,-72(11) /* restore gp registers */ +_GLOBAL(_restgpr_15_x) +_GLOBAL(_rest32gpr_15_x) + lwz 15,-68(11) +_GLOBAL(_restgpr_16_x) +_GLOBAL(_rest32gpr_16_x) + lwz 16,-64(11) +_GLOBAL(_restgpr_17_x) +_GLOBAL(_rest32gpr_17_x) + lwz 17,-60(11) +_GLOBAL(_restgpr_18_x) +_GLOBAL(_rest32gpr_18_x) + lwz 18,-56(11) +_GLOBAL(_restgpr_19_x) +_GLOBAL(_rest32gpr_19_x) + lwz 19,-52(11) +_GLOBAL(_restgpr_20_x) +_GLOBAL(_rest32gpr_20_x) + lwz 20,-48(11) +_GLOBAL(_restgpr_21_x) +_GLOBAL(_rest32gpr_21_x) + lwz 21,-44(11) +_GLOBAL(_restgpr_22_x) +_GLOBAL(_rest32gpr_22_x) + lwz 22,-40(11) +_GLOBAL(_restgpr_23_x) +_GLOBAL(_rest32gpr_23_x) + lwz 23,-36(11) +_GLOBAL(_restgpr_24_x) +_GLOBAL(_rest32gpr_24_x) + lwz 24,-32(11) +_GLOBAL(_restgpr_25_x) +_GLOBAL(_rest32gpr_25_x) + lwz 25,-28(11) +_GLOBAL(_restgpr_26_x) +_GLOBAL(_rest32gpr_26_x) + lwz 26,-24(11) +_GLOBAL(_restgpr_27_x) +_GLOBAL(_rest32gpr_27_x) + lwz 27,-20(11) +_GLOBAL(_restgpr_28_x) +_GLOBAL(_rest32gpr_28_x) + lwz 28,-16(11) +_GLOBAL(_restgpr_29_x) +_GLOBAL(_rest32gpr_29_x) + lwz 29,-12(11) +_GLOBAL(_restgpr_30_x) +_GLOBAL(_rest32gpr_30_x) + lwz 30,-8(11) +_GLOBAL(_restgpr_31_x) +_GLOBAL(_rest32gpr_31_x) + lwz 0,4(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr + -- 1.7.5.3 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-27 9:50 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 1/2] " Andre Naujoks @ 2011-07-27 9:51 ` Andre Naujoks 2011-07-28 11:52 ` Sascha Hauer 2 siblings, 0 replies; 10+ messages in thread From: Andre Naujoks @ 2011-07-27 9:51 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: barebox From 9b3985045da1161a934cba48749fe1759e62dae6 Mon Sep 17 00:00:00 2001 From: Andre Naujoks <nautsch2@googlemail.com> Date: Wed, 27 Jul 2011 11:29:43 +0200 Subject: [PATCH 2/2] Ported ppc ashrdi3 from linux kernel --- arch/ppc/lib/misc.S | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/ppc/lib/misc.S b/arch/ppc/lib/misc.S index 24f901f..bd06ff2 100644 --- a/arch/ppc/lib/misc.S +++ b/arch/ppc/lib/misc.S @@ -2,6 +2,20 @@ #include <asm/ppc_asm.tmpl> #include <asm-generic/errno.h> + .globl __ashrdi3 +__ashrdi3: + subfic r6,r5,32 + srw r4,r4,r5 # LSW = count > 31 ? 0 : LSW >> count + addi r7,r5,32 # could be xori, or addi with -32 + slw r6,r3,r6 # t1 = count > 31 ? 0 : MSW << (32-count) + rlwinm r8,r7,0,32 # t3 = (count < 32) ? 32 : 0 + sraw r7,r3,r7 # t2 = MSW >> (count-32) + or r4,r4,r6 # LSW |= t1 + slw r7,r7,r8 # t2 = (count < 32) ? 0 : t2 + sraw r3,r3,r5 # MSW = MSW >> count + or r4,r4,r7 # LSW |= t2 + blr + .globl __ashldi3 __ashldi3: subfic r6,r5,32 -- 1.7.5.3 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-27 9:50 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 1/2] " Andre Naujoks 2011-07-27 9:51 ` [PATCH 2/2] " Andre Naujoks @ 2011-07-28 11:52 ` Sascha Hauer 2011-07-28 13:15 ` Andre Naujoks 2 siblings, 1 reply; 10+ messages in thread From: Sascha Hauer @ 2011-07-28 11:52 UTC (permalink / raw) To: Andre Naujoks; +Cc: barebox On Wed, Jul 27, 2011 at 11:50:12AM +0200, Andre Naujoks wrote: > Am 27.07.2011 08:40, schrieb Andre Naujoks: > > Am 26.07.2011 16:20, schrieb Marc Kleine-Budde: > >> On 07/26/2011 03:56 PM, Andre Naujoks wrote: > >>> Hello. > >>> > >>> We are currently trying to compile a barebox with the git version of > >>> ptxdist and the git version of the OSELAS generic Toolchain for powerpc. > >>> > >>> Also the current 2011.07.0 release of barebox. > >>> > >>> We are having some problems during the build, which I think are a result > >>> of some changes in gcc's optimizations (since 4.4.something). GCC uses > >>> some functions on the ppc platform to optimze the size of the resulting > >>> binary, which are only present in the libgcc.a. > >>> > >>> The compile stage works fine up tp the last linker step: > >>> > >>> CC arch/ppc/lib/time.o > >>> AS arch/ppc/lib/misc.o > >>> CC arch/ppc/lib/ppclinux.o > >>> CC arch/ppc/lib/board_data.o > >>> LD arch/ppc/lib/built-in.o > >>> LD barebox > >>> common/built-in.o: In function `mapset': > >>> hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' > >>> common/built-in.o: In function `syntax_err': > >>> hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' > >>> common/built-in.o: In function `done_command': > >>> hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' > >>> common/built-in.o: In function `done_pipe': > >>> hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' > >>> common/built-in.o: In function `is_assignment': > >>> hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' > >>> common/built-in.o: In function `b_addchr': > >>> hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' > >>> common/built-in.o: In function `b_addqchr': > >>> hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' > >>> ... > >>> > >>> > >>> This goes on for a few pages. > >>> > >>> As far as I can see, the possibilities I have here, is to either > >>> integrate the missing functions out of the gcc sources into barebox, or > >>> make barebox link with libgcc, which seems surprisingly difficult, due > >>> to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. > >>> -L.. did not help here. > >>> > >>> Am I right with this assumption, or am I missing something else here? > >> > >> We don't want to link barebox against libgcc, that's bad style. I > >> suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to > >> barebox. > > > > Thanks. I will give this a shot and see how far I get. If it works I > > will come back with a patch. > > Hi. > > With a little help from a collegue, we came up with the patches in the > followong mails. Basically the kernel files without the 64 bit parts. > > The second patch was another part of libgcc, which seemed to fit best in > the misc.S file, which was already present. Applied to -master. Thanks Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: barebox compilation with gcc 4.5.2 and ptxdist 2011-07-28 11:52 ` Sascha Hauer @ 2011-07-28 13:15 ` Andre Naujoks 0 siblings, 0 replies; 10+ messages in thread From: Andre Naujoks @ 2011-07-28 13:15 UTC (permalink / raw) To: Sascha Hauer; +Cc: barebox Am 28.07.2011 13:52, schrieb Sascha Hauer: > On Wed, Jul 27, 2011 at 11:50:12AM +0200, Andre Naujoks wrote: >> Am 27.07.2011 08:40, schrieb Andre Naujoks: >>> Am 26.07.2011 16:20, schrieb Marc Kleine-Budde: >>>> On 07/26/2011 03:56 PM, Andre Naujoks wrote: >>>>> Hello. >>>>> >>>>> We are currently trying to compile a barebox with the git version of >>>>> ptxdist and the git version of the OSELAS generic Toolchain for powerpc. >>>>> >>>>> Also the current 2011.07.0 release of barebox. >>>>> >>>>> We are having some problems during the build, which I think are a result >>>>> of some changes in gcc's optimizations (since 4.4.something). GCC uses >>>>> some functions on the ppc platform to optimze the size of the resulting >>>>> binary, which are only present in the libgcc.a. >>>>> >>>>> The compile stage works fine up tp the last linker step: >>>>> >>>>> CC arch/ppc/lib/time.o >>>>> AS arch/ppc/lib/misc.o >>>>> CC arch/ppc/lib/ppclinux.o >>>>> CC arch/ppc/lib/board_data.o >>>>> LD arch/ppc/lib/built-in.o >>>>> LD barebox >>>>> common/built-in.o: In function `mapset': >>>>> hush.c:(.text.mapset+0x44): undefined reference to `_restgpr_30_x' >>>>> common/built-in.o: In function `syntax_err': >>>>> hush.c:(.text.syntax_err+0x34): undefined reference to `_restgpr_30_x' >>>>> common/built-in.o: In function `done_command': >>>>> hush.c:(.text.done_command+0x94): undefined reference to `_restgpr_29_x' >>>>> common/built-in.o: In function `done_pipe': >>>>> hush.c:(.text.done_pipe+0x5c): undefined reference to `_restgpr_29_x' >>>>> common/built-in.o: In function `is_assignment': >>>>> hush.c:(.text.is_assignment+0x8c): undefined reference to `_restgpr_27_x' >>>>> common/built-in.o: In function `b_addchr': >>>>> hush.c:(.text.b_addchr+0x8c): undefined reference to `_restgpr_28_x' >>>>> common/built-in.o: In function `b_addqchr': >>>>> hush.c:(.text.b_addqchr+0x78): undefined reference to `_restgpr_29_x' >>>>> ... >>>>> >>>>> >>>>> This goes on for a few pages. >>>>> >>>>> As far as I can see, the possibilities I have here, is to either >>>>> integrate the missing functions out of the gcc sources into barebox, or >>>>> make barebox link with libgcc, which seems surprisingly difficult, due >>>>> to the unfamiliar (to me) build process. A simple LDFLAGS_barebox+=-l.. >>>>> -L.. did not help here. >>>>> >>>>> Am I right with this assumption, or am I missing something else here? >>>> >>>> We don't want to link barebox against libgcc, that's bad style. I >>>> suggest to port arch/powerpc/lib/crtsavres.S from the linux kernel to >>>> barebox. >>> >>> Thanks. I will give this a shot and see how far I get. If it works I >>> will come back with a patch. >> >> Hi. >> >> With a little help from a collegue, we came up with the patches in the >> followong mails. Basically the kernel files without the 64 bit parts. >> >> The second patch was another part of libgcc, which seemed to fit best in >> the misc.S file, which was already present. > > Applied to -master. Thats great. Thanks! Andre > > Thanks > Sascha > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-07-28 13:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-07-26 13:56 barebox compilation with gcc 4.5.2 and ptxdist Andre Naujoks 2011-07-26 14:20 ` Marc Kleine-Budde 2011-07-26 14:35 ` Jean-Christophe PLAGNIOL-VILLARD 2011-07-27 6:40 ` Andre Naujoks 2011-07-27 9:50 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 1/2] " Andre Naujoks 2011-07-27 9:53 ` Andre Naujoks 2011-07-27 9:51 ` [PATCH 2/2] " Andre Naujoks 2011-07-28 11:52 ` Sascha Hauer 2011-07-28 13:15 ` Andre Naujoks
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox