* config.in: Regenerate.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
Merge from mainline
2002-03-27 Gregory Steuck <greg@nest.cx>
* elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
terminating NULL if empty symbol table.
(_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
2002-03-26 Alan Modra <amodra@bigpond.net.au>
* elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
2002-03-23 Alan Modra <amodra@bigpond.net.au>
* elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
section file offset for !SEC_LOAD sections.
2002-03-20 Daniel Jacobowitz <drow@mvista.com>
* dwarf2.c (struct funcinfo): Move up.
(lookup_address_in_function_table): New argument function_ptr.
Set it.
(lookup_address_in_line_table): New argument function. If function
is non-NULL, use it to handle ``addr'' before the first line note of
the function.
(comp_unit_find_nearest_line): Update and swap calls to
lookup_address_in_function_table and lookup_address_in_line_table.
* syms.c (_bfd_stab_section_find_nearest_line): Use the first
N_SLINE encountered if we see an N_FUN before any N_SLINE.
2002-03-18 Alan Modra <amodra@bigpond.net.au>
* libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
* libbfd.h: Regenerate.
* archive.c (coff_write_armap): Pass on failures from
bfd_write_bigendian_4byte_int.
2002-03-14 H.J. Lu <hjl@gnu.org>
* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
error to bfd_error_nonrepresentable_section for reinit_array
section in DSO.
2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
* coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
OR it in rather than replacing previously selected flags.
* elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
(TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
2002-03-14 Alan Modra <amodra@bigpond.net.au>
* elflink.h (elf_bfd_final_link): Revert last change. Instead,
ensure reloc size matches before calling elf_link_input_bfd.
Add an assert to check reloc size when counting output relocs.
2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
* mmo.c (mmo_get_loc): Return NULL rather than false.
2002-03-13 Alan Modra <amodra@bigpond.net.au>
* elflink.h: Formatting fixes.
(elf_link_output_extsym): Merge undefined and undef weak cases.
* elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
when word size of input matches output word size.
2002-03-07 H.J. Lu (hjl@gnu.org)
* coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type
as the type for bfd_reloc_val.
2002-03-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
* elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function.
(elf_hppa_relocate_section): Ignore undefined dynamic loader symbols.
(elf_hppa_final_link_relocate): Correct relocations for indirect
references to local data through the DLT. Fix .opd creation for
local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64
relocations. Use e_lsel selector for R_PARISC_DLTIND21L,
R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per
"Processor-Specific ELF for PA_RISC, Version 1.43" document.
Similarly, use e_rsel for DLT and LTOFF 'R' relocations.
* elf32-hppa.c (final_link_relocate): Revise relocation selectors
as per "Processor-Specific ELF for PA_RISC, Version 1.43" document.
2002-03-05 Jakub Jelinek <jakub@redhat.com>
* merge.c (_bfd_merge_sections): Don't segfault if there
is nothing to merge due to GC.
2002-03-05 Alan Modra <amodra@bigpond.net.au>
* elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep
symbols that have been forced local.
* elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
to output forced local syms for non-shared link.
(elf_link_output_extsym): Tweak condition for calling backend
adjust_dynamic_symbol so that previous behaviour is kept.
Whitespace changes throughout file.
2002-03-04 H.J. Lu <hjl@gnu.org>
* elf.c (bfd_section_from_shdr): Handle special sections,
.init_array, .fini_array and .preinit_array.
(elf_fake_sections): Likewise.
* elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the
DT entry only if the section is in output for .init_array,
.fini_array and .preinit_array. Complain about .preinit_array
section in DSO.
(elf_bfd_final_link): Warn zero size for .init_array,
.fini_array and .preinit_array sections.
* elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove
SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
(elfNN_ia64_fake_sections): Remove .init_array, .fini_array and
.preinit_array.
2002-03-01 David Mosberger <davidm@hpl.hp.com>
* elflink.h (size_dynamic_sections): If section named
".preinit_array" exists, create DT_PREINIT_ARRAY and
DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for
".init_array" and ".fini_array".
(elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ,
DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and
DT_FINI_ARRAY.
2002-02-19 Frank Ch. Eigler <fche@redhat.com>
* syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
* elf.c (_bfd_elf_make_section_from_shdr): Do not insist on
non-zero physical addresses when adjusting the LMAs of new
sections.
2002-02-11 Michael Snyder <msnyder@redhat.com>
* elf-bfd.h (elfcore_write_lwpstatus): Add prototype.
* elf.c (elfcore_grok_pstatus): Add prototype.
(elfcore_grok_lwpstatus): Add prototype.
(elfcore_write_lwpstatus): New function.
(elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy.
+2002-03-28 Alan Modra <amodra@bigpond.net.au>
+
+ * aclocal.m4: Regenerate.
+ * config.in: Regenerate.
+ * Makefile.am: Run "make dep-am".
+ * Makefile.in: Regenerate.
+
+ Merge from mainline
+ 2002-03-27 Gregory Steuck <greg@nest.cx>
+ * elf.c (_bfd_elf_get_symtab_upper_bound): Leave space for
+ terminating NULL if empty symbol table.
+ (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
+
+ 2002-03-26 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h (elf_gc_mark): Don't recurse into non-ELF sections.
+
+ 2002-03-23 Alan Modra <amodra@bigpond.net.au>
+ * elf.c (_bfd_elf_make_section_from_shdr): Don't set lma based on
+ section file offset for !SEC_LOAD sections.
+
+ 2002-03-20 Daniel Jacobowitz <drow@mvista.com>
+ * dwarf2.c (struct funcinfo): Move up.
+ (lookup_address_in_function_table): New argument function_ptr.
+ Set it.
+ (lookup_address_in_line_table): New argument function. If function
+ is non-NULL, use it to handle ``addr'' before the first line note of
+ the function.
+ (comp_unit_find_nearest_line): Update and swap calls to
+ lookup_address_in_function_table and lookup_address_in_line_table.
+ * syms.c (_bfd_stab_section_find_nearest_line): Use the first
+ N_SLINE encountered if we see an N_FUN before any N_SLINE.
+
+ 2002-03-18 Alan Modra <amodra@bigpond.net.au>
+ * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
+ * libbfd.h: Regenerate.
+ * archive.c (coff_write_armap): Pass on failures from
+ bfd_write_bigendian_4byte_int.
+
+ 2002-03-14 H.J. Lu <hjl@gnu.org>
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Set the BFD
+ error to bfd_error_nonrepresentable_section for reinit_array
+ section in DSO.
+
+ 2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+ * coffcode.h (coff_slurp_symbol_table): When adding BSF_WEAK flag,
+ OR it in rather than replacing previously selected flags.
+ * elfxx-target.h (TARGET_BIG_SYM): Set ar_max_namelen to 15.
+ (TARGET_LITTLE_SYM): Set ar_max_namelen to 15.
+
+ 2002-03-14 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h (elf_bfd_final_link): Revert last change. Instead,
+ ensure reloc size matches before calling elf_link_input_bfd.
+ Add an assert to check reloc size when counting output relocs.
+
+ 2002-03-14 Nick Clifton <nickc@cambridge.redhat.com>
+ * mmo.c (mmo_get_loc): Return NULL rather than false.
+
+ 2002-03-13 Alan Modra <amodra@bigpond.net.au>
+ * elflink.h: Formatting fixes.
+ (elf_link_output_extsym): Merge undefined and undef weak cases.
+ * elflink.h (elf_bfd_final_link): Only call elf_link_input_bfd
+ when word size of input matches output word size.
+
+ 2002-03-07 H.J. Lu (hjl@gnu.org)
+ * coff-sh.c (shcoff_reloc_map): Use bfd_reloc_code_real_type
+ as the type for bfd_reloc_val.
+
+ 2002-03-05 John David Anglin <dave@hiauly1.hia.nrc.ca>
+ * elf-hppa.h (elf_hppa_is_dynamic_loader_symbol): New function.
+ (elf_hppa_relocate_section): Ignore undefined dynamic loader symbols.
+ (elf_hppa_final_link_relocate): Correct relocations for indirect
+ references to local data through the DLT. Fix .opd creation for
+ local symbols using R_PARISC_LTOFF_FPTR32 and R_PARISC_FPTR64
+ relocations. Use e_lsel selector for R_PARISC_DLTIND21L,
+ R_PARISC_LTOFF_FPTR21L and R_PARISC_LTOFF_TP21L as per
+ "Processor-Specific ELF for PA_RISC, Version 1.43" document.
+ Similarly, use e_rsel for DLT and LTOFF 'R' relocations.
+ * elf32-hppa.c (final_link_relocate): Revise relocation selectors
+ as per "Processor-Specific ELF for PA_RISC, Version 1.43" document.
+
+ 2002-03-05 Jakub Jelinek <jakub@redhat.com>
+ * merge.c (_bfd_merge_sections): Don't segfault if there
+ is nothing to merge due to GC.
+
+ 2002-03-05 Alan Modra <amodra@bigpond.net.au>
+ * elf32-hppa.c (clobber_millicode_symbols): Remove hack to keep
+ symbols that have been forced local.
+ * elflink.h (elf_bfd_final_link): Call elf_link_output_extsym
+ to output forced local syms for non-shared link.
+ (elf_link_output_extsym): Tweak condition for calling backend
+ adjust_dynamic_symbol so that previous behaviour is kept.
+ Whitespace changes throughout file.
+
+ 2002-03-04 H.J. Lu <hjl@gnu.org>
+ * elf.c (bfd_section_from_shdr): Handle special sections,
+ .init_array, .fini_array and .preinit_array.
+ (elf_fake_sections): Likewise.
+ * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Create the
+ DT entry only if the section is in output for .init_array,
+ .fini_array and .preinit_array. Complain about .preinit_array
+ section in DSO.
+ (elf_bfd_final_link): Warn zero size for .init_array,
+ .fini_array and .preinit_array sections.
+ * elfxx-ia64.c (elfNN_ia64_section_from_shdr): Remove
+ SHT_INIT_ARRAY, SHT_FINI_ARRAY and SHT_PREINIT_ARRAY.
+ (elfNN_ia64_fake_sections): Remove .init_array, .fini_array and
+ .preinit_array.
+
+ 2002-03-01 David Mosberger <davidm@hpl.hp.com>
+ * elflink.h (size_dynamic_sections): If section named
+ ".preinit_array" exists, create DT_PREINIT_ARRAY and
+ DT_PREINIT_ARRAYSZ entries in dynamic table. Analogously for
+ ".init_array" and ".fini_array".
+ (elf_bfd_final_link): Handle DT_PREINIT_ARRAYSZ, DT_INIT_ARRAYSZ,
+ DT_FINI_ARRAYSZ, DT_PREINIT_ARRAY, DT_INIT_ARRAY, and
+ DT_FINI_ARRAY.
+
+ 2002-02-19 Frank Ch. Eigler <fche@redhat.com>
+ * syms.c (stt[]): Sorted. Added .init/.fini -> "t" mapping.
+
+ 2002-02-13 Nick Clifton <nickc@cambridge.redhat.com>
+ * elf.c (_bfd_elf_make_section_from_shdr): Do not insist on
+ non-zero physical addresses when adjusting the LMAs of new
+ sections.
+
+ 2002-02-11 Michael Snyder <msnyder@redhat.com>
+ * elf-bfd.h (elfcore_write_lwpstatus): Add prototype.
+ * elf.c (elfcore_grok_pstatus): Add prototype.
+ (elfcore_grok_lwpstatus): Add prototype.
+ (elfcore_write_lwpstatus): New function.
+ (elfcore_write_pstatus): Fix typo, eliminate unnecessary memcpy.
+
2002-03-20 Tom Rix <trix@redhat.com>
* coff-rs6000.c (_bfd_xcoff_stat_arch_elt): Renamed from
elf32-target.h
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h $(srcdir)/../opcodes/sh64-opc.h
-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
+ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
+ elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.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 \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
+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-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 \
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
SOURCES = $(libbfd_a_SOURCES) $(libbfd_la_SOURCES)
OBJECTS = $(libbfd_a_OBJECTS) $(libbfd_la_OBJECTS)
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
rev="$$subdir $$rev"; \
- test "$$subdir" = "." && dot_seen=yes; \
+ test "$$subdir" != "." || dot_seen=yes; \
done; \
test "$$dot_seen" = "no" && rev=". $$rev"; \
target=`echo $@ | sed s/-recursive//`; \
elf32-target.h
elf32-sh64.lo: elf32-sh64.c $(INCDIR)/filenames.h elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
- elf32-target.h $(srcdir)/../opcodes/sh64-opc.h
-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
+ $(INCDIR)/bfdlink.h $(srcdir)/../opcodes/sh64-opc.h \
+ elf32-sh.c $(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h \
+ elf32-target.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 \
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/reloc-macros.h \
elf64-target.h
+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-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 \
-dnl aclocal.m4 generated automatically by aclocal 1.4
+dnl aclocal.m4 generated automatically by aclocal 1.4-p5
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-AC_DEFUN(AM_INIT_AUTOMAKE,
+AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
# Check to make sure that the build environment is sane.
#
-AC_DEFUN(AM_SANITY_CHECK,
+AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
+AC_DEFUN([AM_MISSING_PROG],
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Like AC_CONFIG_HEADER, but automatically create stamp file.
-AC_DEFUN(AM_CONFIG_HEADER,
+AC_DEFUN([AM_CONFIG_HEADER],
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
# serial 1
-AC_DEFUN(AM_MAINTAINER_MODE,
+AC_DEFUN([AM_MAINTAINER_MODE],
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
# Define a conditional.
-AC_DEFUN(AM_CONDITIONAL,
+AC_DEFUN([AM_CONDITIONAL],
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
/* BFD back-end for archive files (libraries).
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001
+ 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
!= sizeof (struct ar_hdr))
return false;
- bfd_write_bigendian_4byte_int (arch, symbol_count);
+ if (!bfd_write_bigendian_4byte_int (arch, symbol_count))
+ return false;
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary. */
while (count < symbol_count && map[count].u.abfd == current)
{
- bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr);
+ if (!bfd_write_bigendian_4byte_int (arch, archive_member_file_ptr))
+ return false;
count++;
}
/* Add size of this archive entry. */
/* This structure is used to map BFD reloc codes to SH PE relocs. */
struct shcoff_reloc_map
{
- unsigned char bfd_reloc_val;
+ bfd_reloc_code_real_type bfd_reloc_val;
unsigned char shcoff_reloc_val;
};
#ifdef COFF_WITH_PE
if (src->u.syment.n_sclass == C_NT_WEAK)
- dst->symbol.flags = BSF_WEAK;
+ dst->symbol.flags |= BSF_WEAK;
+
if (src->u.syment.n_sclass == C_SECTION
&& src->u.syment.n_scnum > 0)
- {
- dst->symbol.flags = BSF_LOCAL;
- }
+ dst->symbol.flags = BSF_LOCAL;
#endif
-
if (src->u.syment.n_sclass == C_WEAKEXT)
- dst->symbol.flags = BSF_WEAK;
+ dst->symbol.flags |= BSF_WEAK;
break;
/* Define if you have the <sys/procfs.h> header file. */
#undef HAVE_SYS_PROCFS_H
+/* Define if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
+/* Define if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
static struct line_info_table *decode_line_info
PARAMS ((struct comp_unit *, struct dwarf2_debug *));
static boolean lookup_address_in_line_info_table
- PARAMS ((struct line_info_table *, bfd_vma, const char **, unsigned int *));
+ PARAMS ((struct line_info_table *, bfd_vma, struct funcinfo *,
+ const char **, unsigned int *));
static boolean lookup_address_in_function_table
- PARAMS ((struct funcinfo *, bfd_vma, const char **));
+ PARAMS ((struct funcinfo *, bfd_vma, struct funcinfo **, const char **));
static boolean scan_unit_for_functions PARAMS ((struct comp_unit *));
static bfd_vma find_rela_addend
PARAMS ((bfd *, asection *, bfd_size_type, asymbol**));
struct line_info* last_line;
};
+struct funcinfo
+{
+ struct funcinfo *prev_func;
+ char* name;
+ bfd_vma low;
+ bfd_vma high;
+};
+
static void
add_line_info (table, address, filename, line, column, end_sequence)
struct line_info_table* table;
static boolean
lookup_address_in_line_info_table (table,
addr,
+ function,
filename_ptr,
linenumber_ptr)
struct line_info_table* table;
bfd_vma addr;
+ struct funcinfo *function;
const char **filename_ptr;
unsigned int *linenumber_ptr;
{
if (!each_line->end_sequence
&& addr >= each_line->address && addr < next_line->address)
{
- *filename_ptr = each_line->filename;
- *linenumber_ptr = each_line->line;
+ /* If this line appears to span functions, and addr is in the
+ later function, return the first line of that function instead
+ of the last line of the earlier one. This check is for GCC
+ 2.95, which emits the first line number for a function late. */
+ if (function != NULL
+ && each_line->address < function->low
+ && next_line->address > function->low)
+ {
+ *filename_ptr = next_line->filename;
+ *linenumber_ptr = next_line->line;
+ }
+ else
+ {
+ *filename_ptr = each_line->filename;
+ *linenumber_ptr = each_line->line;
+ }
return true;
}
next_line = each_line;
each_line = each_line->prev_line;
}
+ /* At this point each_line is NULL but next_line is not. If we found the
+ containing function in this compilation unit, return the first line we
+ have a number for. This is also for compatibility with GCC 2.95. */
+ if (function != NULL)
+ {
+ *filename_ptr = next_line->filename;
+ *linenumber_ptr = next_line->line;
+ return true;
+ }
+
return false;
}
/* Function table functions. */
-struct funcinfo
-{
- struct funcinfo *prev_func;
- char* name;
- bfd_vma low;
- bfd_vma high;
-};
-
/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return true. */
static boolean
lookup_address_in_function_table (table,
addr,
+ function_ptr,
functionname_ptr)
struct funcinfo* table;
bfd_vma addr;
+ struct funcinfo** function_ptr;
const char **functionname_ptr;
{
struct funcinfo* each_func;
if (addr >= each_func->low && addr < each_func->high)
{
*functionname_ptr = each_func->name;
+ *function_ptr = each_func;
return true;
}
}
{
boolean line_p;
boolean func_p;
+ struct funcinfo *function;
if (unit->error)
return false;
}
}
+ function = NULL;
+ func_p = lookup_address_in_function_table (unit->function_table,
+ addr,
+ &function,
+ functionname_ptr);
line_p = lookup_address_in_line_info_table (unit->line_table,
addr,
+ function,
filename_ptr,
linenumber_ptr);
- func_p = lookup_address_in_function_table (unit->function_table,
- addr,
- functionname_ptr);
return line_p || func_p;
}
PARAMS ((bfd *, char *, int *, void *, int));
extern char *elfcore_write_prxfpreg
PARAMS ((bfd *, char *, int *, void *, int));
+extern char *elfcore_write_lwpstatus
+ PARAMS ((bfd*, char*, int*, long, int, void*));
/* MIPS ELF specific routines. */
static boolean elf_hppa_remark_useless_dynamic_symbols
PARAMS ((struct elf_link_hash_entry *, PTR));
+static boolean elf_hppa_is_dynamic_loader_symbol
+ PARAMS ((const char *));
+
static void elf_hppa_record_segment_addrs
PARAMS ((bfd *, asection *, PTR));
return true;
}
+static boolean
+elf_hppa_is_dynamic_loader_symbol (name)
+ const char * name;
+{
+ return (! strcmp (name, "__CPU_REVISION")
+ || ! strcmp (name, "__CPU_KEYBITS_1")
+ || ! strcmp (name, "__SYSTEM_ID_D")
+ || ! strcmp (name, "__FPU_MODEL")
+ || ! strcmp (name, "__FPU_REVISION")
+ || ! strcmp (name, "__ARGC")
+ || ! strcmp (name, "__ARGV")
+ || ! strcmp (name, "__ENVP")
+ || ! strcmp (name, "__TLS_SIZE_D")
+ || ! strcmp (name, "__LOAD_INFO")
+ || ! strcmp (name, "__systab"));
+}
+
/* Record the lowest address for the data and text segments. */
static void
elf_hppa_record_segment_addrs (abfd, section, data)
relocation = 0;
else
{
- if (!((*info->callbacks->undefined_symbol)
- (info, h->root.root.string, input_bfd,
- input_section, rel->r_offset, true)))
- return false;
- break;
+ /* Ignore dynamic loader defined symbols. */
+ if (elf_hppa_is_dynamic_loader_symbol (h->root.root.string))
+ relocation = 0;
+ else
+ {
+ if (!((*info->callbacks->undefined_symbol)
+ (info, h->root.root.string, input_bfd,
+ input_section, rel->r_offset, true)))
+ return false;
+ break;
+ }
}
}
a local function which had its address taken. */
if (dyn_h->h == NULL)
{
- bfd_put_64 (hppa_info->dlt_sec->owner,
- value,
- hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
-
- /* Now handle .opd creation if needed. */
+ /* Now do .opd creation if needed. */
if (r_type == R_PARISC_LTOFF_FPTR14R
|| r_type == R_PARISC_LTOFF_FPTR14DR
|| r_type == R_PARISC_LTOFF_FPTR14WR
0, 16);
/* The next word is the address of the function. */
- bfd_put_64 (hppa_info->opd_sec->owner, value,
+ bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
(hppa_info->opd_sec->contents
+ dyn_h->opd_offset + 16));
bfd_put_64 (hppa_info->opd_sec->owner, value,
(hppa_info->opd_sec->contents
+ dyn_h->opd_offset + 24));
+
+ /* The DLT value is the address of the .opd entry. */
+ value = (dyn_h->opd_offset
+ + hppa_info->opd_sec->output_offset
+ + hppa_info->opd_sec->output_section->vma);
+ addend = 0;
}
+
+ bfd_put_64 (hppa_info->dlt_sec->owner,
+ value + addend,
+ hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
}
/* We want the value of the DLT offset for this symbol, not
if (r_type == R_PARISC_DLTIND21L
|| r_type == R_PARISC_LTOFF_FPTR21L
|| r_type == R_PARISC_LTOFF_TP21L)
- value = hppa_field_adjust (value, addend, e_lrsel);
+ value = hppa_field_adjust (value, 0, e_lsel);
else if (r_type == R_PARISC_DLTIND14F
|| r_type == R_PARISC_LTOFF_FPTR16F
|| r_type == R_PARISC_LTOFF_FPTR16WF
|| r_type == R_PARISC_LTOFF_TP16F
|| r_type == R_PARISC_LTOFF_TP16WF
|| r_type == R_PARISC_LTOFF_TP16DF)
- value = hppa_field_adjust (value, addend, e_fsel);
+ value = hppa_field_adjust (value, 0, e_fsel);
else
- value = hppa_field_adjust (value, addend, e_rrsel);
+ value = hppa_field_adjust (value, 0, e_rsel);
insn = elf_hppa_relocate_insn (insn, (int) value, r_type);
break;
memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
/* The next word is the address of the function. */
- bfd_put_64 (hppa_info->opd_sec->owner, value,
+ bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
(hppa_info->opd_sec->contents
+ dyn_h->opd_offset + 16));
(hppa_info->opd_sec->output_section->owner);
bfd_put_64 (hppa_info->opd_sec->owner, value,
hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
+
+ /* The DLT value is the address of the .opd entry. */
+ value = (dyn_h->opd_offset
+ + hppa_info->opd_sec->output_offset
+ + hppa_info->opd_sec->output_section->vma);
+
+ bfd_put_64 (hppa_info->dlt_sec->owner,
+ value,
+ hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
}
/* We want the value of the DLT offset for this symbol, not
memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
/* The next word is the address of the function. */
- bfd_put_64 (hppa_info->opd_sec->owner, value,
+ bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
(hppa_info->opd_sec->contents
+ dyn_h->opd_offset + 16));
(hppa_info->opd_sec->output_section->owner);
bfd_put_64 (hppa_info->opd_sec->owner, value,
hppa_info->opd_sec->contents + dyn_h->opd_offset + 24);
+
+ /* The DLT value is the address of the .opd entry. */
+ value = (dyn_h->opd_offset
+ + hppa_info->opd_sec->output_offset
+ + hppa_info->opd_sec->output_section->vma);
+
+ bfd_put_64 (hppa_info->dlt_sec->owner,
+ value,
+ hppa_info->dlt_sec->contents + dyn_h->dlt_offset);
}
/* We want the value of the DLT offset for this symbol, not
memset (hppa_info->opd_sec->contents + dyn_h->opd_offset, 0, 16);
/* The next word is the address of the function. */
- bfd_put_64 (hppa_info->opd_sec->owner, value,
+ bfd_put_64 (hppa_info->opd_sec->owner, value + addend,
(hppa_info->opd_sec->contents
+ dyn_h->opd_offset + 16));
+ hppa_info->opd_sec->output_offset
+ hppa_info->opd_sec->output_section->vma);
- bfd_put_64 (input_bfd, value + addend, hit_data);
+ bfd_put_64 (input_bfd, value, hit_data);
return bfd_reloc_ok;
}
offset plus size lies within the segment's memory
span and, if the section is loaded, the extent of the
loaded data lies within the extent of the segment.
- If the p_paddr field is not set, we don't alter the
- LMA. */
+
+ Note - we used to check the p_paddr field as well, and
+ refuse to set the LMA if it was 0. This is wrong
+ though, as a perfectly valid initialised segment can
+ have a p_paddr of zero. Some architectures, eg ARM,
+ place special significance on the address 0 and
+ executables need to be able to have a segment which
+ covers this address. */
if (phdr->p_type == PT_LOAD
- && phdr->p_paddr
&& (bfd_vma) hdr->sh_offset >= phdr->p_offset
&& (hdr->sh_offset + hdr->sh_size
<= phdr->p_offset + phdr->p_memsz)
|| (phdr->p_offset + phdr->p_filesz
>= hdr->sh_offset + hdr->sh_size)))
{
- /* We used to do a relative adjustment here, but
- that doesn't work if the segment is packed with
- code from multiple VMAs. Instead we calculate
- the LMA absoultely, based on the LMA of the
- segment (it is assumed that the segment will
- contain sections with contiguous LMAs, even if
- the VMAs are not). */
- newsect->lma = phdr->p_paddr
- + hdr->sh_offset - phdr->p_offset;
+ if ((flags & SEC_LOAD) == 0)
+ newsect->lma += phdr->p_paddr - phdr->p_vaddr;
+ else
+ /* We used to use the same adjustment for SEC_LOAD
+ sections, but that doesn't work if the segment
+ is packed with code from multiple VMAs.
+ Instead we calculate the section LMA based on
+ the segment LMA. It is assumed that the
+ segment will contain sections with contiguous
+ LMAs, even if the VMAs are not. */
+ newsect->lma = (phdr->p_paddr
+ + hdr->sh_offset - phdr->p_offset);
break;
}
}
case SHT_NOBITS: /* .bss section. */
case SHT_HASH: /* .hash section. */
case SHT_NOTE: /* .note section. */
+ case SHT_INIT_ARRAY: /* .init_array section. */
+ case SHT_FINI_ARRAY: /* .fini_array section. */
+ case SHT_PREINIT_ARRAY: /* .preinit_array section. */
return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
case SHT_SYMTAB: /* A symbol table */
this_hdr->sh_type = SHT_REL;
this_hdr->sh_entsize = bed->s->sizeof_rel;
}
+ else if (strcmp (asect->name, ".init_array") == 0)
+ this_hdr->sh_type = SHT_INIT_ARRAY;
+ else if (strcmp (asect->name, ".fini_array") == 0)
+ this_hdr->sh_type = SHT_FINI_ARRAY;
+ else if (strcmp (asect->name, ".preinit_array") == 0)
+ this_hdr->sh_type = SHT_PREINIT_ARRAY;
else if (strncmp (asect->name, ".note", 5) == 0)
this_hdr->sh_type = SHT_NOTE;
else if (strncmp (asect->name, ".stab", 5) == 0
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
+ symtab_size = (symcount + 1) * (sizeof (asymbol *));
+ if (symcount > 0)
+ symtab_size -= sizeof (asymbol *);
return symtab_size;
}
}
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
- symtab_size = (symcount - 1 + 1) * (sizeof (asymbol *));
+ symtab_size = (symcount + 1) * (sizeof (asymbol *));
+ if (symcount > 0)
+ symtab_size -= sizeof (asymbol *);
return symtab_size;
}
#endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */
#if defined (HAVE_PSTATUS_T)
+static boolean elfcore_grok_pstatus PARAMS ((bfd *, Elf_Internal_Note *));
+
static boolean
elfcore_grok_pstatus (abfd, note)
bfd *abfd;
#endif /* defined (HAVE_PSTATUS_T) */
#if defined (HAVE_LWPSTATUS_T)
+static boolean elfcore_grok_lwpstatus PARAMS ((bfd *, Elf_Internal_Note *));
+
static boolean
elfcore_grok_lwpstatus (abfd, note)
bfd *abfd;
}
#endif /* HAVE_PRSTATUS_T */
+#if defined (HAVE_LWPSTATUS_T)
+char *
+elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs)
+ bfd *abfd;
+ char *buf;
+ int *bufsiz;
+ long pid;
+ int cursig;
+ void *gregs;
+{
+ lwpstatus_t lwpstat;
+ char *note_name = "CORE";
+
+ memset (&lwpstat, 0, sizeof (lwpstat));
+ lwpstat.pr_lwpid = pid >> 16;
+ lwpstat.pr_cursig = cursig;
+#if defined (HAVE_LWPSTATUS_T_PR_REG)
+ memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg));
+#elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT)
+#if !defined(gregs)
+ memcpy (lwpstat.pr_context.uc_mcontext.gregs,
+ gregs, sizeof (lwpstat.pr_context.uc_mcontext.gregs));
+#else
+ memcpy (lwpstat.pr_context.uc_mcontext.__gregs,
+ gregs, sizeof (lwpstat.pr_context.uc_mcontext.__gregs));
+#endif
+#endif
+ return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_LWPSTATUS, &lwpstat, sizeof (lwpstat));
+}
+#endif /* HAVE_LWPSTATUS_T */
+
#if defined (HAVE_PSTATUS_T)
char *
elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs)
pstatus_t pstat;
char *note_name = "CORE";
- memset (&pstat, 0, sizeof (prstat));
- pstat.pr_pid = pid;
- memcpy (pstat.pr_reg, gregs, sizeof (pstat.pr_reg));
- return elfcore_write_note (abfd, buf, bufsiz,
- note_name, NT_PSTATUS, &pstat, sizeof (pstat));
+ memset (&pstat, 0, sizeof (pstat));
+ pstat.pr_pid = pid & 0xffff;
+ buf = elfcore_write_note (abfd, buf, bufsiz, note_name,
+ NT_PSTATUS, &pstat, sizeof (pstat));
+ return buf;
}
#endif /* HAVE_PSTATUS_T */
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
elf32_hppa_hide_symbol (info, h, true);
-
- /* ?!? We only want to remove these from the dynamic symbol table.
- Therefore we do not leave ELF_LINK_FORCED_LOCAL set. */
- h->elf_link_hash_flags &= ~ELF_LINK_FORCED_LOCAL;
}
return true;
}
r_field = e_fsel;
break;
- case R_PARISC_DIR21L:
+ case R_PARISC_DLTIND21L:
case R_PARISC_PCREL21L:
- case R_PARISC_DPREL21L:
case R_PARISC_PLABEL21L:
- case R_PARISC_DLTIND21L:
+ r_field = e_lsel;
+ break;
+
+ case R_PARISC_DIR21L:
+ case R_PARISC_DPREL21L:
r_field = e_lrsel;
break;
- case R_PARISC_DIR17R:
case R_PARISC_PCREL17R:
- case R_PARISC_DIR14R:
case R_PARISC_PCREL14R:
- case R_PARISC_DPREL14R:
case R_PARISC_PLABEL14R:
case R_PARISC_DLTIND14R:
+ r_field = e_rsel;
+ break;
+
+ case R_PARISC_DIR17R:
+ case R_PARISC_DIR14R:
+ case R_PARISC_DPREL14R:
r_field = e_rrsel;
break;
asection *hsec;
/* This code handles the special SHN_MIPS_{TEXT,DATA} section
- indices used by MIPS ELF. */
+ indices used by MIPS ELF. */
switch (h->root.type)
{
default:
&& sym->st_size != h->size)
{
/* Since we think we have two common symbols, issue a multiple
- common warning if desired. Note that we only warn if the
- size is different. If the size is the same, we simply let
- the old symbol override the new one as normally happens with
- symbols defined in dynamic objects. */
+ common warning if desired. Note that we only warn if the
+ size is different. If the size is the same, we simply let
+ the old symbol override the new one as normally happens with
+ symbols defined in dynamic objects. */
if (! ((*info->callbacks->multiple_common)
(info, h->root.root.string, oldbfd, bfd_link_hash_common,
*size_change_ok = true;
/* If we get here when the old symbol is a common symbol, then
- we are explicitly letting it override a weak symbol or
- function in a dynamic object, and we don't want to warn about
- a type change. If the old symbol is a defined symbol, a type
- change warning may still be appropriate. */
+ we are explicitly letting it override a weak symbol or
+ function in a dynamic object, and we don't want to warn about
+ a type change. If the old symbol is a defined symbol, a type
+ change warning may still be appropriate. */
if (h->root.type == bfd_link_hash_common)
*type_change_ok = true;
olddyncommon = false;
/* We again permit a type change when a common symbol may be
- overriding a function. */
+ overriding a function. */
if (bfd_is_com_section (sec))
*type_change_ok = true;
h->verinfo.vertree = NULL;
/* In this special case, if H is the target of an indirection,
- we want the caller to frob with H rather than with the
- indirect symbol. That will permit the caller to redefine the
- target of the indirection, rather than the indirect symbol
- itself. FIXME: This will break the -y option if we store a
- symbol with a different name. */
+ we want the caller to frob with H rather than with the
+ indirect symbol. That will permit the caller to redefine the
+ target of the indirection, rather than the indirect symbol
+ itself. FIXME: This will break the -y option if we store a
+ symbol with a different name. */
*sym_hash = h;
}
return false;
/* If the predumed common symbol in the dynamic object is
- larger, pretend that the new symbol has its size. */
+ larger, pretend that the new symbol has its size. */
if (h->size > *pvalue)
*pvalue = h->size;
&& bind != STB_WEAK)
{
/* To make this work we have to frob the flags so that the rest
- of the code does not think we are using the regular
- definition. */
+ of the code does not think we are using the regular
+ definition. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
h->elf_link_hash_flags |= ELF_LINK_HASH_REF_REGULAR;
else if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
| ELF_LINK_HASH_DEF_DYNAMIC);
/* If H is the target of an indirection, we want the caller to
- use H rather than the indirect symbol. Otherwise if we are
- defining a new indirect symbol we will wind up attaching it
- to the entry we are overriding. */
+ use H rather than the indirect symbol. Otherwise if we are
+ defining a new indirect symbol we will wind up attaching it
+ to the entry we are overriding. */
*sym_hash = h;
}
}
/* Now set HI to H, so that the following code will set the
- other fields correctly. */
+ other fields correctly. */
hi = h;
}
& (ELF_LINK_HASH_DEF_DYNAMIC
| ELF_LINK_HASH_DEF_REGULAR)) == 0);
- (*bed->elf_backend_copy_indirect_symbol) (h, hi);
+ (*bed->elf_backend_copy_indirect_symbol) (h, hi);
/* See if the new flags lead us to realize that the symbol
must be dynamic. */
|| h->root.type == bfd_link_hash_defweak))
{
/* We don't want to issue this warning. Clobber
- the section size so that the warning does not
- get copied into the output file. */
+ the section size so that the warning does not
+ get copied into the output file. */
s->_raw_size = 0;
continue;
}
if (! info->relocateable)
{
/* Clobber the section size so that the warning does
- not get copied into the output file. */
+ not get copied into the output file. */
s->_raw_size = 0;
}
}
goto error_return;
/* Read in the symbol versions, but don't bother to convert them
- to internal format. */
+ to internal format. */
if (elf_dynversym (abfd) != 0)
{
Elf_Internal_Shdr *versymhdr;
if (! dynamic)
{
/* If we are creating a shared library, create all the dynamic
- sections immediately. We need to attach them to something,
- so we attach them to this BFD, provided it is the right
- format. FIXME: If there are no input BFD's of the same
- format as the output, we can't make a shared library. */
+ sections immediately. We need to attach them to something,
+ so we attach them to this BFD, provided it is the right
+ format. FIXME: If there are no input BFD's of the same
+ format as the output, we can't make a shared library. */
if (info->shared
&& is_elf_hash_table (info)
&& ! hash_table->dynamic_sections_created
if (*name == '\0')
{
if (elf_dt_soname (abfd) != NULL)
- dt_needed = true;
+ dt_needed = true;
add_needed = false;
}
}
/* Ignore DT_RPATH if we have seen DT_RUNPATH. */
if (!runpath && dyn.d_tag == DT_RPATH)
- {
+ {
struct bfd_link_needed_list *n, **pn;
char *fnm, *anm;
unsigned int tagv = dyn.d_un.d_val;
}
/* Save the SONAME, if there is one, because sometimes the
- linker emulation code will need to know it. */
+ linker emulation code will need to know it. */
if (*name == '\0')
name = basename (bfd_get_filename (abfd));
elf_dt_name (abfd) = name;
vernum = iver.vs_vers & VERSYM_VERSION;
/* If this is a hidden symbol, or if it is not version
- 1, we append the version name to the symbol name.
- However, we do not modify a non-hidden absolute
- symbol, because it might be the version symbol
- itself. FIXME: What if it isn't? */
+ 1, we append the version name to the symbol name.
+ However, we do not modify a non-hidden absolute
+ symbol, because it might be the version symbol
+ itself. FIXME: What if it isn't? */
if ((iver.vs_vers & VERSYM_HIDDEN) != 0
|| (vernum > 1 && ! bfd_is_abs_section (sec)))
{
h = (struct elf_link_hash_entry *) h->root.u.i.link;
/* Remember the old alignment if this is a common symbol, so
- that we don't reduce the alignment later on. We can't
- check later, because _bfd_generic_link_add_one_symbol
- will set a default for the alignment which we want to
- override. */
+ that we don't reduce the alignment later on. We can't
+ check later, because _bfd_generic_link_add_one_symbol
+ will set a default for the alignment which we want to
+ override. */
if (h->root.type == bfd_link_hash_common)
old_alignment = h->root.u.c.p->alignment_power;
}
/* If this is a common symbol, then we always want H->SIZE
- to be the size of the common symbol. The code just above
- won't fix the size if a common symbol becomes larger. We
- don't warn about a size change here, because that is
- covered by --warn-common. */
+ to be the size of the common symbol. The code just above
+ won't fix the size if a common symbol becomes larger. We
+ don't warn about a size change here, because that is
+ covered by --warn-common. */
if (h->root.type == bfd_link_hash_common)
h->size = h->root.u.c.size;
h->other = sym.st_other;
/* If neither has visibility, use the st_other of the
- definition. This is an arbitrary choice, since the
- other bits have no general meaning. */
+ definition. This is an arbitrary choice, since the
+ other bits have no general meaning. */
if (!symvis && !hvis
&& (definition || h->other == 0))
h->other = sym.st_other;
goto error_return;
/* The symbol from a DT_NEEDED object is referenced from
- the regular object to create a dynamic executable. We
+ the regular object to create a dynamic executable. We
have to make sure there is a DT_NEEDED entry for it. */
dt_needed = false;
}
/* If the real definition is in the list of dynamic
- symbols, make sure the weak definition is put there
- as well. If we don't do this, then the dynamic
- loader might not merge the entries for the real
- definition and the weak definition. */
+ symbols, make sure the weak definition is put there
+ as well. If we don't do this, then the dynamic
+ loader might not merge the entries for the real
+ definition and the weak definition. */
if (h->dynindx != -1
&& hlook->dynindx == -1)
{
eif.failed = false;
/* If we are supposed to export all symbols into the dynamic symbol
- table (this is not the normal case), then do so. */
+ table (this is not the normal case), then do so. */
if (info->export_dynamic)
{
elf_link_hash_traverse (elf_hash_table (info), elf_export_symbol,
- (PTR) &eif);
+ (PTR) &eif);
if (eif.failed)
return false;
}
return false;
}
+ if (bfd_get_section_by_name (output_bfd, ".preinit_array") != NULL)
+ {
+ /* DT_PREINIT_ARRAY is not allowed in shared library. */
+ if (info->shared)
+ {
+ bfd *sub;
+ asection *o;
+
+ for (sub = info->input_bfds; sub != NULL;
+ sub = sub->link_next)
+ for (o = sub->sections; o != NULL; o = o->next)
+ if (elf_section_data (o)->this_hdr.sh_type
+ == SHT_PREINIT_ARRAY)
+ {
+ (*_bfd_error_handler)
+ (_("%s: .preinit_array section is not allowed in DSO"),
+ bfd_archive_filename (sub));
+ break;
+ }
+
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return false;
+ }
+
+ if (!elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAY,
+ (bfd_vma) 0)
+ || !elf_add_dynamic_entry (info, (bfd_vma) DT_PREINIT_ARRAYSZ,
+ (bfd_vma) 0))
+ return false;
+ }
+ if (bfd_get_section_by_name (output_bfd, ".init_array") != NULL)
+ {
+ if (!elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAY,
+ (bfd_vma) 0)
+ || !elf_add_dynamic_entry (info, (bfd_vma) DT_INIT_ARRAYSZ,
+ (bfd_vma) 0))
+ return false;
+ }
+ if (bfd_get_section_by_name (output_bfd, ".fini_array") != NULL)
+ {
+ if (!elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAY,
+ (bfd_vma) 0)
+ || !elf_add_dynamic_entry (info, (bfd_vma) DT_FINI_ARRAYSZ,
+ (bfd_vma) 0))
+ return false;
+ }
+
dynstr = bfd_get_section_by_name (dynobj, ".dynstr");
/* If .dynstr is excluded from the link, we don't want any of
these tags. Strictly, we should be checking each section
BFD_ASSERT (s != NULL);
/* We may have created additional version definitions if we are
- just linking a regular application. */
+ just linking a regular application. */
verdefs = asvinfo.verdefs;
/* Skip anonymous version tag. */
\f
/* This function is used to adjust offsets into .dynstr for
dynamic symbols. This is called via elf_link_hash_traverse. */
-
+
static boolean elf_adjust_dynstr_offsets
PARAMS ((struct elf_link_hash_entry *, PTR));
-
+
static boolean
elf_adjust_dynstr_offsets (h, data)
struct elf_link_hash_entry *h;
bfd_size_type i;
Elf_Internal_Verdef def;
Elf_Internal_Verdaux defaux;
-
+
s = bfd_get_section_by_name (dynobj, ".gnu.version_d");
p = (bfd_byte *) s->contents;
do
bfd_size_type i;
Elf_Internal_Verneed need;
Elf_Internal_Vernaux needaux;
-
+
s = bfd_get_section_by_name (dynobj, ".gnu.version_r");
p = (bfd_byte *) s->contents;
do
else
{
/* Unfortunately, ELF_LINK_NON_ELF is only correct if the symbol
- was first seen in a non-ELF file. Fortunately, if the symbol
- was first seen in an ELF file, we're probably OK unless the
- symbol was defined in a non-ELF file. Catch that case here.
- FIXME: We're still in trouble if the symbol was first seen in
- a dynamic object, and then later in a non-ELF regular object. */
+ was first seen in a non-ELF file. Fortunately, if the symbol
+ was first seen in an ELF file, we're probably OK unless the
+ symbol was defined in a non-ELF file. Catch that case here.
+ FIXME: We're still in trouble if the symbol was first seen in
+ a dynamic object, and then later in a non-ELF regular object. */
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0
}
if (!eif->verdefs)
- {
+ {
doit:
if (! _bfd_elf_link_record_dynamic_symbol (eif->info, h))
{
eif->failed = true;
return false;
}
- }
+ }
}
return true;
hidden = true;
/* There are two consecutive ELF_VER_CHR characters if this is
- not a hidden symbol. */
+ not a hidden symbol. */
++p;
if (*p == ELF_VER_CHR)
{
len = p - h->root.root.string;
alc = bfd_malloc ((bfd_size_type) len);
if (alc == NULL)
- return false;
+ return false;
strncpy (alc, h->root.root.string, len - 1);
alc[len - 1] = '\0';
if (alc[len - 2] == ELF_VER_CHR)
- alc[len - 2] = '\0';
+ alc[len - 2] = '\0';
h->verinfo.vertree = t;
t->used = true;
}
/* See if there is anything to force this symbol to
- local scope. */
+ local scope. */
if (d == NULL && t->locals != NULL)
{
for (d = t->locals; d != NULL; d = d->next)
}
/* If we are building an application, we need to create a
- version node for this version. */
+ version node for this version. */
if (t == NULL && ! info->shared)
{
struct bfd_elf_version_tree **pp;
int version_index;
/* If we aren't going to export this symbol, we don't need
- to worry about it. */
+ to worry about it. */
if (h->dynindx == -1)
return true;
else if (t == NULL)
{
/* We could not find the version for a symbol when
- generating a shared archive. Return an error. */
+ generating a shared archive. Return an error. */
(*_bfd_error_handler)
(_("%s: undefined versioned symbol name %s"),
bfd_get_filename (sinfo->output_bfd), h->root.root.string);
struct bfd_elf_version_expr *d;
/* See if can find what version this symbol is in. If the
- symbol is supposed to be local, then don't actually register
- it. */
+ symbol is supposed to be local, then don't actually register
+ it. */
deflt = NULL;
for (t = sinfo->verdefs; t != NULL; t = t->next)
{
dynobj = elf_hash_table (info)->dynobj;
emit_relocs = (info->relocateable
- || info->emitrelocations
- || bed->elf_backend_emit_relocs);
+ || info->emitrelocations
+ || bed->elf_backend_emit_relocs);
finfo.info = info;
finfo.output_bfd = abfd;
if (info->relocateable || info->emitrelocations)
o->reloc_count += sec->reloc_count;
- else if (bed->elf_backend_count_relocs)
+ else if (bed->elf_backend_count_relocs)
{
Elf_Internal_Rela * relocs;
(abfd, sec, (PTR) NULL,
(Elf_Internal_Rela *) NULL, info->keep_memory));
- o->reloc_count += (*bed->elf_backend_count_relocs)
- (sec, relocs);
+ o->reloc_count
+ += (*bed->elf_backend_count_relocs) (sec, relocs);
if (!info->keep_memory)
free (relocs);
= elf_section_data (output_section);
unsigned int *rel_count;
unsigned int *rel_count2;
+ bfd_size_type entsize;
+ bfd_size_type entsize2;
- /* We must be careful to add the relocation froms the
+ /* We must be careful to add the relocations from the
input section to the right output count. */
- if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize)
+ entsize = esdi->rel_hdr.sh_entsize;
+ entsize2 = esdi->rel_hdr2 ? esdi->rel_hdr2->sh_entsize : 0;
+ BFD_ASSERT ((entsize == sizeof (Elf_External_Rel)
+ || entsize == sizeof (Elf_External_Rela))
+ && entsize2 != entsize
+ && (entsize2 == 0
+ || entsize2 == sizeof (Elf_External_Rel)
+ || entsize2 == sizeof (Elf_External_Rela)));
+ if (entsize == esdo->rel_hdr.sh_entsize)
{
rel_count = &esdo->rel_count;
rel_count2 = &esdo->rel_count2;
{
for (p = o->link_order_head; p != NULL; p = p->next)
{
+ Elf_Internal_Shdr *rhdr;
+
if (p->type == bfd_indirect_link_order
&& (bfd_get_flavour (p->u.indirect.section->owner)
- == bfd_target_elf_flavour))
+ == bfd_target_elf_flavour)
+ && (((rhdr = &elf_section_data (p->u.indirect.section)->rel_hdr)
+ ->sh_entsize == 0)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rel)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rela))
+ && (((rhdr = elf_section_data (p->u.indirect.section)->rel_hdr2)
+ == NULL)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rel)
+ || rhdr->sh_entsize == sizeof (Elf_External_Rela)))
{
sub = p->u.indirect.section->owner;
if (! sub->output_has_begun)
}
}
+ /* Output any global symbols that got converted to local in a
+ version script or due to symbol visibility. We do this in a
+ separate step since ELF requires all local symbols to appear
+ prior to any global symbols. FIXME: We should only do this if
+ some global symbols were, in fact, converted to become local.
+ FIXME: Will this work correctly with the Irix 5 linker? */
+ eoinfo.failed = false;
+ eoinfo.finfo = &finfo;
+ eoinfo.localsyms = true;
+ elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
+ (PTR) &eoinfo);
+ if (eoinfo.failed)
+ return false;
+
/* That wrote out all the local symbols. Finish up the symbol table
with the global symbols. Even if we want to strip everything we
can, we still need to deal with those global symbols that got
converted to local in a version script. */
- if (info->shared)
- {
- /* Output any global symbols that got converted to local in a
- version script. We do this in a separate step since ELF
- requires all local symbols to appear prior to any global
- symbols. FIXME: We should only do this if some global
- symbols were, in fact, converted to become local. FIXME:
- Will this work correctly with the Irix 5 linker? */
- eoinfo.failed = false;
- eoinfo.finfo = &finfo;
- eoinfo.localsyms = true;
- elf_link_hash_traverse (elf_hash_table (info), elf_link_output_extsym,
- (PTR) &eoinfo);
- if (eoinfo.failed)
- return false;
- }
-
/* The sh_info field records the index of the first non local symbol. */
symtab_hdr->sh_info = bfd_get_symcount (abfd);
/* Copy the internal symbol as is.
Note that we saved a word of storage and overwrote
- the original st_name with the dynstr_index. */
- sym = e->isym;
+ the original st_name with the dynstr_index. */
+ sym = e->isym;
if (e->isym.st_shndx != SHN_UNDEF
&& (e->isym.st_shndx < SHN_LORESERVE
}
break;
+ case DT_PREINIT_ARRAYSZ:
+ name = ".preinit_array";
+ goto get_size;
+ case DT_INIT_ARRAYSZ:
+ name = ".init_array";
+ goto get_size;
+ case DT_FINI_ARRAYSZ:
+ name = ".fini_array";
+ get_size:
+ o = bfd_get_section_by_name (abfd, name);
+ BFD_ASSERT (o != NULL);
+ if (o->_raw_size == 0)
+ (*_bfd_error_handler)
+ (_("warning: %s section has zero size"), name);
+ dyn.d_un.d_val = o->_raw_size;
+ elf_swap_dyn_out (dynobj, &dyn, dyncon);
+ break;
+
+ case DT_PREINIT_ARRAY:
+ name = ".preinit_array";
+ goto get_vma;
+ case DT_INIT_ARRAY:
+ name = ".init_array";
+ goto get_vma;
+ case DT_FINI_ARRAY:
+ name = ".fini_array";
+ goto get_vma;
+
case DT_HASH:
name = ".hash";
goto get_vma;
if ((o->flags & SEC_LINKER_CREATED) == 0)
{
/* At this point, we are only interested in sections
- created by elf_link_create_dynamic_sections. */
+ created by elf_link_create_dynamic_sections. */
continue;
}
if ((elf_section_data (o->output_section)->this_hdr.sh_type
else
{
/* The contents of the .dynstr section are actually in a
- stringtab. */
+ stringtab. */
off = elf_section_data (o->output_section)->this_hdr.sh_offset;
if (bfd_seek (abfd, off, SEEK_SET) != 0
|| ! _bfd_elf_strtab_emit (abfd,
{
if ((o->flags & SEC_RELOC) != 0
&& elf_section_data (o)->rel_hashes != NULL)
- free (elf_section_data (o)->rel_hashes);
+ free (elf_section_data (o)->rel_hashes);
}
elf_tdata (abfd)->linker = true;
{
Elf_External_Sym *dest;
Elf_External_Sym_Shndx *destshndx;
-
+
boolean (*output_symbol_hook) PARAMS ((bfd *,
struct bfd_link_info *info,
const char *,
return false;
case bfd_link_hash_undefined:
- input_sec = bfd_und_section_ptr;
- sym.st_shndx = SHN_UNDEF;
- break;
-
case bfd_link_hash_undefweak:
input_sec = bfd_und_section_ptr;
sym.st_shndx = SHN_UNDEF;
case bfd_link_hash_indirect:
/* These symbols are created by symbol versioning. They point
- to the decorated version of the name. For example, if the
- symbol foo@@GNU_1.2 is the default, which should be used when
- foo is used with no version, then we add an indirect symbol
- foo which points to foo@@GNU_1.2. We ignore these symbols,
- since the indirected symbol is already in the hash table. */
+ to the decorated version of the name. For example, if the
+ symbol foo@@GNU_1.2 is the default, which should be used when
+ foo is used with no version, then we add an indirect symbol
+ foo which points to foo@@GNU_1.2. We ignore these symbols,
+ since the indirected symbol is already in the hash table. */
return true;
case bfd_link_hash_warning:
/* We can't represent these symbols in ELF, although a warning
- symbol may have come from a .gnu.warning.SYMBOL section. We
- just put the target symbol in the hash table. If the target
- symbol does not really exist, don't do anything. */
+ symbol may have come from a .gnu.warning.SYMBOL section. We
+ just put the target symbol in the hash table. If the target
+ symbol does not really exist, don't do anything. */
if (h->root.u.i.link->type == bfd_link_hash_new)
return true;
return (elf_link_output_extsym
/* Give the processor backend a chance to tweak the symbol value,
and also to finish up anything that needs to be done for this
- symbol. */
+ symbol. FIXME: Not calling elf_backend_finish_dynamic_symbol for
+ forced local syms when non-shared is due to a historical quirk. */
if ((h->dynindx != -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
+ && (finfo->info->shared
+ || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
&& elf_hash_table (finfo->info)->dynamic_sections_created)
{
struct elf_backend_data *bed;
return true;
emit_relocs = (finfo->info->relocateable
- || finfo->info->emitrelocations
- || bed->elf_backend_emit_relocs);
+ || finfo->info->emitrelocations
+ || bed->elf_backend_emit_relocs);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
if (elf_bad_symtab (input_bfd))
continue;
/* If this symbol is defined in a section which we are
- discarding, we don't need to keep it, but note that
- linker_mark is only reliable for sections that have contents.
- For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
- as well as linker_mark. */
+ discarding, we don't need to keep it, but note that
+ linker_mark is only reliable for sections that have contents.
+ For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
+ as well as linker_mark. */
if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
&& isec != NULL
&& ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
}
/* Get the contents of the section. They have been cached by a
- relaxation routine. Note that o is a section in an input
- file, so the contents field will not have been set by any of
- the routines which work on output files. */
+ relaxation routine. Note that o is a section in an input
+ file, so the contents field will not have been set by any of
+ the routines which work on output files. */
if (elf_section_data (o)->this_hdr.contents != NULL)
contents = elf_section_data (o)->this_hdr.contents;
else
}
/* Swap out the relocs. */
- if (bed->elf_backend_emit_relocs
- && !(finfo->info->relocateable
+ if (bed->elf_backend_emit_relocs
+ && !(finfo->info->relocateable
|| finfo->info->emitrelocations))
- reloc_emitter = bed->elf_backend_emit_relocs;
- else
- reloc_emitter = elf_link_output_relocs;
+ reloc_emitter = bed->elf_backend_emit_relocs;
+ else
+ reloc_emitter = elf_link_output_relocs;
input_rel_hdr = &elf_section_data (o)->rel_hdr;
- (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
+ (*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
input_rel_hdr = elf_section_data (o)->rel_hdr2;
- if (input_rel_hdr)
- {
- internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
+ if (input_rel_hdr)
+ {
+ internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
- reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs);
- }
+ reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs);
+ }
}
}
struct elf_link_hash_entry *h;
/* Treat a reloc against a defined symbol as though it were
- actually against the section. */
+ actually against the section. */
h = ((struct elf_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
indx = section->output_section->target_index;
*rel_hash_ptr = NULL;
/* It seems that we ought to add the symbol value to the
- addend here, but in practice it has already been added
- because it was passed to constructor_callback. */
+ addend here, but in practice it has already been added
+ because it was passed to constructor_callback. */
addend += section->output_section->vma + section->output_offset;
}
else if (h != NULL)
if (elf_bad_symtab (input_bfd))
{
nlocsyms = symtab_hdr->sh_size / sizeof (Elf_External_Sym);
- extsymoff = 0;
+ extsymoff = 0;
}
else
extsymoff = nlocsyms = symtab_hdr->sh_info;
locsym_shndx + (locsym_shndx ? r_symndx : 0),
&s);
if (ELF_ST_BIND (s.st_info) == STB_LOCAL)
- rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
+ rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
else
{
- h = sym_hashes[r_symndx - extsymoff];
- rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL);
+ h = sym_hashes[r_symndx - extsymoff];
+ rsec = (*gc_mark_hook) (sec->owner, info, rel, h, NULL);
}
}
else if (r_symndx >= nlocsyms)
}
if (rsec && !rsec->gc_mark)
- if (!elf_gc_mark (info, rsec, gc_mark_hook))
- {
- ret = false;
- goto out2;
- }
+ {
+ if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour)
+ rsec->gc_mark = 1;
+ else if (!elf_gc_mark (info, rsec, gc_mark_hook))
+ {
+ ret = false;
+ goto out2;
+ }
+ }
}
out2:
pu = h->vtable_parent->vtable_entries_used;
if (pu != NULL)
{
- asection *sec = h->root.u.def.section;
- struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
- int file_align = bed->s->file_align;
+ asection *sec = h->root.u.def.section;
+ struct elf_backend_data *bed = get_elf_backend_data (sec->owner);
+ int file_align = bed->s->file_align;
n = h->vtable_parent->vtable_entries_size / file_align;
while (n--)
bfd *sub;
asection * (*gc_mark_hook)
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *h, Elf_Internal_Sym *));
+ struct elf_link_hash_entry *h, Elf_Internal_Sym *));
if (!get_elf_backend_data (abfd)->can_gc_sections
|| info->relocateable || info->emitrelocations
for (o = sub->sections; o != NULL; o = o->next)
{
if (o->flags & SEC_KEEP)
- if (!elf_gc_mark (info, o, gc_mark_hook))
+ if (!elf_gc_mark (info, o, gc_mark_hook))
return false;
}
}
}
stab = strip ? NULL : bfd_get_section_by_name (abfd, ".stab");
- if ((! stab || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
+ if ((! stab
+ || elf_section_data(stab)->sec_info_type != ELF_INFO_TYPE_STABS)
&& ! eh
&& (strip || ! bed->elf_backend_discard_info))
continue;
freesyms = NULL;
if (symtab_hdr->contents)
- cookie.locsyms = (void *) symtab_hdr->contents;
+ cookie.locsyms = (void *) symtab_hdr->contents;
else if (cookie.locsymcount == 0)
- cookie.locsyms = NULL;
+ cookie.locsyms = NULL;
else
- {
- bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym);
- cookie.locsyms = bfd_malloc (amt);
- if (cookie.locsyms == NULL)
+ {
+ bfd_size_type amt = cookie.locsymcount * sizeof (Elf_External_Sym);
+ cookie.locsyms = bfd_malloc (amt);
+ if (cookie.locsyms == NULL)
return false;
freesyms = cookie.locsyms;
if (bfd_seek (abfd, symtab_hdr->sh_offset, SEEK_SET) != 0
- || bfd_bread (cookie.locsyms, amt, abfd) != amt)
+ || bfd_bread (cookie.locsyms, amt, abfd) != amt)
{
error_ret_free_loc:
free (cookie.locsyms);
return false;
- }
- }
+ }
+ }
cookie.locsym_shndx = NULL;
if (shndx_hdr->sh_size != 0 && cookie.locsymcount != 0)
cookie.relend = NULL;
if (eh->reloc_count)
cookie.rels = (NAME(_bfd_elf,link_read_relocs)
- (abfd, eh, (PTR) NULL,
- (Elf_Internal_Rela *) NULL,
+ (abfd, eh, (PTR) NULL, (Elf_Internal_Rela *) NULL,
info->keep_memory));
if (cookie.rels)
{
free (freesyms);
}
- if (ehdr
- && _bfd_elf_discard_section_eh_frame_hdr (output_bfd,
- info, ehdr))
+ if (ehdr && _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info, ehdr))
ret = true;
return ret;
}
elf_section_ignore_discarded_relocs (sec)
asection *sec;
{
+ struct elf_backend_data *bed;
+
switch (elf_section_data (sec)->sec_info_type)
{
case ELF_INFO_TYPE_STABS:
default:
break;
}
- if ((get_elf_backend_data (sec->owner)->elf_backend_ignore_discarded_relocs
- != NULL)
- && (*get_elf_backend_data (sec->owner)
- ->elf_backend_ignore_discarded_relocs) (sec))
+
+ bed = get_elf_backend_data (sec->owner);
+ if (bed->elf_backend_ignore_discarded_relocs != NULL
+ && (*bed->elf_backend_ignore_discarded_relocs) (sec))
return true;
return false;
switch (hdr->sh_type)
{
case SHT_IA_64_UNWIND:
- case SHT_INIT_ARRAY:
- case SHT_FINI_ARRAY:
- case SHT_PREINIT_ARRAY:
case SHT_IA_64_HP_OPT_ANOT:
break;
}
else if (strcmp (name, ELF_STRING_ia64_archext) == 0)
hdr->sh_type = SHT_IA_64_EXT;
- else if (strcmp (name, ".init_array") == 0)
- hdr->sh_type = SHT_INIT_ARRAY;
- else if (strcmp (name, ".fini_array") == 0)
- hdr->sh_type = SHT_FINI_ARRAY;
- else if (strcmp (name, ".preinit_array") == 0)
- hdr->sh_type = SHT_PREINIT_ARRAY;
else if (strcmp (name, ".HP.opt_annot") == 0)
hdr->sh_type = SHT_IA_64_HP_OPT_ANOT;
else if (strcmp (name, ".reloc") == 0)
/* Target definitions for NN-bit ELF
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* ar_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
- 14,
+ of the archiver and should be independently tunable. The System V ABI,
+ Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
+ 15,
/* Routines to byte-swap various sized integers from the data sections */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
/* ar_max_namelen: maximum number of characters in an archive header
FIXME: this really has nothing to do with ELF, this is a characteristic
- of the archiver and should be independently tunable. This value is
- a WAG (wild a** guess) */
- 14,
+ of the archiver and should be independently tunable. The System V ABI,
+ Chapter 7 (Formats & Protocols), Archive section sets this as 15. */
+ 15,
/* Routines to byte-swap various sized integers from the data sections */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_write_bigendian_4byte_int
SYNOPSIS
- void bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+ boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int);
DESCRIPTION
Write a 4 byte integer @var{i} to the output BFD @var{abfd}, in big
archives.
*/
-void
+boolean
bfd_write_bigendian_4byte_int (abfd, i)
bfd *abfd;
unsigned int i;
{
bfd_byte buffer[4];
bfd_putb32 ((bfd_vma) i, buffer);
- if (bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) != 4)
- abort ();
+ return bfd_bwrite ((PTR) buffer, (bfd_size_type) 4, abfd) == 4;
}
bfd_vma
/* And more follows */
-void
+boolean
bfd_write_bigendian_4byte_int PARAMS ((bfd *, unsigned int));
unsigned int
if (secinfo)
continue;
+ if (sinfo->htab->first == NULL)
+ continue;
+
if (sinfo->htab->strings)
merge_strings (sinfo);
else
entry = (mmo_data_list_type *)
bfd_zalloc (sec->owner, sizeof (mmo_data_list_type) + allocated_size);
if (entry == NULL)
- return false;
+ return NULL;
entry->where = vma;
entry->size = size;
entry->allocated_size = allocated_size;
adding entries. Since it is so short, a linear search is used. */
static const struct section_to_type stt[] =
{
- {"*DEBUG*", 'N'},
{".bss", 'b'},
- {"zerovars", 'b'}, /* MRI .bss */
+ {"code", 't'}, /* MRI .text */
{".data", 'd'},
- {"vars", 'd'}, /* MRI .data */
+ {"*DEBUG*", 'N'},
+ {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */
+ {".drectve", 'i'}, /* MSVC's .drective section */
+ {".edata", 'e'}, /* MSVC's .edata (export) section */
+ {".fini", 't'}, /* ELF fini section */
+ {".idata", 'i'}, /* MSVC's .idata (import) section */
+ {".init", 't'}, /* ELF init section */
+ {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */
{".rdata", 'r'}, /* Read only data. */
{".rodata", 'r'}, /* Read only data. */
{".sbss", 's'}, /* Small BSS (uninitialized data). */
{".scommon", 'c'}, /* Small common. */
{".sdata", 'g'}, /* Small initialized data. */
{".text", 't'},
- {"code", 't'}, /* MRI .text */
- {".drectve", 'i'}, /* MSVC's .drective section */
- {".idata", 'i'}, /* MSVC's .idata (import) section */
- {".edata", 'e'}, /* MSVC's .edata (export) section */
- {".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */
- {".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */
+ {"vars", 'd'}, /* MRI .data */
+ {"zerovars", 'b'}, /* MRI .bss */
{0, 0}
};
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
{
- boolean done;
+ boolean done, saw_line, saw_func;
bfd_vma val;
+ saw_line = false;
+ saw_func = false;
done = false;
switch (stab[TYPEOFF])
/* A line number. The value is relative to the start of the
current function. */
val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
- if (val <= offset)
+ /* If this line starts before our desired offset, or if it's
+ the first line we've been able to find, use it. The
+ !saw_line check works around a bug in GCC 2.95.3, which emits
+ the first N_SLINE late. */
+ if (!saw_line || val <= offset)
{
*pline = bfd_get_16 (abfd, stab + DESCOFF);
}
if (val > offset)
done = true;
+ saw_line = true;
break;
case N_FUN:
case N_SO:
- done = true;
+ if (saw_func || saw_line)
+ done = true;
+ saw_func = true;
break;
}