Re: [PATCH v2 2/2] powerpc new toolchains fix (crt.S)

2010-05-13 Thread Anton Vorontsov
On Thu, May 13, 2010 at 07:27:59PM +0200, Segher Boessenkool wrote:
> >Linker does not provide some vital functions when building
> >freestanding
> >applications with a new toolchain,
> 
> That's because the compiler provides those functions, not the linker.
> 
> >so we have to provide our own CRT.
> 
> ...in libgcc.  Why don't you link against that?

For the same reason we don't link kernel against libgcc?
I.e. just a matter of taste. There are two camps: those who
argue against libgcc, and those who argue for libgcc.

Hey! You were in this thread! :-)

http://www.mail-archive.com/linuxppc-dev@lists.ozlabs.org/msg17224.html

Purgatory is just a small (tiny) piece of code that runs
between kernels. Whether use libgcc or not, personally, I have
no strong opinion. Kexec didn't use it, so we kept it the same
way.

Thanks,

-- 
Anton Vorontsov
email: cbouatmai...@gmail.com
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v2 2/2] powerpc new toolchains fix (crt.S)

2010-05-13 Thread Segher Boessenkool
Linker does not provide some vital functions when building  
freestanding

applications with a new toolchain,


That's because the compiler provides those functions, not the linker.


so we have to provide our own CRT.


...in libgcc.  Why don't you link against that?


p.s.
Without the CRT we won't see any build errors (since the purgatory is
linked with --no-undefined), but the purgatory code won't work,


It would be nice if the build would check if anything unexpectedly
undefined is left.


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: [PATCH v2 2/2] powerpc new toolchains fix (crt.S)

2010-05-13 Thread Simon Horman
On Wed, May 12, 2010 at 11:08:49AM +0400, Maxim Uvarov wrote:
> 
> Hello everybody,
> 
>   Changes from previous version:
>   - removed bogus hyphen from the patch;
>   - move ifdefs to crt.S instead of Makefile
> 
> 
>   Please find here patch for user land kexec-tools application. Following
>   patch makes kexec-tools work for both kexec and kdump. I tested it with 
>   git kernel (linus-tree) and Freescale/Logic MPC8360ERDK board with 
>   mpc83xx_defconfig kernel config.
> 
>   kexec:
>   kexec -l vmlinux --command-line="console= ... etc"
>   kexec -e
> 
>   kdump:
>   kexec -p vmlinux_dump --command-line="console=... etc"
>   echo c > /proc/sysrq-trigger
> 
>   I also think that is is reasonable:
>   - put GAME_CUBE specific code to separate files;
>   - combine  ppc and ppc64 to powerpc directory (I'm planning to do it.
>   And that why in some places my patch have ifdefs for PPC64);
> 
> Best regards,
> Maxim Uvarov.

Thanks,

I'm assuming that the silence that this patch set received,
in contrast to the first revision where there was some quick discussion,
means that everyone is ok with these changes. So I've gone ahead and pushed
them into the tree.

> From: Maxim Uvarov 
> 
> Linker does not provide some vital functions when building freestanding
> applications with a new toolchain, so we have to provide our own CRT.
> 
> p.s.
> Without the CRT we won't see any build errors (since the purgatory is
> linked with --no-undefined), but the purgatory code won't work,
> 'kexec -e' will just hang the board.
> 
> 
> I added option to configure to keep code buildable for old toolchais.
> But there should be way to do this automatically.

I seem to have an old toolchain :-)

> Author: Anton Vorontsov 
> Signed-off-by: Maxim Uvarov 
> Signed-off-by: Maxim Uvarov 
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH v2 2/2] powerpc new toolchains fix (crt.S)

2010-05-12 Thread Maxim Uvarov

Hello everybody,

  Changes from previous version:
  - removed bogus hyphen from the patch;
  - move ifdefs to crt.S instead of Makefile


  Please find here patch for user land kexec-tools application. Following
  patch makes kexec-tools work for both kexec and kdump. I tested it with 
  git kernel (linus-tree) and Freescale/Logic MPC8360ERDK board with 
  mpc83xx_defconfig kernel config.

  kexec:
  kexec -l vmlinux --command-line="console= ... etc"
  kexec -e

  kdump:
  kexec -p vmlinux_dump --command-line="console=... etc"
  echo c > /proc/sysrq-trigger

  I also think that is is reasonable:
  - put GAME_CUBE specific code to separate files;
  - combine  ppc and ppc64 to powerpc directory (I'm planning to do it.
And that why in some places my patch have ifdefs for PPC64);

Best regards,
Maxim Uvarov.

From: Maxim Uvarov 

Linker does not provide some vital functions when building freestanding
applications with a new toolchain, so we have to provide our own CRT.

p.s.
Without the CRT we won't see any build errors (since the purgatory is
linked with --no-undefined), but the purgatory code won't work,
'kexec -e' will just hang the board.


I added option to configure to keep code buildable for old toolchais.
But there should be way to do this automatically.

Author: Anton Vorontsov 
Signed-off-by: Maxim Uvarov 
Signed-off-by: Maxim Uvarov 
---

 configure.ac|9 +
 purgatory/arch/ppc/Makefile |1 
 purgatory/arch/ppc/crt.S|  263 +++
 3 files changed, 273 insertions(+), 0 deletions(-)
 create mode 100644 purgatory/arch/ppc/crt.S

diff --git a/configure.ac b/configure.ac
index fcf50e4..63606bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,15 @@ if test "$with_xen" = yes ; then
AC_MSG_NOTICE([Xen support disabled])))
 fi
 
+dnl new toolchains
+if test "$ARCH" = ppc; then
+AC_ARG_WITH([oldtoolchain],
+   AC_HELP_STRING([--with-oldtoolchain],[compile without crt.S
+   required for new toolchains]),
+   AC_DEFINE(PPC_OLDTOOLCHAIN, 1,
+   [Define to compile with old toolchains]))
+fi
+
 dnl ---Sanity checks
 if test "$CC"  = "no"; then AC_MSG_ERROR([cc not found]); fi
 if test "$CPP" = "no"; then AC_MSG_ERROR([cpp not found]); fi
diff --git a/purgatory/arch/ppc/Makefile b/purgatory/arch/ppc/Makefile
index 72289a0..4020778 100644
--- a/purgatory/arch/ppc/Makefile
+++ b/purgatory/arch/ppc/Makefile
@@ -6,6 +6,7 @@ ppc_PURGATORY_SRCS += purgatory/arch/ppc/v2wrap_32.S
 ppc_PURGATORY_SRCS += purgatory/arch/ppc/misc.S
 ppc_PURGATORY_SRCS += purgatory/arch/ppc/purgatory-ppc.c
 ppc_PURGATORY_SRCS += purgatory/arch/ppc/console-ppc.c
+ppc_PURGATORY_SRCS += purgatory/arch/ppc/crt.S
 
 dist += purgatory/arch/ppc/Makefile $(ppc_PURGATORY_SRCS)  \
purgatory/arch/ppc/purgatory-ppc.h purgatory/arch/ppc/ppc_asm.h
diff --git a/purgatory/arch/ppc/crt.S b/purgatory/arch/ppc/crt.S
new file mode 100644
index 000..70f4d61
--- /dev/null
+++ b/purgatory/arch/ppc/crt.S
@@ -0,0 +1,263 @@
+/* This is from linux-2.6/arch/powerpc/lib/crtsavres.S:
+ *
+ * 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
+ *
+ * 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 o