Bug 11016

Summary: PAGE_SIZE redefined in dlltool.c
Product: binutils Reporter: Jerker Bäck <jerker.back>
Component: binutilsAssignee: unassigned
Status: RESOLVED DUPLICATE    
Severity: normal CC: bug-binutils
Priority: P2    
Version: 2.21   
Target Milestone: ---   
Host: x86_64-unknown-interix6.1 Target: x86_64-unknown-interix6.1
Build: x86_64-unknown-interix6.1 Last reconfirmed:

Description Jerker Bäck 2009-11-24 21:23:45 UTC
dlltool.c(244) defines PAGE_SIZE

The PAGE_SIZE symbol is/should be defined in limits.h on a POSIX system (see
http://www.opengroup.org). NT POSIX subsystem (SUA) defines it to 0x10000
(10*0x1000). In my headers PAGE_SIZE is defined as an enum and dlltool.c
generates a compiler error due to PAGE_SIZE is defined before including system
headers.

I need advise how to fix this. 
Assuming setting PAGE_SIZE to 0x1000 is preferable, we can let dlltool.c set an
explicit value after including the system headers, like this:

Index: dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.97
diff -d -u -p -r1.97 dlltool.c
--- dlltool.c	28 Oct 2009 17:21:36 -0000	1.97
+++ dlltool.c	24 Nov 2009 17:27:50 -0000
@@ -241,9 +241,6 @@
 
 #define show_allnames 0
 
-#define PAGE_SIZE ((bfd_vma) 4096)
-#define PAGE_MASK ((bfd_vma) (-4096))
-
 #include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
@@ -259,6 +256,9 @@
 #include <stdarg.h>
 #include <assert.h>
 
+#define PAGE_SIZE ((bfd_vma) 4096)
+#define PAGE_MASK ((bfd_vma) (-4096))
+
Comment 1 Hans-Peter Nilsson 2009-11-24 21:41:15 UTC

*** This bug has been marked as a duplicate of 11017 ***