Should NBPG be unconditionally undefined to avoid references to PAGE_SIZE?

Stephen M. Kenton skenton@ou.edu
Fri Sep 14 18:09:00 GMT 2007


Alan Modra wrote:
> On Fri, Sep 14, 2007 at 09:55:13AM -0500, Stephen M. Kenton wrote:
>   
>> This is probably a better place to discuss this than bug-binutils. I am 
>> trying to make it easier for people to build cross-compile tool chains 
>> for all 20+ targets supported by the Linux kernel,
>>     
>
> All the world is not (yet) Linux.  Take a look at bfd/configure.  I
> see linux, riscix, bsd, sysv, freebsd, sco, mach, osf, riscos, hpux,
> ultrix and other unspecified operating systems using trad-core.c.
> Have you considered how many of those targets you might break by
> #undef NBPG?
>
>   
Yep, that's why I asked the question instead of submitting a 
quite-possibly-bogus patch.  However, if you look a couple of lines down 
from my putative undef of NBPG in trad-core.c  you will find.

#ifndef NBPG
# define NBPG getpagesize()
#endif

Maybe that should something to the effect of (if linux or not NBPG then 
define NBPG ), if getpagesize() is not portable enough. I don't know 
enough about "riscix, bsd, sysv, freebsd, sco, mach, osf, riscos, 
hpux,ultrix and other unspecified operating systems" to comment on 
them.  For this define to work, all the uses of NBPG have to be dynamic 
anyway so I assume the rest of the binutils code is OK with it.  Maybe 
there are target specific uses that require a constant?

Steve



More information about the Binutils mailing list