2008-06-15 21:07:43

by Peter Korsgaard

[permalink] [raw]
Subject: [PATCH] export linux/a.out.h

Export linux/a.out.h like we do for asm/a.out.h as some applications needs
it (E.G. valgrind). One minor complication is that the interesting stuff is
protected by an CONFIG_ARCH_SUPPORTS_AOUT ifdef, so make sure that gets
defined for unifdef.

Signed-off-by: Peter Korsgaard <[email protected]>
---
include/linux/Kbuild | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 93b9885..d998fc7 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -162,6 +162,8 @@ header-y += video_encoder.h
header-y += videotext.h
header-y += x25.h

+UNIFDEF += -DCONFIG_ARCH_SUPPORTS_AOUT
+unifdef-y += a.out.h
unifdef-y += acct.h
unifdef-y += adb.h
unifdef-y += adfs_fs.h
--
1.5.5.1


2008-06-15 21:32:50

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH] export linux/a.out.h

On Sun, 2008-06-15 at 23:07 +0200, Peter Korsgaard wrote:
> Export linux/a.out.h like we do for asm/a.out.h as some applications needs
> it (E.G. valgrind). One minor complication is that the interesting stuff is
> protected by an CONFIG_ARCH_SUPPORTS_AOUT ifdef, so make sure that gets
> defined for unifdef.

No, let's fix the file instead. We should never have wrapped its
contents in CONFIG_ARCH_SUPPORTS_AOUT in the first place.

And we don't want to export it unconditionally. We want something like
we already have in include/asm-generic/Kbuild.asm:

ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h)
unifdef-y += a.out.h
endif

--
dwmw2

2008-06-15 22:34:15

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [PATCH] export linux/a.out.h

On Sun, 15 Jun 2008 23:07:01 +0200
Peter Korsgaard <[email protected]> wrote:

> Export linux/a.out.h like we do for asm/a.out.h as some applications
> needs it (E.G. valgrind).

do we know what they need it for?

--
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings,
visit http://www.lesswatts.org

2008-06-16 07:03:48

by Peter Korsgaard

[permalink] [raw]
Subject: Re: [PATCH] export linux/a.out.h

>>>>> "Arjan" == Arjan van de Ven <[email protected]> writes:

Hi,

>> Export linux/a.out.h like we do for asm/a.out.h as some applications
>> needs it (E.G. valgrind).

Arjan> do we know what they need it for?

>From a quick look at the valgrind code - struct nlist for stabs
parsing.

--
Bye, Peter Korsgaard

2008-06-16 08:29:48

by Peter Korsgaard

[permalink] [raw]
Subject: [PATCH v2] export linux/a.out.h

Export linux/a.out.h like we do for asm/a.out.h as some applications needs
it (E.G. valgrind). One minor complication is that the content is protected
by an CONFIG_ARCH_SUPPORTS_AOUT ifdef, so get rid of it.

Signed-off-by: Peter Korsgaard <[email protected]>
---
include/linux/Kbuild | 3 +++
include/linux/a.out.h | 8 --------
2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 93b9885..e61f1f9 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -162,6 +162,9 @@ header-y += video_encoder.h
header-y += videotext.h
header-y += x25.h

+ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h)
+unifdef-y += a.out.h
+endif
unifdef-y += acct.h
unifdef-y += adb.h
unifdef-y += adfs_fs.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 208f4e8..e86dfca 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,8 +1,6 @@
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__

-#ifdef CONFIG_ARCH_SUPPORTS_AOUT
-
#define __GNU_EXEC_MACROS__

#ifndef __STRUCT_EXEC_OVERRIDE__
@@ -277,10 +275,4 @@ struct relocation_info
#endif /* no N_RELOCATION_INFO_DECLARED. */

#endif /*__ASSEMBLY__ */
-#else /* CONFIG_ARCH_SUPPORTS_AOUT */
-#ifndef __ASSEMBLY__
-struct exec {
-};
-#endif
-#endif /* CONFIG_ARCH_SUPPORTS_AOUT */
#endif /* __A_OUT_GNU_H__ */
--
1.5.5.1

2008-06-16 12:01:23

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, 2008-06-16 at 10:29 +0200, Peter Korsgaard wrote:
> Export linux/a.out.h like we do for asm/a.out.h as some applications needs
> it (E.G. valgrind). One minor complication is that the content is protected
> by an CONFIG_ARCH_SUPPORTS_AOUT ifdef, so get rid of it.

There was a _reason_ for that ifdef, although on reflection probably not
a particularly good one. But unless we remove the reason for that ifdef,
your patch will break compilation on architectures which don't have
<asm/a.out.h>.

We should get rid of CONFIG_ARCH_SUPPORTS_AOUT entirely. The only
remaining users of it are fs/exec.c, which uses it entirely redundantly:
#if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)

...and (indirectly, by virtue of being the only other file that includes
<linux/a.out.h> when ARCH_SUPPORTS_AOUT might be unset) fs/binfmt_elf.c,
which still has unnecessary references to 'struct exec' even though Andi
removed the support for a.out interpreters a few months ago. That can
just go away.

Please see git.infradead.org/users/dwmw2/aout-2.6.git

David Woodhouse (6):
Include <asm/a.out.h> in fs/exec.c only for Alpha.
Remove last traces of a.out support from ELF loader.
Remove #ifdef CONFIG_ARCH_SUPPORTS_AOUT from <linux/a.out.h>
Export <linux/a.out.h> to userspace again.
Remove redundant CONFIG_ARCH_SUPPORTS_AOUT
Remove references to now-defunct CONFIG_ARCH_SUPPORTS_AOUT from defconfigs

The first four are shown below, as a single combined patch.

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 0fa95b1..d48ff5f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -16,7 +16,6 @@
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/mman.h>
-#include <linux/a.out.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/binfmts.h>
@@ -548,7 +547,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
struct {
struct elfhdr elf_ex;
struct elfhdr interp_elf_ex;
- struct exec interp_ex;
} *loc;

loc = kmalloc(sizeof(*loc), GFP_KERNEL);
@@ -680,7 +678,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
}

/* Get the exec headers */
- loc->interp_ex = *((struct exec *)bprm->buf);
loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);
break;
}
diff --git a/fs/exec.c b/fs/exec.c
index 9448f1b..da94a6f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -26,7 +26,6 @@
#include <linux/file.h>
#include <linux/fdtable.h>
#include <linux/mman.h>
-#include <linux/a.out.h>
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/smp_lock.h>
@@ -61,6 +60,11 @@
#include <linux/kmod.h>
#endif

