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
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:
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))
@@ -259,6 +256,9 @@
+#define PAGE_SIZE ((bfd_vma) 4096)
+#define PAGE_MASK ((bfd_vma) (-4096))
Random comment coming out of the woodwork:
I can't help thinking that you should change this and all uses to
TARGET_PAGE_SIZE and TARGET_PAGE_MASK, and the problem would probably be solved.
If you *really* need the host page size...no you don't.
*** Bug 11016 has been marked as a duplicate of this bug. ***
*** Bug 11014 has been marked as a duplicate of this bug. ***
(In reply to comment #1)
> Random comment coming out of the woodwork:
> I can't help thinking that you should change this and all uses to
> TARGET_PAGE_SIZE and TARGET_PAGE_MASK, and the problem would probably be
> If you *really* need the host page size...no you don't.
That is an idea. TARGET_PAGE_SIZE=0x1000 is set by all targets using dlltool
(AFAICS), but it is defined by the ld/emulparams scripts and used only in ld
scripts. BTW HOST is TARGET, although dlltool is not currently used by
Interix. It favours its own PE shared library solution.
Created attachment 4434 [details]
Solution based on COFF_PAGE_SIZE
Antother solution could be to use COFF_PAGE_SIZE. The COFF_PAGE_SIZE define
must then be moved from implementation to header.
Subject: Bug 11017
Module name: src
Changes by: email@example.com 2009-12-02 14:04:17
include/coff : ChangeLog i386.h x86_64.h
bfd : ChangeLog coff-i386.c
binutils : ChangeLog dlltool.c
* dlltool.c (PAGE_SIZE): Delete.
(PAGE_MASK): Provide default definition based on COFF_PAGE_SIZE.
Check for DLLTOOL_DEFAULT_MX86_64 and DLLTOOL_DEFAULT_I386.
* coff-i386.h (COFF_PAGE_SIZE): Definition moved to coff/i386.h
* i386lh (COFF_PAGE_SIZE): Define.
* x86_64.h (COFF_PAGE_SIZE): Define.
Thanks for the patch - I have now checked it in.