Deleted Added
full compact
elf32-s390.c (99461) elf32-s390.c (107492)
1/* IBM S/390-specific support for 32-bit ELF
2 Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Carl B. Pedersen and Martin Schwidefsky.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 26 unchanged lines hidden (view full) ---

35 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
36static struct bfd_link_hash_table *elf_s390_link_hash_table_create
37 PARAMS ((bfd *));
38static boolean create_got_section
39 PARAMS((bfd *, struct bfd_link_info *));
40static boolean elf_s390_create_dynamic_sections
41 PARAMS((bfd *, struct bfd_link_info *));
42static void elf_s390_copy_indirect_symbol
1/* IBM S/390-specific support for 32-bit ELF
2 Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
3 Contributed by Carl B. Pedersen and Martin Schwidefsky.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 26 unchanged lines hidden (view full) ---

35 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
36static struct bfd_link_hash_table *elf_s390_link_hash_table_create
37 PARAMS ((bfd *));
38static boolean create_got_section
39 PARAMS((bfd *, struct bfd_link_info *));
40static boolean elf_s390_create_dynamic_sections
41 PARAMS((bfd *, struct bfd_link_info *));
42static void elf_s390_copy_indirect_symbol
43 PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
43 PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
44 struct elf_link_hash_entry *));
44static boolean elf_s390_check_relocs
45 PARAMS ((bfd *, struct bfd_link_info *, asection *,
46 const Elf_Internal_Rela *));
47static asection *elf_s390_gc_mark_hook
45static boolean elf_s390_check_relocs
46 PARAMS ((bfd *, struct bfd_link_info *, asection *,
47 const Elf_Internal_Rela *));
48static asection *elf_s390_gc_mark_hook
48 PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
49 PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
49 struct elf_link_hash_entry *, Elf_Internal_Sym *));
50static boolean elf_s390_gc_sweep_hook
51 PARAMS ((bfd *, struct bfd_link_info *, asection *,
52 const Elf_Internal_Rela *));
53static boolean elf_s390_adjust_dynamic_symbol
54 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
55static boolean allocate_dynrelocs
56 PARAMS ((struct elf_link_hash_entry *, PTR));

--- 416 unchanged lines hidden (view full) ---

473
474static struct bfd_link_hash_table *
475elf_s390_link_hash_table_create (abfd)
476 bfd *abfd;
477{
478 struct elf_s390_link_hash_table *ret;
479 bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
480
50 struct elf_link_hash_entry *, Elf_Internal_Sym *));
51static boolean elf_s390_gc_sweep_hook
52 PARAMS ((bfd *, struct bfd_link_info *, asection *,
53 const Elf_Internal_Rela *));
54static boolean elf_s390_adjust_dynamic_symbol
55 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
56static boolean allocate_dynrelocs
57 PARAMS ((struct elf_link_hash_entry *, PTR));

--- 416 unchanged lines hidden (view full) ---

474
475static struct bfd_link_hash_table *
476elf_s390_link_hash_table_create (abfd)
477 bfd *abfd;
478{
479 struct elf_s390_link_hash_table *ret;
480 bfd_size_type amt = sizeof (struct elf_s390_link_hash_table);
481
481 ret = (struct elf_s390_link_hash_table *) bfd_alloc (abfd, amt);
482 ret = (struct elf_s390_link_hash_table *) bfd_malloc (amt);
482 if (ret == NULL)
483 return NULL;
484
485 if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
486 {
483 if (ret == NULL)
484 return NULL;
485
486 if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
487 {
487 bfd_release (abfd, ret);
488 free (ret);
488 return NULL;
489 }
490
491 ret->sgot = NULL;
492 ret->sgotplt = NULL;
493 ret->srelgot = NULL;
494 ret->splt = NULL;
495 ret->srelplt = NULL;

--- 63 unchanged lines hidden (view full) ---

559 abort ();
560
561 return true;
562}
563
564/* Copy the extra info we tack onto an elf_link_hash_entry. */
565
566static void
489 return NULL;
490 }
491
492 ret->sgot = NULL;
493 ret->sgotplt = NULL;
494 ret->srelgot = NULL;
495 ret->splt = NULL;
496 ret->srelplt = NULL;

--- 63 unchanged lines hidden (view full) ---

560 abort ();
561
562 return true;
563}
564
565/* Copy the extra info we tack onto an elf_link_hash_entry. */
566
567static void
567elf_s390_copy_indirect_symbol (dir, ind)
568elf_s390_copy_indirect_symbol (bed, dir, ind)
569 struct elf_backend_data *bed;
568 struct elf_link_hash_entry *dir, *ind;
569{
570 struct elf_s390_link_hash_entry *edir, *eind;
571
572 edir = (struct elf_s390_link_hash_entry *) dir;
573 eind = (struct elf_s390_link_hash_entry *) ind;
574
575 if (eind->dyn_relocs != NULL)

--- 25 unchanged lines hidden (view full) ---

601 }
602 *pp = edir->dyn_relocs;
603 }
604
605 edir->dyn_relocs = eind->dyn_relocs;
606 eind->dyn_relocs = NULL;
607 }
608
570 struct elf_link_hash_entry *dir, *ind;
571{
572 struct elf_s390_link_hash_entry *edir, *eind;
573
574 edir = (struct elf_s390_link_hash_entry *) dir;
575 eind = (struct elf_s390_link_hash_entry *) ind;
576
577 if (eind->dyn_relocs != NULL)

--- 25 unchanged lines hidden (view full) ---

603 }
604 *pp = edir->dyn_relocs;
605 }
606
607 edir->dyn_relocs = eind->dyn_relocs;
608 eind->dyn_relocs = NULL;
609 }
610
609 _bfd_elf_link_hash_copy_indirect (dir, ind);
611 _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
610}
611
612/* Look through the relocs for a section during the first phase, and
613 allocate space in the global offset table or procedure linkage
614 table. */
615
616static boolean
617elf_s390_check_relocs (abfd, info, sec, relocs)

