public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Variable page size for ELF
@ 1999-07-10 19:24 H.J. Lu
  1999-07-10 19:44 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1999-07-10 19:24 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

Hi,

I got a request to support variable page size for ELF. It turned out
not too hard to implement. Is that interesting to anyone? Should I
send in my patch which adds "--page-size SIZE" to ld?

Thanks.


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-10 19:24 Variable page size for ELF H.J. Lu
@ 1999-07-10 19:44 ` Ian Lance Taylor
  1999-07-10 20:47   ` H.J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 1999-07-10 19:44 UTC (permalink / raw)
  To: hjl; +Cc: binutils

   Date: Sat, 10 Jul 1999 19:24:37 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   I got a request to support variable page size for ELF. It turned out
   not too hard to implement. Is that interesting to anyone? Should I
   send in my patch which adds "--page-size SIZE" to ld?

It's hard for me to imagine an application for that.  However, if
there is some reason that it is useful, in a way that can not be
handled by simply changing the linker script, then I have no objection
to such an option.  At first glance it seems like anything you can do
by changing the page size you can do by changing the linker script,
using the PHDRS option.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-10 19:44 ` Ian Lance Taylor
@ 1999-07-10 20:47   ` H.J. Lu
  1999-07-11  8:13     ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1999-07-10 20:47 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

> 
>    Date: Sat, 10 Jul 1999 19:24:37 -0700 (PDT)
>    From: hjl@lucon.org (H.J. Lu)
> 
>    I got a request to support variable page size for ELF. It turned out
>    not too hard to implement. Is that interesting to anyone? Should I
>    send in my patch which adds "--page-size SIZE" to ld?
> 
> It's hard for me to imagine an application for that.  However, if
> there is some reason that it is useful, in a way that can not be
> handled by simply changing the linker script, then I have no objection

The problem is get_elf_backend_data (abfd)->maxpagesize in BFD and
MAXPAGESIZE in linker script. I did

1. Add functions to get/set get_elf_backend_data (abfd)->maxpagesize.
2. Made MAXPAGESIZE in linker script a variable.

Now the ELF linker script has

MAXPAGESIZE != 0 ? MAXPAGESIZE : ${MAXPAGESIZE}

in place of ${MAXPAGESIZE}.

> to such an option.  At first glance it seems like anything you can do
> by changing the page size you can do by changing the linker script,
> using the PHDRS option.
> 

How does PHDRS work?

-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-10 20:47   ` H.J. Lu
@ 1999-07-11  8:13     ` Ian Lance Taylor
  1999-07-11 10:38       ` H.J. Lu
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 1999-07-11  8:13 UTC (permalink / raw)
  To: hjl; +Cc: binutils

   Date: Sat, 10 Jul 1999 20:47:58 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   >    I got a request to support variable page size for ELF. It turned out
   >    not too hard to implement. Is that interesting to anyone? Should I
   >    send in my patch which adds "--page-size SIZE" to ld?
   > 
   > It's hard for me to imagine an application for that.  However, if
   > there is some reason that it is useful, in a way that can not be
   > handled by simply changing the linker script, then I have no objection

   The problem is get_elf_backend_data (abfd)->maxpagesize in BFD and
   MAXPAGESIZE in linker script. I did

   1. Add functions to get/set get_elf_backend_data (abfd)->maxpagesize.
   2. Made MAXPAGESIZE in linker script a variable.

   Now the ELF linker script has

   MAXPAGESIZE != 0 ? MAXPAGESIZE : ${MAXPAGESIZE}

   in place of ${MAXPAGESIZE}.

I guessed that much, but I still find it hard to imagine an
application.  We shouldn't provide features merely because we can; we
should stick to providing features that are meaningful and useful.

Merely changing the linker script is not a terribly useful feature,
since people can already change it anyhow.  The interesting new
feature here is changing the use of maxpagesize in the backend data
structure.  However, the only interesting use of the backend
maxpagesize is to set up the program headers, and you can already do
that using PHDRS in the linker script.

So I don't see any new functionality in the --page-size option.  Of
course, if it is a useful shorthand, we should add it anyhow.  But
that is where I wonder what the application is, since I don't see that
either.

By the way, MAXPAGESIZE should probably not be used as a symbol name
in a linker script, because it is part of the user's name space.
Something like __MAXPAGESIZE would be better.

   > to such an option.  At first glance it seems like anything you can do
   > by changing the page size you can do by changing the linker script,
   > using the PHDRS option.

   How does PHDRS work?

It's documented.  Basically, it lets you set the program headers in
the linker script.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-11  8:13     ` Ian Lance Taylor
@ 1999-07-11 10:38       ` H.J. Lu
  1999-07-11 13:02         ` Richard Henderson
  1999-07-11 16:45         ` Ian Lance Taylor
  0 siblings, 2 replies; 9+ messages in thread
From: H.J. Lu @ 1999-07-11 10:38 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: binutils

> Merely changing the linker script is not a terribly useful feature,
> since people can already change it anyhow.  The interesting new
> feature here is changing the use of maxpagesize in the backend data
> structure.  However, the only interesting use of the backend
> maxpagesize is to set up the program headers, and you can already do
> that using PHDRS in the linker script.

I took a look at PHDRS. It is not easy to get it right with alignment
by hand.

> 
> So I don't see any new functionality in the --page-size option.  Of
> course, if it is a useful shorthand, we should add it anyhow.  But
> that is where I wonder what the application is, since I don't see that
> either.

I got the request from our IA64 people.

> 
> By the way, MAXPAGESIZE should probably not be used as a symbol name
> in a linker script, because it is part of the user's name space.
> Something like __MAXPAGESIZE would be better.
> 

MAXPAGESIZE is a variable in linker script just like SIZEOF_HEADER.
It shouldn't show up in executable.



-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-11 10:38       ` H.J. Lu
@ 1999-07-11 13:02         ` Richard Henderson
  1999-07-11 13:22           ` H.J. Lu
  1999-07-11 16:45         ` Ian Lance Taylor
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Henderson @ 1999-07-11 13:02 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Ian Lance Taylor, binutils

On Sun, Jul 11, 1999 at 10:38:05AM -0700, H.J. Lu wrote:
> I got the request from our IA64 people.

It seems quite likely that they want -N. 

If not, have one of them call me tomorrow so I can figure out what it
is that they are trying to accomplish, because this request makes no
sense to me at all.


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-11 13:02         ` Richard Henderson
@ 1999-07-11 13:22           ` H.J. Lu
  1999-07-11 15:11             ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 1999-07-11 13:22 UTC (permalink / raw)
  To: Richard Henderson; +Cc: ian, binutils

> 
> On Sun, Jul 11, 1999 at 10:38:05AM -0700, H.J. Lu wrote:
> > I got the request from our IA64 people.
> 
> It seems quite likely that they want -N. 
> 
> If not, have one of them call me tomorrow so I can figure out what it
> is that they are trying to accomplish, because this request makes no
> sense to me at all.
> 

They don't want -N. There are several usages I can think of

1. Some OSes do support variable page size. IRIX is one of them. But
you need some way to tell the system what page size you want. It is
possible that one day Linux will support variable page size on
platforms where the hardware support is available.
2. IA32 has 4K page size. But we may want to use a different page size
for IA32 binaries when run them under IA64.
3. The page size of Linux/IA64 may change due to various reasons. It
will be helpful to change page size via linker command line.


-- 
H.J. Lu (hjl@gnu.org)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-11 13:22           ` H.J. Lu
@ 1999-07-11 15:11             ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1999-07-11 15:11 UTC (permalink / raw)
  To: H.J. Lu; +Cc: ian, binutils

