[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2023-07-29 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread evandro at yahoo dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

Evandro Menezes  changed:

   What|Removed |Added

 CC||evandro at yahoo dot com

--- Comment #8 from Evandro Menezes  ---
(In reply to H.J. Lu from comment #7)
> I also want to support larger code size in small model.  Put .plt after .text
> will help small model.  I will implement large PLT for large model.

Methinks that it's more appealing to maintain a single PLT template, regardless
of the model, and have sparse segments to support text-ro-plt-got.  The
overhead in the memory space should be insignificant if done only in the large
code model.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #7 from H.J. Lu  ---
(In reply to Michael Matz from comment #5)
> (In reply to H.J. Lu from comment #4)
> > When there is a large readonly section,  it makes no differences between
> > 
> > text, plt, readonly, got
> > 
> > and
> > 
> > text, readonly, plt, got
> > 
> > since text needs to reach plt and plt needs to reach got.
> 
> Yes, but text reaching PLT is trivial with the large code model.  But PLT
> reaching GOT requires changing the PLT layout.  The reason for my idea
> of moving the PLT was to avoid doing that.  And with a large readonly only
> the latter layout achieves that.  So I think that should be the default
> layout.

I also want to support larger code size in small model.  Put .plt after .text
will help small model.  I will implement large PLT for large model.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #6 from H.J. Lu  ---
(In reply to Michael Matz from comment #5)
> (In reply to H.J. Lu from comment #4)
> > When there is a large readonly section,  it makes no differences between
> > 
> > text, plt, readonly, got
> > 
> > and
> > 
> > text, readonly, plt, got
> > 
> > since text needs to reach plt and plt needs to reach got.
> 
> Yes, but text reaching PLT is trivial with the large code model.  But PLT
> reaching GOT requires changing the PLT layout.  The reason for my idea
> of moving the PLT was to avoid doing that.  And with a large readonly only
> the latter layout achieves that.  So I think that should be the default
> layout.

Putting readonly data between text makes this even worse:

https://sourceware.org/bugzilla/show_bug.cgi?id=16685

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #5 from Michael Matz  ---
(In reply to H.J. Lu from comment #4)
> When there is a large readonly section,  it makes no differences between
> 
> text, plt, readonly, got
> 
> and
> 
> text, readonly, plt, got
> 
> since text needs to reach plt and plt needs to reach got.

Yes, but text reaching PLT is trivial with the large code model.  But PLT
reaching GOT requires changing the PLT layout.  The reason for my idea
of moving the PLT was to avoid doing that.  And with a large readonly only
the latter layout achieves that.  So I think that should be the default layout.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #4 from H.J. Lu  ---
(In reply to Michael Matz from comment #3)
> (In reply to H.J. Lu from comment #2)
> > It is an interesting idea.
> 
> Yeah, that's how I tested the large model back in the days when I implemented
> some of it.  Never got around to actually change the PLT layout.
> 
> > If we place .plt just after .text, there
> > may be readonly sections before .got, the distance between .plt and
> > .got.plt can still be big.
> 
> Yes, unfortunately.
> 
> > If we place .plt just before .got, the
> > text segment will have text, readonly data and followed by text. Do
> > we want to do that?
> 
> At least it wouldn't change the executable view of the ELF files, those
> sections would still be contained in the read-only-exec segment.  Also the
> GNU_RELRO (writable, but only during loading) part could be moved after .got.
> Thereby .got would be first in the RW segment and .plt last in the RE
> segment,
> right next to each other.

When there is a large readonly section,  it makes no differences between

text
plt
readonly
got

and

text
readonly
plt
got

since text needs to reach plt and plt needs to reach got.  We should go
with

text
plt
readonly
got

I will prepare a patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-18 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #3 from Michael Matz  ---
(In reply to H.J. Lu from comment #2)
> It is an interesting idea.

Yeah, that's how I tested the large model back in the days when I implemented
some of it.  Never got around to actually change the PLT layout.

> If we place .plt just after .text, there
> may be readonly sections before .got, the distance between .plt and
> .got.plt can still be big.

Yes, unfortunately.

> If we place .plt just before .got, the
> text segment will have text, readonly data and followed by text. Do
> we want to do that?

At least it wouldn't change the executable view of the ELF files, those
sections would still be contained in the read-only-exec segment.  Also the
GNU_RELRO (writable, but only during loading) part could be moved after .got.
Thereby .got would be first in the RW segment and .plt last in the RE segment,
right next to each other.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-17 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

--- Comment #2 from H.J. Lu  ---
(In reply to Michael Matz from comment #1)
> Back in http://www.sourceware.org/ml/binutils/2006-03/msg00276.html
> I suggested to place .plt after .text so that PLT and GOT are nearer
> to each other.  In that case the large PLT layout would only need to
> be used if there were more that 100 million PLT slots (and GOT entry).
> 

It is an interesting idea.  If we place .plt just after .text, there
may be readonly sections before .got, the distance between .plt and
.got.plt can still be big.  If we place .plt just before .got, the
text segment will have text, readonly data and followed by text. Do
we want to do that?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/17592] x86-64 linker generates wrong PLT for large model

2014-11-17 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=17592

Michael Matz  changed:

   What|Removed |Added

 CC||matz at suse dot de

--- Comment #1 from Michael Matz  ---
Back in http://www.sourceware.org/ml/binutils/2006-03/msg00276.html
I suggested to place .plt after .text so that PLT and GOT are nearer
to each other.  In that case the large PLT layout would only need to
be used if there were more that 100 million PLT slots (and GOT entry).

Nevertheless, for full large model support you're right, the large PLT
layout needs to be implemented.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils