[lkml]   [2011]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] RFC: fs to be compiled with -Dlinux
I dunno how to solve this problem the real way or if I'm just doing
something idiotic. I'm using a vanilla GCC "arm-none-eabi-gcc" not
targeted at any specific OS so the environment variable "linux" is
not set. Then I try to compile an arch that by default wants to
generate an a.out image, actually mach-rpc (Acorn RISC PC) from
rpc_defconfig. (This is the grandfather in arch/arm/* if I'm not

Without this patch that currently fails like this with a "none"

CC fs/binfmt_aout.o
/home/elinwal/linux/fs/binfmt_aout.c: In function 'load_aout_binary':
/home/elinwal/linux/fs/binfmt_aout.c:256: error: 'SEGMENT_SIZE' undeclared (first use in this function)
/home/elinwal/linux/fs/binfmt_aout.c:256: error: (Each undeclared identifier is reported only once
/home/elinwal/linux/fs/binfmt_aout.c:256: error: for each function it appears in.)
make[3]: *** [fs/binfmt_aout.o] Error 1
make[2]: *** [fs] Error 2

However the kernel compilation process in fs/binmft_aout.c require
SEGMENT_SIZE which is in turn defined in <linux/a.out.h> like this:

#ifdef linux
#ifdef __KERNEL__
#include <asm/page.h>
#include <unistd.h>
#if defined(__i386__) || defined(__mc68000__)
#define SEGMENT_SIZE 1024
#ifdef __KERNEL__
#define SEGMENT_SIZE getpagesize()

I don't know what the intent of all the pre-git
specific-machine detection code surrounding this statement
is, sorry I'm too young and naive. I don't dare to just delete
it though since it looks like stuff some userspace programs may
depend on, or intended for cross-compilation somekindof or

Instead I chicken out and stick -Dlinux into the fs
Makefile, since that sure as hell cannot get the definition
of SEGMENT_SIZE from any other place than this file.

That doesn't feel good either, so: help.

Signed-off-by: Linus Walleij <>
fs/Makefile | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index d2c3353..128debc 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -3,7 +3,12 @@
# 14 Sep 2000, Christoph Hellwig <>
# Rewritten to use lists instead of if-statements.
+# binfmt_aout includes <linux/a.out.h> which requires that the compiler
+# defines "linux" to provide SEGMENT_SIZE and such things for the kernel
+# compilation
+ccflags-y := -Dlinux

obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \

 \ /
  Last update: 2011-10-28 12:27    [W:0.059 / U:0.776 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site