[PATCH] Discard unneeded PLT entries on SPARC 64-bit
Eric Botcazou
ebotcazou@libertysurf.fr
Sun Jan 9 22:49:00 GMT 2005
Hi,
We have the following failure in the GCC 4.0.0pre+Binutils 2.15.94 testsuite
on Solaris/SPARC 64-bit:
FAIL: gcc.dg/cleanup-5.c execution test
The loader complains about bogus relocations in the PLT:
0000000100105380 R_SPARC_JMP_SLOT malloc
00000001001053a0 R_SPARC_JMP_SLOT _Unwind_Find_FDE
00000001001053c0 R_SPARC_JMP_SLOT memset
0000000000000000 R_SPARC_NONE *ABS*
0000000100105400 R_SPARC_JMP_SLOT exit
0000000000000000 R_SPARC_NONE *ABS*
0000000100105440 R_SPARC_JMP_SLOT memcpy
0000000100105460 R_SPARC_JMP_SLOT pthread_mutex_unlock
0000000000000000 R_SPARC_NONE *ABS*
00000001001054a0 R_SPARC_JMP_SLOT free
00000001001054c0 R_SPARC_JMP_SLOT __deregister_frame_info
0000000000000000 R_SPARC_NONE *ABS*
0000000000000000 R_SPARC_NONE *ABS*
0000000100105520 R_SPARC_JMP_SLOT pthread_create
0000000000000000 R_SPARC_NONE *ABS*
0000000100105560 R_SPARC_JMP_SLOT abort
0000000100105580 R_SPARC_JMP_SLOT pthread_once
0000000000000000 R_SPARC_NONE *ABS*
00000001001055c0 R_SPARC_JMP_SLOT _exit
0000000000000000 R_SPARC_NONE *ABS*
0000000100105600 R_SPARC_JMP_SLOT strlen
0000000000000000 R_SPARC_NONE *ABS*
0000000100105640 R_SPARC_JMP_SLOT pthread_mutex_lock
0000000000000000 R_SPARC_NONE *ABS*
0000000100105680 R_SPARC_JMP_SLOT atexit
0000000000000000 R_SPARC_NONE *ABS*
0000000000000000 R_SPARC_NONE *ABS*
00000001001056e0 R_SPARC_JMP_SLOT __register_frame_info
The 12 R_SPARC_NONE relocs correspond to LOCAL HIDDEN symbols in libgcc_eh
that are not referenced. Space is reserved for them in the .plt
and .rela.plt sections but apparently the relocations are never finalized.
The proposed fix is to avoid reserving space for them in the first place. The
condition is borrowed from the twin function in elf32-sparc.c. Tested on
sparc64-sun-solaris2.9.
2005-01-04 Eric Botcazou <ebotcazou@libertysurf.fr>
* elf64-sparc.c (sparc64_elf_adjust_dynamic_symbol): When linking a
non-shared object, do not reserve space in .plt and .rela.plt for regular
symbols not defined or referenced in shared objects.
Note that we still emit unneeded dynamic relocations against data for the
testcase:
0000000100105718 R_SPARC_GLOB_DAT __deregister_frame_info
0000000100105728 R_SPARC_GLOB_DAT __register_frame_info
but the fix would be more invasive.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bfd_sparc_discard_plt.diff
Type: text/x-diff
Size: 829 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050109/fb41deaa/attachment.bin>
More information about the Binutils
mailing list