+#ifdef __alpha__
+/* for /sbin/loader handling in search_binary_handler() */
+#include <linux/a.out.h>
+#endif
+
int core_uses_pid;
char core_pattern[CORENAME_MAX_SIZE] = "core";
int suid_dumpable = 0;
@@ -1155,7 +1159,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
{
int try,retval;
struct linux_binfmt *fmt;
-#if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)
+#ifdef __alpha__
/* handle /sbin/loader.. */
{
struct exec * eh = (struct exec *) bprm->buf;
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 93b9885..b6fbb25 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -166,6 +166,9 @@ unifdef-y += acct.h
unifdef-y += adb.h
unifdef-y += adfs_fs.h
unifdef-y += agpgart.h
+ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h)
+unifdef-y += a.out.h
+endif
unifdef-y += apm_bios.h
unifdef-y += atalk.h
unifdef-y += atmdev.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 208f4e8..e86dfca 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,8 +1,6 @@
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__

-#ifdef CONFIG_ARCH_SUPPORTS_AOUT
-
#define __GNU_EXEC_MACROS__

#ifndef __STRUCT_EXEC_OVERRIDE__
@@ -277,10 +275,4 @@ struct relocation_info
#endif /* no N_RELOCATION_INFO_DECLARED. */

#endif /*__ASSEMBLY__ */
-#else /* CONFIG_ARCH_SUPPORTS_AOUT */
-#ifndef __ASSEMBLY__
-struct exec {
-};
-#endif
-#endif /* CONFIG_ARCH_SUPPORTS_AOUT */
#endif /* __A_OUT_GNU_H__ */

--
dwmw2

2008-06-16 12:18:54

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, Jun 16, 2008 at 01:01:03PM +0100, David Woodhouse wrote:
>...
> David Woodhouse (6):
>...
> Remove references to now-defunct CONFIG_ARCH_SUPPORTS_AOUT from defconfigs

Please don't do this kind of defconfig updates - it doesn't bring any
advantage but can create tons of patch conflicts.

The next time a defconfig gets updated it will anyway automatically be
fixed, and for defconfigs that aren't updated it doesn't create any
problems to keep them as they are today until they might one day get
updated.

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-16 12:21:00

by Peter Korsgaard

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

>>>>> "David" == David Woodhouse <[email protected]> writes:

Hi,

David> Please see git.infradead.org/users/dwmw2/aout-2.6.git

David> David Woodhouse (6):
David> Include <asm/a.out.h> in fs/exec.c only for Alpha.
David> Remove last traces of a.out support from ELF loader.
David> Remove #ifdef CONFIG_ARCH_SUPPORTS_AOUT from <linux/a.out.h>
David> Export <linux/a.out.h> to userspace again.
David> Remove redundant CONFIG_ARCH_SUPPORTS_AOUT
David> Remove references to now-defunct CONFIG_ARCH_SUPPORTS_AOUT from defconfigs

David> The first four are shown below, as a single combined patch.

Thanks David, looks good to me.

Acked-by: Peter Korsgaard <[email protected]>

--
Bye, Peter Korsgaard

2008-06-16 12:27:19

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, 2008-06-16 at 15:17 +0300, Adrian Bunk wrote:
> On Mon, Jun 16, 2008 at 01:01:03PM +0100, David Woodhouse wrote:
> >...
> > David Woodhouse (6):
> >...
> > Remove references to now-defunct CONFIG_ARCH_SUPPORTS_AOUT from defconfigs
>
> Please don't do this kind of defconfig updates - it doesn't bring any
> advantage but can create tons of patch conflicts.
>
> The next time a defconfig gets updated it will anyway automatically be
> fixed, and for defconfigs that aren't updated it doesn't create any
> problems to keep them as they are today until they might one day get
> updated.

OK. I did wonder about that, which is why I did it in a separate patch.

Actually, I think we can drop the preceding patch too -- it's not
necessary to fix the regression in 2.6.26, and dhowells suggests that we
might still want to use ARCH_SUPPORTS_AOUT, by making BINFMT_AOUT depend
on it instead of that hard-coded list of architectures.

If we do that, then ARCH_SUPPORTS_AOUT would need to be defined on a
different set of architectures to the ones it's currently defined on --
so I don't really want to go there before 2.6.26. I'll push just the
parts which were included in the mail I just sent.

Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
<asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
sense?

--
dwmw2

2008-06-16 13:22:27

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, 2008-06-16 at 14:20 +0200, Peter Korsgaard wrote:
> David Woodhouse <[email protected]> writes:
> > On Mon, 2008-06-16 at 10:29 +0200, Peter Korsgaard wrote:
> > > Export linux/a.out.h like we do for asm/a.out.h as some applications needs
> > > it (E.G. valgrind). One minor complication is that the content is protected
> > > by an CONFIG_ARCH_SUPPORTS_AOUT ifdef, so get rid of it.
> >
> > There was a _reason_ for that ifdef, although on reflection probably not
> > a particularly good one. But unless we remove the reason for that ifdef,
> > your patch will break compilation on architectures which don't have
> > <asm/a.out.h>.
> >
> > We should get rid of CONFIG_ARCH_SUPPORTS_AOUT entirely. The only
> > remaining users of it are fs/exec.c, which uses it entirely redundantly:
> > #if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)
> >
> > ...and (indirectly, by virtue of being the only other file that includes
> > <linux/a.out.h> when ARCH_SUPPORTS_AOUT might be unset) fs/binfmt_elf.c,
> > which still has unnecessary references to 'struct exec' even though Andi
> > removed the support for a.out interpreters a few months ago. That can
> > just go away.
>>
> > Please see git.infradead.org/users/dwmw2/aout-2.6.git
> >
> > David Woodhouse (6):
> > Include <asm/a.out.h> in fs/exec.c only for Alpha.
> > Remove last traces of a.out support from ELF loader.
> > Remove #ifdef CONFIG_ARCH_SUPPORTS_AOUT from <linux/a.out.h>
> > Export <linux/a.out.h> to userspace again.
> > Remove redundant CONFIG_ARCH_SUPPORTS_AOUT
> > Remove references to now-defunct CONFIG_ARCH_SUPPORTS_AOUT from defconfigs
> >
> > The first four are shown below, as a single combined patch.
>
> Thanks David, looks good to me.
>
> Acked-by: Peter Korsgaard <[email protected]>

OK, I'll send just those first four on to Linus for 2.6.26 to fix the
<linux/a.out.h> regression. The rest can wait till later, as discussed.

--
dwmw2

2008-06-16 13:22:53

by David Woodhouse

[permalink] [raw]
Subject: [PATCH 1/4] Include <asm/a.out.h> in fs/exec.c only for Alpha.

We only need it for the /sbin/loader hack for OSF/1 executables, and we
don't want to include it otherwise.

While we're at it, remove the redundant '&& CONFIG_ARCH_SUPPORTS_AOUT'
in the ifdef around that code. It's already dependent on __alpha__, and
CONFIG_ARCH_SUPPORTS_AOUT is hard-coded to 'y' there.

Signed-off-by: David Woodhouse <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
---
fs/exec.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 9448f1b..da94a6f 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -26,7 +26,6 @@
#include <linux/file.h>
#include <linux/fdtable.h>
#include <linux/mman.h>
-#include <linux/a.out.h>
#include <linux/stat.h>
#include <linux/fcntl.h>
#include <linux/smp_lock.h>
@@ -61,6 +60,11 @@
#include <linux/kmod.h>
#endif

+#ifdef __alpha__
+/* for /sbin/loader handling in search_binary_handler() */
+#include <linux/a.out.h>
+#endif
+
int core_uses_pid;
char core_pattern[CORENAME_MAX_SIZE] = "core";
int suid_dumpable = 0;
@@ -1155,7 +1159,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
{
int try,retval;
struct linux_binfmt *fmt;
-#if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)
+#ifdef __alpha__
/* handle /sbin/loader.. */
{
struct exec * eh = (struct exec *) bprm->buf;
--
1.5.5.1

2008-06-16 13:23:13

by David Woodhouse

[permalink] [raw]
Subject: [PATCH 2/4] Remove last traces of a.out support from ELF loader.

In commit d20894a23708c2af75966534f8e4dedb46d48db2, Andi removed support
for a.out interpreters from the ELF loader, which was only ever needed
for the transition from a.out to ELF.

This removes the last traces of that support, in particular the
inclusion of <linux/a.out.h>.

Signed-off-by: David Woodhouse <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
---
fs/binfmt_elf.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 0fa95b1..d48ff5f 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -16,7 +16,6 @@
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/mman.h>
-#include <linux/a.out.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/binfmts.h>
@@ -548,7 +547,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
struct {
struct elfhdr elf_ex;
struct elfhdr interp_elf_ex;
- struct exec interp_ex;
} *loc;

loc = kmalloc(sizeof(*loc), GFP_KERNEL);
@@ -680,7 +678,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
}

/* Get the exec headers */
- loc->interp_ex = *((struct exec *)bprm->buf);
loc->interp_elf_ex = *((struct elfhdr *)bprm->buf);
break;
}
--
1.5.5.1

2008-06-16 13:24:07

by David Woodhouse

[permalink] [raw]
Subject: [PATCH 3/4] Remove #ifdef CONFIG_ARCH_SUPPORTS_AOUT from <linux/a.out.h>

This file is only included where it makes sense now, so there's no need
for the CONFIG_ARCH_SUPPORTS_AOUT conditional -- and that conditional is
bad, because we want to export <linux/a.out.h> to userspace.

Signed-off-by: David Woodhouse <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
---
include/linux/a.out.h | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index 208f4e8..e86dfca 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,8 +1,6 @@
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__

-#ifdef CONFIG_ARCH_SUPPORTS_AOUT
-
#define __GNU_EXEC_MACROS__

#ifndef __STRUCT_EXEC_OVERRIDE__
@@ -277,10 +275,4 @@ struct relocation_info
#endif /* no N_RELOCATION_INFO_DECLARED. */

#endif /*__ASSEMBLY__ */
-#else /* CONFIG_ARCH_SUPPORTS_AOUT */
-#ifndef __ASSEMBLY__
-struct exec {
-};
-#endif
-#endif /* CONFIG_ARCH_SUPPORTS_AOUT */
#endif /* __A_OUT_GNU_H__ */
--
1.5.5.1

2008-06-16 13:24:23

by David Woodhouse

[permalink] [raw]
Subject: [PATCH 4/4] Export <linux/a.out.h> to userspace again.

This seems to have been removed accidentally in commit
ed7b1889da256977574663689b598d88950bbd23, but wasn't supposed to have
been -- the original patch at http://lkml.org/lkml/2007/10/30/144 just
moved it from $(header-y) to $(unifdef-y)

Signed-off-by: David Woodhouse <[email protected]>
Acked-by: Peter Korsgaard <[email protected]>
---
include/linux/Kbuild | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 93b9885..b6fbb25 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -166,6 +166,9 @@ unifdef-y += acct.h
unifdef-y += adb.h
unifdef-y += adfs_fs.h
unifdef-y += agpgart.h
+ifeq ($(wildcard include/asm-$(SRCARCH)/a.out.h),include/asm-$(SRCARCH)/a.out.h)
+unifdef-y += a.out.h
+endif
unifdef-y += apm_bios.h
unifdef-y += atalk.h
unifdef-y += atmdev.h
--
1.5.5.1

2008-06-16 13:48:53

by David Howells

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

David Woodhouse <[email protected]> wrote:

> Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> sense?

Maybe because some arches supported ELF with AOUT interpreters but not full
AOUT binaries?

David

2008-06-16 14:41:16

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h


>
> ...and (indirectly, by virtue of being the only other file that includes
> <linux/a.out.h> when ARCH_SUPPORTS_AOUT might be unset) fs/binfmt_elf.c,
> which still has unnecessary references to 'struct exec' even though Andi
> removed the support for a.out interpreters a few months ago. That can
> just go away.

I didn't think the Alpha /sbin/loader stuff was an a.out interpreter for ELF.

Also pure a.out is still supported.

It might be ok to remove it anyways, but you should check with someone
who knows Alpha first. cc Richard.


-Andi

2008-06-16 15:15:56

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, 2008-06-16 at 16:40 +0200, Andi Kleen wrote:
> > We should get rid of CONFIG_ARCH_SUPPORTS_AOUT entirely. The only
> > remaining users of it are fs/exec.c, which uses it entirely redundantly:
> > #if defined(__alpha__) && defined(CONFIG_ARCH_SUPPORTS_AOUT)
> >
> > ...and (indirectly, by virtue of being the only other file that includes
> > <linux/a.out.h> when ARCH_SUPPORTS_AOUT might be unset) fs/binfmt_elf.c,
> > which still has unnecessary references to 'struct exec' even though Andi
> > removed the support for a.out interpreters a few months ago. That can
> > just go away.
>
> I didn't think the Alpha /sbin/loader stuff was an a.out interpreter for ELF.
>
> Also pure a.out is still supported.
>
> It might be ok to remove it anyways, but you should check with someone
> who knows Alpha first. cc Richard.

The Alpha /sbin/loader support, and the a.out-interpreter-for-ELF, are
two completely separate issues -- you're right that /sbin/loader isn't
an a.out interpreter for ELF files.

They're the two places which rely on '#ifdef CONFIG_ARCH_SUPPORTS_AOUT'
in <linux/a.out.h>, because they include <linux/a.out.h> on platforms
which might not have <asm/a.out.h>.

In the Alpha case in fs/exec.c, we can simply include <linux/a.out.h>
only #ifdef __alpha__ -- while noting that that code could probably do
with a little more cleanup and turning into a properly registered binfmt
rather than a special case, if possible.

In the case of fs/binfmt_elf.c, we can simply remove the inclusion of
<linux/a.out.h> and all references to 'struct exec'. You removed the
rest of the a.out interpreter support already; that last part probably
should have gone away at the same time.

Proper a.out support in fs/binfmt_aout.c can stay as it is; you won't be
building binfmt_aout.c unless your platform supports a.out anyway.

And then we can remove the #ifdef CONFIG_ARCH_SUPPORTS_AOUT in
<linux/a.out.h>, and export it to userspace again, which was the point
of Peter's patch that started this thread.

--
dwmw2

2008-06-16 15:47:28

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH v2] export linux/a.out.h

