bfd/
* Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo. (BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c. (elf32-sh64-com.lo): New dependency list. * Makefile.in: Regenerate. * configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec) (bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add elf32-sh64-com.lo. * configure: Regenerate. * elf32-sh64.c (sh64_address_in_cranges) (sh64_get_contents_type, sh64_address_is_shmedia): Move to... (crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb): (crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to... * elf32-sh64-com.c: ...here. New file. include/elf/ * sh.h (_bfd_sh64_crange_qsort_cmpb, _bfd_sh64_crange_qsort_cmpl) (_bfd_sh64_crange_bsearch_cmpb, _bfd_sh64_crange_bsearch_cmpl): New prototypes.
This commit is contained in:
parent
a9a3a1846b
commit
9cba27b282
9 changed files with 331 additions and 271 deletions
|
@ -1,3 +1,19 @@
|
|||
2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
|
||||
|
||||
* Makefile.am (BFD32_BACKENDS): Add elf32-sh64-com.lo.
|
||||
(BFD32_BACKENDS_CFILES): Add elf32-sh64-com.c.
|
||||
(elf32-sh64-com.lo): New dependency list.
|
||||
* Makefile.in: Regenerate.
|
||||
* configure.in (bfd_elf32_sh64_vec, bfd_elf32_sh64l_vec)
|
||||
(bfd_elf32_sh64nbsd_vec, bfd_elf32_sh64lnbsd_vec): Add
|
||||
elf32-sh64-com.lo.
|
||||
* configure: Regenerate.
|
||||
* elf32-sh64.c (sh64_address_in_cranges)
|
||||
(sh64_get_contents_type, sh64_address_is_shmedia): Move to...
|
||||
(crange_qsort_cmpb, crange_qsort_cmpl, crange_bsearch_cmpb):
|
||||
(crange_bsearch_cmpl): Prepend _bfd_sh64_ to name and move to...
|
||||
* elf32-sh64-com.c: ...here. New file.
|
||||
|
||||
2002-06-04 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* elf32-openrisc.c (openrisc_elf_gc_mark_hook): Remove
|
||||
|
|
|
@ -229,6 +229,7 @@ BFD32_BACKENDS = \
|
|||
elf32-sh.lo \
|
||||
elf32-sh-lin.lo \
|
||||
elf32-sh64.lo \
|
||||
elf32-sh64-com.lo \
|
||||
elf32-sh-nbsd.lo \
|
||||
elf32-sh64-nbsd.lo \
|
||||
elf32-sparc.lo \
|
||||
|
@ -378,6 +379,7 @@ BFD32_BACKENDS_CFILES = \
|
|||
elf32-pj.c \
|
||||
elf32-ppc.c \
|
||||
elf32-sh64.c \
|
||||
elf32-sh64-com.c \
|
||||
elf32-s390.c \
|
||||
elf32-sh.c \
|
||||
elf32-sh-lin.c \
|
||||
|
@ -1197,11 +1199,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
|
|||
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
|
||||
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c $(INCDIR)/filenames.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
|
||||
elf32-sh64.c elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
|
||||
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
|
||||
|
@ -1218,6 +1219,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
|
|||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
|
||||
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
|
||||
|
@ -1491,10 +1497,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
|||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf64-target.h
|
||||
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf64-sh64.c elf64-target.h
|
||||
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
|
||||
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
|
||||
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
|
||||
|
|
|
@ -171,10 +171,10 @@ ALL_MACHINES_CFILES = cpu-a29k.c cpu-alpha.c cpu-arc.c cpu-arm.c cpu-avr.c
|
|||
|
||||
# The .o files needed by all of the 32 bit vectors that are configured into
|
||||
# target_vector in targets.c if configured with --enable-targets=all.
|
||||
BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo elf32-ia64.lo elf32-m32r.lo elf32-m68hc11.lo elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo elf32-sh64.lo elf32-sh-nbsd.lo elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo reloc16.lo riscix.lo sparclinux.lo sparclynx.lo sparcnetbsd.lo sunos.lo vaxnetbsd.lo versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo vms-tir.lo xcofflink.lo
|
||||
BFD32_BACKENDS = aout-adobe.lo aout-arm.lo aout-cris.lo aout-ns32k.lo aout-sparcle.lo aout-tic30.lo aout0.lo aout32.lo armnetbsd.lo bout.lo cf-i386lynx.lo cf-m68klynx.lo cf-sparclynx.lo coff-a29k.lo coff-apollo.lo coff-arm.lo coff-aux.lo coff-h8300.lo coff-h8500.lo coff-i386.lo coff-go32.lo coff-i860.lo coff-i960.lo coff-m68k.lo coff-m88k.lo coff-mips.lo coff-or32.lo coff-rs6000.lo coff-sh.lo coff-sparc.lo coff-stgo32.lo coff-svm68k.lo coff-tic30.lo coff-tic54x.lo coff-tic80.lo coff-u68k.lo coff-we32k.lo coff-w65.lo coff-z8k.lo cofflink.lo dwarf1.lo ecoff.lo ecofflink.lo efi-app-ia32.lo elf.lo elf32-arc.lo elfarm-oabi.lo elfarm-nabi.lo elf32-avr.lo elf32-cris.lo elf32-d10v.lo elf32-d30v.lo elf32-dlx.lo elf32-fr30.lo elf32-gen.lo elf32-h8300.lo elf32-hppa.lo elf32-i370.lo elf32-i386.lo elf32-i386qnx.lo elf32-i860.lo elf32-i960.lo elf32-ia64.lo elf32-m32r.lo elf32-m68hc11.lo elf32-m68hc12.lo elf32-m68k.lo elf32-m88k.lo elf-m10200.lo elf-m10300.lo elf32-mcore.lo elfxx-mips.lo elf32-mips.lo elf32-openrisc.lo elf32-or32.lo elf32-pj.lo elf32-ppc.lo elf32-s390.lo elf32-sh.lo elf32-sh-lin.lo elf32-sh64.lo elf32-sh64-com.lo elf32-sh-nbsd.lo elf32-sh64-nbsd.lo elf32-sparc.lo elf32-v850.lo elf32-vax.lo elf32-xstormy16.lo elf32.lo elflink.lo elf-strtab.lo elf-eh-frame.lo epoc-pe-arm.lo epoc-pei-arm.lo hp300bsd.lo hp300hpux.lo som.lo i386aout.lo i386bsd.lo i386dynix.lo i386freebsd.lo i386linux.lo i386lynx.lo i386msdos.lo i386netbsd.lo i386mach3.lo i386os9k.lo ieee.lo m68k4knetbsd.lo m68klinux.lo m68klynx.lo m68knetbsd.lo m88kmach3.lo mipsbsd.lo newsos3.lo nlm.lo nlm32-i386.lo nlm32-sparc.lo nlm32-ppc.lo nlm32.lo ns32knetbsd.lo oasys.lo pc532-mach.lo pdp11.lo pe-arm.lo pei-arm.lo pe-i386.lo pei-i386.lo pe-mcore.lo pei-mcore.lo pe-ppc.lo pei-ppc.lo pe-sh.lo pei-sh.lo pe-mips.lo pei-mips.lo peigen.lo ppcboot.lo reloc16.lo riscix.lo sparclinux.lo sparclynx.lo sparcnetbsd.lo sunos.lo vaxnetbsd.lo versados.lo vms.lo vms-gsd.lo vms-hdr.lo vms-misc.lo vms-tir.lo xcofflink.lo
|
||||
|
||||
|
||||
BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-go32.c coff-i960.c coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c coff-we32k.c coff-w65.c coff-z8k.c cofflink.c dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c elf32-fr30.c elf32-gen.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c elf32-i860.c elf32-i960.c elf32-m32r.c elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c elf32-ppc.c elf32-sh64.c elf32-s390.c elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32.c elflink.c elf-strtab.c elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c i386freebsd.c i386linux.c i386lynx.c i386msdos.c i386netbsd.c i386mach3.c i386os9k.c ieee.c m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c pei-mips.c ppcboot.c reloc16.c riscix.c sparclinux.c sparclynx.c sparcnetbsd.c sunos.c vaxnetbsd.c versados.c vms.c vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c
|
||||
BFD32_BACKENDS_CFILES = aout-adobe.c aout-arm.c aout-cris.c aout-ns32k.c aout-sparcle.c aout-tic30.c aout0.c aout32.c armnetbsd.c bout.c cf-i386lynx.c cf-m68klynx.c cf-sparclynx.c coff-a29k.c coff-apollo.c coff-arm.c coff-aux.c coff-h8300.c coff-h8500.c coff-i386.c coff-i860.c coff-go32.c coff-i960.c coff-m68k.c coff-m88k.c coff-mips.c coff-or32.c coff-rs6000.c coff-sh.c coff-sparc.c coff-stgo32.c coff-svm68k.c coff-tic30.c coff-tic54x.c coff-tic80.c coff-u68k.c coff-we32k.c coff-w65.c coff-z8k.c cofflink.c dwarf1.c ecoff.c ecofflink.c efi-app-ia32.c elf.c elf32-arc.c elfarm-oabi.c elfarm-nabi.c elf32-avr.c elf32-cris.c elf32-d10v.c elf32-d30v.c elf32-dlx.c elf32-fr30.c elf32-gen.c elf32-h8300.c elf32-hppa.c elf32-i370.c elf32-i386.c elf32-i386qnx.c elf32-i860.c elf32-i960.c elf32-m32r.c elf32-m68k.c elf32-m68hc11.c elf32-m68hc12.c elf32-m88k.c elf-m10200.c elf-m10300.c elf32-mcore.c elfxx-mips.c elf32-mips.c elf32-openrisc.c elf32-or32.c elf32-pj.c elf32-ppc.c elf32-sh64.c elf32-sh64-com.c elf32-s390.c elf32-sh.c elf32-sh-lin.c elf32-sh-nbsd.c elf32-sh64-nbsd.c elf32-sparc.c elf32-v850.c elf32-vax.c elf32-xstormy16.c elf32.c elflink.c elf-strtab.c elf-eh-frame.c epoc-pe-arm.c epoc-pei-arm.c hp300bsd.c hp300hpux.c som.c i386aout.c i386bsd.c i386dynix.c i386freebsd.c i386linux.c i386lynx.c i386msdos.c i386netbsd.c i386mach3.c i386os9k.c ieee.c m68k4knetbsd.c m68klinux.c m68klynx.c m68knetbsd.c m88kmach3.c mipsbsd.c newsos3.c nlm.c nlm32-i386.c nlm32-sparc.c nlm32-ppc.c nlm32.c ns32knetbsd.c oasys.c pc532-mach.c pdp11.c pe-arm.c pei-arm.c pe-i386.c pei-i386.c pe-mcore.c pei-mcore.c pe-ppc.c pei-ppc.c pe-sh.c pei-sh.c pe-mips.c pei-mips.c ppcboot.c reloc16.c riscix.c sparclinux.c sparclynx.c sparcnetbsd.c sunos.c vaxnetbsd.c versados.c vms.c vms-gsd.c vms-hdr.c vms-misc.c vms-tir.c xcofflink.c
|
||||
|
||||
|
||||
# The .o files needed by all of the 64 bit vectors that are configured into
|
||||
|
@ -1245,11 +1245,10 @@ elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
|
|||
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
|
||||
elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c $(INCDIR)/filenames.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
|
||||
elf32-sh64.c elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-sh64-com.lo: elf32-sh64-com.c $(INCDIR)/filenames.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h $(srcdir)/../opcodes/sh64-opc.h
|
||||
elf32-s390.lo: elf32-s390.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
|
||||
|
@ -1266,6 +1265,11 @@ elf32-sh-nbsd.lo: elf32-sh-nbsd.c elf32-sh.c $(INCDIR)/filenames.h \
|
|||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sh64-nbsd.lo: elf32-sh64-nbsd.c elf32-sh64.c \
|
||||
$(INCDIR)/filenames.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(srcdir)/../opcodes/sh64-opc.h elf32-sh.c $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sparc.h \
|
||||
|
@ -1539,10 +1543,10 @@ elf64-sh64.lo: elf64-sh64.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
|
|||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf64-target.h
|
||||
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c $(INCDIR)/filenames.h \
|
||||
$(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/elf/sh.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf64-sh64.c elf64-target.h
|
||||
elf64-sh64-nbsd.lo: elf64-sh64-nbsd.c elf64-sh64.c \
|
||||
$(INCDIR)/filenames.h $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf64-target.h
|
||||
elf64-sparc.lo: elf64-sparc.c $(INCDIR)/filenames.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h $(INCDIR)/opcode/sparc.h \
|
||||
|
|
8
bfd/configure
vendored
8
bfd/configure
vendored
|
@ -6095,12 +6095,12 @@ do
|
|||
# FIXME: We include cofflink.lo not because it's needed for
|
||||
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
|
||||
# which needs it but does not list it. Should be fixed in right place.
|
||||
bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
|
||||
|
|
|
@ -609,12 +609,12 @@ do
|
|||
# FIXME: We include cofflink.lo not because it's needed for
|
||||
# bfd_elf32_sh64[l]_vec, but because we include bfd_elf32_sh[l]_vec
|
||||
# which needs it but does not list it. Should be fixed in right place.
|
||||
bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf32_sh64l_vec) tb="$tb elf32-sh64.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" target_size=64 ;;
|
||||
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf64_sh64l_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64nbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf32_sh64lnbsd_vec) tb="$tb elf32-sh64-nbsd.lo elf32-sh64-com.lo elf32.lo $elf cofflink.lo" ;;
|
||||
bfd_elf64_sh64nbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf64_sh64lnbsd_vec) tb="$tb elf64-sh64-nbsd.lo elf64.lo $elf" target_size=64 ;;
|
||||
bfd_elf32_sparc_vec) tb="$tb elf32-sparc.lo elf32.lo $elf" ;;
|
||||
|
|
264
bfd/elf32-sh64-com.c
Normal file
264
bfd/elf32-sh64-com.c
Normal file
|
@ -0,0 +1,264 @@
|
|||
/* Hitachi SH64-specific support for 32-bit ELF
|
||||
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define SH64_ELF
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "elf/sh.h"
|
||||
#include "../opcodes/sh64-opc.h"
|
||||
|
||||
static boolean sh64_address_in_cranges
|
||||
PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *));
|
||||
|
||||
/* Ordering functions of a crange, for the qsort and bsearch calls and for
|
||||
different endianness. */
|
||||
|
||||
int
|
||||
_bfd_sh64_crange_qsort_cmpb (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = bfd_getb32 (p1);
|
||||
bfd_vma a2 = bfd_getb32 (p2);
|
||||
|
||||
/* Preserve order if there's ambiguous contents. */
|
||||
if (a1 == a2)
|
||||
return (char *) p1 - (char *) p2;
|
||||
|
||||
return a1 - a2;
|
||||
}
|
||||
|
||||
int
|
||||
_bfd_sh64_crange_qsort_cmpl (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = (bfd_vma) bfd_getl32 (p1);
|
||||
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
|
||||
|
||||
/* Preserve order if there's ambiguous contents. */
|
||||
if (a1 == a2)
|
||||
return (char *) p1 - (char *) p2;
|
||||
|
||||
return a1 - a2;
|
||||
}
|
||||
|
||||
int
|
||||
_bfd_sh64_crange_bsearch_cmpb (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = *(bfd_vma *) p1;
|
||||
bfd_vma a2 = (bfd_vma) bfd_getb32 (p2);
|
||||
bfd_size_type size
|
||||
= (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
|
||||
|
||||
if (a1 >= a2 + size)
|
||||
return 1;
|
||||
if (a1 < a2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
_bfd_sh64_crange_bsearch_cmpl (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = *(bfd_vma *) p1;
|
||||
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
|
||||
bfd_size_type size
|
||||
= (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
|
||||
|
||||
if (a1 >= a2 + size)
|
||||
return 1;
|
||||
if (a1 < a2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check whether a specific address is specified within a .cranges
|
||||
section. Return FALSE if not found, and TRUE if found, and the region
|
||||
filled into RANGEP if non-NULL. */
|
||||
|
||||
static boolean
|
||||
sh64_address_in_cranges (cranges, addr, rangep)
|
||||
asection *cranges;
|
||||
bfd_vma addr;
|
||||
sh64_elf_crange *rangep;
|
||||
{
|
||||
bfd_byte *cranges_contents;
|
||||
bfd_byte *found_rangep;
|
||||
bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges);
|
||||
|
||||
/* If the size is not a multiple of the cranges entry size, then
|
||||
something is badly wrong. */
|
||||
if ((cranges_size % SH64_CRANGE_SIZE) != 0)
|
||||
return false;
|
||||
|
||||
/* If this section has relocations, then we can't do anything sane. */
|
||||
if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC)
|
||||
return false;
|
||||
|
||||
/* Has some kind soul (or previous call) left processed, sorted contents
|
||||
for us? */
|
||||
if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY)
|
||||
&& elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED)
|
||||
cranges_contents = cranges->contents;
|
||||
else
|
||||
{
|
||||
cranges_contents
|
||||
= bfd_malloc (cranges->_cooked_size == 0
|
||||
? cranges->_cooked_size : cranges->_raw_size);
|
||||
if (cranges_contents == NULL)
|
||||
return false;
|
||||
|
||||
if (! bfd_get_section_contents (cranges->owner, cranges,
|
||||
cranges_contents, (file_ptr) 0,
|
||||
cranges_size))
|
||||
goto error_return;
|
||||
|
||||
/* Is it sorted? */
|
||||
if (elf_section_data (cranges)->this_hdr.sh_type
|
||||
!= SHT_SH5_CR_SORTED)
|
||||
/* Nope. Lets sort it. */
|
||||
qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE,
|
||||
SH64_CRANGE_SIZE,
|
||||
bfd_big_endian (cranges->owner)
|
||||
? _bfd_sh64_crange_qsort_cmpb : _bfd_sh64_crange_qsort_cmpl);
|
||||
|
||||
/* Let's keep it around. */
|
||||
cranges->contents = cranges_contents;
|
||||
bfd_set_section_flags (cranges->owner, cranges,
|
||||
bfd_get_section_flags (cranges->owner, cranges)
|
||||
| SEC_IN_MEMORY);
|
||||
|
||||
/* It's sorted now. */
|
||||
elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED;
|
||||
}
|
||||
|
||||
/* Try and find a matching range. */
|
||||
found_rangep
|
||||
= bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE,
|
||||
SH64_CRANGE_SIZE,
|
||||
bfd_big_endian (cranges->owner)
|
||||
? _bfd_sh64_crange_bsearch_cmpb
|
||||
: _bfd_sh64_crange_bsearch_cmpl);
|
||||
|
||||
/* Fill in a few return values if we found a matching range. */
|
||||
if (found_rangep)
|
||||
{
|
||||
enum sh64_elf_cr_type cr_type
|
||||
= bfd_get_16 (cranges->owner,
|
||||
SH64_CRANGE_CR_TYPE_OFFSET + found_rangep);
|
||||
bfd_vma cr_addr
|
||||
= bfd_get_32 (cranges->owner,
|
||||
SH64_CRANGE_CR_ADDR_OFFSET
|
||||
+ (char *) found_rangep);
|
||||
bfd_size_type cr_size
|
||||
= bfd_get_32 (cranges->owner,
|
||||
SH64_CRANGE_CR_SIZE_OFFSET
|
||||
+ (char *) found_rangep);
|
||||
|
||||
rangep->cr_addr = cr_addr;
|
||||
rangep->cr_size = cr_size;
|
||||
rangep->cr_type = cr_type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* There is a .cranges section, but it does not have a descriptor
|
||||
matching this address. */
|
||||
return false;
|
||||
|
||||
error_return:
|
||||
free (cranges_contents);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Determine what ADDR points to in SEC, and fill in a range descriptor in
|
||||
*RANGEP if it's non-NULL. */
|
||||
|
||||
enum sh64_elf_cr_type
|
||||
sh64_get_contents_type (sec, addr, rangep)
|
||||
asection *sec;
|
||||
bfd_vma addr;
|
||||
sh64_elf_crange *rangep;
|
||||
{
|
||||
asection *cranges;
|
||||
|
||||
/* Fill in the range with the boundaries of the section as a default. */
|
||||
if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
|
||||
&& elf_elfheader (sec->owner)->e_type == ET_EXEC)
|
||||
{
|
||||
rangep->cr_addr = bfd_get_section_vma (sec->owner, sec);
|
||||
rangep->cr_size = bfd_section_size (sec->owner, sec);
|
||||
rangep->cr_type = CRT_NONE;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
/* If none of the pertinent bits are set, then it's a SHcompact (or at
|
||||
least not SHmedia). */
|
||||
if ((elf_section_data (sec)->this_hdr.sh_flags
|
||||
& (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0)
|
||||
{
|
||||
enum sh64_elf_cr_type cr_type
|
||||
= ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0
|
||||
? CRT_SH5_ISA16 : CRT_DATA);
|
||||
rangep->cr_type = cr_type;
|
||||
return cr_type;
|
||||
}
|
||||
|
||||
/* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */
|
||||
if ((elf_section_data (sec)->this_hdr.sh_flags
|
||||
& (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32)
|
||||
{
|
||||
rangep->cr_type = CRT_SH5_ISA32;
|
||||
return CRT_SH5_ISA32;
|
||||
}
|
||||
|
||||
/* Otherwise, we have to look up the .cranges section. */
|
||||
cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME);
|
||||
|
||||
if (cranges == NULL)
|
||||
/* A mixed section but there's no .cranges section. This is probably
|
||||
bad input; it does not comply to specs. */
|
||||
return CRT_NONE;
|
||||
|
||||
/* If this call fails, we will still have CRT_NONE in rangep->cr_type
|
||||
and that will be suitable to return. */
|
||||
sh64_address_in_cranges (cranges, addr, rangep);
|
||||
|
||||
return rangep->cr_type;
|
||||
}
|
||||
|
||||
/* This is a simpler exported interface for the benefit of gdb et al. */
|
||||
|
||||
boolean
|
||||
sh64_address_is_shmedia (sec, addr)
|
||||
asection *sec;
|
||||
bfd_vma addr;
|
||||
{
|
||||
sh64_elf_crange dummy;
|
||||
return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32;
|
||||
}
|
245
bfd/elf32-sh64.c
245
bfd/elf32-sh64.c
|
@ -105,15 +105,6 @@ static void sh64_find_section_for_address PARAMS ((bfd *, asection *, PTR));
|
|||
#define INCLUDE_SHMEDIA
|
||||
#include "elf32-sh.c"
|
||||
|
||||
/* The type sh64_elf_crange is defined in elf/sh.h which is included in
|
||||
elf32-sh.c, hence these prototypes located after including it. */
|
||||
static int crange_qsort_cmpb PARAMS ((const void *, const void *));
|
||||
static int crange_qsort_cmpl PARAMS ((const void *, const void *));
|
||||
static int crange_bsearch_cmpb PARAMS ((const void *, const void *));
|
||||
static int crange_bsearch_cmpl PARAMS ((const void *, const void *));
|
||||
static boolean sh64_address_in_cranges
|
||||
PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *));
|
||||
|
||||
/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections, and pass
|
||||
through SHT_SH5_CR_SORTED on a sorted .cranges section. */
|
||||
|
||||
|
@ -731,7 +722,8 @@ sh64_elf_final_write_processing (abfd, linker)
|
|||
qsort (cranges->contents, cranges_size / SH64_CRANGE_SIZE,
|
||||
SH64_CRANGE_SIZE,
|
||||
bfd_big_endian (cranges->owner)
|
||||
? crange_qsort_cmpb : crange_qsort_cmpl);
|
||||
? _bfd_sh64_crange_qsort_cmpb
|
||||
: _bfd_sh64_crange_qsort_cmpl);
|
||||
elf_section_data (cranges)->this_hdr.sh_type
|
||||
= SHT_SH5_CR_SORTED;
|
||||
}
|
||||
|
@ -750,236 +742,3 @@ sh64_elf_final_write_processing (abfd, linker)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ordering functions of a crange, for the qsort and bsearch calls and for
|
||||
different endianness. */
|
||||
|
||||
static int
|
||||
crange_qsort_cmpb (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = bfd_getb32 (p1);
|
||||
bfd_vma a2 = bfd_getb32 (p2);
|
||||
|
||||
/* Preserve order if there's ambiguous contents. */
|
||||
if (a1 == a2)
|
||||
return (char *) p1 - (char *) p2;
|
||||
|
||||
return a1 - a2;
|
||||
}
|
||||
|
||||
static int
|
||||
crange_qsort_cmpl (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = (bfd_vma) bfd_getl32 (p1);
|
||||
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
|
||||
|
||||
/* Preserve order if there's ambiguous contents. */
|
||||
if (a1 == a2)
|
||||
return (char *) p1 - (char *) p2;
|
||||
|
||||
return a1 - a2;
|
||||
}
|
||||
|
||||
static int
|
||||
crange_bsearch_cmpb (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = *(bfd_vma *) p1;
|
||||
bfd_vma a2 = (bfd_vma) bfd_getb32 (p2);
|
||||
bfd_size_type size
|
||||
= (bfd_size_type) bfd_getb32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
|
||||
|
||||
if (a1 >= a2 + size)
|
||||
return 1;
|
||||
if (a1 < a2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
crange_bsearch_cmpl (p1, p2)
|
||||
const PTR p1;
|
||||
const PTR p2;
|
||||
{
|
||||
bfd_vma a1 = *(bfd_vma *) p1;
|
||||
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
|
||||
bfd_size_type size
|
||||
= (bfd_size_type) bfd_getl32 (SH64_CRANGE_CR_SIZE_OFFSET + (char *) p2);
|
||||
|
||||
if (a1 >= a2 + size)
|
||||
return 1;
|
||||
if (a1 < a2)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check whether a specific address is specified within a .cranges
|
||||
section. Return FALSE if not found, and TRUE if found, and the region
|
||||
filled into RANGEP if non-NULL. */
|
||||
|
||||
static boolean
|
||||
sh64_address_in_cranges (cranges, addr, rangep)
|
||||
asection *cranges;
|
||||
bfd_vma addr;
|
||||
sh64_elf_crange *rangep;
|
||||
{
|
||||
bfd_byte *cranges_contents;
|
||||
bfd_byte *found_rangep;
|
||||
bfd_size_type cranges_size = bfd_section_size (cranges->owner, cranges);
|
||||
|
||||
/* If the size is not a multiple of the cranges entry size, then
|
||||
something is badly wrong. */
|
||||
if ((cranges_size % SH64_CRANGE_SIZE) != 0)
|
||||
return false;
|
||||
|
||||
/* If this section has relocations, then we can't do anything sane. */
|
||||
if (bfd_get_section_flags (cranges->owner, cranges) & SEC_RELOC)
|
||||
return false;
|
||||
|
||||
/* Has some kind soul (or previous call) left processed, sorted contents
|
||||
for us? */
|
||||
if ((bfd_get_section_flags (cranges->owner, cranges) & SEC_IN_MEMORY)
|
||||
&& elf_section_data (cranges)->this_hdr.sh_type == SHT_SH5_CR_SORTED)
|
||||
cranges_contents = cranges->contents;
|
||||
else
|
||||
{
|
||||
cranges_contents
|
||||
= bfd_malloc (cranges->_cooked_size == 0
|
||||
? cranges->_cooked_size : cranges->_raw_size);
|
||||
if (cranges_contents == NULL)
|
||||
return false;
|
||||
|
||||
if (! bfd_get_section_contents (cranges->owner, cranges,
|
||||
cranges_contents, (file_ptr) 0,
|
||||
cranges_size))
|
||||
goto error_return;
|
||||
|
||||
/* Is it sorted? */
|
||||
if (elf_section_data (cranges)->this_hdr.sh_type
|
||||
!= SHT_SH5_CR_SORTED)
|
||||
/* Nope. Lets sort it. */
|
||||
qsort (cranges_contents, cranges_size / SH64_CRANGE_SIZE,
|
||||
SH64_CRANGE_SIZE,
|
||||
bfd_big_endian (cranges->owner)
|
||||
? crange_qsort_cmpb : crange_qsort_cmpl);
|
||||
|
||||
/* Let's keep it around. */
|
||||
cranges->contents = cranges_contents;
|
||||
bfd_set_section_flags (cranges->owner, cranges,
|
||||
bfd_get_section_flags (cranges->owner, cranges)
|
||||
| SEC_IN_MEMORY);
|
||||
|
||||
/* It's sorted now. */
|
||||
elf_section_data (cranges)->this_hdr.sh_type = SHT_SH5_CR_SORTED;
|
||||
}
|
||||
|
||||
/* Try and find a matching range. */
|
||||
found_rangep
|
||||
= bsearch (&addr, cranges_contents, cranges_size / SH64_CRANGE_SIZE,
|
||||
SH64_CRANGE_SIZE,
|
||||
bfd_big_endian (cranges->owner)
|
||||
? crange_bsearch_cmpb : crange_bsearch_cmpl);
|
||||
|
||||
/* Fill in a few return values if we found a matching range. */
|
||||
if (found_rangep)
|
||||
{
|
||||
enum sh64_elf_cr_type cr_type
|
||||
= bfd_get_16 (cranges->owner,
|
||||
SH64_CRANGE_CR_TYPE_OFFSET + found_rangep);
|
||||
bfd_vma cr_addr
|
||||
= bfd_get_32 (cranges->owner,
|
||||
SH64_CRANGE_CR_ADDR_OFFSET
|
||||
+ (char *) found_rangep);
|
||||
bfd_size_type cr_size
|
||||
= bfd_get_32 (cranges->owner,
|
||||
SH64_CRANGE_CR_SIZE_OFFSET
|
||||
+ (char *) found_rangep);
|
||||
|
||||
rangep->cr_addr = cr_addr;
|
||||
rangep->cr_size = cr_size;
|
||||
rangep->cr_type = cr_type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* There is a .cranges section, but it does not have a descriptor
|
||||
matching this address. */
|
||||
return false;
|
||||
|
||||
error_return:
|
||||
free (cranges_contents);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Determine what ADDR points to in SEC, and fill in a range descriptor in
|
||||
*RANGEP if it's non-NULL. */
|
||||
|
||||
enum sh64_elf_cr_type
|
||||
sh64_get_contents_type (sec, addr, rangep)
|
||||
asection *sec;
|
||||
bfd_vma addr;
|
||||
sh64_elf_crange *rangep;
|
||||
{
|
||||
asection *cranges;
|
||||
|
||||
/* Fill in the range with the boundaries of the section as a default. */
|
||||
if (bfd_get_flavour (sec->owner) == bfd_target_elf_flavour
|
||||
&& elf_elfheader (sec->owner)->e_type == ET_EXEC)
|
||||
{
|
||||
rangep->cr_addr = bfd_get_section_vma (sec->owner, sec);
|
||||
rangep->cr_size = bfd_section_size (sec->owner, sec);
|
||||
rangep->cr_type = CRT_NONE;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
/* If none of the pertinent bits are set, then it's a SHcompact (or at
|
||||
least not SHmedia). */
|
||||
if ((elf_section_data (sec)->this_hdr.sh_flags
|
||||
& (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == 0)
|
||||
{
|
||||
enum sh64_elf_cr_type cr_type
|
||||
= ((bfd_get_section_flags (sec->owner, sec) & SEC_CODE) != 0
|
||||
? CRT_SH5_ISA16 : CRT_DATA);
|
||||
rangep->cr_type = cr_type;
|
||||
return cr_type;
|
||||
}
|
||||
|
||||
/* If only the SHF_SH5_ISA32 bit is set, then we have SHmedia. */
|
||||
if ((elf_section_data (sec)->this_hdr.sh_flags
|
||||
& (SHF_SH5_ISA32 | SHF_SH5_ISA32_MIXED)) == SHF_SH5_ISA32)
|
||||
{
|
||||
rangep->cr_type = CRT_SH5_ISA32;
|
||||
return CRT_SH5_ISA32;
|
||||
}
|
||||
|
||||
/* Otherwise, we have to look up the .cranges section. */
|
||||
cranges = bfd_get_section_by_name (sec->owner, SH64_CRANGES_SECTION_NAME);
|
||||
|
||||
if (cranges == NULL)
|
||||
/* A mixed section but there's no .cranges section. This is probably
|
||||
bad input; it does not comply to specs. */
|
||||
return CRT_NONE;
|
||||
|
||||
/* If this call fails, we will still have CRT_NONE in rangep->cr_type
|
||||
and that will be suitable to return. */
|
||||
sh64_address_in_cranges (cranges, addr, rangep);
|
||||
|
||||
return rangep->cr_type;
|
||||
}
|
||||
|
||||
/* This is a simpler exported interface for the benefit of gdb et al. */
|
||||
|
||||
boolean
|
||||
sh64_address_is_shmedia (sec, addr)
|
||||
asection *sec;
|
||||
bfd_vma addr;
|
||||
{
|
||||
sh64_elf_crange dummy;
|
||||
return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2002-06-04 Jason Thorpe <thorpej@wasabisystems.com>
|
||||
|
||||
* sh.h (_bfd_sh64_crange_qsort_cmpb, _bfd_sh64_crange_qsort_cmpl)
|
||||
(_bfd_sh64_crange_bsearch_cmpb, _bfd_sh64_crange_bsearch_cmpl): New
|
||||
prototypes.
|
||||
|
||||
2002-06-01 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* alpha.h (LITUSE_ALPHA_ADDR, LITUSE_ALPHA_BASE, LITUSE_ALPHA_BYTOFF,
|
||||
|
|
|
@ -108,6 +108,11 @@ extern enum sh64_elf_cr_type sh64_get_contents_type
|
|||
FIXME: This seems redundant now that we export the interface above. */
|
||||
extern boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma));
|
||||
|
||||
extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *));
|
||||
extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *));
|
||||
extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *));
|
||||
extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *));
|
||||
|
||||
/* We put this in elf_section_data (section)->tdata. */
|
||||
struct sh64_section_data
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue