mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Import missing linkage.h from Linux 3.19-rc6
@ 2015-01-29  2:37 Masahiro Yamada
  2015-01-29  8:54 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2015-01-29  2:37 UTC (permalink / raw)
  To: barebox

Since include/linux/linkage.h includes <asm/linkage.h>,
each architecture should generally have <asm/linkage.h>.

Import linkage.h from the corresponding architecture
of Linux 3.19-rc6.

Note:
  arch/efi/include/asm/linkage.h is a copy of
  arch/x86/include/asm/linkage.h.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
---

 arch/efi/include/asm/linkage.h      | 61 +++++++++++++++++++++++++++++++++++++
 arch/mips/include/asm/linkage.h     | 13 ++++++++
 arch/nios2/include/asm/linkage.h    | 25 +++++++++++++++
 arch/openrisc/include/asm/linkage.h | 25 +++++++++++++++
 arch/ppc/include/asm/linkage.h      | 15 +++++++++
 arch/x86/include/asm/linkage.h      | 61 +++++++++++++++++++++++++++++++++++++
 include/asm-generic/linkage.h       |  8 +++++
 7 files changed, 208 insertions(+)
 create mode 100644 arch/efi/include/asm/linkage.h
 create mode 100644 arch/mips/include/asm/linkage.h
 create mode 100644 arch/nios2/include/asm/linkage.h
 create mode 100644 arch/openrisc/include/asm/linkage.h
 create mode 100644 arch/ppc/include/asm/linkage.h
 create mode 100644 arch/x86/include/asm/linkage.h
 create mode 100644 include/asm-generic/linkage.h