On Mon, 2008-06-16 at 14:48 +0100, David Howells wrote:
> David Woodhouse <[email protected]> wrote:
>
> > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > sense?
>
> Maybe because some arches supported ELF with AOUT interpreters but not full
> AOUT binaries?

Is that sane? I thought a.out interpreters for ELF were a transitional
thing to cope with moving from a.out to ELF. Would anyone really do that
unless they had real a.out support in the first place?

I'm more inclined to believe that they just blindly copied <asm/user.h>
from i386 when the arch was created, and then later got
ARCH_SUPPORTS_AOUT defined for that arch because they had a
<asm/a.out.h>.

I suspect we could actually just remove <asm/a.out.h> for all
architectures except Alpha, x86, ARM and m68k. We'd probably have to
remove inclusions of <linux/a.out.h> from a few places in arch code, but
all of them will turn out to be gratuitous anyway.

--
dwmw2

2008-06-17 08:44:16

by Adrian Bunk

[permalink] [raw]
Subject: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Mon, Jun 16, 2008 at 01:26:54PM +0100, David Woodhouse wrote:
>...
> Actually, I think we can drop the preceding patch too -- it's not
> necessary to fix the regression in 2.6.26, and dhowells suggests that we
> might still want to use ARCH_SUPPORTS_AOUT, by making BINFMT_AOUT depend
> on it instead of that hard-coded list of architectures.
>
> If we do that, then ARCH_SUPPORTS_AOUT would need to be defined on a
> different set of architectures to the ones it's currently defined on --
> so I don't really want to go there before 2.6.26. I'll push just the
> parts which were included in the mail I just sent.
>
> Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> sense?

