summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2003-03-26 14:20:14 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2003-03-26 14:20:14 +0000
commitfa34274fedcf712ef8d60edcd13d983be6262d8b (patch)
tree9d2533dc0525f9aaf364780eab323eda837691a8
parent7e7581f2011e685487a9010e018d603869f2f998 (diff)
downloadbinutils-redhat-fa34274fedcf712ef8d60edcd13d983be6262d8b.tar.gz
* elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.cagney_framebase-20030326-branchpoint
(elf_m68k_relocate_section): Use it to correctly handle symbols forced to be local. (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got entries for symbols that are forced to be local.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf32-m68k.c35
2 files changed, 37 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b9718b0b90..cec8e28d80 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2003-03-26 Andreas Schwab <schwab@suse.de>
+
+ * elf32-m68k.c (WILL_CALL_FINISH_DYNAMIC_SYMBOL): Define.
+ (elf_m68k_relocate_section): Use it to correctly handle symbols
+ forced to be local.
+ (elf_m68k_finish_dynamic_symbol): Emit RELATIVE reloc for got
+ entries for symbols that are forced to be local.
+
2003-03-25 Alexandre Oliva <aoliva@redhat.com>
* elfxx-mips.c (_bfd_mips_relax_section): New function.
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 19a2ce8c75..abb0eece33 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1097,6 +1097,17 @@ elf_m68k_adjust_dynamic_symbol (info, h)
return TRUE;
}
+/* This is the condition under which elf_m68k_finish_dynamic_symbol
+ will be called from elflink.h. If elflink.h doesn't call our
+ finish_dynamic_symbol routine, we'll need to do something about
+ initializing any .plt and .got entries in elf_m68k_relocate_section. */
+#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
+ ((DYN) \
+ && ((SHARED) \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
+ && ((H)->dynindx != -1 \
+ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
+
/* Set the sizes of the dynamic sections. */
static bfd_boolean
@@ -1416,9 +1427,14 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_68K_GOT32)
&& strcmp (h->root.root.string,
"_GLOBAL_OFFSET_TABLE_") != 0))
- && elf_hash_table (info)->dynamic_sections_created
+ && (WILL_CALL_FINISH_DYNAMIC_SYMBOL
+ (elf_hash_table (info)->dynamic_sections_created,
+ info->shared, h))
&& (! info->shared
- || (! info->symbolic && h->dynindx != -1)
+ || (! 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
@@ -1496,13 +1512,18 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
if (h != NULL)
{
+ bfd_boolean dyn;
+
off = h->got.offset;
BFD_ASSERT (off != (bfd_vma) -1);
- if (!elf_hash_table (info)->dynamic_sections_created
+ dyn = elf_hash_table (info)->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_HASH_DEF_REGULAR)))
+ && (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)
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
@@ -1940,7 +1961,9 @@ elf_m68k_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)
+ && (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))
{
rela.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);