Bug 11014 - PAGE_SIZE redefined in dlltool.c
Summary: PAGE_SIZE redefined in dlltool.c
Status: RESOLVED DUPLICATE of bug 11017
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.21
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-24 17:37 UTC by Jerker Bäck
Modified: 2009-11-24 21:42 UTC (History)
1 user (show)

See Also:
Host: x86_64-unknown-interix6.1
Target: x86_64-unknown-interix6.1
Build: x86_64-unknown-interix6.1
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerker Bäck 2009-11-24 17:37:08 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 Andreas Schwab 2009-11-24 21:42:14 UTC

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