My guess would be that binfmt_aout isn't actually used there.

The affected architectures are:
- h8300
- m32r
- parisc
- sh
- v850

v850 is broken beyond repair, and I hope my patch to remove the
architecture will make it into 2.6.27.

For the other 4 architectures I have Cc'ed the architecture maintainers.

> dwmw2

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-17 09:47:48

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, 2008-06-17 at 11:42 +0300, Adrian Bunk wrote:
>
> > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > sense?
>
> My guess would be that binfmt_aout isn't actually used there.
>
> The affected architectures are:
> - h8300
> - m32r
> - parisc
> - sh
> - v850
>
> v850 is broken beyond repair, and I hope my patch to remove the
> architecture will make it into 2.6.27.
>
> For the other 4 architectures I have Cc'ed the architecture maintainers.

There's another set of architectures which have <asm/a.out.h> but don't
define ARCH_SUPPORTS_AOUT. Including PowerPC.

I think we can probably get away with removing <asm/a.out.h> from every
architecture other than Alpha, ARM, m68k and x86, and killing
ARCH_SUPPORTS_AOUT completely.

Or maybe, as dhowells suggests, re-defining ARCH_SUPPORTS_AOUT to be set
only on Alpha, ARM, m68k and x86 (so BINFMT_AOUT can depend on it).

--
dwmw2

2008-06-17 10:12:47

by Adrian Bunk

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 10:46:44AM +0100, David Woodhouse wrote:
> On Tue, 2008-06-17 at 11:42 +0300, Adrian Bunk wrote:
> >
> > > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > > sense?
> >
> > My guess would be that binfmt_aout isn't actually used there.
> >
> > The affected architectures are:
> > - h8300
> > - m32r
> > - parisc
> > - sh
> > - v850
> >
> > v850 is broken beyond repair, and I hope my patch to remove the
> > architecture will make it into 2.6.27.
> >
> > For the other 4 architectures I have Cc'ed the architecture maintainers.
>
> There's another set of architectures which have <asm/a.out.h> but don't
> define ARCH_SUPPORTS_AOUT. Including PowerPC.
>
> I think we can probably get away with removing <asm/a.out.h> from every
> architecture other than Alpha, ARM, m68k and x86, and killing
> ARCH_SUPPORTS_AOUT completely.

include/linux/a.out.h contains an #include <asm/a.out.h> and is exported
to userspace...

> Or maybe, as dhowells suggests, re-defining ARCH_SUPPORTS_AOUT to be set
> only on Alpha, ARM, m68k and x86 (so BINFMT_AOUT can depend on it).

The pattern for this stuff is to provide a HAVE_AOUT kconfig variable
that gets select'ed by these architectures.

> dwmw2

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-17 10:19:18

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, 2008-06-17 at 13:11 +0300, Adrian Bunk wrote:
> On Tue, Jun 17, 2008 at 10:46:44AM +0100, David Woodhouse wrote:
> > On Tue, 2008-06-17 at 11:42 +0300, Adrian Bunk wrote:
> > >
> > > > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > > > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > > > sense?
> > >
> > > My guess would be that binfmt_aout isn't actually used there.
> > >
> > > The affected architectures are:
> > > - h8300
> > > - m32r
> > > - parisc
> > > - sh
> > > - v850
> > >
> > > v850 is broken beyond repair, and I hope my patch to remove the
> > > architecture will make it into 2.6.27.
> > >
> > > For the other 4 architectures I have Cc'ed the architecture maintainers.
> >
> > There's another set of architectures which have <asm/a.out.h> but don't
> > define ARCH_SUPPORTS_AOUT. Including PowerPC.
> >
> > I think we can probably get away with removing <asm/a.out.h> from every
> > architecture other than Alpha, ARM, m68k and x86, and killing
> > ARCH_SUPPORTS_AOUT completely.
>
> include/linux/a.out.h contains an #include <asm/a.out.h> and is exported
> to userspace...

Actually, it isn't -- but it _should_ be. But we can do it conditionally.
See http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=5939c6a41

> > Or maybe, as dhowells suggests, re-defining ARCH_SUPPORTS_AOUT to be set
> > only on Alpha, ARM, m68k and x86 (so BINFMT_AOUT can depend on it).
>
> The pattern for this stuff is to provide a HAVE_AOUT kconfig variable
> that gets select'ed by these architectures.

Or that; it doesn't really matter. I was about to remove
ARCH_SUPPORTS_AOUT completely, but David suggested that it could be used
to kill that hard-coded '(X86_32 || ALPHA || ARM || M68K)' in
fs/Kconfig.binfmt.


--
dwmw2

2008-06-17 10:25:51

by Adrian Bunk

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 11:18:45AM +0100, David Woodhouse wrote:
> On Tue, 2008-06-17 at 13:11 +0300, Adrian Bunk wrote:
> > On Tue, Jun 17, 2008 at 10:46:44AM +0100, David Woodhouse wrote:
> > > On Tue, 2008-06-17 at 11:42 +0300, Adrian Bunk wrote:
> > > >
> > > > > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > > > > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > > > > sense?
> > > >
> > > > My guess would be that binfmt_aout isn't actually used there.
> > > >
> > > > The affected architectures are:
> > > > - h8300
> > > > - m32r
> > > > - parisc
> > > > - sh
> > > > - v850
> > > >
> > > > v850 is broken beyond repair, and I hope my patch to remove the
> > > > architecture will make it into 2.6.27.
> > > >
> > > > For the other 4 architectures I have Cc'ed the architecture maintainers.
> > >
> > > There's another set of architectures which have <asm/a.out.h> but don't
> > > define ARCH_SUPPORTS_AOUT. Including PowerPC.
> > >
> > > I think we can probably get away with removing <asm/a.out.h> from every
> > > architecture other than Alpha, ARM, m68k and x86, and killing
> > > ARCH_SUPPORTS_AOUT completely.
> >
> > include/linux/a.out.h contains an #include <asm/a.out.h> and is exported
> > to userspace...
>
> Actually, it isn't -- but it _should_ be. But we can do it conditionally.
> See http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=5939c6a41
>...

It's already in Linus' tree.

Sorry, you are right, I missed that it takes care of exporting
linux/a.out.h only when asm/a.out.h exists.

> dwmw2

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-17 11:29:06

by Matthew Wilcox

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 11:42:35AM +0300, Adrian Bunk wrote:
> On Mon, Jun 16, 2008 at 01:26:54PM +0100, David Woodhouse wrote:
> > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > sense?
>
> My guess would be that binfmt_aout isn't actually used there.

It was probably copied from MIPS in the early days of the parisc port
and nobody ever b othered to look at it before. There was never an
a.out format for parisc.

--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."

2008-06-17 11:29:55

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, 2008-06-17 at 13:11 +0300, Adrian Bunk wrote:
> The pattern for this stuff is to provide a HAVE_AOUT kconfig variable
> that gets select'ed by these architectures.

http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=a5db5179

Subject: [PATCH] Introduce HAVE_AOUT symbol to remove hard-coded arch list for BINFMT_AOUT

HAVE_AOUT doesn't quite do the same thing as the recently removed
ARCH_SUPPORTS_AOUT config option. That was set even on platforms where
binfmt_aout isn't supported, although it's not entirely clear why.

So it's best just to introduce a new symbol, handled consistently with
other similar HAVE_xxx symbols; with a simple 'select' the arch Kconfig.

Signed-off-by: David Woodhouse <[email protected]>
---
arch/alpha/Kconfig | 1 +
arch/arm/Kconfig | 1 +
arch/m68k/Kconfig | 1 +
arch/x86/Kconfig | 1 +
fs/Kconfig.binfmt | 5 ++++-
5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 207196e..f80e548 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -7,6 +7,7 @@ config ALPHA
default y
select HAVE_IDE
select HAVE_OPROFILE
+ select HAVE_AOUT
help
The Alpha is a 64-bit general-purpose processor designed and
marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8fd3ab3..2be8bd7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
select HAVE_OPROFILE
select HAVE_KPROBES if (!XIP_KERNEL)
select HAVE_KRETPROBES if (HAVE_KPROBES)
+ select HAVE_AOUT
help
The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index bfb6395..83c4338 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -6,6 +6,7 @@ config M68K
bool
default y
select HAVE_IDE
+ select HAVE_AOUT

config MMU
bool
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 8fdaa70..bd066ae 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -25,6 +25,7 @@ config X86
select HAVE_KRETPROBES
select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
select HAVE_ARCH_KGDB if !X86_VOYAGER
+ select HAVE_AOUT if X86_32

config ARCH_DEFCONFIG
string
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
index 0999d5c..5592e08 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
@@ -59,9 +59,12 @@ config BINFMT_SHARED_FLAT
help
Support FLAT shared libraries

+config HAVE_AOUT
+ def_bool n
+
config BINFMT_AOUT
tristate "Kernel support for a.out and ECOFF binaries"
- depends on (X86_32 || ALPHA || ARM || M68K)
+ depends on HAVE_AOUT
---help---
A.out (Assembler.OUTput) is a set of formats for libraries and
executables used in the earliest versions of UNIX. Linux used
--
1.5.5.1


--
dwmw2

2008-06-17 12:23:19

by Sam Ravnborg

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 12:28:33PM +0100, David Woodhouse wrote:
> On Tue, 2008-06-17 at 13:11 +0300, Adrian Bunk wrote:
> > The pattern for this stuff is to provide a HAVE_AOUT kconfig variable
> > that gets select'ed by these architectures.
>
> http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=a5db5179
>
> Subject: [PATCH] Introduce HAVE_AOUT symbol to remove hard-coded arch list for BINFMT_AOUT
>
> HAVE_AOUT doesn't quite do the same thing as the recently removed
> ARCH_SUPPORTS_AOUT config option. That was set even on platforms where
> binfmt_aout isn't supported, although it's not entirely clear why.
>
> So it's best just to introduce a new symbol, handled consistently with
> other similar HAVE_xxx symbols; with a simple 'select' the arch Kconfig.

Looks good.
One minor issue...


> @@ -7,6 +7,7 @@ config ALPHA
> default y
> select HAVE_IDE
> select HAVE_OPROFILE
> + select HAVE_AOUT
Sorting these alphabetically will result in less merge conflicts when the list grows.

Sam

2008-06-17 12:29:36

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, 2008-06-17 at 14:23 +0200, Sam Ravnborg wrote:
> Sorting these alphabetically will result in less merge conflicts when
> the list grows.

Maybe, but it doesn't grow that fast -- and it's small enough that if I
add stuff in the middle, the context will cover the whole thing and
cause a merge conflict either way. And it isn't in alphabetical order
now either :)

--
dwmw2

2008-06-17 12:36:46

by Sam Ravnborg

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 01:29:09PM +0100, David Woodhouse wrote:
> On Tue, 2008-06-17 at 14:23 +0200, Sam Ravnborg wrote:
> > Sorting these alphabetically will result in less merge conflicts when
> > the list grows.
>
> Maybe, but it doesn't grow that fast -- and it's small enough that if I
> add stuff in the middle, the context will cover the whole thing and
> cause a merge conflict either way. And it isn't in alphabetical order
> now either :)
I know and I know.
If someone did the janitorial effort and converted all the
per-arch defined symbols to one single definiton
and select the list would grow rapidly.

Sam

2008-06-17 12:54:49

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, 2008-06-17 at 14:37 +0200, Sam Ravnborg wrote:
> I know and I know.
> If someone did the janitorial effort and converted all the
> per-arch defined symbols to one single definiton
> and select the list would grow rapidly.

http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=e75fd00c

They're still not in alphabetical order, but I haven't made it worse :)

--
dwmw2

2008-06-22 09:51:14

by Adrian Bunk

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 12:28:33PM +0100, David Woodhouse wrote:
> On Tue, 2008-06-17 at 13:11 +0300, Adrian Bunk wrote:
> > The pattern for this stuff is to provide a HAVE_AOUT kconfig variable
> > that gets select'ed by these architectures.
>
> http://git.infradead.org/users/dwmw2/aout-2.6.git?a=commitdiff;h=a5db5179
>
> Subject: [PATCH] Introduce HAVE_AOUT symbol to remove hard-coded arch list for BINFMT_AOUT
>
> HAVE_AOUT doesn't quite do the same thing as the recently removed
> ARCH_SUPPORTS_AOUT config option. That was set even on platforms where
> binfmt_aout isn't supported, although it's not entirely clear why.
>
> So it's best just to introduce a new symbol, handled consistently with
> other similar HAVE_xxx symbols; with a simple 'select' the arch Kconfig.
>
> Signed-off-by: David Woodhouse <[email protected]>
> ---
> arch/alpha/Kconfig | 1 +
> arch/arm/Kconfig | 1 +
> arch/m68k/Kconfig | 1 +
> arch/x86/Kconfig | 1 +
> fs/Kconfig.binfmt | 5 ++++-
> 5 files changed, 8 insertions(+), 1 deletions(-)
>...
> --- a/fs/Kconfig.binfmt
> +++ b/fs/Kconfig.binfmt
> @@ -59,9 +59,12 @@ config BINFMT_SHARED_FLAT
> help
> Support FLAT shared libraries
>
> +config HAVE_AOUT
> + def_bool n
> +
> config BINFMT_AOUT
> tristate "Kernel support for a.out and ECOFF binaries"
> - depends on (X86_32 || ALPHA || ARM || M68K)
> + depends on HAVE_AOUT
> ---help---
> A.out (Assembler.OUTput) is a set of formats for libraries and
> executables used in the earliest versions of UNIX. Linux used

What about m68knommu?

I don't know whether it was intentionally available there, but the
removal in your patch does not seem to be intentional.

> dwmw2

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-22 11:50:25

by David Woodhouse

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Sun, 2008-06-22 at 12:49 +0300, Adrian Bunk wrote:
>
> What about m68knommu?
>
> I don't know whether it was intentionally available there, but the
> removal in your patch does not seem to be intentional.

Hm, true. Well spotted. I think it's probably correct though -- I don't
think m68knommu can really support a.out binaries, can it?

--
dwmw2

2008-06-22 23:53:49

by David McCullough

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout


Jivin David Woodhouse lays it down ...
> On Sun, 2008-06-22 at 12:49 +0300, Adrian Bunk wrote:
> >
> > What about m68knommu?
> >
> > I don't know whether it was intentionally available there, but the
> > removal in your patch does not seem to be intentional.
>
> Hm, true. Well spotted. I think it's probably correct though -- I don't
> think m68knommu can really support a.out binaries, can it?

No it can't.

--
David McCullough, [email protected], Ph:+61 734352815
Secure Computing - SnapGear http://www.uCdot.org http://www.snapgear.com

2008-06-24 04:18:43

by Paul Mundt

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 17, 2008 at 11:42:35AM +0300, Adrian Bunk wrote:
> On Mon, Jun 16, 2008 at 01:26:54PM +0100, David Woodhouse wrote:
> >...
> > Actually, I think we can drop the preceding patch too -- it's not
> > necessary to fix the regression in 2.6.26, and dhowells suggests that we
> > might still want to use ARCH_SUPPORTS_AOUT, by making BINFMT_AOUT depend
> > on it instead of that hard-coded list of architectures.
> >
> > If we do that, then ARCH_SUPPORTS_AOUT would need to be defined on a
> > different set of architectures to the ones it's currently defined on --
> > so I don't really want to go there before 2.6.26. I'll push just the
> > parts which were included in the mail I just sent.
> >
> > Why _are_ there architectures which define ARCH_SUPPORTS_AOUT and have
> > <asm/a.out.h> but don't support binfmt_aout, anyway? How does that make
> > sense?
>
> My guess would be that binfmt_aout isn't actually used there.
>
> The affected architectures are:
> - h8300
> - m32r
> - parisc
> - sh
> - v850
>
> v850 is broken beyond repair, and I hope my patch to remove the
> architecture will make it into 2.6.27.
>
> For the other 4 architectures I have Cc'ed the architecture maintainers.
>
There was never an a.out format for any of sh/h8300/m32r. It's likely
just perpetuated damage copied over from the other ports, as in the
parisc case.