diff --git a/arch/efi/include/asm/linkage.h b/arch/efi/include/asm/linkage.h
new file mode 100644
index 0000000..79327e9
--- /dev/null
+++ b/arch/efi/include/asm/linkage.h
@@ -0,0 +1,61 @@
+#ifndef _ASM_X86_LINKAGE_H
+#define _ASM_X86_LINKAGE_H
+
+#include <linux/stringify.h>
+
+#undef notrace
+#define notrace __attribute__((no_instrument_function))
+
+#ifdef CONFIG_X86_32
+#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
+
+/*
+ * Make sure the compiler doesn't do anything stupid with the
+ * arguments on the stack - they are owned by the *caller*, not
+ * the callee. This just fools gcc into not spilling into them,
+ * and keeps it from doing tailcall recursion and/or using the
+ * stack slots for temporaries, since they are live and "used"
+ * all the way to the end of the function.
+ *
+ * NOTE! On x86-64, all the arguments are in registers, so this
+ * only matters on a 32-bit kernel.
+ */
+#define asmlinkage_protect(n, ret, args...) \
+	__asmlinkage_protect##n(ret, ##args)
+#define __asmlinkage_protect_n(ret, args...) \
+	__asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
+#define __asmlinkage_protect0(ret) \
+	__asmlinkage_protect_n(ret)
+#define __asmlinkage_protect1(ret, arg1) \
+	__asmlinkage_protect_n(ret, "m" (arg1))
+#define __asmlinkage_protect2(ret, arg1, arg2) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2))
+#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3))
+#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4))
+#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4), "m" (arg5))
+#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4), "m" (arg5), "m" (arg6))
+
+#endif /* CONFIG_X86_32 */
+
+#ifdef __ASSEMBLY__
+
+#define GLOBAL(name)	\
+	.globl name;	\
+	name:
+
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
+#define __ALIGN		.p2align 4, 0x90
+#define __ALIGN_STR	__stringify(__ALIGN)
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_X86_LINKAGE_H */
+
diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
new file mode 100644
index 0000000..2767dda
--- /dev/null
+++ b/arch/mips/include/asm/linkage.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_LINKAGE_H
+#define __ASM_LINKAGE_H
+
+#ifdef __ASSEMBLY__
+#include <asm/asm.h>
+#endif
+
+#define __weak __attribute__((weak))
+#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
+#define SYSCALL_ALIAS(alias, name)					\
+	asm ( #alias " = " #name "\n\t.globl " #alias)
+
+#endif
diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h
new file mode 100644
index 0000000..e0c6dec
--- /dev/null
+++ b/arch/nios2/include/asm/linkage.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
+ *
+ * All rights reserved.
+ *
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ */
+
+#ifndef _ASM_NIOS2_LINKAGE_H
+#define _ASM_NIOS2_LINKAGE_H
+
+/* This file is required by include/linux/linkage.h */
+#define __ALIGN .align 4
+#define __ALIGN_STR ".align 4"
+
+#endif
diff --git a/arch/openrisc/include/asm/linkage.h b/arch/openrisc/include/asm/linkage.h
new file mode 100644
index 0000000..e263875
--- /dev/null
+++ b/arch/openrisc/include/asm/linkage.h
@@ -0,0 +1,25 @@
+/*
+ * OpenRISC Linux
+ *
+ * Linux architectural port borrowing liberally from similar works of
+ * others.  All original copyrights apply as per the original source
+ * declaration.
+ *
+ * OpenRISC implementation:
+ * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
+ * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
+ * et al.
+ *
+ * This program 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 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ASM_OPENRISC_LINKAGE_H
+#define __ASM_OPENRISC_LINKAGE_H
+
+#define __ALIGN      .align 0
+#define __ALIGN_STR ".align 0"
+
+#endif /* __ASM_OPENRISC_LINKAGE_H */
diff --git a/arch/ppc/include/asm/linkage.h b/arch/ppc/include/asm/linkage.h
new file mode 100644
index 0000000..e3ad5c7
--- /dev/null
+++ b/arch/ppc/include/asm/linkage.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_POWERPC_LINKAGE_H
+#define _ASM_POWERPC_LINKAGE_H
+
+#ifdef CONFIG_PPC64
+#if !defined(_CALL_ELF) || _CALL_ELF != 2
+#define cond_syscall(x) \
+	asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"		\
+	     "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
+#define SYSCALL_ALIAS(alias, name)					\
+	asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"	\
+	     "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
+#endif
+#endif
+
+#endif	/* _ASM_POWERPC_LINKAGE_H */
diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
new file mode 100644
index 0000000..79327e9
--- /dev/null
+++ b/arch/x86/include/asm/linkage.h
@@ -0,0 +1,61 @@
+#ifndef _ASM_X86_LINKAGE_H
+#define _ASM_X86_LINKAGE_H
+
+#include <linux/stringify.h>
+
+#undef notrace
+#define notrace __attribute__((no_instrument_function))
+
+#ifdef CONFIG_X86_32
+#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
+
+/*
+ * Make sure the compiler doesn't do anything stupid with the
+ * arguments on the stack - they are owned by the *caller*, not
+ * the callee. This just fools gcc into not spilling into them,
+ * and keeps it from doing tailcall recursion and/or using the
+ * stack slots for temporaries, since they are live and "used"
+ * all the way to the end of the function.
+ *
+ * NOTE! On x86-64, all the arguments are in registers, so this
+ * only matters on a 32-bit kernel.
+ */
+#define asmlinkage_protect(n, ret, args...) \
+	__asmlinkage_protect##n(ret, ##args)
+#define __asmlinkage_protect_n(ret, args...) \
+	__asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
+#define __asmlinkage_protect0(ret) \
+	__asmlinkage_protect_n(ret)
+#define __asmlinkage_protect1(ret, arg1) \
+	__asmlinkage_protect_n(ret, "m" (arg1))
+#define __asmlinkage_protect2(ret, arg1, arg2) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2))
+#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3))
+#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4))
+#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4), "m" (arg5))
+#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
+	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
+			      "m" (arg4), "m" (arg5), "m" (arg6))
+
+#endif /* CONFIG_X86_32 */
+
+#ifdef __ASSEMBLY__
+
+#define GLOBAL(name)	\
+	.globl name;	\
+	name:
+
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
+#define __ALIGN		.p2align 4, 0x90
+#define __ALIGN_STR	__stringify(__ALIGN)
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_X86_LINKAGE_H */
+
diff --git a/include/asm-generic/linkage.h b/include/asm-generic/linkage.h
new file mode 100644
index 0000000..fef7a01
--- /dev/null
+++ b/include/asm-generic/linkage.h
@@ -0,0 +1,8 @@
+#ifndef __ASM_GENERIC_LINKAGE_H
+#define __ASM_GENERIC_LINKAGE_H
+/*
+ * linux/linkage.h provides reasonable defaults.
+ * an architecture can override them by providing its own version.
+ */
+
+#endif /* __ASM_GENERIC_LINKAGE_H */
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Import missing linkage.h from Linux 3.19-rc6
  2015-01-29  2:37 [PATCH] Import missing linkage.h from Linux 3.19-rc6 Masahiro Yamada
