summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1999-07-30 21:42:21 +0000
committerRichard Henderson <rth@redhat.com>1999-07-30 21:42:21 +0000
commita11c78e7ddcbb5b7c6d703334a3e5a5cabf1919d (patch)
treebc6b948d1a719c7ee606b1ac95827ddad93719b5
parent6d8809aa625bfe3e0cc7a5558b37240c74c623a9 (diff)
downloadbinutils-gdb-a11c78e7ddcbb5b7c6d703334a3e5a5cabf1919d.tar.gz
Jakub Jelinek <jj@ultra.linux.cz>
* elf64-sparc.c (sparc64_elf_build_plt): Cosmetic change - ABI wants ba,a,pt %xcc instead of %icc. Emit correct .PLT0-(.PLTN+4) initial value into the pointer slots of large PLT entries. (sparc64_elf_plt_ptr_offset): Fix calculation. (sparc64_elf_finish_dynamic_symbol): Negative value of R_SPARC_JMP_SLOT addend should be relative to load address, not .plt section start. (sparc64_elf_size_info): Sparc64 uses 32bit .hash entries.
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/elf64-sparc.c23
2 files changed, 25 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a6ce27659d9..b9951104894 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,16 @@
1999-07-30 Jakub Jelinek <jj@ultra.linux.cz>
+ * elf64-sparc.c (sparc64_elf_build_plt): Cosmetic change - ABI
+ wants ba,a,pt %xcc instead of %icc.
+ Emit correct .PLT0-(.PLTN+4) initial value into the pointer slots
+ of large PLT entries.
+ (sparc64_elf_plt_ptr_offset): Fix calculation.
+ (sparc64_elf_finish_dynamic_symbol): Negative value of R_SPARC_JMP_SLOT
+ addend should be relative to load address, not .plt section start.
+ (sparc64_elf_size_info): Sparc64 uses 32bit .hash entries.
+
+1999-07-30 Jakub Jelinek <jj@ultra.linux.cz>
+
* elf-bfd.h (struct elf_backend_data): Add
print_symbol_all and output_arch_syms backend methods.
* elfxx-target.h: Likewise.
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 107f3714029..733ea5e5c79 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -875,8 +875,8 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
/* sethi (. - plt0), %g1 */
sethi = 0x03000000 | (i * PLT_ENTRY_SIZE);
- /* ba,a,pt %icc, plt1 */
- ba = 0x30480000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
+ /* ba,a,pt %xcc, plt1 */
+ ba = 0x30680000 | (((contents+PLT_ENTRY_SIZE) - (entry+4)) / 4 & 0x7ffff);
bfd_put_32 (output_bfd, sethi, entry);
bfd_put_32 (output_bfd, ba, entry+4);
@@ -913,7 +913,7 @@ sparc64_elf_build_plt (output_bfd, contents, nentries)
bfd_put_32 (output_bfd, 0x83c3c001, entry+16); /* jmpl %o7+%g1,%g1 */
bfd_put_32 (output_bfd, 0x9e100005, entry+20); /* mov %g5,%o7 */
- bfd_put_64 (output_bfd, contents - entry+4, ptr);
+ bfd_put_64 (output_bfd, contents - (entry+4), ptr);
}
}
}
@@ -948,11 +948,15 @@ sparc64_elf_plt_ptr_offset (index, max)
/* See above for details. */
- block = (index - LARGE_PLT_THRESHOLD) / 160;
- ofs = (index - LARGE_PLT_THRESHOLD) % 160;
- last = (max - LARGE_PLT_THRESHOLD) % 160;
+ block = (((index - LARGE_PLT_THRESHOLD) / 160) * 160)
+ + LARGE_PLT_THRESHOLD;
+ ofs = index - block;
+ if (block + 160 > max)
+ last = (max - LARGE_PLT_THRESHOLD) % 160;
+ else
+ last = 160;
- return ((LARGE_PLT_THRESHOLD + block*160) * PLT_ENTRY_SIZE
+ return (block * PLT_ENTRY_SIZE
+ last * 6*4
+ ofs * 8);
}
@@ -2566,7 +2570,8 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
{
int max = splt->_raw_size / PLT_ENTRY_SIZE;
rela.r_offset = sparc64_elf_plt_ptr_offset (h->plt.offset, max);
- rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4);
+ rela.r_addend = -(sparc64_elf_plt_entry_offset (h->plt.offset) + 4)
+ -(splt->output_section->vma + splt->output_offset);
}
rela.r_offset += (splt->output_section->vma + splt->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
@@ -2896,7 +2901,7 @@ const struct elf_size_info sparc64_elf_size_info =
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
- 8, /* hash-table entry size */
+ 4, /* hash-table entry size */
/* internal relocations per external relocations.
For link purposes we use just 1 internal per
1 external, for assembly and slurp symbol table