summaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-17 23:36:07 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-01-17 23:36:07 +0000
commit8df7a2bd3cae14a7d2758a9b38c1fe0b581cc7d7 (patch)
tree433880eb840db963c463f664cdfe9c86924fb538 /bfd/elf64-x86-64.c
parent0ade561092a63d5481343e7cf758250f02f520de (diff)
downloadbinutils-redhat-8df7a2bd3cae14a7d2758a9b38c1fe0b581cc7d7.tar.gz
Count size relocation as PC-relative relocation
bfd/ * elf32-i386.c (elf_i386_check_relocs): Count size relocation as PC-relative relocation. * elf64-x86-64.c (elf_x86_64_check_relocs): Count size relocation as PC-relative relocation. ld/testsuite/ * ld-size/size32-3-i386.d: New file. * ld-size/size32-3-x32.d: Likewise. * ld-size/size32-3-x86-64.d: Likewise. * ld-size/size32-3.s: Likewise.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index c26060600b..79b6dc6060 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1424,6 +1424,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
struct elf_link_hash_entry *h;
Elf_Internal_Sym *isym;
const char *name;
+ bfd_boolean size_reloc;
r_symndx = htab->r_sym (rel->r_info);
r_type = ELF32_R_TYPE (rel->r_info);
@@ -1708,6 +1709,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_X86_64_SIZE32:
case R_X86_64_SIZE64:
+ size_reloc = TRUE;
goto do_size;
case R_X86_64_32:
@@ -1759,6 +1761,7 @@ pointer:
h->pointer_equality_needed = 1;
}
+ size_reloc = FALSE;
do_size:
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
@@ -1860,7 +1863,8 @@ do_size:
}
p->count += 1;
- if (IS_X86_64_PCREL_TYPE (r_type))
+ /* Count size relocation as PC-relative relocation. */
+ if (IS_X86_64_PCREL_TYPE (r_type) || size_reloc)
p->pc_count += 1;
}
break;