diff options
-rw-r--r-- | bfd/elf32-arm.c | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/ifunc-12.rd | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/ifunc-3.rd | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/ifunc-4.rd | 60 |
4 files changed, 68 insertions, 39 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 0cd3aec..96ba509 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -17691,6 +17691,35 @@ elf32_arm_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, const asection *rel_sec ATTRIBUTE_UNUSED, const Elf_Internal_Rela *rela) { + struct elf32_arm_link_hash_table *htab = elf32_arm_hash_table (info); + + if (htab->root.dynsym != NULL + && htab->root.dynsym->contents != NULL) + { + /* Check relocation against STT_GNU_IFUNC symbol if there are + dynamic symbols. */ + bfd *abfd = info->output_bfd; + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + unsigned long r_symndx = ELF32_R_SYM (rela->r_info); + if (r_symndx != STN_UNDEF) + { + Elf_Internal_Sym sym; + if (!bed->s->swap_symbol_in (abfd, + (htab->root.dynsym->contents + + r_symndx * bed->s->sizeof_sym), + 0, &sym)) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB symbol number %lu references" + " nonexistent SHT_SYMTAB_SHNDX section"), + abfd, r_symndx); + /* Ideally an error class should be returned here. */ + } + else if (ELF_ST_TYPE (sym.st_info) == STT_GNU_IFUNC) + return reloc_class_ifunc; + } + } + switch ((int) ELF32_R_TYPE (rela->r_info)) { case R_ARM_RELATIVE: diff --git a/ld/testsuite/ld-arm/ifunc-12.rd b/ld/testsuite/ld-arm/ifunc-12.rd index 69ed420..c5d62c1 100644 --- a/ld/testsuite/ld-arm/ifunc-12.rd +++ b/ld/testsuite/ld-arm/ifunc-12.rd @@ -5,10 +5,6 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 16 entries: 00010020 ......17 R_ARM_RELATIVE 0001100c ......17 R_ARM_RELATIVE 00011018 ......17 R_ARM_RELATIVE -00010008 ......02 R_ARM_ABS32 f2\(\) f2 -00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2 -00010014 ......02 R_ARM_ABS32 f2t\(\) f2t -0001101c ......15 R_ARM_GLOB_DAT f2t\(\) f2t 00010004 ......a0 R_ARM_IRELATIVE 0001000c ......a0 R_ARM_IRELATIVE 00010010 ......a0 R_ARM_IRELATIVE @@ -17,3 +13,7 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 16 entries: 00011014 ......a0 R_ARM_IRELATIVE 00011020 ......a0 R_ARM_IRELATIVE 00011028 ......a0 R_ARM_IRELATIVE +00010008 ......02 R_ARM_ABS32 f2\(\) f2 +00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2 +00010014 ......02 R_ARM_ABS32 f2t\(\) f2t +0001101c ......15 R_ARM_GLOB_DAT f2t\(\) f2t diff --git a/ld/testsuite/ld-arm/ifunc-3.rd b/ld/testsuite/ld-arm/ifunc-3.rd index e3973e4..274a4e4 100644 --- a/ld/testsuite/ld-arm/ifunc-3.rd +++ b/ld/testsuite/ld-arm/ifunc-3.rd @@ -4,16 +4,16 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 13 entries: 00010004 ......17 R_ARM_RELATIVE 0001101c ......17 R_ARM_RELATIVE 00011020 ......17 R_ARM_RELATIVE -00010014 ......02 R_ARM_ABS32 f2\(\) f2 -00010018 ......03 R_ARM_REL32 f2\(\) f2 -00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2 -00010024 ......02 R_ARM_ABS32 f4\(\) f4 -00011028 ......15 R_ARM_GLOB_DAT f4\(\) f4 0001000c ......a0 R_ARM_IRELATIVE 0001001c ......a0 R_ARM_IRELATIVE 00011010 ......a0 R_ARM_IRELATIVE 00011014 ......a0 R_ARM_IRELATIVE 00011018 ......a0 R_ARM_IRELATIVE +00010014 ......02 R_ARM_ABS32 f2\(\) f2 +00010018 ......03 R_ARM_REL32 f2\(\) f2 +00011024 ......15 R_ARM_GLOB_DAT f2\(\) f2 +00010024 ......02 R_ARM_ABS32 f4\(\) f4 +00011028 ......15 R_ARM_GLOB_DAT f4\(\) f4 Relocation section '\.rel\.plt' at offset 0x8068 contains 1 entry: Offset Info Type Sym\.Value Sym\. Name diff --git a/ld/testsuite/ld-arm/ifunc-4.rd b/ld/testsuite/ld-arm/ifunc-4.rd index 43a0019..b8079d5 100644 --- a/ld/testsuite/ld-arm/ifunc-4.rd +++ b/ld/testsuite/ld-arm/ifunc-4.rd @@ -3,36 +3,6 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 62 entries: Offset Info Type Sym\.Value Sym\. Name 0001106c ......17 R_ARM_RELATIVE 00011070 ......17 R_ARM_RELATIVE -00010034 ......02 R_ARM_ABS32 aaf2\(\) aaf2 -00010038 ......03 R_ARM_REL32 aaf2\(\) aaf2 -00011088 ......15 R_ARM_GLOB_DAT aaf2\(\) aaf2 -0001003c ......02 R_ARM_ABS32 atf2\(\) atf2 -00010040 ......03 R_ARM_REL32 atf2\(\) atf2 -00011074 ......15 R_ARM_GLOB_DAT atf2\(\) atf2 -00010044 ......02 R_ARM_ABS32 abf2\(\) abf2 -00010048 ......03 R_ARM_REL32 abf2\(\) abf2 -000110a0 ......15 R_ARM_GLOB_DAT abf2\(\) abf2 -0001004c ......02 R_ARM_ABS32 taf2\(\) taf2 -00010050 ......03 R_ARM_REL32 taf2\(\) taf2 -00011084 ......15 R_ARM_GLOB_DAT taf2\(\) taf2 -00010054 ......02 R_ARM_ABS32 ttf2\(\) ttf2 -00010058 ......03 R_ARM_REL32 ttf2\(\) ttf2 -0001107c ......15 R_ARM_GLOB_DAT ttf2\(\) ttf2 -0001005c ......02 R_ARM_ABS32 tbf2\(\) tbf2 -00010060 ......03 R_ARM_REL32 tbf2\(\) tbf2 -00011080 ......15 R_ARM_GLOB_DAT tbf2\(\) tbf2 -00010094 ......02 R_ARM_ABS32 aaf4\(\) aaf4 -00011078 ......15 R_ARM_GLOB_DAT aaf4\(\) aaf4 -0001009c ......02 R_ARM_ABS32 atf4\(\) atf4 -00011098 ......15 R_ARM_GLOB_DAT atf4\(\) atf4 -000100a4 ......02 R_ARM_ABS32 abf4\(\) abf4 -0001108c ......15 R_ARM_GLOB_DAT abf4\(\) abf4 -000100ac ......02 R_ARM_ABS32 taf4\(\) taf4 -0001109c ......15 R_ARM_GLOB_DAT taf4\(\) taf4 -000100b4 ......02 R_ARM_ABS32 ttf4\(\) ttf4 -00011094 ......15 R_ARM_GLOB_DAT ttf4\(\) ttf4 -000100bc ......02 R_ARM_ABS32 tbf4\(\) tbf4 -00011090 ......15 R_ARM_GLOB_DAT tbf4\(\) tbf4 00010004 ......a0 R_ARM_IRELATIVE 0001000c ......a0 R_ARM_IRELATIVE 00010014 ......a0 R_ARM_IRELATIVE @@ -63,6 +33,36 @@ Relocation section '\.rel\.dyn' at offset 0x8000 contains 62 entries: 00011060 ......a0 R_ARM_IRELATIVE 00011064 ......a0 R_ARM_IRELATIVE 00011068 ......a0 R_ARM_IRELATIVE +00010034 ......02 R_ARM_ABS32 aaf2\(\) aaf2 +00010038 ......03 R_ARM_REL32 aaf2\(\) aaf2 +00011088 ......15 R_ARM_GLOB_DAT aaf2\(\) aaf2 +0001003c ......02 R_ARM_ABS32 atf2\(\) atf2 +00010040 ......03 R_ARM_REL32 atf2\(\) atf2 +00011074 ......15 R_ARM_GLOB_DAT atf2\(\) atf2 +00010044 ......02 R_ARM_ABS32 abf2\(\) abf2 +00010048 ......03 R_ARM_REL32 abf2\(\) abf2 +000110a0 ......15 R_ARM_GLOB_DAT abf2\(\) abf2 +0001004c ......02 R_ARM_ABS32 taf2\(\) taf2 +00010050 ......03 R_ARM_REL32 taf2\(\) taf2 +00011084 ......15 R_ARM_GLOB_DAT taf2\(\) taf2 +00010054 ......02 R_ARM_ABS32 ttf2\(\) ttf2 +00010058 ......03 R_ARM_REL32 ttf2\(\) ttf2 +0001107c ......15 R_ARM_GLOB_DAT ttf2\(\) ttf2 +0001005c ......02 R_ARM_ABS32 tbf2\(\) tbf2 +00010060 ......03 R_ARM_REL32 tbf2\(\) tbf2 +00011080 ......15 R_ARM_GLOB_DAT tbf2\(\) tbf2 +00010094 ......02 R_ARM_ABS32 aaf4\(\) aaf4 +00011078 ......15 R_ARM_GLOB_DAT aaf4\(\) aaf4 +0001009c ......02 R_ARM_ABS32 atf4\(\) atf4 +00011098 ......15 R_ARM_GLOB_DAT atf4\(\) atf4 +000100a4 ......02 R_ARM_ABS32 abf4\(\) abf4 +0001108c ......15 R_ARM_GLOB_DAT abf4\(\) abf4 +000100ac ......02 R_ARM_ABS32 taf4\(\) taf4 +0001109c ......15 R_ARM_GLOB_DAT taf4\(\) taf4 +000100b4 ......02 R_ARM_ABS32 ttf4\(\) ttf4 +00011094 ......15 R_ARM_GLOB_DAT ttf4\(\) ttf4 +000100bc ......02 R_ARM_ABS32 tbf4\(\) tbf4 +00011090 ......15 R_ARM_GLOB_DAT tbf4\(\) tbf4 Relocation section '\.rel\.plt' at offset 0x81f0 contains 6 entries: Offset Info Type Sym\.Value Sym\. Name |