2008-06-24 11:48:52

by Adrian Bunk

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Sun, Jun 22, 2008 at 12:40:50PM +0100, David Woodhouse wrote:
> On Sun, 2008-06-22 at 12:49 +0300, Adrian Bunk wrote:
> >
> > What about m68knommu?
> >
> > I don't know whether it was intentionally available there, but the
> > removal in your patch does not seem to be intentional.
>
> Hm, true. Well spotted. I think it's probably correct though -- I don't
> think m68knommu can really support a.out binaries, can it?

I found another similar case:

X86_32 UML.

a.out is most likely working there?

> dwmw2

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2008-06-27 17:23:37

by Jeff Dike

[permalink] [raw]
Subject: Re: architectures with ARCH_SUPPORTS_AOUT but no binfmt_aout

On Tue, Jun 24, 2008 at 02:46:43PM +0300, Adrian Bunk wrote:
> I found another similar case:
>
> X86_32 UML.
>
> a.out is most likely working there?

Yup, if it works on the host, it'll work in UML.

Jeff

--
Work email - jdike at linux dot intel dot com

2008-06-27 21:15:30

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] remove unused asm/a.out.h files

On Tue, Jun 17, 2008 at 10:46:44AM +0100, David Woodhouse wrote:
>...
> I think we can probably get away with removing <asm/a.out.h> from every
> architecture other than Alpha, ARM, m68k and x86,
>...

Patch below.

> dwmw2

cu
Adrian


<-- snip -->


This patch removes asm/a.out.h from all architectures that do not
provide a.out support.

This patch also includes the required removal of (unused)
#include <asm/a.out.h>'s and #include <linux/a.out.h>'s in the arch/
code for these architectures.

The ppc and v850 architectures that should anyway be removed in 2.6.27
are not touched by this patch to avoid needless merge conflicts.

Signed-off-by: Adrian Bunk <[email protected]>

---

arch/cris/arch-v10/boot/tools/build.c | 1
arch/h8300/kernel/process.c | 1
arch/ia64/mm/init.c | 1
arch/m68knommu/kernel/process.c | 1
arch/m68knommu/kernel/traps.c | 1
arch/mips/kernel/irixelf.c | 1
arch/mips/kernel/process.c | 1
arch/mips/kernel/syscall.c | 1
arch/powerpc/kernel/softemu8xx.c | 1
arch/powerpc/kernel/traps.c | 1
arch/powerpc/platforms/chrp/setup.c | 1
arch/powerpc/platforms/maple/setup.c | 1
arch/powerpc/platforms/powermac/setup.c | 1
arch/powerpc/platforms/pseries/setup.c | 1
include/asm-avr32/a.out.h | 20 -------------
include/asm-blackfin/a.out.h | 19 -------------
include/asm-cris/a.out.h | 26 -----------------
include/asm-h8300/a.out.h | 20 -------------
include/asm-ia64/a.out.h | 32 ---------------------
include/asm-m32r/a.out.h | 20 -------------
include/asm-m68knommu/a.out.h | 1
include/asm-mips/a.out.h | 35 ------------------------
include/asm-parisc/a.out.h | 20 -------------
include/asm-powerpc/a.out.h | 20 -------------
include/asm-sh/a.out.h | 20 -------------
include/asm-xtensa/a.out.h | 29 -------------------
26 files changed, 276 deletions(-)

9cd72b780be8d25cd2deb99a923030f2fe2aeba4 diff --git a/arch/cris/arch-v10/boot/tools/build.c b/arch/cris/arch-v10/boot/tools/build.c
index 2f9bbb2..c8adef3 100644
--- a/arch/cris/arch-v10/boot/tools/build.c
+++ b/arch/cris/arch-v10/boot/tools/build.c
@@ -30,7 +30,6 @@
#include <sys/sysmacros.h>
#include <unistd.h> /* contains read/write */
#include <fcntl.h>
-#include <linux/a.out.h>
#include <errno.h>

#define MINIX_HEADER 32
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index dfbe7ab..a8ef654 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -34,7 +34,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/fs.h>
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 200100e..f482a90 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -21,7 +21,6 @@
#include <linux/bitops.h>
#include <linux/kexec.h>

-#include <asm/a.out.h>
#include <asm/dma.h>
#include <asm/ia32.h>
#include <asm/io.h>
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 47502d5..3f2d774 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -25,7 +25,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/interrupt.h>
#include <linux/reboot.h>
#include <linux/fs.h>
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c
index ec9aea6..0157b9d 100644
--- a/arch/m68knommu/kernel/traps.c
+++ b/arch/m68knommu/kernel/traps.c
@@ -22,7 +22,6 @@
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/types.h>
-#include <linux/a.out.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/linkage.h>
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index 469c723..e068a72 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -18,7 +18,6 @@
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/mman.h>
-#include <linux/a.out.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/signal.h>
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 2c09a44..2040fc5 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -22,7 +22,6 @@
#include <linux/personality.h>
#include <linux/sys.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/init.h>
#include <linux/completion.h>
#include <linux/kallsyms.h>
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index af1bdc8..0d2b609 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -7,7 +7,6 @@
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 2001 MIPS Technologies, Inc.
*/
-#include <linux/a.out.h>
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/linkage.h>
diff --git a/arch/powerpc/kernel/softemu8xx.c b/arch/powerpc/kernel/softemu8xx.c
index 67d6f68..2489493 100644
--- a/arch/powerpc/kernel/softemu8xx.c
+++ b/arch/powerpc/kernel/softemu8xx.c
@@ -23,7 +23,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/interrupt.h>

#include <asm/pgtable.h>
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 4b5b7ff..c7e499e 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -23,7 +23,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/module.h>
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 116babb..e6b3fac 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -17,7 +17,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/major.h>
#include <linux/interrupt.h>
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 3647147..d4c61c3 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -23,7 +23,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/string.h>
#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 00bd016..19c287a 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -33,7 +33,6 @@
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/string.h>
#include <linux/delay.h>
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f5d29f5..577efcd 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -25,7 +25,6 @@
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/user.h>
-#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/major.h>
#include <linux/interrupt.h>
diff --git a/include/asm-avr32/a.out.h b/include/asm-avr32/a.out.h
deleted file mode 100644
index e46375a..0000000
--- a/include/asm-avr32/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ASM_AVR32_A_OUT_H
-#define __ASM_AVR32_A_OUT_H
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* __ASM_AVR32_A_OUT_H */
diff --git a/include/asm-blackfin/a.out.h b/include/asm-blackfin/a.out.h
deleted file mode 100644
index 6c3d652..0000000
--- a/include/asm-blackfin/a.out.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __BFIN_A_OUT_H__
-#define __BFIN_A_OUT_H__
-
-struct exec {
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* __BFIN_A_OUT_H__ */
diff --git a/include/asm-cris/a.out.h b/include/asm-cris/a.out.h
deleted file mode 100644
index c82e9f9..0000000
--- a/include/asm-cris/a.out.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __CRIS_A_OUT_H__
-#define __CRIS_A_OUT_H__
-
-/* we don't support a.out binaries on Linux/CRIS anyway, so this is
- * not really used but still needed because binfmt_elf.c for some reason
- * wants to know about a.out even if there is no interpreter available...
- */
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif
diff --git a/include/asm-h8300/a.out.h b/include/asm-h8300/a.out.h
deleted file mode 100644
index ded780f..0000000
--- a/include/asm-h8300/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __H8300_A_OUT_H__
-#define __H8300_A_OUT_H__
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* __H8300_A_OUT_H__ */
diff --git a/include/asm-ia64/a.out.h b/include/asm-ia64/a.out.h
deleted file mode 100644
index 193dcfb..0000000
--- a/include/asm-ia64/a.out.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _ASM_IA64_A_OUT_H
-#define _ASM_IA64_A_OUT_H
-
-/*
- * No a.out format has been (or should be) defined so this file is
- * just a dummy that allows us to get binfmt_elf compiled. It
- * probably would be better to clean up binfmt_elf.c so it does not
- * necessarily depend on there being a.out support.
- *
- * Modified 1998-2002
- * David Mosberger-Tang <[email protected]>, Hewlett-Packard Co.
- */
-
-#include <linux/types.h>
-
-struct exec {
- unsigned long a_info;
- unsigned long a_text;
- unsigned long a_data;
- unsigned long a_bss;
- unsigned long a_entry;
-};
-
-#define N_TXTADDR(x) 0
-#define N_DATADDR(x) 0
-#define N_BSSADDR(x) 0
-#define N_DRSIZE(x) 0
-#define N_TRSIZE(x) 0
-#define N_SYMSIZE(x) 0
-#define N_TXTOFF(x) 0
-
-#endif /* _ASM_IA64_A_OUT_H */
diff --git a/include/asm-m32r/a.out.h b/include/asm-m32r/a.out.h
deleted file mode 100644
index ab150f5..0000000
--- a/include/asm-m32r/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _ASM_M32R_A_OUT_H
-#define _ASM_M32R_A_OUT_H
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* _ASM_M32R_A_OUT_H */
diff --git a/include/asm-m68knommu/a.out.h b/include/asm-m68knommu/a.out.h
deleted file mode 100644
index ce18ef9..0000000
--- a/include/asm-m68knommu/a.out.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-m68k/a.out.h>
diff --git a/include/asm-mips/a.out.h b/include/asm-mips/a.out.h
deleted file mode 100644
index cad8371..0000000
--- a/include/asm-mips/a.out.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1994 - 1999, 2003 by Ralf Baechle
- */
-#ifndef _ASM_A_OUT_H
-#define _ASM_A_OUT_H
-
-#ifdef __KERNEL__
-
-
-#endif
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for
- file, in bytes */
- unsigned a_syms; /* length of symbol table data in file,
- in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in
- bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* _ASM_A_OUT_H */
diff --git a/include/asm-parisc/a.out.h b/include/asm-parisc/a.out.h
deleted file mode 100644
index eb04e34..0000000
--- a/include/asm-parisc/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __PARISC_A_OUT_H__
-#define __PARISC_A_OUT_H__
-
-struct exec
-{
- unsigned int a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-powerpc/a.out.h b/include/asm-powerpc/a.out.h
deleted file mode 100644
index 89cead6..0000000
--- a/include/asm-powerpc/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _ASM_POWERPC_A_OUT_H
-#define _ASM_POWERPC_A_OUT_H
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* _ASM_POWERPC_A_OUT_H */
diff --git a/include/asm-sh/a.out.h b/include/asm-sh/a.out.h
deleted file mode 100644
index 1f93130..0000000
--- a/include/asm-sh/a.out.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __ASM_SH_A_OUT_H
-#define __ASM_SH_A_OUT_H
-
-struct exec
-{
- unsigned long a_info; /* Use macros N_MAGIC, etc for access */
- unsigned a_text; /* length of text, in bytes */
- unsigned a_data; /* length of data, in bytes */
- unsigned a_bss; /* length of uninitialized data area for file, in bytes */
- unsigned a_syms; /* length of symbol table data in file, in bytes */
- unsigned a_entry; /* start address */
- unsigned a_trsize; /* length of relocation info for text, in bytes */
- unsigned a_drsize; /* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a) ((a).a_trsize)
-#define N_DRSIZE(a) ((a).a_drsize)
-#define N_SYMSIZE(a) ((a).a_syms)
-
-#endif /* __ASM_SH_A_OUT_H */
diff --git a/include/asm-xtensa/a.out.h b/include/asm-xtensa/a.out.h
deleted file mode 100644
index fdf1370..0000000
--- a/include/asm-xtensa/a.out.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * include/asm-xtensa/a.out.h
- *
- * Dummy a.out file. Xtensa does not support the a.out format, but the kernel
- * seems to depend on it.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_A_OUT_H
-#define _XTENSA_A_OUT_H
-
-struct exec
-{
- unsigned long a_info;
- unsigned a_text;
- unsigned a_data;
- unsigned a_bss;
- unsigned a_syms;
- unsigned a_entry;
- unsigned a_trsize;
- unsigned a_drsize;
-};
-
-#endif /* _XTENSA_A_OUT_H */