@ 2015-01-29  8:54 ` Sascha Hauer
  2015-02-03  6:14   ` Masahiro Yamada
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2015-01-29  8:54 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: barebox

On Thu, Jan 29, 2015 at 11:37:11AM +0900, Masahiro Yamada wrote:
> Since include/linux/linkage.h includes <asm/linkage.h>,
> each architecture should generally have <asm/linkage.h>.
> 
> Import linkage.h from the corresponding architecture
> of Linux 3.19-rc6.
> 
> Note:
>   arch/efi/include/asm/linkage.h is a copy of
>   arch/x86/include/asm/linkage.h.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> ---
> 
>  arch/efi/include/asm/linkage.h      | 61 +++++++++++++++++++++++++++++++++++++
>  arch/mips/include/asm/linkage.h     | 13 ++++++++
>  arch/nios2/include/asm/linkage.h    | 25 +++++++++++++++
>  arch/openrisc/include/asm/linkage.h | 25 +++++++++++++++
>  arch/ppc/include/asm/linkage.h      | 15 +++++++++
>  arch/x86/include/asm/linkage.h      | 61 +++++++++++++++++++++++++++++++++++++
>  include/asm-generic/linkage.h       |  8 +++++
>  7 files changed, 208 insertions(+)
>  create mode 100644 arch/efi/include/asm/linkage.h
>  create mode 100644 arch/mips/include/asm/linkage.h
>  create mode 100644 arch/nios2/include/asm/linkage.h
>  create mode 100644 arch/openrisc/include/asm/linkage.h
>  create mode 100644 arch/ppc/include/asm/linkage.h
>  create mode 100644 arch/x86/include/asm/linkage.h
>  create mode 100644 include/asm-generic/linkage.h
> 
> diff --git a/arch/efi/include/asm/linkage.h b/arch/efi/include/asm/linkage.h
> new file mode 100644
> index 0000000..79327e9
> --- /dev/null
> +++ b/arch/efi/include/asm/linkage.h
> @@ -0,0 +1,61 @@
> +#ifndef _ASM_X86_LINKAGE_H
> +#define _ASM_X86_LINKAGE_H
> +
> +#include <linux/stringify.h>
> +
> +#undef notrace
> +#define notrace __attribute__((no_instrument_function))
> +
> +#ifdef CONFIG_X86_32
> +#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
> +
> +/*
> + * Make sure the compiler doesn't do anything stupid with the
> + * arguments on the stack - they are owned by the *caller*, not
> + * the callee. This just fools gcc into not spilling into them,
> + * and keeps it from doing tailcall recursion and/or using the
> + * stack slots for temporaries, since they are live and "used"
> + * all the way to the end of the function.
> + *
> + * NOTE! On x86-64, all the arguments are in registers, so this
> + * only matters on a 32-bit kernel.
> + */
> +#define asmlinkage_protect(n, ret, args...) \
> +	__asmlinkage_protect##n(ret, ##args)
> +#define __asmlinkage_protect_n(ret, args...) \
> +	__asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args)
> +#define __asmlinkage_protect0(ret) \
> +	__asmlinkage_protect_n(ret)
> +#define __asmlinkage_protect1(ret, arg1) \
> +	__asmlinkage_protect_n(ret, "m" (arg1))
> +#define __asmlinkage_protect2(ret, arg1, arg2) \
> +	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2))
> +#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \
> +	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3))
> +#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \
> +	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
> +			      "m" (arg4))
> +#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \
> +	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
> +			      "m" (arg4), "m" (arg5))
> +#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \
> +	__asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \
> +			      "m" (arg4), "m" (arg5), "m" (arg6))
> +
> +#endif /* CONFIG_X86_32 */
> +
> +#ifdef __ASSEMBLY__
> +
> +#define GLOBAL(name)	\
> +	.globl name;	\
> +	name:
> +
> +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_ALIGNMENT_16)
> +#define __ALIGN		.p2align 4, 0x90
> +#define __ALIGN_STR	__stringify(__ALIGN)
> +#endif
> +
> +#endif /* __ASSEMBLY__ */
> +
> +#endif /* _ASM_X86_LINKAGE_H */
> +
> diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
> new file mode 100644
> index 0000000..2767dda
> --- /dev/null
> +++ b/arch/mips/include/asm/linkage.h
> @@ -0,0 +1,13 @@
> +#ifndef __ASM_LINKAGE_H
> +#define __ASM_LINKAGE_H
> +
> +#ifdef __ASSEMBLY__
> +#include <asm/asm.h>
> +#endif
> +
> +#define __weak __attribute__((weak))
> +#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
> +#define SYSCALL_ALIAS(alias, name)					\
> +	asm ( #alias " = " #name "\n\t.globl " #alias)

__weak is already defined in compiler-gcc.h and should probably be taken
from there. The syscall things are unused in barebox, so better make
this file just empty?

> +
> +#endif
> diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h
> new file mode 100644
> index 0000000..e0c6dec
> --- /dev/null
> +++ b/arch/nios2/include/asm/linkage.h
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
> + *
> + * All rights reserved.
> + *
> + * This program 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 of the License, or
> + * (at your option) any later version.
> + *
> + * This program 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, GOOD TITLE or
> + * NON INFRINGEMENT.  See the GNU General Public License for more
> + * details.
> + */
> +
> +#ifndef _ASM_NIOS2_LINKAGE_H
> +#define _ASM_NIOS2_LINKAGE_H
> +
> +/* This file is required by include/linux/linkage.h */
> +#define __ALIGN .align 4
> +#define __ALIGN_STR ".align 4"

Use default instead? The nios2 kernel file doesn't give a clue why this
should be different from the default.

> +
> +#endif
> diff --git a/arch/openrisc/include/asm/linkage.h b/arch/openrisc/include/asm/linkage.h
> new file mode 100644
> index 0000000..e263875
> --- /dev/null
> +++ b/arch/openrisc/include/asm/linkage.h
> @@ -0,0 +1,25 @@
> +/*
> + * OpenRISC Linux
> + *
> + * Linux architectural port borrowing liberally from similar works of
> + * others.  All original copyrights apply as per the original source
> + * declaration.
> + *
> + * OpenRISC implementation:
> + * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
> + * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
> + * et al.
> + *
> + * This program 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 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#ifndef __ASM_OPENRISC_LINKAGE_H
> +#define __ASM_OPENRISC_LINKAGE_H
> +
> +#define __ALIGN      .align 0
> +#define __ALIGN_STR ".align 0"
> +
> +#endif /* __ASM_OPENRISC_LINKAGE_H */
> diff --git a/arch/ppc/include/asm/linkage.h b/arch/ppc/include/asm/linkage.h
> new file mode 100644
> index 0000000..e3ad5c7
> --- /dev/null
> +++ b/arch/ppc/include/asm/linkage.h
> @@ -0,0 +1,15 @@
> +#ifndef _ASM_POWERPC_LINKAGE_H
> +#define _ASM_POWERPC_LINKAGE_H
> +
> +#ifdef CONFIG_PPC64
> +#if !defined(_CALL_ELF) || _CALL_ELF != 2
> +#define cond_syscall(x) \
> +	asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"		\
> +	     "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
> +#define SYSCALL_ALIAS(alias, name)					\
> +	asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"	\
> +	     "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
> +#endif
> +#endif

Unused in barebox, should be removed.

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] 4+ messages in thread