On Sun, Jul 11, 1999 at 01:22:51PM -0700, H.J. Lu wrote:
> 1. Some OSes do support variable page size. IRIX is one of them. But
> you need some way to tell the system what page size you want. It is
> possible that one day Linux will support variable page size on
> platforms where the hardware support is available.

What has this to do with the maximum architectural page size?
Which is what's supposed to be used in BFD.  That maximum is
specified by the IA64 spec as 64K.

> 2. IA32 has 4K page size. But we may want to use a different page size
> for IA32 binaries when run them under IA64.

No, you can't do that.  All sorts of existing programs will break,
and the whole point of such non-native emulation is to not break
old programs.

> 3. The page size of Linux/IA64 may change due to various reasons. It
> will be helpful to change page size via linker command line.

Again, no.  The value in BFD is the _maximum_ architectural page
size.  By arranging binaries this way, we free the operating system
to choose _any_ architecturally supported page size.


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Variable page size for ELF
  1999-07-11 10:38       ` H.J. Lu
  1999-07-11 13:02         ` Richard Henderson
@ 1999-07-11 16:45         ` Ian Lance Taylor
  1 sibling, 0 replies; 9+ messages in thread
From: Ian Lance Taylor @ 1999-07-11 16:45 UTC (permalink / raw)
  To: hjl; +Cc: binutils

   Date: Sun, 11 Jul 1999 10:38:05 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   > Merely changing the linker script is not a terribly useful feature,
   > since people can already change it anyhow.  The interesting new
   > feature here is changing the use of maxpagesize in the backend data
   > structure.  However, the only interesting use of the backend
   > maxpagesize is to set up the program headers, and you can already do
   > that using PHDRS in the linker script.

   I took a look at PHDRS. It is not easy to get it right with alignment
   by hand.

It's trivial to get the alignment right by hand in the SECTIONS
portion of the linker script.  Then there is no reason to worry about
the PHDRS part.

   > So I don't see any new functionality in the --page-size option.  Of
   > course, if it is a useful shorthand, we should add it anyhow.  But
   > that is where I wonder what the application is, since I don't see that
   > either.

   I got the request from our IA64 people.

Please do talk with Richard and/or me about just why they want this
option.  I am concerned that there is some misunderstanding at the
root of this request, and I would prefer to avoid adding a feature
which nobody will actually use.

   > By the way, MAXPAGESIZE should probably not be used as a symbol name
   > in a linker script, because it is part of the user's name space.
   > Something like __MAXPAGESIZE would be better.

   MAXPAGESIZE is a variable in linker script just like SIZEOF_HEADER.
   It shouldn't show up in executable.

I know.  However, using it in this way will prevent anybody from
referring to MAXPAGESIZE as a symbol in a linker script.  There are
other keywords in the linker script language with the same problem
(all those recognized in lexer state EXPRESSION).  I'm just showing a
somewhat belated concern for not adding another one, particularly
since MAXPAGESIZE is actually a vaguely plausible symbol name.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1999-07-11 16:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-10 19:24 Variable page size for ELF H.J. Lu
1999-07-10 19:44 ` Ian Lance Taylor
1999-07-10 20:47   ` H.J. Lu
1999-07-11  8:13     ` Ian Lance Taylor
1999-07-11 10:38       ` H.J. Lu
1999-07-11 13:02         ` Richard Henderson
1999-07-11 13:22           ` H.J. Lu
1999-07-11 15:11             ` Richard Henderson
1999-07-11 16:45         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).