reloc is against read-only section.
(elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(elf_s390_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elf32-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
reloc is against read-only section.
(elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(elf_s390_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
* elf32-ppc.c (ppc_elf_check_relocs): Set DF_TEXTREL if the reloc
is against read-only section.
(ppc_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
looking up section names for DT_TEXTREL.
(ppc_elf_reloc_type_class): New.
(elf_backend_reloc_type_class): Define.
+2001-08-27 Andreas Jaeger <aj@suse.de>
+
+ * elf64-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_s390_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+ * elf32-s390.c (elf_s390_check_relocs): Set DF_TEXTREL if the
+ reloc is against read-only section.
+ (elf_s390_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (elf_s390_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
+ * elf32-ppc.c (ppc_elf_check_relocs): Set DF_TEXTREL if the reloc
+ is against read-only section.
+ (ppc_elf_size_dynamic_sections): Use DF_TEXTREL flag instead of
+ looking up section names for DT_TEXTREL.
+ (ppc_elf_reloc_type_class): New.
+ (elf_backend_reloc_type_class): Define.
+
2001-08-26 Andreas Jaeger <aj@suse.de>
* elf32-cris.c (cris_elf_check_relocs): Set DF_TEXTREL if the
Elf_Internal_Sym *));
static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
+static enum elf_reloc_type_class ppc_elf_reloc_type_class PARAMS ((int));
#define BRANCH_PREDICT_BIT 0x200000 /* branch prediction bit for branch taken relocs */
#define RA_REGISTER_MASK 0x001f0000 /* mask to set RA in memory instructions */
static boolean
ppc_elf_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
boolean plt;
boolean relocs;
- boolean reltext;
#ifdef DEBUG
fprintf (stderr, "ppc_elf_size_dynamic_sections called\n");
memory for them. */
plt = false;
relocs = false;
- reltext = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
const char *name;
}
else
{
- asection *target;
- const char *outname;
-
/* Remember whether there are any relocation sections. */
relocs = true;
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL entry. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
-
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
s->reloc_count = 0;
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf32_External_Rela);
return ret;
}
+
+static enum elf_reloc_type_class
+ppc_elf_reloc_type_class (type)
+ int type;
+{
+ switch (type)
+ {
+ case R_PPC_RELATIVE:
+ return reloc_class_relative;
+ case R_PPC_REL24:
+ case R_PPC_ADDR24:
+ case R_PPC_JMP_SLOT:
+ return reloc_class_plt;
+ case R_PPC_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
\f
#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_vec
#define TARGET_LITTLE_NAME "elf32-powerpcle"
#define elf_backend_fake_sections ppc_elf_fake_sections
#define elf_backend_additional_program_headers ppc_elf_additional_program_headers
#define elf_backend_modify_segment_map ppc_elf_modify_segment_map
+#define elf_backend_reloc_type_class ppc_elf_reloc_type_class
#include "elf32-target.h"
static boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_s390_object_p PARAMS ((bfd *));
+static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int));
#define USE_RELA 1 /* We want RELA relocations, not REL. */
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf32_External_Rela);
static boolean
elf_s390_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relocs;
boolean plt;
determined the sizes of the various dynamic sections. Allocate
memory for them. */
plt = false;
- reltext = false;
relocs = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
}
else
{
- asection *target;
-
/* Remember whether there are any reloc sections other
than .rela.plt. */
if (strcmp (name, ".rela.plt") != 0)
- {
- const char *outname;
-
- relocs = true;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rela.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
- }
+ relocs = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esa);
}
+static enum elf_reloc_type_class
+elf_s390_reloc_type_class (type)
+ int type;
+{
+ switch (type)
+ {
+ case R_390_RELATIVE:
+ return reloc_class_relative;
+ case R_390_JMP_SLOT:
+ return reloc_class_plt;
+ case R_390_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
#define TARGET_BIG_SYM bfd_elf32_s390_vec
#define TARGET_BIG_NAME "elf32-s390"
#define ELF_ARCH bfd_arch_s390
#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
#define elf_backend_relocate_section elf_s390_relocate_section
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
+#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_object_p elf_s390_object_p
static boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_s390_object_p PARAMS ((bfd *));
+static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int));
#define USE_RELA 1 /* We want RELA relocations, not REL. */
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
return false;
}
+ if (sec->flags & SEC_READONLY)
+ info->flags |= DF_TEXTREL;
}
sreloc->_raw_size += sizeof (Elf64_External_Rela);
static boolean
elf_s390_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
+ bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
{
bfd *dynobj;
asection *s;
- boolean reltext;
boolean relocs;
boolean plt;
determined the sizes of the various dynamic sections. Allocate
memory for them. */
plt = false;
- reltext = false;
relocs = false;
for (s = dynobj->sections; s != NULL; s = s->next)
{
}
else
{
- asection *target;
-
/* Remember whether there are any reloc sections other
than .rela.plt. */
if (strcmp (name, ".rela.plt") != 0)
- {
- const char *outname;
-
- relocs = true;
-
- /* If this relocation section applies to a read only
- section, then we probably need a DT_TEXTREL
- entry. The entries in the .rela.plt section
- really apply to the .got section, which we
- created ourselves and so know is not readonly. */
- outname = bfd_get_section_name (output_bfd,
- s->output_section);
- target = bfd_get_section_by_name (output_bfd, outname + 5);
- if (target != NULL
- && (target->flags & SEC_READONLY) != 0
- && (target->flags & SEC_ALLOC) != 0)
- reltext = true;
- }
+ relocs = true;
/* We use the reloc_count field as a counter if we need
to copy relocs into the output file. */
return false;
}
- if (reltext)
+ if ((info->flags & DF_TEXTREL) != 0)
{
if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
return false;
return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_esame);
}
+
+static enum elf_reloc_type_class
+elf_s390_reloc_type_class (type)
+ int type;
+{
+ switch (type)
+ {
+ case R_390_RELATIVE:
+ return reloc_class_relative;
+ case R_390_JMP_SLOT:
+ return reloc_class_plt;
+ case R_390_COPY:
+ return reloc_class_copy;
+ default:
+ return reloc_class_normal;
+ }
+}
+
/*
* Why was the hash table entry size definition changed from
* ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
#define elf_backend_gc_sweep_hook elf_s390_gc_sweep_hook
#define elf_backend_relocate_section elf_s390_relocate_section
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
+#define elf_backend_reloc_type_class elf_s390_reloc_type_class
#define elf_backend_object_p elf_s390_object_p