* Re: [PATCH] Import missing linkage.h from Linux 3.19-rc6
  2015-01-29  8:54 ` Sascha Hauer
@ 2015-02-03  6:14   ` Masahiro Yamada
  2015-02-03  8:19     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2015-02-03  6:14 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,


On Thu, 29 Jan 2015 09:54:31 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> > +
> > diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
> > new file mode 100644
> > index 0000000..2767dda
> > --- /dev/null
> > +++ b/arch/mips/include/asm/linkage.h
> > @@ -0,0 +1,13 @@
> > +#ifndef __ASM_LINKAGE_H
> > +#define __ASM_LINKAGE_H
> > +
> > +#ifdef __ASSEMBLY__
> > +#include <asm/asm.h>
> > +#endif
> > +
> > +#define __weak __attribute__((weak))
> > +#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
> > +#define SYSCALL_ALIAS(alias, name)					\
> > +	asm ( #alias " = " #name "\n\t.globl " #alias)
> 
> __weak is already defined in compiler-gcc.h and should probably be taken
> from there. The syscall things are unused in barebox, so better make
> this file just empty?


OK, will do.



> > +
> > +#endif
> > diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h
> > new file mode 100644
> > index 0000000..e0c6dec
> > --- /dev/null
> > +++ b/arch/nios2/include/asm/linkage.h
> > @@ -0,0 +1,25 @@
> > +/*
> > + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
> > + *
> > + * All rights reserved.
> > + *
> > + * This program 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 of the License, or
> > + * (at your option) any later version.
> > + *
> > + * This program 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, GOOD TITLE or
> > + * NON INFRINGEMENT.  See the GNU General Public License for more
> > + * details.
> > + */
> > +
> > +#ifndef _ASM_NIOS2_LINKAGE_H
> > +#define _ASM_NIOS2_LINKAGE_H
> > +
> > +/* This file is required by include/linux/linkage.h */
> > +#define __ALIGN .align 4
> > +#define __ALIGN_STR ".align 4"
> 
> Use default instead? The nios2 kernel file doesn't give a clue why this
> should be different from the default.

I have no idea.
If the reason is not clear, why don't we keep it as is for safety?



> > diff --git a/arch/ppc/include/asm/linkage.h b/arch/ppc/include/asm/linkage.h
> > new file mode 100644
> > index 0000000..e3ad5c7
> > --- /dev/null
> > +++ b/arch/ppc/include/asm/linkage.h
> > @@ -0,0 +1,15 @@
> > +#ifndef _ASM_POWERPC_LINKAGE_H
> > +#define _ASM_POWERPC_LINKAGE_H
> > +
> > +#ifdef CONFIG_PPC64
> > +#if !defined(_CALL_ELF) || _CALL_ELF != 2
> > +#define cond_syscall(x) \
> > +	asm ("\t.weak " #x "\n\t.set " #x ", sys_ni_syscall\n"		\
> > +	     "\t.weak ." #x "\n\t.set ." #x ", .sys_ni_syscall\n")
> > +#define SYSCALL_ALIAS(alias, name)					\
> > +	asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"	\
> > +	     "\t.globl ." #alias "\n\t.set ." #alias ", ." #name)
> > +#endif
> > +#endif
> 
> Unused in barebox, should be removed.
> 

OK.  CONFIG_PPC64 is not defined in barebox.



Best Regards
Masahiro Yamada


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Import missing linkage.h from Linux 3.19-rc6
  2015-02-03  6:14   ` Masahiro Yamada
@ 2015-02-03  8:19     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2015-02-03  8:19 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: barebox

On Tue, Feb 03, 2015 at 03:14:41PM +0900, Masahiro Yamada wrote:
> Hi Sascha,
> 
> 
> On Thu, 29 Jan 2015 09:54:31 +0100
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > > +
> > > diff --git a/arch/mips/include/asm/linkage.h b/arch/mips/include/asm/linkage.h
> > > new file mode 100644
> > > index 0000000..2767dda
> > > --- /dev/null
> > > +++ b/arch/mips/include/asm/linkage.h
> > > @@ -0,0 +1,13 @@
> > > +#ifndef __ASM_LINKAGE_H
> > > +#define __ASM_LINKAGE_H
> > > +
> > > +#ifdef __ASSEMBLY__
> > > +#include <asm/asm.h>
> > > +#endif
> > > +
> > > +#define __weak __attribute__((weak))
> > > +#define cond_syscall(x) asm(".weak\t" #x "\n" #x "\t=\tsys_ni_syscall")
> > > +#define SYSCALL_ALIAS(alias, name)					\
> > > +	asm ( #alias " = " #name "\n\t.globl " #alias)
> > 
> > __weak is already defined in compiler-gcc.h and should probably be taken
> > from there. The syscall things are unused in barebox, so better make
> > this file just empty?
> 
> 
> OK, will do.
> 
> 
> 
> > > +
> > > +#endif
> > > diff --git a/arch/nios2/include/asm/linkage.h b/arch/nios2/include/asm/linkage.h
> > > new file mode 100644
> > > index 0000000..e0c6dec
> > > --- /dev/null
> > > +++ b/arch/nios2/include/asm/linkage.h
> > > @@ -0,0 +1,25 @@
> > > +/*
> > > + * Copyright (C) 2009 Thomas Chou <thomas@wytron.com.tw>
> > > + *
> > > + * All rights reserved.
> > > + *
> > > + * This program 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 of the License, or
> > > + * (at your option) any later version.
> > > + *
> > > + * This program 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, GOOD TITLE or
> > > + * NON INFRINGEMENT.  See the GNU General Public License for more
> > > + * details.
> > > + */
> > > +
> > > +#ifndef _ASM_NIOS2_LINKAGE_H
> > > +#define _ASM_NIOS2_LINKAGE_H
> > > +
> > > +/* This file is required by include/linux/linkage.h */
> > > +#define __ALIGN .align 4
> > > +#define __ALIGN_STR ".align 4"
> > 
> > Use default instead? The nios2 kernel file doesn't give a clue why this
> > should be different from the default.
> 
> I have no idea.
> If the reason is not clear, why don't we keep it as is for safety?

This __ALIGN_STR and __ALIGN macros seem to be a leftover from acient
times. In the Kernel there are only a few users of __ALIGN_STR:

./drivers/pnp/pnpbios/bioscalls.c:43:   __ALIGN_STR "\n"
./arch/m68k/kernel/vectors.c:43:    __ALIGN_STR "\n"
./arch/m68k/amiga/config.c:583:         "       " __ALIGN_STR "\n"
./arch/m68k/atari/ataints.c:79:__ALIGN_STR "\n\t"

The second argument to the .align directive is the padding value. The
standard architecture independent value in include/linux/linkage.h is
0x90:

./include/linux/linkage.h:45:#define __ALIGN            .align 4,0x90

0x90 is the x86 assembly for the nop instruction. I doubt that this
makes sense on any other architecture.

All this is unused in barebox, so I think we should drop this rather
than blindly copying from Linux.

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] 4+ messages in thread

end of thread, other threads:[~2015-02-03  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-29  2:37 [PATCH] Import missing linkage.h from Linux 3.19-rc6 Masahiro Yamada
2015-01-29  8:54 ` Sascha Hauer
2015-02-03  6:14   ` Masahiro Yamada
2015-02-03  8:19     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox