bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ARM: Mes C Library: Support gcc-sans-libc.


From: Jan Nieuwenhuizen
Subject: Re: [PATCH] ARM: Mes C Library: Support gcc-sans-libc.
Date: Thu, 04 Jun 2020 21:50:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Danny Milosavljevic writes:

> From: Jan Nieuwenhuizen <janneke@gnu.org>
>
> * lib/linux/arm-mes-gcc/crt1.c: New file.
> * lib/linux/arm-mes-gcc/mini.c: New file.
> * lib/arm-mes-gcc/setjmp.c: New file.
>
> Co-Authored-By: Danny Milosavljevic <dannym@scratchpost.org>

Indeed; if not the other way around ;-)

> ---
>  lib/arm-mes-gcc/setjmp.c     | 61 +++++++++++++++++++++++++++++
>  lib/linux/arm-mes-gcc/crt1.c | 76 ++++++++++++++++++++++++++++++++++++
>  lib/linux/arm-mes-gcc/mini.c | 59 ++++++++++++++++++++++++++++
>  3 files changed, 196 insertions(+)
>  create mode 100644 lib/arm-mes-gcc/setjmp.c
>  create mode 100644 lib/linux/arm-mes-gcc/crt1.c
>  create mode 100644 lib/linux/arm-mes-gcc/mini.c
>
> diff --git a/lib/arm-mes-gcc/setjmp.c b/lib/arm-mes-gcc/setjmp.c
> new file mode 100644
> index 00000000..c9e8b591
> --- /dev/null
> +++ b/lib/arm-mes-gcc/setjmp.c
> @@ -0,0 +1,61 @@
> +/* -*-comment-start: "//";comment-end:""-*-
> + * GNU Mes --- Maxwell Equations of Software
> + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
> + *
> + * This file is part of GNU Mes.
> + *
> + * GNU Mes 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 3 of the License, or (at
> + * your option) any later version.
> + *
> + * GNU Mes 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 GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <setjmp.h>
> +#include <stdlib.h>
> +
> +void
> +__attribute__ ((noinline))
> +longjmp (jmp_buf env, int val)
> +{
> +  // *INDENT-OFF*
> +  asm (
> +       "mov r0, %0\n\t"
> +       "mov r1, %1\n\t"
> +       "cmp r1, #0\n\t"
> +       "moveq r1, #1\n\t" /* returning 0 is not allowed, even when the user 
> wanted to. */
> +       "ldr r13, [r0], #4\n\t" /* stack pointer (sp) */
> +       "ldr r14, [r0], #4\n\t" /* link register (lr) */
> +       "ldmia r0!, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
> +       // TODO: If using VFP, vldmia r0!, {d8-d15}
> +       "mov r0, r1\n\t"
> +       :
> +       : "r" (env), "r" (val));
> +  // *INDENT-ON*
> +  // not reached
> +}
> +
> +int
> +__attribute__ ((noinline))
> +setjmp (jmp_buf env)
> +{
> +  // *INDENT-OFF*
> +  asm (
> +       "mov r0, %0\n\t"
> +       "str r13, [r0], #4\n\t" /* stack pointer (sp) */
> +       "str r14, [r0], #4\n\t" /* link register (lr) */
> +       "stmia r0!, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t"
> +       // TODO: If using VFP, vstmia r0!, {d8-d15}
> +       :
> +       : "r" (env)
> +       : "r0");
> +  // *INDENT-ON*
> +  return 0;
> +}
> diff --git a/lib/linux/arm-mes-gcc/crt1.c b/lib/linux/arm-mes-gcc/crt1.c
> new file mode 100644
> index 00000000..67e7ad29
> --- /dev/null
> +++ b/lib/linux/arm-mes-gcc/crt1.c
> @@ -0,0 +1,76 @@
> +/* -*-comment-start: "//";comment-end:""-*-
> + * GNU Mes --- Maxwell Equations of Software
> + * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>

Did I really write this?  I think this needs a copyright line for yourself?

> diff --git a/lib/linux/arm-mes-gcc/mini.c b/lib/linux/arm-mes-gcc/mini.c
> new file mode 100644
> index 00000000..e524cc7e
> --- /dev/null
> +++ b/lib/linux/arm-mes-gcc/mini.c
> @@ -0,0 +1,59 @@
> +/* -*-comment-start: "//";comment-end:""-*-
> + * GNU Mes --- Maxwell Equations of Software
> + * Copyright © 2016,2017,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>

Same; otherwise LGTM!

Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]