--- 280 unchanged lines hidden (view full) ---

898
899 return true;
900}
901
902/* Return the section that should be marked against GC for a given
903 relocation. */
904
905static asection *
612}
613
614/* Look through the relocs for a section during the first phase, and
615 allocate space in the global offset table or procedure linkage
616 table. */
617
618static boolean
619elf_s390_check_relocs (abfd, info, sec, relocs)

--- 280 unchanged lines hidden (view full) ---

900
901 return true;
902}
903
904/* Return the section that should be marked against GC for a given
905 relocation. */
906
907static asection *
906elf_s390_gc_mark_hook (abfd, info, rel, h, sym)
907 bfd *abfd;
908elf_s390_gc_mark_hook (sec, info, rel, h, sym)
909 asection *sec;
908 struct bfd_link_info *info ATTRIBUTE_UNUSED;
909 Elf_Internal_Rela *rel;
910 struct elf_link_hash_entry *h;
911 Elf_Internal_Sym *sym;
912{
913 if (h != NULL)
914 {
915 switch (ELF32_R_TYPE (rel->r_info))

--- 13 unchanged lines hidden (view full) ---

929 return h->root.u.c.p->section;
930
931 default:
932 break;
933 }
934 }
935 }
936 else
910 struct bfd_link_info *info ATTRIBUTE_UNUSED;
911 Elf_Internal_Rela *rel;
912 struct elf_link_hash_entry *h;
913 Elf_Internal_Sym *sym;
914{
915 if (h != NULL)
916 {
917 switch (ELF32_R_TYPE (rel->r_info))

--- 13 unchanged lines hidden (view full) ---

931 return h->root.u.c.p->section;
932
933 default:
934 break;
935 }
936 }
937 }
938 else
937 {
938 return bfd_section_from_elf_index (abfd, sym->st_shndx);
939 }
939 return bfd_section_from_elf_index (sec->owner, sym->st_shndx);
940
941 return NULL;
942}
943
944/* Update the got entry reference counts for the section being removed. */
945
946static boolean
947elf_s390_gc_sweep_hook (abfd, info, sec, relocs)

--- 111 unchanged lines hidden (view full) ---

1059 struct elf_s390_link_hash_table *htab;
1060 struct elf_s390_link_hash_entry * eh;
1061 struct elf_s390_dyn_relocs *p;
1062 asection *s;
1063 unsigned int power_of_two;
1064
1065 /* If this is a function, put it in the procedure linkage table. We
1066 will fill in the contents of the procedure linkage table later
940
941 return NULL;
942}
943
944/* Update the got entry reference counts for the section being removed. */
945
946static boolean
947elf_s390_gc_sweep_hook (abfd, info, sec, relocs)

--- 111 unchanged lines hidden (view full) ---

1059 struct elf_s390_link_hash_table *htab;
1060 struct elf_s390_link_hash_entry * eh;
1061 struct elf_s390_dyn_relocs *p;
1062 asection *s;
1063 unsigned int power_of_two;
1064
1065 /* If this is a function, put it in the procedure linkage table. We
1066 will fill in the contents of the procedure linkage table later
1067 (although we could actually do it here). */
1067 (although we could actually do it here). */
1068 if (h->type == STT_FUNC
1069 || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
1070 {
1071 if (h->plt.refcount <= 0
1072 || (! info->shared
1073 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
1074 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1075 && h->root.type != bfd_link_hash_undefweak

--- 892 unchanged lines hidden (view full) ---

1968 continue;
1969 }
1970 break;
1971
1972 default:
1973 break;
1974 }
1975
1068 if (h->type == STT_FUNC
1069 || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
1070 {
1071 if (h->plt.refcount <= 0
1072 || (! info->shared
1073 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
1074 && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0
1075 && h->root.type != bfd_link_hash_undefweak

--- 892 unchanged lines hidden (view full) ---

1968 continue;
1969 }
1970 break;
1971
1972 default:
1973 break;
1974 }
1975
1976 /* Dynamic relocs are not propagated for SEC_DEBUGGING sections
1977 because such sections are not SEC_ALLOC and thus ld.so will
1978 not process them. */
1976 if (unresolved_reloc
1979 if (unresolved_reloc
1977 && !(info->shared
1978 && (input_section->flags & SEC_DEBUGGING) != 0
1980 && !((input_section->flags & SEC_DEBUGGING) != 0
1979 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
1980 (*_bfd_error_handler)
1981 (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
1982 bfd_archive_filename (input_bfd),
1983 bfd_get_section_name (input_bfd, input_section),
1984 (long) rel->r_offset,
1985 h->root.root.string);
1986

--- 490 unchanged lines hidden ---
1981 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
1982 (*_bfd_error_handler)
1983 (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
1984 bfd_archive_filename (input_bfd),
1985 bfd_get_section_name (input_bfd, input_section),
1986 (long) rel->r_offset,
1987 h->root.root.string);
1988

--- 490 unchanged lines hidden ---