summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog190
-rw-r--r--bfd/archures.c1
-rw-r--r--bfd/bfd-in.h16
-rw-r--r--bfd/bfd-in2.h35
-rw-r--r--bfd/bfd.c4
-rw-r--r--bfd/config.bfd86
-rwxr-xr-xbfd/configure28
-rw-r--r--bfd/configure.host6
-rw-r--r--bfd/configure.in28
-rw-r--r--bfd/cpu-h8300.c21
-rw-r--r--bfd/cpu-m68hc12.c22
-rw-r--r--bfd/elf-bfd.h37
-rw-r--r--bfd/elf.c44
-rw-r--r--bfd/elf32-h8300.c55
-rw-r--r--bfd/elf32-i386.c37
-rw-r--r--bfd/elf32-i860.c6
-rw-r--r--bfd/elf32-m68hc1x.c22
-rw-r--r--bfd/elf32-m68k.c187
-rw-r--r--bfd/elf32-mips.c8
-rw-r--r--bfd/elf32-ppc.c57
-rw-r--r--bfd/elf32-sh.c39
-rw-r--r--bfd/elf32-xstormy16.c4
-rw-r--r--bfd/elf64-ppc.c43
-rw-r--r--bfd/elfcode.h226
-rw-r--r--bfd/elflink.c20
-rw-r--r--bfd/elflink.h10
-rw-r--r--bfd/elfxx-target.h4
-rw-r--r--bfd/version.h2
28 files changed, 893 insertions, 345 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0cf4ea341ad..4b44b409ad2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,191 @@
+2003-05-21 Marcus Comstedt <marcus@mc.pp.se>
+
+ * config.bfd: Check for a target triplet of shl-...-netbsdelf as
+ well as shle-...-netbsdelf. Remove duplicate entry.
+
+2003-05-21 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): Fix dst_mask
+ for X_STORMY16_REL_12 reloc.
+
+ * elf.c (bfd_elf_get_needed_list): Use is_elf_hash_table to check
+ the type of the has table in the bfd_link_info structure.
+ (bfd_elf_get_runpath_list): Likewise.
+
+2003-05-19 Roland McGrath <roland@redhat.com>
+
+ * elf.c (bfd_elf_bfd_from_remote_memory): New function.
+ * bfd-in.h: Declare it.
+ * bfd-in2.h: Regenerated.
+ * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New function.
+ * elf-bfd.h (struct elf_backend_data): New function pointer member
+ elf_backend_bfd_from_remote_memory.
+ (_bfd_elf32_bfd_from_remote_memory, _bfd_elf64_bfd_from_remote_memory):
+ Declare them.
+ * elfxx-target.h (elf_backend_bfd_from_remote_memory): New macro.
+ (elfNN_bed): Add that to the initializer.
+
+2003-05-15 Roland McGrath <roland@redhat.com>
+
+ * elf.c (elfcore_grok_note): Grok NT_AUXV note, make ".auxv" section.
+
+2003-05-20 Jakub Jelinek <jakub@redhat.com>
+
+ * elflink.h (elf_link_output_extsym): Only issue error about !=
+ STV_DEFAULT symbols if they are bfd_link_hash_undefined.
+
+2003-05-20 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Check ELF_LINK_DYNAMIC_DEF
+ when removing the old definition for symbols with non-default
+ visibility.
+
+2003-05-18 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c (elf32_i860_relocate_highadj): Simplify calculation.
+
+2003-05-17 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_check_relocs): Cache reloc section in
+ elf_section_data during processing of pc-relative and absolute
+ relocations.
+ (elf_m68k_relocate_section): Use the cached reloc section instead
+ of computing it again. Fix handling of visibility. Don't modify
+ addend when copying over a relocation into the output.
+
+2003-05-17 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
+ to trim plt entries. Move undefweak non-default visibility test..
+ (allocate_dynrelocs): ..from here.
+ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't test
+ dynamic_sections_created here. Update comment. Move undefweak
+ non-default visibility test..
+ (allocate_dynrelocs): ..from here. Fix comment.
+ * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL
+ to trim plt entries. Move undefweak non-default visibility test..
+ (allocate_dynrelocs): ..from here. Fix comment.
+ * elflink.h (elf_link_output_extsym): Compare ELF_ST_VISIBILITY with
+ STV_DEFAULT rather than comparing with zero.
+ * elflink.c (_bfd_elf_merge_symbol): Likewise.
+ (_bfd_elf_fix_symbol_flags): Likewise. Format comment.
+
+2003-05-17 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * bfd.c (_bfd_get_gp_value): Prevent illegal access for abfd null
+ pointers.
+ (_bfd_set_gp_value): Likewise.
+
+2003-05-16 Michael Snyder <msnyder@redhat.com>
+ From Bernd Schmidt <bernds@redhat.com>
+ * archures.c (bfd_mach_h8300sx): New.
+ * bfd-in2.h: Regenerate.
+ * cpu-h8300.c (h8300_scan)): Add support for h8300sx.
+ (h8300sx_info_struct): New.
+ (h8300s_info_struct): Link to it.
+ * elf32-h8300.c (elf32_h8_mach): Add support for h8300sx.
+ (elf32_h8_final_write_processing): Likewise.
+ (elf32_h8_relax_section): Likewise.
+
+2003-05-16 Kelley Cook <kelleycook@wideopenwest.com>
+
+ * config.bfd: Accept i[3-7]86 variants.
+ * configure.host: Likewise.
+ * configure.in: Likewise.
+ * configure: Regenerate.
+
+2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_fix_symbol_flags): Also hide protected
+ symbol.
+
+2003-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.h (elf_link_check_versioned_symbol): Also allow
+ the base version.
+
+2003-05-15 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_CALLS_LOCAL.
+ (elf_i386_relocate_section): Likewise.
+ * elf32-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc_elf_relocate_section): Likewise.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc64_elf_relocate_section): Likewise.
+
+2003-05-15 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
+
+ * elf32-mips.c (gprel32_with_gp): Remove useless N64 ABI case.
+
+2003-05-13 Stephane Carrez <stcarrez@nerim.fr>
+
+ * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Check for
+ processor capability, allow merge of HC12 and HCS12 in some cases.
+ (m68hc11_elf_hash_table_create): Use bfd_malloc instead of bfd_zalloc.
+ * cpu-m68hc12.c (bfd_m68hc12s_arch): New struct.
+ (bfd_m68hc12_arch): Link it.
+ (scan_mach): New function.
+
+2003-05-13 Andrew Haley <aph@redhat.com>
+
+ * elf.c (bfd_elf_hash): Mask lower 32 bits of hash.
+
+2003-05-13 Alan Modra <amodra@bigpond.net.au>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Move from
+ elf32-ppc.c. Add ELF_LINK_FORCED_LOCAL check.
+ * elf32-ppc.c: (SYMBOL_REFERENCES_LOCAL, SYMBOL_CALLS_LOCAL): Delete.
+ (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for dynreloc check.
+ (ppc_elf_relocate_section): Likewise.
+ * elf64-ppc.c (allocate_dynrelocs): Likewise.
+ (ppc64_elf_relocate_section): Likewise. Use for .got relocs too.
+ (ppc64_elf_adjust_dynamic_symbol): Don't assume symbols with .plt
+ relocs need no other types.
+ * elf32-i386.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL for
+ dynreloc check.
+ (elf_i386_relocate_section): Likewise. Use for .got relocs too.
+ (elf_i386_finish_dynamic_symbol): Use SYMBOL_REFERENCES_LOCAL for
+ .got relocs.
+
+2003-05-13 Kaz Kojima <kkojima@rr.iij4u.or.jp>
+
+ * elf32-sh.c (sh_elf_adjust_dynamic_symbol): For weak symbols,
+ copy ELF_LINK_NON_GOT_REF from weakdef.
+ (allocate_dynrelocs): For undef weak syms with non-default
+ visibility, a) don't allocate plt entries, b) don't allocate
+ .got relocs, c) discard dyn rel space
+ (sh_elf_relocate_section): d) don't generate .got relocs, e)
+ don't generate dynamic relocs.
+ (sh_elf_copy_indirect_symbol): Don't copy ELF_LINK_NON_GOT_REF
+ for weakdefs when symbol already adjusted.
+
+2003-05-12 Nick Clifton <nickc@redhat.com>
+
+ * elf32-xstormy16.c (xstormy16_elf_howto_table): use 'bitfield'
+ overflow detection for R_XSTORMY16_16 reloc.
+
+2003-05-12 Paul Clarke <paulc@senet.com.au>
+
+ * elf32-h8300.c: Fix typo in name of R_H8_DIR8 reloc.
+
+2003-05-11 Jason Eckhardt <jle@rice.edu>
+
+ * elf32-i860.c (elf32_i860_relocate_highadj): Properly
+ adjust upper bits.
+ (elf32_i860_relocate_splitn): Obtain upper 5 bits from the
+ proper place.
+ (elf32_i860_relocate_pc16): Obtain upper 5 bits from the
+ proper place.
+
+2003-05-11 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (elf_m68k_relocate_section): Replace ugly
+ complicated tests for unresolvable relocs with a simple direct
+ scheme using "unresolved_reloc" var. Report some detail on
+ bfd_reloc_outofrange and similar errors.
+
2003-05-09 Martin Schwidefsky <schwidefsky@de.ibm.com>
* elf32-s390.c (allocate_dynrelocs, elf_s390_relocate_section):
@@ -179,7 +367,7 @@
(elf_i386_relocate_section): Initialize the GOT entries and
skip R_386_32/R_386_PC32 for weak undefined symbols with
non-default visibility.
-
+
* elfxx-ia64.c (allocate_fptr): Don't allocate function
descriptors for weak undefined symbols with non-default
visibility.
diff --git a/bfd/archures.c b/bfd/archures.c
index 3d473c3b8a2..250892ce532 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -169,6 +169,7 @@ DESCRIPTION
.#define bfd_mach_h8300s 3
.#define bfd_mach_h8300hn 4
.#define bfd_mach_h8300sn 5
+.#define bfd_mach_h8300sx 6
. bfd_arch_pdp11, {* DEC PDP-11 *}
. bfd_arch_powerpc, {* PowerPC *}
.#define bfd_mach_ppc 32
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 93fd0fd13b3..fdf5f1c389e 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -694,6 +694,22 @@ extern long bfd_get_elf_phdr_upper_bound
extern int bfd_get_elf_phdrs
PARAMS ((bfd *abfd, void *phdrs));
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+extern bfd *bfd_elf_bfd_from_remote_memory
+ PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)));
+
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size
PARAMS ((bfd *));
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 637376bc0dd..8df80a00aa4 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1,7 +1,7 @@
-/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
- "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
- "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
+/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
+ generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
+ "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
+ "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
"linker.c" and "simple.c".
Run "make headers" in your build bfd/ to regenerate. */
@@ -701,6 +701,22 @@ extern long bfd_get_elf_phdr_upper_bound
extern int bfd_get_elf_phdrs
PARAMS ((bfd *abfd, void *phdrs));
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+extern bfd *bfd_elf_bfd_from_remote_memory
+ PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)));
+
/* Return the arch_size field of an elf bfd, or -1 if not elf. */
extern int bfd_get_arch_size
PARAMS ((bfd *));
@@ -1635,6 +1651,7 @@ enum bfd_architecture
#define bfd_mach_h8300s 3
#define bfd_mach_h8300hn 4
#define bfd_mach_h8300sn 5
+#define bfd_mach_h8300sx 6
bfd_arch_pdp11, /* DEC PDP-11 */
bfd_arch_powerpc, /* PowerPC */
#define bfd_mach_ppc 32
@@ -1775,7 +1792,7 @@ enum bfd_architecture
#define bfd_mach_msp43 43
#define bfd_mach_msp44 44
#define bfd_mach_msp15 15
-#define bfd_mach_msp16 16
+#define bfd_mach_msp16 16
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
#define bfd_mach_xtensa 1
bfd_arch_last
@@ -3463,14 +3480,14 @@ instruction opcode. */
BFD_RELOC_XTENSA_OP1,
BFD_RELOC_XTENSA_OP2,
-/* Xtensa relocation to mark that the assembler expanded the
+/* Xtensa relocation to mark that the assembler expanded the
instructions from an original target. The expansion size is
encoded in the reloc size. */
BFD_RELOC_XTENSA_ASM_EXPAND,
-/* Xtensa relocation to mark that the linker should simplify
-assembler-expanded instructions. This is commonly used
-internally by the linker after analysis of a
+/* Xtensa relocation to mark that the linker should simplify
+assembler-expanded instructions. This is commonly used
+internally by the linker after analysis of a
BFD_RELOC_XTENSA_ASM_EXPAND. */
BFD_RELOC_XTENSA_ASM_SIMPLIFY,
BFD_RELOC_UNUSED };
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 32250823a19..99c5ea668e8 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -894,6 +894,8 @@ bfd_vma
_bfd_get_gp_value (abfd)
bfd *abfd;
{
+ if (! abfd)
+ return 0;
if (abfd->format != bfd_object)
return 0;
@@ -912,6 +914,8 @@ _bfd_set_gp_value (abfd, v)
bfd *abfd;
bfd_vma v;
{
+ if (! abfd)
+ BFD_FAIL ();
if (abfd->format != bfd_object)
return;
diff --git a/bfd/config.bfd b/bfd/config.bfd
index d034ce8e9e8..d93b07131a7 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -38,7 +38,7 @@ c4x*) targ_archs=bfd_tic4x_arch ;;
c54x*) targ_archs=bfd_tic54x_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
-i[3456]86) targ_archs=bfd_i386_arch ;;
+i[3-7]86) targ_archs=bfd_i386_arch ;;
i370) targ_archs=bfd_i370_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch" ;;
@@ -365,97 +365,97 @@ case "${targ}" in
targ_defvec=bfd_elf32_i370_vec
targ_selvecs="bfd_elf32_i370_vec"
;;
- i[3456]86-*-sco3.2v5*coff)
+ i[3-7]86-*-sco3.2v5*coff)
targ_defvec=i386coff_vec
targ_selvecs=bfd_elf32_i386_vec
;;
- i[3456]86-*-sysv4* | i[3456]86-*-unixware* | i[3456]86-*-solaris2* | \
- i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | \
- i[3456]86-*-dgux* | i[3456]86-*-sysv5*)
+ i[3-7]86-*-sysv4* | i[3-7]86-*-unixware* | i[3-7]86-*-solaris2* | \
+ i[3-7]86-*-elf | i[3-7]86-*-sco3.2v5* | \
+ i[3-7]86-*-dgux* | i[3-7]86-*-sysv5*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
- i[3456]86-*-kaos*)
+ i[3-7]86-*-kaos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=bfd_elf32_i386_vec
;;
- i[3456]86-*-nto*)
+ i[3-7]86-*-nto*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386coff_vec
;;
- i[3456]86-*-aros*)
+ i[3-7]86-*-aros*)
targ_defvec=bfd_elf32_i386_vec
;;
- i[3456]86-*-chorus*)
+ i[3-7]86-*-chorus*)
targ_defvec=bfd_elf32_i386_vec
;;
*-*-msdosdjgpp* | *-*-go32* | *-go32-rtems* )
targ_defvec=go32coff_vec
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
;;
- i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \
- i[3456]86-*-aix*)
+ i[3-7]86-*-sysv* | i[3-7]86-*-isc* | i[3-7]86-*-sco* | i[3-7]86-*-coff | \
+ i[3-7]86-*-aix*)
targ_defvec=i386coff_vec
;;
- i[3456]86*-*-rtemscoff*)
+ i[3-7]86*-*-rtemscoff*)
targ_defvec=i386coff_vec
targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
;;
- i[3456]86-*-rtemself* | i[3456]86-*-rtems*)
+ i[3-7]86-*-rtemself* | i[3-7]86-*-rtems*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386coff_vec i386aout_vec"
;;
- i[3456]86-*-darwin* | i[3456]86-*-macos10* | i[3456]86-*-rhapsody*)
+ i[3-7]86-*-darwin* | i[3-7]86-*-macos10* | i[3-7]86-*-rhapsody*)
targ_defvec=mach_o_le_vec
targ_selvecs="mach_o_le_vec mach_o_be_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec"
targ_archs="bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
;;
- i[3456]86-sequent-bsd*)
+ i[3-7]86-sequent-bsd*)
targ_defvec=i386dynix_vec
targ_underscore=yes
;;
- i[3456]86-*-bsd*)
+ i[3-7]86-*-bsd*)
targ_defvec=i386bsd_vec
targ_underscore=yes
;;
- i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | \
- i[3456]86-*-freebsd[12])
+ i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | \
+ i[3-7]86-*-freebsd[12])
targ_defvec=i386freebsd_vec
targ_selvecs=i386bsd_vec
targ_underscore=yes
;;
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd*)
targ_defvec=bfd_elf32_i386_freebsd_vec
targ_selvecs=i386coff_vec
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
- i[3456]86-*-freebsd3* | i[3456]86-*-freebsd4 | i[3456]86-*-freebsd4.0*)
+ i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*)
targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
esac
;;
- i[3456]86-*-netbsdelf*)
+ i[3-7]86-*-netbsdelf*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs=i386netbsd_vec
;;
- i[3456]86-*-netbsdpe*)
+ i[3-7]86-*-netbsdpe*)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
;;
- i[3456]86-*-netbsdaout* | i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*)
targ_defvec=i386netbsd_vec
targ_selvecs="bfd_elf32_i386_vec i386bsd_vec"
targ_underscore=yes
;;
- i[3456]86-*-netware*)
+ i[3-7]86-*-netware*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="nlm32_i386_vec i386coff_vec i386aout_vec"
;;
- i[3456]86-*-linux*aout*)
+ i[3-7]86-*-linux*aout*)
targ_defvec=i386linux_vec
targ_selvecs=bfd_elf32_i386_vec
targ_underscore=yes
;;
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
targ64_selvecs=bfd_elf64_x86_64_vec
@@ -474,58 +474,58 @@ case "${targ}" in
targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
;;
#endif
- i[3456]86-*-lynxos*)
+ i[3-7]86-*-lynxos*)
targ_defvec=i386lynx_coff_vec
targ_selvecs=i386lynx_aout_vec
;;
- i[3456]86-*-gnu*)
+ i[3-7]86-*-gnu*)
targ_defvec=bfd_elf32_i386_vec
;;
- i[3456]86-*-mach* | i[3456]86-*-osf1mk*)
+ i[3-7]86-*-mach* | i[3-7]86-*-osf1mk*)
targ_defvec=i386mach3_vec
targ_cflags=-DSTAT_FOR_EXEC
targ_underscore=yes
;;
- i[3456]86-*-os9k)
+ i[3-7]86-*-os9k)
targ_defvec=i386os9k_vec
;;
- i[3456]86-*-msdos*)
+ i[3-7]86-*-msdos*)
targ_defvec=i386aout_vec
targ_selvecs=i386msdos_vec
;;
- i[3456]86-*-moss*)
+ i[3-7]86-*-moss*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386msdos_vec i386aout_vec"
;;
- i[3456]86-*-beospe*)
+ i[3-7]86-*-beospe*)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec"
;;
- i[3456]86-*-beoself* | i[3456]86-*-beos*)
+ i[3-7]86-*-beoself* | i[3-7]86-*-beos*)
targ_defvec=bfd_elf32_i386_vec
targ_selvecs="i386pe_vec i386pei_vec"
;;
- i[3456]86-*-interix*)
+ i[3-7]86-*-interix*)
targ_defvec=i386pei_vec
targ_selvecs="i386pe_vec"
# FIXME: This should eventually be checked at runtime.
targ_cflags=-DSTRICT_PE_FORMAT
;;
- i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe)
+ i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
targ_defvec=i386pe_vec
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
;;
- i[3456]86-none-*)
+ i[3-7]86-none-*)
targ_defvec=i386coff_vec
;;
- i[3456]86-*-aout* | i[3456]86*-*-vsta*)
+ i[3-7]86-*-aout* | i[3-7]86*-*-vsta*)
targ_defvec=i386aout_vec
;;
- i[3456]86-*-vxworks*)
+ i[3-7]86-*-vxworks*)
targ_defvec=i386aout_vec
targ_underscore=yes
;;
- i[3456]86-*-chaos)
+ i[3-7]86-*-chaos)
targ_defvec=bfd_elf32_i386_vec
targ_selfvecs=i386chaos_vec
;;
@@ -1016,17 +1016,13 @@ case "${targ}" in
;;
#endif
- shle-*-netbsdelf*)
+ sh*l*-*-netbsdelf*)
targ_defvec=bfd_elf32_shlnbsd_vec
targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
#ifdef BFD64
targ_selvecs="${targ_selvecs} bfd_elf32_sh64lnbsd_vec bfd_elf32_sh64nbsd_vec bfd_elf64_sh64lnbsd_vec bfd_elf64_sh64nbsd_vec"
#endif
;;
- sh*le-*-netbsdelf*)
- targ_defvec=bfd_elf32_shlnbsd_vec
- targ_selvecs="bfd_elf32_shnbsd_vec shcoff_vec shlcoff_vec"
- ;;
sh-*-netbsdelf*)
targ_defvec=bfd_elf32_shnbsd_vec
targ_selvecs="bfd_elf32_shlnbsd_vec shcoff_vec shlcoff_vec"
diff --git a/bfd/configure b/bfd/configure
index 47eaef7476f..df2d7ff38fc 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -5121,50 +5121,50 @@ if test "${target}" = "${host}"; then
TRAD_HEADER='"hosts/i370linux.h"'
;;
- i[3456]86-sequent-bsd*)
+ i[3-7]86-sequent-bsd*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
- i[3456]86-sequent-sysv4*) ;;
- i[3456]86-sequent-sysv*)
+ i[3-7]86-sequent-sysv4*) ;;
+ i[3-7]86-sequent-sysv*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
- i[3456]86-*-bsdi)
+ i[3-7]86-*-bsdi)
COREFILE=
;;
- i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]86-*-freebsd*aout*)
+ i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd*)
COREFILE=''
TRAD_HEADER='"hosts/i386bsd.h"'
;;
- i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*)
COREFILE=netbsd-core.lo
;;
- i[3456]86-esix-sysv3*)
+ i[3-7]86-esix-sysv3*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/esix.h"'
;;
- i[3456]86-*-sco3.2v5*)
+ i[3-7]86-*-sco3.2v5*)
COREFILE=sco5-core.lo
;;
- i[3456]86-*-sco* | i[3456]86-*-isc*)
+ i[3-7]86-*-sco* | i[3-7]86-*-isc*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386sco.h"'
;;
- i[3456]86-*-mach3*)
+ i[3-7]86-*-mach3*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
- i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3456]86-*-aix*) COREFILE=aix386-core.lo ;;
+ i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
+ i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
i860-*-mach3* | i860-*-osf1*)
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i860mach3.h"'
diff --git a/bfd/configure.host b/bfd/configure.host
index 634b0b12376..b690fb9c01e 100644
--- a/bfd/configure.host
+++ b/bfd/configure.host
@@ -37,9 +37,9 @@ ia64-*-hpux*) host64=true
HOST_U_64BIT_TYPE="unsigned long long";
;;
-i[3456]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
-i[3456]86-sequent-sysv4*) ;;
-i[3456]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
+i[3-7]86-sequent-bsd*) HDEFINES=-Dshared=genshared ;;
+i[3-7]86-sequent-sysv4*) ;;
+i[3-7]86-sequent-sysv*) HDEFINES=-Dshared=genshared ;;
mips*-*-netbsd*) ;;
mips*-*-openbsd*) ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index a2b56d2f341..b7081454d67 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -175,72 +175,72 @@ if test "${target}" = "${host}"; then
;;
changequote(,)dnl
- i[3456]86-sequent-bsd*)
+ i[3-7]86-sequent-bsd*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
- i[3456]86-sequent-sysv4*) ;;
- i[3456]86-sequent-sysv*)
+ i[3-7]86-sequent-sysv4*) ;;
+ i[3-7]86-sequent-sysv*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/symmetry.h"'
;;
changequote(,)dnl
- i[3456]86-*-bsdi)
+ i[3-7]86-*-bsdi)
changequote([,])dnl
COREFILE=
;;
changequote(,)dnl
- i[3456]86-*-bsd* | i[34567]86-*-freebsd[123] | i[34567]86-*-freebsd[123]\.* | i[34567]86-*-freebsd4\.[01234]* | i[34567]86-*-freebsd*aout*)
+ i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[123] | i[3-7]86-*-freebsd[123]\.* | i[3-7]86-*-freebsd4\.[01234]* | i[3-7]86-*-freebsd*aout*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
- i[3456]86-*-freebsd*)
+ i[3-7]86-*-freebsd*)
changequote([,])dnl
COREFILE=''
TRAD_HEADER='"hosts/i386bsd.h"'
;;
changequote(,)dnl
- i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
+ i[3-7]86-*-netbsd* | i[3-7]86-*-openbsd*)
changequote([,])dnl
COREFILE=netbsd-core.lo
;;
changequote(,)dnl
- i[3456]86-esix-sysv3*)
+ i[3-7]86-esix-sysv3*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/esix.h"'
;;
changequote(,)dnl
- i[3456]86-*-sco3.2v5*)
+ i[3-7]86-*-sco3.2v5*)
changequote([,])dnl
COREFILE=sco5-core.lo
;;
changequote(,)dnl
- i[3456]86-*-sco* | i[3456]86-*-isc*)
+ i[3-7]86-*-sco* | i[3-7]86-*-isc*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386sco.h"'
;;
changequote(,)dnl
- i[3456]86-*-mach3*)
+ i[3-7]86-*-mach3*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386mach3.h"'
;;
changequote(,)dnl
- i[3456]86-*-linux-gnu*)
+ i[3-7]86-*-linux-gnu*)
changequote([,])dnl
COREFILE=trad-core.lo
TRAD_HEADER='"hosts/i386linux.h"'
;;
changequote(,)dnl
- i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
- i[3456]86-*-aix*) COREFILE=aix386-core.lo ;;
+ i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
+ i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
changequote([,])dnl
i860-*-mach3* | i860-*-osf1*)
COREFILE=trad-core.lo
diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c
index 2a5c604df64..f61e7576a8b 100644
--- a/bfd/cpu-h8300.c
+++ b/bfd/cpu-h8300.c
@@ -81,6 +81,9 @@ h8300_scan (info, string)
if (*string == 'n' || *string == 'N')
return (info->mach == bfd_mach_h8300sn);
+ if (*string == 'x' || *string == 'X')
+ return (info->mach == bfd_mach_h8300sx);
+
return (info->mach == bfd_mach_h8300s);
}
else
@@ -103,6 +106,22 @@ compatible (in, out)
return in;
}
+static const bfd_arch_info_type h8300sx_info_struct =
+{
+ 32, /* 32 bits in a word */
+ 32, /* 32 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_h8300,
+ bfd_mach_h8300sx,
+ "h8300sx", /* arch_name */
+ "h8300sx", /* printable name */
+ 1,
+ FALSE, /* the default machine */
+ compatible,
+ h8300_scan,
+ 0
+};
+
static const bfd_arch_info_type h8300sn_info_struct =
{
32, /* 32 bits in a word. */
@@ -116,7 +135,7 @@ static const bfd_arch_info_type h8300sn_info_struct =
FALSE, /* The default machine. */
compatible,
h8300_scan,
- 0
+ &h8300sx_info_struct
};
diff --git a/bfd/cpu-m68hc12.c b/bfd/cpu-m68hc12.c
index d43eb95fc17..f4c8c9e7581 100644
--- a/bfd/cpu-m68hc12.c
+++ b/bfd/cpu-m68hc12.c
@@ -1,5 +1,5 @@
/* BFD support for the Motorola 68HC12 processor
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,10 +21,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "sysdep.h"
#include "libbfd.h"
+const bfd_arch_info_type bfd_m68hc12s_arch =
+{
+ 16, /* 16 bits in a word */
+ 32, /* 16 bits in an address */
+ 8, /* 8 bits in a byte */
+ bfd_arch_m68hc12,
+ bfd_mach_m6812s,
+ "m68hc12:HCS12",
+ "m68hc12",
+ 4, /* section alignment power */
+ TRUE,
+ bfd_default_compatible,
+ bfd_default_scan,
+ 0,
+};
+
const bfd_arch_info_type bfd_m68hc12_arch =
{
16, /* 16 bits in a word */
- 16, /* 16 bits in an address */
+ 32, /* 16 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_m68hc12,
0,
@@ -34,5 +50,5 @@ const bfd_arch_info_type bfd_m68hc12_arch =
TRUE,
bfd_default_compatible,
bfd_default_scan,
- 0,
+ &bfd_m68hc12s_arch,
};
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 073aee8a179..1da605502b5 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -210,6 +210,30 @@ struct elf_link_hash_entry
#define ELF_LINK_DYNAMIC_WEAK 040000
};
+/* Will references to this symbol always reference the symbol
+ in this object? STV_PROTECTED is excluded from the visibility test
+ here so that function pointer comparisons work properly. Since
+ function symbols not defined in an app are set to their .plt entry,
+ it's necessary for shared libs to also reference the .plt even
+ though the symbol is really local to the shared lib. */
+#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
+ ((! (INFO)->shared \
+ || (INFO)->symbolic \
+ || (H)->dynindx == -1 \
+ || ELF_ST_VISIBILITY ((H)->other) == STV_INTERNAL \
+ || ELF_ST_VISIBILITY ((H)->other) == STV_HIDDEN \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \
+ && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+
+/* Will _calls_ to this symbol always call the version in this object? */
+#define SYMBOL_CALLS_LOCAL(INFO, H) \
+ ((! (INFO)->shared \
+ || (INFO)->symbolic \
+ || (H)->dynindx == -1 \
+ || ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0) \
+ && ((H)->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
+
/* Records local symbols to be emitted in the dynamic symbol table. */
struct elf_link_local_dynamic_entry
@@ -851,6 +875,12 @@ struct elf_backend_data
Used for the MIPS ELF .mdebug section. */
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
+ /* This function implements `bfd_elf_bfd_from_remote_memory';
+ see elf.c, elfcode.h. */
+ bfd *(*elf_backend_bfd_from_remote_memory)
+ PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)));
+
/* Alternate EM_xxxx machine codes for this backend. */
int elf_machine_alt1;
int elf_machine_alt2;
@@ -1726,6 +1756,13 @@ extern char *elfcore_write_prxfpreg
extern char *elfcore_write_lwpstatus
PARAMS ((bfd *, char *, int *, long, int, const PTR));
+extern bfd *_bfd_elf32_bfd_from_remote_memory
+ PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int)));
+extern bfd *_bfd_elf64_bfd_from_remote_memory
+ PARAMS ((bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ int (*target_read_memory) (bfd_vma, char *, int)));
+
/* SH ELF specific routine. */
extern bfd_boolean _sh_elf_set_mach_from_flags
diff --git a/bfd/elf.c b/bfd/elf.c
index 737f4954711..66383e7c0d4 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -271,7 +271,7 @@ bfd_elf_hash (namearg)
h ^= g;
}
}
- return h;
+ return h & 0xffffffff;
}
/* Read a specified number of bytes at a specified offset in an ELF
@@ -1616,7 +1616,7 @@ bfd_elf_get_needed_list (abfd, info)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (! is_elf_hash_table (info))
return NULL;
return elf_hash_table (info)->needed;
}
@@ -1629,7 +1629,7 @@ bfd_elf_get_runpath_list (abfd, info)
bfd *abfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (! is_elf_hash_table (info))
return NULL;
return elf_hash_table (info)->runpath;
}
@@ -6884,6 +6884,20 @@ elfcore_grok_note (abfd, note)
#else
return TRUE;
#endif
+
+ case NT_AUXV:
+ {
+ asection *sect = bfd_make_section (abfd, ".auxv");
+
+ if (sect == NULL)
+ return FALSE;
+ sect->_raw_size = note->descsz;
+ sect->filepos = note->descpos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+ return TRUE;
+ }
}
}
@@ -7535,3 +7549,27 @@ _bfd_elf_section_offset (abfd, info, sec, offset)
return offset;
}
}
+
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+
+bfd *
+bfd_elf_bfd_from_remote_memory (templ, ehdr_vma, loadbasep, target_read_memory)
+ bfd *templ;
+ bfd_vma ehdr_vma;
+ bfd_vma *loadbasep;
+ int (*target_read_memory) PARAMS ((bfd_vma vma, char *myaddr, int len));
+{
+ return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory)
+ (templ, ehdr_vma, loadbasep, target_read_memory);
+}
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 30db68f2119..f272dc8e084 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -69,8 +69,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_dont,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_NONE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -83,8 +83,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_dont,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_DIR32", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -97,8 +97,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_dont,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_DIR16", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -111,9 +111,9 @@ static reloc_howto_type h8_elf_howto_table[] = {
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- special, /* special_function */
- "R_H8_DIR16", /* name */
+ complain_overflow_dont,/* complain_on_overflow */
+ special, /* special_function */
+ "R_H8_DIR8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0x000000ff, /* dst_mask */
@@ -126,7 +126,7 @@ static reloc_howto_type h8_elf_howto_table[] = {
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- special, /* special_function */
+ special, /* special_function */
"R_H8_DIR16A8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -140,7 +140,7 @@ static reloc_howto_type h8_elf_howto_table[] = {
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- special, /* special_function */
+ special, /* special_function */
"R_H8_DIR16R8", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -154,7 +154,7 @@ static reloc_howto_type h8_elf_howto_table[] = {
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- special, /* special_function */
+ special, /* special_function */
"R_H8_DIR24A8", /* name */
TRUE, /* partial_inplace */
0xff000000, /* src_mask */
@@ -168,7 +168,7 @@ static reloc_howto_type h8_elf_howto_table[] = {
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
- special, /* special_function */
+ special, /* special_function */
"R_H8_DIR24R8", /* name */
TRUE, /* partial_inplace */
0xff000000, /* src_mask */
@@ -181,8 +181,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_dont,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_DIR32", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
@@ -195,8 +195,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_signed,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_PCREL16", /* name */
FALSE, /* partial_inplace */
0xffff, /* src_mask */
@@ -209,8 +209,8 @@ static reloc_howto_type h8_elf_howto_table[] = {
8, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
- complain_overflow_signed, /* complain_on_overflow */
- special, /* special_function */
+ complain_overflow_signed,/* complain_on_overflow */
+ special, /* special_function */
"R_H8_PCREL8", /* name */
FALSE, /* partial_inplace */
0xff, /* src_mask */
@@ -579,6 +579,9 @@ elf32_h8_mach (flags)
case E_H8_MACH_H8300SN:
return bfd_mach_h8300sn;
+
+ case E_H8_MACH_H8300SX:
+ return bfd_mach_h8300sx;
}
}
@@ -615,6 +618,10 @@ elf32_h8_final_write_processing (abfd, linker)
case bfd_mach_h8300sn:
val = E_H8_MACH_H8300SN;
break;
+
+ case bfd_mach_h8300sx:
+ val = E_H8_MACH_H8300SX;
+ break;
}
elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH);
@@ -1023,7 +1030,10 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
&& value >= 0xff00
&& value <= 0xffff)
|| ((bfd_get_mach (abfd) == bfd_mach_h8300h
- || bfd_get_mach (abfd) == bfd_mach_h8300s)
+ /* FIXME: h8300hn? */
+ || bfd_get_mach (abfd) == bfd_mach_h8300s
+ /* FIXME: h8300sn? */
+ || bfd_get_mach (abfd) == bfd_mach_h8300sx)
&& value >= 0xffff00
&& value <= 0xffffff))
{
@@ -1081,7 +1091,10 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
&& value >= 0xff00
&& value <= 0xffff)
|| ((bfd_get_mach (abfd) == bfd_mach_h8300h
- || bfd_get_mach (abfd) == bfd_mach_h8300s)
+ /* FIXME: h8300hn? */
+ || bfd_get_mach (abfd) == bfd_mach_h8300s
+ /* FIXME: h8300sn? */
+ || bfd_get_mach (abfd) == bfd_mach_h8300sx)
&& value >= 0xffff00
&& value <= 0xffffff))
{
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 320e9859839..cfcb7b34c19 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1390,11 +1390,9 @@ elf_i386_adjust_dynamic_symbol (info, h)
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{
if (h->plt.refcount <= 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
- && h->root.type != bfd_link_hash_undefweak
- && h->root.type != bfd_link_hash_undefined))
+ || SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
/* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic
@@ -1558,9 +1556,7 @@ allocate_dynrelocs (h, inf)
htab = elf_i386_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && h->plt.refcount > 0)
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
@@ -1679,9 +1675,13 @@ allocate_dynrelocs (h, inf)
if (info->shared)
{
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || info->symbolic))
+ /* The only reloc that uses pc_count is R_386_PC32, which will
+ appear on a call or on something like ".long foo - .". We
+ want calls to protected symbols to resolve directly to the
+ function rather than going via the plt. If people want
+ function pointer comparisons to work as expected then they
+ should avoid writing assembly like ".long foo - .". */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct elf_i386_dyn_relocs **pp;
@@ -2305,10 +2305,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
dyn = htab->elf.dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
|| (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak))
{
@@ -2439,10 +2436,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type != bfd_link_hash_undefweak)
&& (r_type != R_386_PC32
|| (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ && !SYMBOL_CALLS_LOCAL (info, h))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
&& h != NULL
@@ -3172,10 +3166,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ && SYMBOL_REFERENCES_LOCAL (info, h))
{
BFD_ASSERT((h->got.offset & 1) != 0);
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index d24a29d8a63..74112f1389f 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -718,7 +718,7 @@ elf32_i860_relocate_splitn (input_bfd, rello, contents, value)
value += rello->r_addend;
/* Separate the fields and insert. */
- value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
+ value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
@@ -750,7 +750,7 @@ elf32_i860_relocate_pc16 (input_bfd, input_section, rello, contents, value)
value += rello->r_addend;
/* Separate the fields and insert. */
- value = (((value & 0xf8) << 5) | (value & 0x7ff)) & howto->dst_mask;
+ value = (((value & 0xf800) << 5) | (value & 0x7ff)) & howto->dst_mask;
insn = (insn & ~howto->dst_mask) | value;
bfd_put_32 (input_bfd, insn, contents + rello->r_offset);
@@ -802,8 +802,8 @@ elf32_i860_relocate_highadj (input_bfd, rel, contents, value)
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- value += ((rel->r_addend & 0x8000) << 1);
value += rel->r_addend;
+ value += 0x8000;
value = ((value >> 16) & 0xffff);
insn = (insn & 0xffff0000) | value;
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 3c2ff6118f5..176a256c744 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -75,14 +75,15 @@ m68hc11_elf_hash_table_create (abfd)
struct m68hc11_elf_link_hash_table *ret;
bfd_size_type amt = sizeof (struct m68hc11_elf_link_hash_table);
- ret = (struct m68hc11_elf_link_hash_table *) bfd_zalloc (abfd, amt);
+ ret = (struct m68hc11_elf_link_hash_table *) bfd_malloc (amt);
if (ret == (struct m68hc11_elf_link_hash_table *) NULL)
return NULL;
+ memset (ret, 0, amt);
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
_bfd_elf_link_hash_newfunc))
{
- bfd_release (abfd, ret);
+ free (ret);
return NULL;
}
@@ -91,7 +92,7 @@ m68hc11_elf_hash_table_create (abfd)
ret->stub_hash_table = (struct bfd_hash_table*) bfd_malloc (amt);
if (ret->stub_hash_table == NULL)
{
- bfd_release (abfd, ret);
+ free (ret);
return NULL;
}
if (!bfd_hash_table_init (ret->stub_hash_table, stub_hash_newfunc))
@@ -1405,6 +1406,21 @@ _bfd_m68hc11_elf_merge_private_bfd_data (ibfd, obfd)
bfd_archive_filename (ibfd));
ok = FALSE;
}
+
+ /* Processor compatibility. */
+ if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags))
+ {
+ (*_bfd_error_handler)
+ (_("%s: linking files compiled for HCS12 with "
+ "others compiled for HC12"),
+ bfd_archive_filename (ibfd));
+ ok = FALSE;
+ }
+ new_flags = ((new_flags & ~EF_M68HC11_MACH_MASK)
+ | (EF_M68HC11_MERGE_MACH (new_flags, old_flags)));
+
+ elf_elfheader (obfd)->e_flags = new_flags;
+
new_flags &= ~EF_M68HC11_ABI;
old_flags &= ~EF_M68HC11_ABI;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index e314ebb4b94..1cf23d6abb7 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -673,6 +673,7 @@ elf_m68k_check_relocs (abfd, info, sec, relocs)
|| !bfd_set_section_alignment (dynobj, sreloc, 2))
return FALSE;
}
+ elf_section_data (sec)->sreloc = sreloc;
}
if (sec->flags & SEC_READONLY
@@ -1380,6 +1381,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Sym *sym;
asection *sec;
bfd_vma relocation;
+ bfd_boolean unresolved_reloc;
bfd_reloc_status_type r;
r_type = ELF32_R_TYPE (rel->r_info);
@@ -1395,6 +1397,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
h = NULL;
sym = NULL;
sec = NULL;
+ unresolved_reloc = FALSE;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
@@ -1407,71 +1410,29 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+
+ relocation = 0;
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
sec = h->root.u.def.section;
- if (((r_type == R_68K_PLT8
- || r_type == R_68K_PLT16
- || r_type == R_68K_PLT32
- || r_type == R_68K_PLT8O
- || r_type == R_68K_PLT16O
- || r_type == R_68K_PLT32O)
- && h->plt.offset != (bfd_vma) -1
- && elf_hash_table (info)->dynamic_sections_created)
- || ((r_type == R_68K_GOT8O
- || r_type == R_68K_GOT16O
- || r_type == R_68K_GOT32O
- || ((r_type == R_68K_GOT8
- || r_type == R_68K_GOT16
- || r_type == R_68K_GOT32)
- && strcmp (h->root.root.string,
- "_GLOBAL_OFFSET_TABLE_") != 0))
- && (WILL_CALL_FINISH_DYNAMIC_SYMBOL
- (elf_hash_table (info)->dynamic_sections_created,
- info->shared, h))
- && (! info->shared
- || (! info->symbolic
- && h->dynindx != -1
- && (h->elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL) == 0)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
- || (info->shared
- && ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- && ((input_section->flags & SEC_ALLOC) != 0
- /* DWARF will emit R_68K_32 relocations in its
- sections against symbols defined externally
- in shared libraries. We can't do anything
- with them here. */
- || ((input_section->flags & SEC_DEBUGGING) != 0
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
- && (r_type == R_68K_8
- || r_type == R_68K_16
- || r_type == R_68K_32
- || r_type == R_68K_PC8
- || r_type == R_68K_PC16
- || r_type == R_68K_PC32)))
- {
- /* In these cases, we don't need the relocation
- value. We check specially because in some
- obscure cases sec->output_section will be NULL. */
- relocation = 0;
- }
+ if (sec->output_section == NULL)
+ /* Set a flag that will be cleared later if we find a
+ relocation value for this symbol. output_section
+ is typically NULL for symbols satisfied by a shared
+ library. */
+ unresolved_reloc = TRUE;
else
relocation = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
else if (h->root.type == bfd_link_hash_undefweak)
- relocation = 0;
+ ;
else if (info->shared
&& !info->no_undefined
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
- relocation = 0;
+ ;
else
{
if (!(info->callbacks->undefined_symbol
@@ -1480,7 +1441,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return FALSE;
- relocation = 0;
}
}
@@ -1546,6 +1506,8 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
h->got.offset |= 1;
}
}
+ else
+ unresolved_reloc = FALSE;
}
else
{
@@ -1628,6 +1590,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
relocation = (splt->output_section->vma
+ splt->output_offset
+ h->plt.offset);
+ unresolved_reloc = FALSE;
break;
case R_68K_PLT8O:
@@ -1644,6 +1607,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
}
relocation = h->plt.offset;
+ unresolved_reloc = FALSE;
/* This relocation does not use the addend. */
rel->r_addend = 0;
@@ -1664,12 +1628,17 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& ((r_type != R_68K_PC8
&& r_type != R_68K_PC16
&& r_type != R_68K_PC32)
- || (!info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)))
+ || (h != NULL
+ && h->dynindx != -1
+ && (!info->symbolic
+ || (h->elf_link_hash_flags
+ & ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -1679,26 +1648,6 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
are copied into the output file to be resolved at run
time. */
- if (sreloc == NULL)
- {
- const char *name;
-
- name = (bfd_elf_string_from_elf_section
- (input_bfd,
- elf_elfheader (input_bfd)->e_shstrndx,
- elf_section_data (input_section)->rel_hdr.sh_name));
- if (name == NULL)
- return FALSE;
-
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
- && strcmp (bfd_get_section_name (input_bfd,
- input_section),
- name + 5) == 0);
-
- sreloc = bfd_get_section_by_name (dynobj, name);
- BFD_ASSERT (sreloc != NULL);
- }
-
skip = FALSE;
relocate = FALSE;
@@ -1714,19 +1663,22 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
if (skip)
memset (&outrel, 0, sizeof outrel);
- /* h->dynindx may be -1 if the symbol was marked to
- become local. */
else if (h != NULL
- && ((! info->symbolic && h->dynindx != -1)
+ && h->dynindx != -1
+ && (r_type == R_68K_PC8
+ || r_type == R_68K_PC16
+ || r_type == R_68K_PC32
+ || !info->shared
+ || !info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
{
- BFD_ASSERT (h->dynindx != -1);
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
- outrel.r_addend = relocation + rel->r_addend;
+ outrel.r_addend = rel->r_addend;
}
else
{
+ /* This symbol is local, or marked to become local. */
if (r_type == R_68K_32)
{
relocate = TRUE;
@@ -1767,6 +1719,10 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
+ sreloc = elf_section_data (input_section)->sreloc;
+ if (sreloc == NULL)
+ abort ();
+
loc = sreloc->contents;
loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
@@ -1790,39 +1746,58 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
break;
}
+ /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
+ because such sections are not SEC_ALLOC and thus ld.so will
+ not process them. */
+ if (unresolved_reloc
+ && !((input_section->flags & SEC_DEBUGGING) != 0
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset,
+ h->root.root.string);
+ return FALSE;
+ }
+
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
- switch (r)
+ const char *name;
+
+ if (h != NULL)
+ name = h->root.root.string;
+ else
{
- default:
- case bfd_reloc_outofrange:
- abort ();
- case bfd_reloc_overflow:
- {
- const char *name;
+ name = bfd_elf_string_from_elf_section (input_bfd,
+ symtab_hdr->sh_link,
+ sym->st_name);
+ if (name == NULL)
+ return FALSE;
+ if (*name == '\0')
+ name = bfd_section_name (input_bfd, sec);
+ }
- if (h != NULL)
- name = h->root.root.string;
- else
- {
- name = bfd_elf_string_from_elf_section (input_bfd,
- symtab_hdr->sh_link,
- sym->st_name);
- if (name == NULL)
- return FALSE;
- if (*name == '\0')
- name = bfd_section_name (input_bfd, sec);
- }
- if (!(info->callbacks->reloc_overflow
- (info, name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
- return FALSE;
- }
- break;
+ if (r == bfd_reloc_overflow)
+ {
+ if (!(info->callbacks->reloc_overflow
+ (info, name, howto->name, (bfd_vma) 0,
+ input_bfd, input_section, rel->r_offset)))
+ return FALSE;
+ }
+ else
+ {
+ (*_bfd_error_handler)
+ (_("%s(%s+0x%lx): reloc against `%s': error %d"),
+ bfd_archive_filename (input_bfd),
+ bfd_get_section_name (input_bfd, input_section),
+ (long) rel->r_offset, name, (int) r);
+ return FALSE;
}
}
}
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index 85819d55d3d..3b472464b10 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -1197,13 +1197,7 @@ gprel32_with_gp (abfd, symbol, reloc_entry, input_section, relocateable, data,
if (reloc_entry->address > input_section->_cooked_size)
return bfd_reloc_outofrange;
- if (reloc_entry->howto->src_mask == 0)
- {
- /* This case arises with the 64-bit MIPS ELF ABI. */
- val = 0;
- }
- else
- val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
+ val = bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address);
/* Set val to the offset into the section or symbol. */
val += reloc_entry->addend;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 64c2839f421..1e1ab8cce3b 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -147,27 +147,6 @@ static bfd_boolean ppc_elf_grok_psinfo
#define TP_OFFSET 0x7000
#define DTP_OFFSET 0x8000
-/* Will references to this symbol always reference the symbol
- in this object? STV_PROTECTED is excluded from the visibility test
- here so that function pointer comparisons work properly. Since
- function symbols not defined in an app are set to their .plt entry,
- it's necessary for shared libs to also reference the .plt even
- though the symbol is really local to the shared lib. */
-#define SYMBOL_REFERENCES_LOCAL(INFO, H) \
- ((! INFO->shared \
- || INFO->symbolic \
- || H->dynindx == -1 \
- || ELF_ST_VISIBILITY (H->other) == STV_INTERNAL \
- || ELF_ST_VISIBILITY (H->other) == STV_HIDDEN) \
- && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
-
-/* Will _calls_ to this symbol always call the version in this object? */
-#define SYMBOL_CALLS_LOCAL(INFO, H) \
- ((! INFO->shared \
- || INFO->symbolic \
- || H->dynindx == -1 \
- || ELF_ST_VISIBILITY (H->other) != STV_DEFAULT) \
- && (H->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
/* The PPC linker needs to keep track of the number of relocs that it
decides to copy as dynamic relocs in check_relocs for each symbol.
@@ -2516,19 +2495,21 @@ ppc_elf_adjust_dynamic_symbol (info, h)
{
/* Clear procedure linkage table information for any symbol that
won't need a .plt entry. */
- if (! htab->elf.dynamic_sections_created
+ if (h->plt.refcount <= 0
|| SYMBOL_CALLS_LOCAL (info, h)
- || h->plt.refcount <= 0)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
/* A PLT entry is not required/allowed when:
- 1. We are not using ld.so; because then the PLT entry
- can't be set up, so we can't use one.
+ 1. We are not using ld.so; because then the PLT entry
+ can't be set up, so we can't use one. In this case,
+ ppc_elf_adjust_dynamic_symbol won't even be called.
- 2. We know for certain that a call to this symbol
- will go to this object.
+ 2. GC has rendered the entry unused.
- 3. GC has rendered the entry unused. */
+ 3. We know for certain that a call to this symbol
+ will go to this object, or will remain undefined. */
h->plt.offset = (bfd_vma) -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
@@ -2694,9 +2675,7 @@ allocate_dynrelocs (h, inf)
htab = ppc_elf_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && h->plt.refcount > 0)
{
/* Make sure this symbol is output as a dynamic symbol. */
if (h->dynindx == -1
@@ -2817,11 +2796,16 @@ allocate_dynrelocs (h, inf)
defined in regular objects. For the normal shared case, discard
space for relocs that have become local due to symbol visibility
changes. */
+
if (info->shared)
{
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || info->symbolic))
+ /* Relocs that use pc_count are those that appear on a call insn,
+ or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
+ generated via assembly. We want calls to protected symbols to
+ resolve directly to the function rather than going via the plt.
+ If people want function pointer comparisons to work as expected
+ then they should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct ppc_elf_dyn_relocs **pp;
@@ -5013,10 +4997,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type != bfd_link_hash_undefweak)
&& (MUST_BE_DYN_RELOC (r_type)
|| (h != NULL
- && h->dynindx != -1
- && (!info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ && !SYMBOL_CALLS_LOCAL (info, h))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
&& (input_section->flags & SEC_ALLOC) != 0
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 8041f5e4c02..4ff31bfb695 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -3940,6 +3940,10 @@ sh_elf_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value;
+ if (info->nocopyreloc)
+ h->elf_link_hash_flags
+ = ((h->elf_link_hash_flags & ~ELF_LINK_NON_GOT_REF)
+ | (h->weakdef->elf_link_hash_flags & ELF_LINK_NON_GOT_REF));
return TRUE;
}
@@ -4083,7 +4087,9 @@ allocate_dynrelocs (h, inf)
}
if (htab->root.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
@@ -4169,8 +4175,10 @@ allocate_dynrelocs (h, inf)
htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
else if (tls_type == GOT_TLS_GD)
htab->srelgot->_raw_size += 2 * sizeof (Elf32_External_Rela);
- else if (info->shared ||
- WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
+ else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
+ && (info->shared
+ || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
}
else
@@ -4229,6 +4237,12 @@ allocate_dynrelocs (h, inf)
pp = &p->next;
}
}
+
+ /* Also discard relocs on undefined weak syms with non-default
+ visibility. */
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak)
+ eh->dyn_relocs = NULL;
}
else
{
@@ -4885,6 +4899,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SH_DIR32:
case R_SH_REL32:
if (info->shared
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak)
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0
&& (r_type != R_SH_REL32
@@ -5053,7 +5070,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| (info->shared
&& (info->symbolic || h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
+ || (ELF_ST_VISIBILITY (h->other)
+ && h->root.type == bfd_link_hash_undefweak))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -6128,7 +6147,17 @@ sh_elf_copy_indirect_symbol (bed, dir, ind)
eind->tls_type = GOT_UNKNOWN;
}
- _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+ if (ind->root.type != bfd_link_hash_indirect
+ && (dir->elf_link_hash_flags & ELF_LINK_HASH_DYNAMIC_ADJUSTED) != 0)
+ /* If called to transfer flags for a weakdef during processing
+ of elf_adjust_dynamic_symbol, don't copy ELF_LINK_NON_GOT_REF.
+ We clear it ourselves for ELIMINATE_COPY_RELOCS. */
+ dir->elf_link_hash_flags |=
+ (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK));
+ else
+ _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
}
static int
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index 2964d343cb3..c05c186cbc2 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -96,7 +96,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
- complain_overflow_dont, /* complain_on_overflow */
+ complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_XSTORMY16_16", /* name */
FALSE, /* partial_inplace */
@@ -176,7 +176,7 @@ static reloc_howto_type xstormy16_elf_howto_table [] =
"R_XSTORMY16_REL_12", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
- 0x0fff, /* dst_mask */
+ 0x0ffe, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 24-bit absolute relocation suitable for the jump instructions. */
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 011e637b122..f32d261fe6e 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4505,15 +4505,13 @@ ppc64_elf_adjust_dynamic_symbol (info, h)
break;
if (!((struct ppc_link_hash_entry *) h)->is_func_descriptor
|| ent == NULL
- || (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || (! info->shared
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0))
+ || SYMBOL_CALLS_LOCAL (info, h)
+ || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+ && h->root.type == bfd_link_hash_undefweak))
{
h->plt.plist = NULL;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
}
- return TRUE;
}
else
h->plt.plist = NULL;
@@ -5497,9 +5495,7 @@ allocate_dynrelocs (h, inf)
if (htab->elf.dynamic_sections_created
&& h->dynindx != -1
- && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)
- && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ && WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
{
struct plt_entry *pent;
bfd_boolean doneone = FALSE;
@@ -5622,9 +5618,13 @@ allocate_dynrelocs (h, inf)
if (info->shared)
{
- if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
- && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
- || info->symbolic))
+ /* Relocs that use pc_count are those that appear on a call insn,
+ or certain REL relocs (see MUST_BE_DYN_RELOC) that can be
+ generated via assembly. We want calls to protected symbols to
+ resolve directly to the function rather than going via the plt.
+ If people want function pointer comparisons to work as expected
+ then they should avoid writing weird assembly. */
+ if (SYMBOL_CALLS_LOCAL (info, h))
{
struct ppc_dyn_relocs **pp;
@@ -7604,12 +7604,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_boolean dyn = htab->elf.dynamic_sections_created;
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared
- && (info->symbolic
- || h->dynindx == -1
- || (h->elf_link_hash_flags
- & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR)))
+ && SYMBOL_REFERENCES_LOCAL (info, h)))
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally, or the symbol was forced to be local
@@ -7882,10 +7877,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| h->root.type != bfd_link_hash_undefweak)
&& (MUST_BE_DYN_RELOC (r_type)
|| (h != NULL
- && h->dynindx != -1
- && (! info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+ && !SYMBOL_CALLS_LOCAL (info, h))))
|| (ELIMINATE_COPY_RELOCS
&& !info->shared
&& h != NULL
@@ -7920,13 +7912,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (skip)
memset (&outrel, 0, sizeof outrel);
else if (h != NULL
- && h->dynindx != -1
- && !is_opd
- && (!MUST_BE_DYN_RELOC (r_type)
- || !info->shared
- || !info->symbolic
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0))
+ && !SYMBOL_REFERENCES_LOCAL (info, h)
+ && !is_opd)
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
else
{
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 0be8048a041..55c5b4264e0 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -1568,6 +1568,232 @@ elf_symbol_flags (flags)
}
#endif
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for a target with the word size and byte order found in the
+ remote memory. */
+
+bfd *
+NAME(_bfd_elf,bfd_from_remote_memory) (templ, ehdr_vma, loadbasep,
+ target_read_memory)
+ bfd *templ;
+ bfd_vma ehdr_vma;
+ bfd_vma *loadbasep;
+ int (*target_read_memory) PARAMS ((bfd_vma vma, char *myaddr, int len));
+{
+ Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
+ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */
+ Elf_External_Phdr *x_phdrs;
+ Elf_Internal_Phdr *i_phdrs, *last_phdr;
+ bfd *nbfd;
+ struct bfd_in_memory *bim;
+ int contents_size;
+ char *contents;
+ int err;
+ unsigned int i;
+ bfd_vma loadbase;
+
+ /* Read in the ELF header in external format. */
+ err = target_read_memory (ehdr_vma, (char *) &x_ehdr, sizeof x_ehdr);
+ if (err)
+ {
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+
+ /* Now check to see if we have a valid ELF file, and one that BFD can
+ make use of. The magic number must match, the address size ('class')
+ and byte-swapping must match our XVEC entry. */
+
+ if (! elf_file_p (&x_ehdr)
+ || x_ehdr.e_ident[EI_VERSION] != EV_CURRENT
+ || x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ /* Check that file's byte order matches xvec's */
+ switch (x_ehdr.e_ident[EI_DATA])
+ {
+ case ELFDATA2MSB: /* Big-endian */
+ if (! bfd_header_big_endian (templ))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ break;
+ case ELFDATA2LSB: /* Little-endian */
+ if (! bfd_header_little_endian (templ))
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+ break;
+ case ELFDATANONE: /* No data encoding specified */
+ default: /* Unknown data encoding specified */
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ elf_swap_ehdr_in (templ, &x_ehdr, &i_ehdr);
+
+ /* The file header tells where to find the program headers.
+ These are what we use to actually choose what to read. */
+
+ if (i_ehdr.e_phentsize != sizeof (Elf_External_Phdr) || i_ehdr.e_phnum == 0)
+ {
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ x_phdrs = (Elf_External_Phdr *)
+ bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs));
+ if (x_phdrs == NULL)
+ {
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs,
+ i_ehdr.e_phnum * sizeof x_phdrs[0]);
+ if (err)
+ {
+ free (x_phdrs);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+ i_phdrs = (Elf_Internal_Phdr *) &x_phdrs[i_ehdr.e_phnum];
+
+ contents_size = 0;
+ last_phdr = NULL;
+ loadbase = ehdr_vma;
+ for (i = 0; i < i_ehdr.e_phnum; ++i)
+ {
+ elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
+ if (i_phdrs[i].p_type == PT_LOAD)
+ {
+ bfd_vma segment_end;
+ segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
+ + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
+ if (segment_end > (bfd_vma) contents_size)
+ contents_size = segment_end;
+
+ if ((i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0)
+ loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align);
+
+ last_phdr = &i_phdrs[i];
+ }
+ }
+ if (last_phdr == NULL)
+ {
+ /* There were no PT_LOAD segments, so we don't have anything to read. */
+ free (x_phdrs);
+ bfd_set_error (bfd_error_wrong_format);
+ return NULL;
+ }
+
+ /* Trim the last segment so we don't bother with zeros in the last page
+ that are off the end of the file. However, if the extra bit in that
+ page includes the section headers, keep them. */
+ if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz
+ && (bfd_vma) contents_size >= (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ {
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+ if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize;
+ }
+ else
+ contents_size = last_phdr->p_offset + last_phdr->p_filesz;
+
+ /* Now we know the size of the whole image we want read in. */
+ contents = (char *) bfd_zmalloc ((bfd_size_type) contents_size);
+ if (contents == NULL)
+ {
+ free (x_phdrs);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+
+ for (i = 0; i < i_ehdr.e_phnum; ++i)
+ if (i_phdrs[i].p_type == PT_LOAD)
+ {
+ bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
+ bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
+ + i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align;
+ if (end > (bfd_vma) contents_size)
+ end = contents_size;
+ err = target_read_memory ((loadbase + i_phdrs[i].p_vaddr)
+ & -i_phdrs[i].p_align,
+ contents + start, end - start);
+ if (err)
+ {
+ free (x_phdrs);
+ free (contents);
+ bfd_set_error (bfd_error_system_call);
+ errno = err;
+ return NULL;
+ }
+ }
+ free (x_phdrs);
+
+ /* If the segments visible in memory didn't include the section headers,
+ then clear them from the file header. */
+ if ((bfd_vma) contents_size < (i_ehdr.e_shoff
+ + i_ehdr.e_shnum * i_ehdr.e_shentsize))
+ {
+ memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff);
+ memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum);
+ memset (&x_ehdr.e_shstrndx, 0, sizeof x_ehdr.e_shstrndx);
+ }
+
+ /* This will normally have been in the first PT_LOAD segment. But it
+ conceivably could be missing, and we might have just changed it. */
+ memcpy (contents, &x_ehdr, sizeof x_ehdr);
+
+ /* Now we have a memory image of the ELF file contents. Make a BFD. */
+ bim = ((struct bfd_in_memory *)
+ bfd_malloc ((bfd_size_type) sizeof (struct bfd_in_memory)));
+ if (bim == NULL)
+ {
+ free (contents);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ nbfd = _bfd_new_bfd ();
+ if (nbfd == NULL)
+ {
+ free (bim);
+ free (contents);
+ bfd_set_error (bfd_error_no_memory);
+ return NULL;
+ }
+ nbfd->filename = "<in-memory>";
+ nbfd->xvec = templ->xvec;
+ bim->size = contents_size;
+ bim->buffer = contents;
+ nbfd->iostream = (PTR) bim;
+ nbfd->flags = BFD_IN_MEMORY;
+ nbfd->direction = read_direction;
+ nbfd->mtime = time (NULL);
+ nbfd->mtime_set = TRUE;
+
+ if (loadbasep)
+ *loadbasep = loadbase;
+ return nbfd;
+}
+
#include "elfcore.h"
#include "elflink.h"
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 05194591b4a..cc311863e1a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -855,7 +855,7 @@ _bfd_elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, skip,
/* If the old symbol has non-default visibility, we ignore the new
definition from a dynamic object. */
if (newdyn
- && ELF_ST_VISIBILITY (h->other)
+ && ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& !bfd_is_und_section (sec))
{
*skip = TRUE;
@@ -871,7 +871,7 @@ _bfd_elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, skip,
return TRUE;
}
else if (!newdyn
- && ELF_ST_VISIBILITY (sym->st_other)
+ && ELF_ST_VISIBILITY (sym->st_other) != STV_DEFAULT
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)
{
/* If the new symbol with non-default visibility comes from a
@@ -884,7 +884,8 @@ _bfd_elf_merge_symbol (abfd, info, name, sym, psec, pvalue, sym_hash, skip,
if (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)
{
h->elf_link_hash_flags &= ~ELF_LINK_HASH_DEF_DYNAMIC;
- h->elf_link_hash_flags |= ELF_LINK_HASH_REF_DYNAMIC;
+ h->elf_link_hash_flags |= (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_DYNAMIC_DEF);
}
/* FIXME: Should we check type and size for protected symbol? */
h->size = 0;
@@ -2427,17 +2428,14 @@ _bfd_elf_fix_symbol_flags (h, eif)
/* If -Bsymbolic was used (which means to bind references to global
symbols to the definition within the shared object), and this
symbol was defined in a regular object, then it actually doesn't
- need a PLT entry, and we can accomplish that by forcing it local.
- Likewise, if the symbol has hidden or internal visibility.
- FIXME: It might be that we also do not need a PLT for other
- non-hidden visibilities, but we would have to tell that to the
- backend specifically; we can't just clear PLT-related data here. */
+ need a PLT entry. Likewise, if the symbol has non-default
+ visibility. If the symbol has hidden or internal visibility, we
+ will force it local. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& eif->info->shared
&& is_elf_hash_table (eif->info)
&& (eif->info->symbolic
- || ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
- || ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
+ || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
{
struct elf_backend_data *bed;
@@ -2452,7 +2450,7 @@ _bfd_elf_fix_symbol_flags (h, eif)
/* If a weak undefined symbol has non-default visibility, we also
hide it from the dynamic linker. */
- if (ELF_ST_VISIBILITY (h->other)
+ if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& h->root.type == bfd_link_hash_undefweak)
{
struct elf_backend_data *bed;
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 2c025edceee..7b32491d945 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -4334,6 +4334,7 @@ elf_link_check_versioned_symbol (info, h)
{
const char *name;
Elf_Internal_Versym iver;
+ unsigned short version_index;
if (ELF_ST_BIND (isym->st_info) == STB_LOCAL
|| isym->st_shndx == SHN_UNDEF)
@@ -4354,9 +4355,10 @@ elf_link_check_versioned_symbol (info, h)
abort ();
}
- if ((iver.vs_vers & VERSYM_VERSION) == 2)
+ version_index = iver.vs_vers & VERSYM_VERSION;
+ if (version_index == 1 || version_index == 2)
{
- /* This is the oldest (default) sym. We can use it. */
+ /* This is the base or first version. We can use it. */
free (extversym);
free (isymbuf);
return TRUE;
@@ -4618,9 +4620,9 @@ elf_link_output_extsym (h, data)
/* If a non-weak symbol with non-default visibility is not defined
locally, it is a fatal error. */
if (! finfo->info->relocateable
- && ELF_ST_VISIBILITY (sym.st_other)
+ && ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT
&& ELF_ST_BIND (sym.st_info) != STB_WEAK
- && h->root.type != bfd_link_hash_undefweak
+ && h->root.type == bfd_link_hash_undefined
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
(*_bfd_error_handler)
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 734d78bb75e..58a96b14a01 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -338,6 +338,9 @@
#ifndef elf_backend_ecoff_debug_swap
#define elf_backend_ecoff_debug_swap 0
#endif
+#ifndef elf_backend_bfd_from_remote_memory
+#define elf_backend_bfd_from_remote_memory _bfd_elfNN_bfd_from_remote_memory
+#endif
#ifndef elf_backend_got_header_size
#define elf_backend_got_header_size 0
#endif
@@ -490,6 +493,7 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_mips_irix_compat,
elf_backend_mips_rtype_to_howto,
elf_backend_ecoff_debug_swap,
+ elf_backend_bfd_from_remote_memory,
ELF_MACHINE_ALT1,
ELF_MACHINE_ALT2,
&elf_backend_size_info,
diff --git a/bfd/version.h b/bfd/version.h
index 235b6c252c1..0e173863959 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,3 +1,3 @@
-#define BFD_VERSION_DATE 20030509
+#define BFD_VERSION_DATE 20030521
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_string@