On Tue, 2011-05-24 at 12:31 +0200, Mark Wielaard wrote:
On Mon, 2011-05-23 at 13:43 -0700, Roland McGrath wrote:
> You don't want to constrain it to STT_SECTION symbols. Any symbol whose
> shndx is in a non-allocated section ought to be fine. Whether you see only
> section-relative references or see symbols too depends on the tools and
> machine (IIRC s390 gets a lot of symbol-relative relocations).
Too bad, it kept the code simple since I could just ignore the actual
symbol value was always zero, which made the ET_REL case almost
completely trivial. And in all the cases I saw the cross-debug-section
relocations use the STT_SECTION symbol of another debug section plus an
addend (either explicit in the RELA case, or already at the offset
location in the REL case).
I added the s390 testcase and the following patch to the
mjw/reloc-debug-sections branch:
2011-05-23 Mark Wielaard <mjw(a)redhat.com>
* strip.c (relocate): Take new arguments is_rela to indicate
whether the relocation is from a SHT_REL or SHT_RELA section.
Relocate against any debug section symbol, not just STT_SECTION
symbols. For SHT_REL relocations, fetch addend from offset and
add it to symbol value if not zero.
With this the s390 testcase sees a reduction in size of 30%. One other
testcase is also slightly smaller.
Thanks,
Mark