[Patch] sh64: Handle SHmedia PC-relative relocs as dynamic relocs

Clarke, Stephen stephen.clarke@superh.com
Fri Oct 11 17:02:00 GMT 2002


Seems this one has been overlooked thus far, so I'll take the
opportunity to update it ...

The original patch omitted the handling of pc-relative relocations
in sh_elf_gc_sweep_hook, so I've added that.

Since refcounting was introduced, it's necessary to handle some
SHmedia absolute relocations in sh_elf_check_relocs, for plt
refcounting when you're linking an absolute program to a shared
library, so I've added those too, together with the corresponding
additions to sh_elf_gc_sweep_hook.

Without this absolute relocation plt refcounting you got a linker
error, so I've added a test case for that (ld-sh/sh64/dsolink*),
which in turn requires a mechanism to create a dso to link
against.  Kojima-san recently added this to ld-sh/rd-sh.exp,
so I've duplicated his work in ld-sh/sh64/rd-sh64.exp.

The updated patch is attached.  The changelog info is:

bfd:

	* elf32-sh.c (sh_elf_relocate_section): Handle SHmedia
	PC-relative relocations as dynamic relocations.
	(sh_elf_gc_sweep_hook): Handle SHmedia PC-relative
	relocations and SHmedia R_SH_IMM_xxx absolute relocations.
	(sh_elf_check_relocs): Likewise.
	* elf64-sh64.c (sh_elf64_relocate_section): Handle SHmedia
	PC-relative relocations as dynamic relocations.
	(sh_elf64_check_relocs): Likewise.

ld/testsuite:

	* ld-sh/sh64/dsolink-0-dso.d, ld-sh/sh64/dsolink-1.d,
	ld-sh/sh64/dsolink-1.s, ld-sh/sh64/dsolinklib.s: New test.
	* ld-sh/sh64/rd-sh64.exp: Add the dso-creating functionality
	from ld-sh/rd-sh.exp.
	* ld-sh/sh64/shpcrel.d, ld-sh/sh64/shpcrel.s,
	ld-sh/sh64/shpcrel64.d, ld-sh/sh64/shpcrel64.s: New test.

Steve.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pcrel-patch.gz
Type: application/x-gzip
Size: 3730 bytes
Desc: pcrel-patch.gz
URL: <https://sourceware.org/pipermail/binutils/attachments/20021011/a7bfd281/attachment.bin>


More information about the Binutils mailing list