This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] alpha: Fix up NBPG in <sys/user.h>


 Linux headers stopped providing PAGE_SHIFT at some point, over a year 
ago, and <asm/page.h>, at least for the Alpha, is now solely for the 
kernel use only, wrapped by an #ifdef __KERNEL__ protection, so there is 
no point in including it at all.

 Here is a patch that provides the necessary definition in a way similar 
to what the i386 port does.  Without this change programs that make use of 
NBPG do not build for the Alpha, e.g. (taken from a build of BFD):

alpha-linux-gcc -DHAVE_CONFIG_H -I. -DTRAD_CORE -I. -I. -I./../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -mcpu=ev4 -pipe -O2 -fomit-frame-pointer -c trad-core.c  -fPIC -DPIC -o .libs/trad-core.o
trad-core.c: In function 'trad_unix_core_file_p':
trad-core.c:122: error: 'PAGE_SIZE' undeclared (first use in this function)
trad-core.c:122: error: (Each undeclared identifier is reported only once
trad-core.c:122: error: for each function it appears in.)

2007-10-01  Maciej W. Rozycki  <>

	* sysdeps/unix/sysv/linux/alpha/sys/user.h: Do not include 

 Taken against 2.4, but applies to HEAD.  Please apply.


diff -up --recursive --new-file glibc-2.4.macro/sysdeps/unix/sysv/linux/alpha/sys/user.h glibc-2.4/sysdeps/unix/sysv/linux/alpha/sys/user.h
--- glibc-2.4.macro/sysdeps/unix/sysv/linux/alpha/sys/user.h	2001-07-06 04:56:13.000000000 +0000
+++ glibc-2.4/sysdeps/unix/sysv/linux/alpha/sys/user.h	2007-09-28 21:03:52.000000000 +0000
@@ -23,7 +23,6 @@
    only. Don't read too much into it. Don't use it for anything other
    than gdb/strace unless you know what you are doing. */
-#include <asm/page.h>
 #include <asm/reg.h>
 struct user
@@ -41,6 +40,9 @@ struct user
   char u_comm[32];				/* user command name */
+#define PAGE_SHIFT		13
+#define PAGE_SIZE		(1UL << PAGE_SHIFT)
+#define PAGE_MASK		(~(PAGE_SIZE-1))
 #define NBPG			PAGE_SIZE
 #define UPAGES			1
 #define HOST_TEXT_START_ADDR	(u.start_code)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]