diff options
author | Andreas Jaeger <aj@suse.de> | 2001-08-27 08:59:08 +0000 |
---|---|---|
committer | Andreas Jaeger <aj@suse.de> | 2001-08-27 08:59:08 +0000 |
commit | 29c2fb7c2b10c63eb2cf01e6c9a3a7c787581fee (patch) | |
tree | 89fac937f6f461d1c4d0b225bf2eccb62a6004a3 /bfd/elf64-s390.c | |
parent | 081310158f46d3f33b6ea5dde29d10818eaeb0b3 (diff) | |
download | gdb-29c2fb7c2b10c63eb2cf01e6c9a3a7c787581fee.zip gdb-29c2fb7c2b10c63eb2cf01e6c9a3a7c787581fee.tar.gz gdb-29c2fb7c2b10c63eb2cf01e6c9a3a7c787581fee.tar.bz2 |
* 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.
Diffstat (limited to 'bfd/elf64-s390.c')
-rw-r--r-- | bfd/elf64-s390.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index a175555..0e80c43 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -56,6 +56,7 @@ static boolean elf_s390_finish_dynamic_symbol 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. */ @@ -684,6 +685,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) || ! 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); @@ -1069,12 +1072,11 @@ elf_s390_adjust_dynamic_symbol (info, h) 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; @@ -1117,7 +1119,6 @@ elf_s390_size_dynamic_sections (output_bfd, info) 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) { @@ -1164,29 +1165,10 @@ elf_s390_size_dynamic_sections (output_bfd, info) } 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. */ @@ -1242,7 +1224,7 @@ elf_s390_size_dynamic_sections (output_bfd, info) return false; } - if (reltext) + if ((info->flags & DF_TEXTREL) != 0) { if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0)) return false; @@ -2112,6 +2094,24 @@ elf_s390_object_p (abfd) 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 @@ -2179,6 +2179,7 @@ const struct elf_size_info s390_elf64_size_info = #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 |