diff options
author | nobody <> | 1999-07-20 22:27:32 +0000 |
---|---|---|
committer | nobody <> | 1999-07-20 22:27:32 +0000 |
commit | f59527fdfff0315fe386cf150797856c098eaa45 (patch) | |
tree | 5c81995e4b0c159d50d64bc5e9d83f5af26f61f6 /bfd/elf.c | |
parent | 252b5132c753830d5fd56823373aed85f2a0db63 (diff) | |
download | gdb-binu_ss_19990721.zip gdb-binu_ss_19990721.tar.gz gdb-binu_ss_19990721.tar.bz2 |
This commit was manufactured by cvs2svn to create tag 'binu_ss_19990721'.binu_ss_19990721
Sprout from cygnus 1999-05-03 07:29:11 UTC Richard Henderson <rth@redhat.com> '19990502 sourceware import'
Cherrypick from master 1999-07-20 22:27:31 UTC Doug Evans <dje@google.com> ' * ldlang.c (lang_gc_sections): Only handle the start symbol':
ChangeLog
Makefile.in
bfd/ChangeLog
bfd/Makefile.am
bfd/Makefile.in
bfd/aclocal.m4
bfd/aix386-core.c
bfd/aout-adobe.c
bfd/aout-arm.c
bfd/aout-ns32k.c
bfd/aout-target.h
bfd/aout-tic30.c
bfd/aoutx.h
bfd/archive.c
bfd/archures.c
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/bfd.c
bfd/binary.c
bfd/bout.c
bfd/cisco-core.c
bfd/coff-a29k.c
bfd/coff-alpha.c
bfd/coff-apollo.c
bfd/coff-arm.c
bfd/coff-h8300.c
bfd/coff-h8500.c
bfd/coff-i386.c
bfd/coff-i860.c
bfd/coff-i960.c
bfd/coff-m68k.c
bfd/coff-m88k.c
bfd/coff-mcore.c
bfd/coff-mips.c
bfd/coff-ppc.c
bfd/coff-rs6000.c
bfd/coff-sh.c
bfd/coff-sparc.c
bfd/coff-stgo32.c
bfd/coff-tic30.c
bfd/coff-tic80.c
bfd/coff-w65.c
bfd/coff-we32k.c
bfd/coff-z8k.c
bfd/coffcode.h
bfd/coffgen.c
bfd/cofflink.c
bfd/coffswap.h
bfd/config.bfd
bfd/config.in
bfd/configure
bfd/configure.host
bfd/configure.in
bfd/cpu-arm.c
bfd/cpu-h8500.c
bfd/cpu-ns32k.c
bfd/cpu-w65.c
bfd/dwarf1.c
bfd/dwarf2.c
bfd/ecoff.c
bfd/ecofflink.c
bfd/elf-bfd.h
bfd/elf-hppa.h
bfd/elf-m10200.c
bfd/elf-m10300.c
bfd/elf.c
bfd/elf32-arc.c
bfd/elf32-arm.h
bfd/elf32-d10v.c
bfd/elf32-d30v.c
bfd/elf32-fr30.c
bfd/elf32-gen.c
bfd/elf32-hppa.c
bfd/elf32-hppa.h
bfd/elf32-i386.c
bfd/elf32-i860.c
bfd/elf32-i960.c
bfd/elf32-m32r.c
bfd/elf32-m68k.c
bfd/elf32-m88k.c
bfd/elf32-mcore.c
bfd/elf32-mips.c
bfd/elf32-ppc.c
bfd/elf32-sh.c
bfd/elf32-sparc.c
bfd/elf32-v850.c
bfd/elf64-alpha.c
bfd/elf64-gen.c
bfd/elf64-mips.c
bfd/elf64-sparc.c
bfd/elfarm-nabi.c
bfd/elfarm-oabi.c
bfd/elfcode.h
bfd/elflink.c
bfd/elflink.h
bfd/elfxx-target.h
bfd/epoc-pe-arm.c
bfd/epoc-pei-arm.c
bfd/hash.c
bfd/hosts/alphalinux.h
bfd/hp300hpux.c
bfd/hppabsd-core.c
bfd/hpux-core.c
bfd/i386linux.c
bfd/i386lynx.c
bfd/i386msdos.c
bfd/i386os9k.c
bfd/ieee.c
bfd/ihex.c
bfd/irix-core.c
bfd/libbfd-in.h
bfd/libbfd.c
bfd/libbfd.h
bfd/libhppa.h
bfd/linker.c
bfd/m68klinux.c
bfd/mipsbsd.c
bfd/netbsd-core.c
bfd/nlm-target.h
bfd/nlm32-ppc.c
bfd/nlm32-sparc.c
bfd/nlmcode.h
bfd/oasys.c
bfd/osf-core.c
bfd/pe-arm.c
bfd/pei-arm.c
bfd/peicode.h
bfd/po/POTFILES.in
bfd/po/bfd.pot
bfd/ppcboot.c
bfd/ptrace-core.c
bfd/reloc.c
bfd/riscix.c
bfd/sco5-core.c
bfd/section.c
bfd/som.c
bfd/sparclinux.c
bfd/srec.c
bfd/stabs.c
bfd/sunos.c
bfd/syms.c
bfd/targets.c
bfd/tekhex.c
bfd/trad-core.c
bfd/versados.c
bfd/vms-gsd.c
bfd/vms-hdr.c
bfd/vms-misc.c
bfd/vms-tir.c
bfd/vms.c
bfd/vms.h
bfd/xcofflink.c
binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/NEWS
binutils/addr2line.c
binutils/ar.c
binutils/arparse.y
binutils/arsup.c
binutils/binutils.texi
binutils/config.in
binutils/configure
binutils/configure.in
binutils/debug.c
binutils/deflex.l
binutils/defparse.y
binutils/dlltool.c
binutils/dllwrap.c
binutils/filemode.c
binutils/ieee.c
binutils/nm.c
binutils/objcopy.1
binutils/objcopy.c
binutils/objdump.c
binutils/po/POTFILES.in
binutils/po/binutils.pot
binutils/prdbg.c
binutils/rclex.l
binutils/rcparse.y
binutils/rdcoff.c
binutils/readelf.c
binutils/rename.c
binutils/rescoff.c
binutils/resrc.c
binutils/size.c
binutils/stabs.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/objdump.exp
binutils/testsuite/binutils-all/readelf.h
binutils/testsuite/binutils-all/readelf.r
binutils/testsuite/binutils-all/readelf.wi
binutils/windres.c
binutils/windres.h
binutils/wrstabs.c
config.guess
config.sub
configure
configure.in
gas/ChangeLog
gas/Makefile.am
gas/Makefile.in
gas/NEWS
gas/aclocal.m4
gas/app.c
gas/as.c
gas/as.h
gas/atof-generic.c
gas/cgen.c
gas/cond.c
gas/config/atof-ieee.c
gas/config/m68k-parse.h
gas/config/obj-aout.c
gas/config/obj-aout.h
gas/config/obj-bout.c
gas/config/obj-coff.c
gas/config/obj-coff.h
gas/config/obj-ecoff.c
gas/config/obj-ecoff.h
gas/config/obj-elf.c
gas/config/obj-elf.h
gas/config/obj-multi.h
gas/config/obj-vms.h
gas/config/tc-alpha.c
gas/config/tc-alpha.h
gas/config/tc-arc.c
gas/config/tc-arc.h
gas/config/tc-arm.c
gas/config/tc-arm.h
gas/config/tc-d10v.c
gas/config/tc-d30v.c
gas/config/tc-d30v.h
gas/config/tc-fr30.c
gas/config/tc-hppa.c
gas/config/tc-hppa.h
gas/config/tc-i386.c
gas/config/tc-i386.h
gas/config/tc-i860.c
gas/config/tc-i960.c
gas/config/tc-i960.h
gas/config/tc-m32r.c
gas/config/tc-m68k.c
gas/config/tc-m68k.h
gas/config/tc-m88k.c
gas/config/tc-mcore.c
gas/config/tc-mcore.h
gas/config/tc-mips.c
gas/config/tc-mips.h
gas/config/tc-mn10200.c
gas/config/tc-mn10300.c
gas/config/tc-ns32k.c
gas/config/tc-ns32k.h
gas/config/tc-ppc.c
gas/config/tc-ppc.h
gas/config/tc-sh.c
gas/config/tc-sh.h
gas/config/tc-sparc.c
gas/config/tc-sparc.h
gas/config/tc-tahoe.c
gas/config/tc-tic30.c
gas/config/tc-v850.c
gas/config/tc-vax.c
gas/config/tc-w65.c
gas/config/tc-z8k.c
gas/configure
gas/configure.in
gas/dep-in.sed
gas/doc/Makefile.in
gas/doc/c-arm.texi
gas/doc/c-sparc.texi
gas/doc/internals.texi
gas/dwarf2dbg.c
gas/dwarf2dbg.h
gas/ecoff.c
gas/ecoff.h
gas/expr.c
gas/expr.h
gas/frags.h
gas/gasp.c
gas/hash.c
gas/hash.h
gas/input-file.c
gas/itbl-ops.c
gas/itbl-ops.h
gas/listing.c
gas/macro.c
gas/po/POTFILES.in
gas/po/gas.pot
gas/read.c
gas/read.h
gas/stabs.c
gas/struc-symbol.h
gas/subsegs.c
gas/symbols.c
gas/symbols.h
gas/testsuite/ChangeLog
gas/testsuite/gas/all/itbl-test.c
gas/testsuite/gas/arm/arm7t.d
gas/testsuite/gas/arm/inst.d
gas/testsuite/gas/elf/elf.exp
gas/testsuite/gas/elf/section0.d
gas/testsuite/gas/elf/section0.s
gas/testsuite/gas/elf/section1.d
gas/testsuite/gas/elf/section1.s
gas/testsuite/gas/i386/amd.d
gas/testsuite/gas/i386/amd.s
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/katmai.d
gas/testsuite/gas/i386/katmai.s
gas/testsuite/gas/i386/opcode.d
gas/testsuite/gas/i386/prefix.d
gas/testsuite/gas/i386/prefix.s
gas/testsuite/gas/i386/reloc.d
gas/testsuite/gas/i386/reloc.s
gas/testsuite/gas/macros/irp.d
gas/testsuite/gas/macros/irp.s
gas/testsuite/gas/macros/rept.d
gas/testsuite/gas/macros/rept.s
gas/testsuite/gas/macros/test2.d
gas/testsuite/gas/macros/test2.s
gas/testsuite/gas/macros/test3.d
gas/testsuite/gas/macros/test3.s
gas/testsuite/gas/mcore/allinsn.d
gas/testsuite/gas/mips/elf_e_flags.c
gas/testsuite/gas/mips/elf_e_flags.s
gas/testsuite/gas/mips/elf_e_flags1.d
gas/testsuite/gas/mips/elf_e_flags2.d
gas/testsuite/gas/mips/elf_e_flags3.d
gas/testsuite/gas/mips/elf_e_flags4.d
gas/testsuite/gas/mips/sync.d
gas/testsuite/gas/sparc/prefetch.d
gas/testsuite/gas/sparc/rdpr.d
gas/testsuite/gas/sparc/reloc64.d
gas/testsuite/gas/sparc/set64.d
gas/testsuite/gas/sparc/set64.s
gas/testsuite/gas/sparc/sparc.exp
gas/testsuite/gas/sparc/synth64.d
gas/testsuite/gas/sparc/synth64.s
gas/testsuite/gas/sparc/wrpr.d
gas/testsuite/gas/vtable/vtable.exp
gas/write.c
gprof/ChangeLog
gprof/Makefile.am
gprof/Makefile.in
gprof/alpha.c
gprof/basic_blocks.c
gprof/call_graph.c
gprof/cg_dfn.c
gprof/configure
gprof/configure.in
gprof/corefile.c
gprof/gmon_io.c
gprof/gprof.texi
gprof/hist.c
gprof/i386.c
gprof/po/POTFILES.in
gprof/po/gprof.pot
gprof/sparc.c
gprof/sym_ids.c
gprof/symtab.c
gprof/tahoe.c
gprof/vax.c
include/ChangeLog
include/ansidecl.h
include/aout/ChangeLog
include/aout/aout64.h
include/bfdlink.h
include/coff/ChangeLog
include/coff/arm.h
include/coff/internal.h
include/coff/mcore.h
include/dis-asm.h
include/elf/ChangeLog
include/elf/arm.h
include/elf/common.h
include/elf/dwarf.h
include/elf/dwarf2.h
include/elf/hppa.h
include/elf/i960.h
include/elf/m68k.h
include/elf/mcore.h
include/elf/mips.h
include/elf/reloc-macros.h
include/elf/sparc.h
include/opcode/ChangeLog
include/opcode/hppa.h
include/opcode/i386.h
include/opcode/m68k.h
include/opcode/ppc.h
ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/NEWS
ld/configure
ld/configure.host
ld/configure.in
ld/configure.tgt
ld/emulparams/armelf.sh
ld/emulparams/armelf_linux.sh
ld/emulparams/armelf_oabi.sh
ld/emulparams/elf32_i960.sh
ld/emulparams/elf32bmipn32.sh
ld/emulparams/elf32mcore.sh
ld/emulparams/elf32ppclinux.sh
ld/emulparams/elf64_sparc.sh
ld/emulparams/elf64bmip.sh
ld/emulparams/mcorepe.sh
ld/emultempl/armcoff.em
ld/emultempl/armelf.em
ld/emultempl/armelf_oabi.em
ld/emultempl/elf32.em
ld/emultempl/linux.em
ld/emultempl/pe.em
ld/emultempl/sunos.em
ld/genscripts.sh
ld/ld.texinfo
ld/ldcref.c
ld/ldemul.c
ld/ldexp.c
ld/ldfile.c
ld/ldgram.y
ld/ldlang.c
ld/ldlang.h
ld/ldmain.c
ld/lexsup.c
ld/pe-dll.c
ld/po/POTFILES.in
ld/po/ld.pot
ld/scripttempl/armcoff.sc
ld/scripttempl/elf.sc
ld/scripttempl/mcorepe.sc
ld/scripttempl/pe.sc
ld/scripttempl/v850.sc
ld/testsuite/ChangeLog
ld/testsuite/ld-cdtest/cdtest-main.cc
ld/testsuite/ld-checks/asm.s
ld/testsuite/ld-checks/checks.exp
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-elfvers/vers17.c
ld/testsuite/ld-elfvers/vers17.dsym
ld/testsuite/ld-elfvers/vers17.map
ld/testsuite/ld-elfvers/vers17.ver
ld/testsuite/ld-elfvers/vers18.c
ld/testsuite/ld-elfvers/vers18.dsym
ld/testsuite/ld-elfvers/vers18.map
ld/testsuite/ld-elfvers/vers18.sym
ld/testsuite/ld-elfvers/vers18.ver
ld/testsuite/ld-elfvers/vers19.c
ld/testsuite/ld-elfvers/vers19.dsym
ld/testsuite/ld-elfvers/vers19.ver
ld/testsuite/ld-scripts/phdrs.exp
ld/testsuite/ld-scripts/weak.exp
ld/testsuite/ld-shared/sh1.c
ld/testsuite/ld-shared/shared.exp
ld/testsuite/ld-srec/srec.exp
ld/testsuite/ld-undefined/undefined.exp
ld/testsuite/lib/ld-lib.exp
libiberty/ChangeLog
libiberty/argv.c
libiberty/choose-temp.c
libiberty/configure
libiberty/configure.in
libiberty/cplus-dem.c
libiberty/getruntime.c
libiberty/splay-tree.c
opcodes/ChangeLog
opcodes/Makefile.am
opcodes/Makefile.in
opcodes/alpha-dis.c
opcodes/arm-dis.c
opcodes/dis-buf.c
opcodes/disassemble.c
opcodes/i386-dis.c
opcodes/m68k-dis.c
opcodes/m68k-opc.c
opcodes/mcore-dis.c
opcodes/mcore-opc.h
opcodes/po/POTFILES.in
opcodes/po/opcodes.pot
opcodes/sparc-dis.c
opcodes/sparc-opc.c
opcodes/tic30-dis.c
texinfo/texinfo.tex
Delete:
intl/ChangeLog.Cygnus
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 191 |
1 files changed, 120 insertions, 71 deletions
@@ -200,10 +200,12 @@ _bfd_elf_swap_versym_out (abfd, src, dst) /* Standard ELF hash function. Do not change this function; you will cause invalid hash tables to be generated. */ + unsigned long -bfd_elf_hash (name) - CONST unsigned char *name; +bfd_elf_hash (namearg) + const char *namearg; { + const unsigned char *name = (const unsigned char *) namearg; unsigned long h = 0; unsigned long g; int ch; @@ -503,13 +505,13 @@ bfd_elf_generic_reloc (abfd, input_section, output_bfd, error_message) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; arelent *reloc_entry; asymbol *symbol; - PTR data; + PTR data ATTRIBUTE_UNUSED; asection *input_section; bfd *output_bfd; - char **error_message; + char **error_message ATTRIBUTE_UNUSED; { if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0 @@ -944,7 +946,7 @@ bfd_elf_set_dt_needed_name (abfd, name) struct bfd_link_needed_list * bfd_elf_get_needed_list (abfd, info) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info; { if (info->hash->creator->flavour != bfd_target_elf_flavour) @@ -1201,6 +1203,15 @@ bfd_section_from_shdr (abfd, shindex) asection *target_sect; Elf_Internal_Shdr *hdr2; + /* Check for a bogus link to avoid crashing. */ + if (hdr->sh_link >= ehdr->e_shnum) + { + ((*_bfd_error_handler) + (_("%s: invalid link %lu for reloc section %s (index %u)"), + bfd_get_filename (abfd), hdr->sh_link, name, shindex)); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + } + /* For some incomprehensible reason Oracle distributes libraries for Solaris in which some of the objects have bogus sh_link fields. It would be nice if we could just @@ -1265,6 +1276,10 @@ bfd_section_from_shdr (abfd, shindex) target_sect->flags |= SEC_RELOC; target_sect->relocation = NULL; target_sect->rel_filepos = hdr->sh_offset; + /* In the section to which the relocations apply, mark whether + its relocations are of the REL or RELA variety. */ + elf_section_data (target_sect)->use_rela_p + = (hdr->sh_type == SHT_RELA); abfd->flags |= HAS_RELOC; return true; } @@ -1324,11 +1339,15 @@ _bfd_elf_new_section_hook (abfd, sec) { struct bfd_elf_section_data *sdata; - sdata = (struct bfd_elf_section_data *) bfd_alloc (abfd, sizeof (*sdata)); + sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, sizeof (*sdata)); if (!sdata) return false; sec->used_by_bfd = (PTR) sdata; - memset (sdata, 0, sizeof (*sdata)); + + /* Indicate whether or not this section should use RELA relocations. */ + sdata->use_rela_p + = get_elf_backend_data (abfd)->default_use_rela_p; + return true; } @@ -1423,6 +1442,43 @@ bfd_section_from_phdr (abfd, hdr, index) return true; } +/* Initialize REL_HDR, the section-header for new section, containing + relocations against ASECT. If USE_RELA_P is true, we use RELA + relocations; otherwise, we use REL relocations. */ + +boolean +_bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p) + bfd *abfd; + Elf_Internal_Shdr *rel_hdr; + asection *asect; + boolean use_rela_p; +{ + char *name; + struct elf_backend_data *bed; + + bed = get_elf_backend_data (abfd); + name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name)); + if (name == NULL) + return false; + sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name); + rel_hdr->sh_name = + (unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name, + true, false); + if (rel_hdr->sh_name == (unsigned int) -1) + return false; + rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL; + rel_hdr->sh_entsize = (use_rela_p + ? bed->s->sizeof_rela + : bed->s->sizeof_rel); + rel_hdr->sh_addralign = bed->s->file_align; + rel_hdr->sh_flags = 0; + rel_hdr->sh_addr = 0; + rel_hdr->sh_size = 0; + rel_hdr->sh_offset = 0; + + return true; +} + /* Set up an ELF internal section header for a section. */ /*ARGSUSED*/ @@ -1478,7 +1534,7 @@ elf_fake_sections (abfd, asect, failedptrarg) else if (strcmp (asect->name, ".hash") == 0) { this_hdr->sh_type = SHT_HASH; - this_hdr->sh_entsize = bed->s->arch_size / 8; + this_hdr->sh_entsize = bed->s->sizeof_hash_entry; } else if (strcmp (asect->name, ".dynsym") == 0) { @@ -1491,13 +1547,13 @@ elf_fake_sections (abfd, asect, failedptrarg) this_hdr->sh_entsize = bed->s->sizeof_dyn; } else if (strncmp (asect->name, ".rela", 5) == 0 - && get_elf_backend_data (abfd)->use_rela_p) + && get_elf_backend_data (abfd)->may_use_rela_p) { this_hdr->sh_type = SHT_RELA; this_hdr->sh_entsize = bed->s->sizeof_rela; } else if (strncmp (asect->name, ".rel", 4) == 0 - && ! get_elf_backend_data (abfd)->use_rela_p) + && get_elf_backend_data (abfd)->may_use_rel_p) { this_hdr->sh_type = SHT_REL; this_hdr->sh_entsize = bed->s->sizeof_rel; @@ -1558,47 +1614,19 @@ elf_fake_sections (abfd, asect, failedptrarg) this_hdr->sh_flags |= SHF_EXECINSTR; /* Check for processor-specific section types. */ - { - struct elf_backend_data *bed = get_elf_backend_data (abfd); - - if (bed->elf_backend_fake_sections) - (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect); - } + if (bed->elf_backend_fake_sections) + (*bed->elf_backend_fake_sections) (abfd, this_hdr, asect); /* If the section has relocs, set up a section header for the - SHT_REL[A] section. */ - if ((asect->flags & SEC_RELOC) != 0) - { - Elf_Internal_Shdr *rela_hdr; - int use_rela_p = get_elf_backend_data (abfd)->use_rela_p; - char *name; - - rela_hdr = &elf_section_data (asect)->rel_hdr; - name = bfd_alloc (abfd, sizeof ".rela" + strlen (asect->name)); - if (name == NULL) - { - *failedptr = true; - return; - } - sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name); - rela_hdr->sh_name = - (unsigned int) _bfd_stringtab_add (elf_shstrtab (abfd), name, - true, false); - if (rela_hdr->sh_name == (unsigned int) -1) - { - *failedptr = true; - return; - } - rela_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL; - rela_hdr->sh_entsize = (use_rela_p - ? bed->s->sizeof_rela - : bed->s->sizeof_rel); - rela_hdr->sh_addralign = bed->s->file_align; - rela_hdr->sh_flags = 0; - rela_hdr->sh_addr = 0; - rela_hdr->sh_size = 0; - rela_hdr->sh_offset = 0; - } + SHT_REL[A] section. If two relocation sections are required for + this section, it is up to the processor-specific back-end to + create the other. */ + if ((asect->flags & SEC_RELOC) != 0 + && !_bfd_elf_init_reloc_shdr (abfd, + &elf_section_data (asect)->rel_hdr, + asect, + elf_section_data (asect)->use_rela_p)) + *failedptr = true; } /* Assign all ELF section numbers. The dummy first section is handled here @@ -1626,6 +1654,11 @@ assign_section_numbers (abfd) d->rel_idx = 0; else d->rel_idx = section_number++; + + if (d->rel_hdr2) + d->rel_idx2 = section_number++; + else + d->rel_idx2 = 0; } t->shstrtab_section = section_number++; @@ -1674,6 +1707,8 @@ assign_section_numbers (abfd) i_shdrp[d->this_idx] = &d->this_hdr; if (d->rel_idx != 0) i_shdrp[d->rel_idx] = &d->rel_hdr; + if (d->rel_idx2 != 0) + i_shdrp[d->rel_idx2] = d->rel_hdr2; /* Fill in the sh_link and sh_info fields while we're at it. */ @@ -1685,6 +1720,11 @@ assign_section_numbers (abfd) d->rel_hdr.sh_link = t->symtab_section; d->rel_hdr.sh_info = d->this_idx; } + if (d->rel_idx2 != 0) + { + d->rel_hdr2->sh_link = t->symtab_section; + d->rel_hdr2->sh_info = d->this_idx; + } switch (d->this_hdr.sh_type) { @@ -2011,6 +2051,10 @@ _bfd_elf_compute_section_file_positions (abfd, link_info) if (! prep_headers (abfd)) return false; + /* Post process the headers if necessary. */ + if (bed->elf_backend_post_process_headers) + (*bed->elf_backend_post_process_headers) (abfd, link_info); + failed = false; bfd_map_over_sections (abfd, elf_fake_sections, &failed); if (failed) @@ -2514,11 +2558,7 @@ assign_file_positions_for_segments (abfd) elf_sort_sections); p->p_type = m->p_type; - - if (m->p_flags_valid) - p->p_flags = m->p_flags; - else - p->p_flags = 0; + p->p_flags = m->p_flags; if (p->p_type == PT_LOAD && m->count > 0 @@ -3042,6 +3082,9 @@ prep_headers (abfd) bfd_big_endian (abfd) ? ELFDATA2MSB : ELFDATA2LSB; i_ehdrp->e_ident[EI_VERSION] = bed->s->ev_current; + i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_SYSV; + i_ehdrp->e_ident[EI_ABIVERSION] = 0; + for (count = EI_PAD; count < EI_NIDENT; count++) i_ehdrp->e_ident[count] = 0; @@ -3077,6 +3120,9 @@ prep_headers (abfd) case bfd_arch_i860: i_ehdrp->e_machine = EM_860; break; + case bfd_arch_i960: + i_ehdrp->e_machine = EM_960; + break; case bfd_arch_mips: /* MIPS Rxxxx */ i_ehdrp->e_machine = EM_MIPS; /* only MIPS R3000 */ break; @@ -3827,6 +3873,9 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) || ihdr->sh_type == SHT_GNU_verdef) ohdr->sh_info = ihdr->sh_info; + elf_section_data (osec)->use_rela_p + = elf_section_data (isec)->use_rela_p; + return true; } @@ -4140,7 +4189,7 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd) long _bfd_elf_get_reloc_upper_bound (abfd, asect) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; sec_ptr asect; { return (asect->reloc_count + 1) * sizeof (arelent *); @@ -4471,7 +4520,7 @@ _bfd_elf_make_empty_symbol (abfd) void _bfd_elf_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd; + bfd *ignore_abfd ATTRIBUTE_UNUSED; asymbol *symbol; symbol_info *ret; { @@ -4484,7 +4533,7 @@ _bfd_elf_get_symbol_info (ignore_abfd, symbol, ret) boolean _bfd_elf_is_local_label_name (abfd, name) - bfd *abfd; + bfd *abfd ATTRIBUTE_UNUSED; const char *name; { /* Normal local symbols start with ``.L''. */ @@ -4510,8 +4559,8 @@ _bfd_elf_is_local_label_name (abfd, name) alent * _bfd_elf_get_lineno (ignore_abfd, symbol) - bfd *ignore_abfd; - asymbol *symbol; + bfd *ignore_abfd ATTRIBUTE_UNUSED; + asymbol *symbol ATTRIBUTE_UNUSED; { abort (); return NULL; @@ -4565,7 +4614,7 @@ _bfd_elf_find_nearest_line (abfd, if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset, filename_ptr, functionname_ptr, - line_ptr)) + line_ptr, 0)) return true; if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, @@ -4661,9 +4710,9 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count) void _bfd_elf_no_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd; - arelent *cache_ptr; - Elf_Internal_Rela *dst; + bfd *abfd ATTRIBUTE_UNUSED; + arelent *cache_ptr ATTRIBUTE_UNUSED; + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; { abort (); } @@ -4797,13 +4846,13 @@ _bfd_elf_close_and_cleanup (abfd) bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg) - bfd *abfd; - arelent *re; - struct symbol_cache_entry *symbol; - PTR data; - asection *is; - bfd *obfd; - char **errmsg; + bfd *abfd ATTRIBUTE_UNUSED; + arelent *re ATTRIBUTE_UNUSED; + struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED; + PTR data ATTRIBUTE_UNUSED; + asection *is ATTRIBUTE_UNUSED; + bfd *obfd ATTRIBUTE_UNUSED; + char **errmsg ATTRIBUTE_UNUSED; { return bfd_reloc_ok; } |