This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Decreasing the size of .opd on ppc64 (take 2)


Hi!

Attached are both binutils and gcc patches which implement what I talked
about back in June, particularly if the compiler knows it will never look
at the r11 (static chain reg) passed to a function, it doesn't need 0
to be passed there (well, in reality it was sometimes 0 and sometimes
shared library's load address), but can be passed fd_func value of next
.opd entry, thus the .opd entries effectively overlap.
+--------------+-------------+--------------+
| ent0 fd_func | ent0 fd_toc | ent0 fd_aux  |
+--------------+-------------+--------------+-------------+-------------+
                             | ent1 fd_func | ent1 fd_toc | ent1 fd_aux |
                             +--------------+-------------+-------------+
For e.g. nested C functions were r11 register is live on entry, an explicit
fd_aux field not overlapped with next .opd entry is still used.
The linker is able to cope with a different mix of overlapped and overlapped
.opd entries.

The linker now has a --non-overlapping-opd switch which could be useful
if some post-link processing tool can't cope with this .opd overlapping
(the dynamic linker certainly can cope with it).
When ld is given --non-overlapping-opd, it would canonicalize the above to:
+--------------+-------------+---+--------------+-------------+-------------+
| ent0 fd_func | ent0 fd_toc | 0 | ent1 fd_func | ent1 fd_toc | ent1 fd_aux
|
+--------------+-------------+---+--------------+-------------+-------------+

The patch is on top of Alan's no-dot-syms patches
http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00557.html
(the binutils side is already in CVS).

Tested with binutils make check, gcc make check and glibc make check
on ppc64-redhat-linux, no regressions.

For glibc, this saves around 18KB of per-process memory, for e.g. libgcj.so
almost 150KB.

	Jakub

Attachment: binutils-CVS-opd-overlap.patch
Description: Text document

Attachment: gcc35-opd-overlap.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]