aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-16 22:41:03 +0000
committerH.J. Lu <hjl.tools@gmail.com>2013-01-16 22:41:03 +0000
commit6a3e1baeae1ce25cc959d53a84925074a97deef9 (patch)
treef107d8ef043b24823adcd0b6c953195ee928b39b
parent2f81ff928644e457e4edbff1257e663845857f6b (diff)
downloadgdb-6a3e1baeae1ce25cc959d53a84925074a97deef9.zip
gdb-6a3e1baeae1ce25cc959d53a84925074a97deef9.tar.gz
gdb-6a3e1baeae1ce25cc959d53a84925074a97deef9.tar.bz2
Update x86 size relocation check
* elf32-i386.c (elf_i386_check_relocs): Update R_386_SIZE32 check. (elf_i386_relocate_section): Don't check TLS for R_386_SIZE32. * elf64-x86-64.c (elf_x86_64_check_relocs): Update R_X86_64_SIZE32 and R_X86_64_SIZE64 check. (elf_x86_64_relocate_section): Don't check TLS for R_X86_64_SIZE32 nor R_X86_64_SIZE64.
-rw-r--r--bfd/ChangeLog11
-rw-r--r--bfd/elf32-i386.c19
-rw-r--r--bfd/elf64-x86-64.c21
3 files changed, 20 insertions, 31 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2dec362..f75e046 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,16 @@
2013-01-16 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-i386.c (elf_i386_check_relocs): Update R_386_SIZE32
+ check.
+ (elf_i386_relocate_section): Don't check TLS for R_386_SIZE32.
+
+ * elf64-x86-64.c (elf_x86_64_check_relocs): Update R_X86_64_SIZE32
+ and R_X86_64_SIZE64 check.
+ (elf_x86_64_relocate_section): Don't check TLS for R_X86_64_SIZE32
+ nor R_X86_64_SIZE64.
+
+2013-01-16 H.J. Lu <hongjiu.lu@intel.com>
+
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 368c8d5..9c061ba 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1556,6 +1556,9 @@ elf_i386_check_relocs (bfd *abfd,
h->plt.refcount += 1;
break;
+ case R_386_SIZE32:
+ goto do_size;
+
case R_386_TLS_IE_32:
case R_386_TLS_IE:
case R_386_TLS_GOTIE:
@@ -1686,7 +1689,6 @@ elf_i386_check_relocs (bfd *abfd,
case R_386_32:
case R_386_PC32:
- case R_386_SIZE32:
if (h != NULL && info->executable)
{
/* If this reloc is in a read-only section, we might
@@ -1704,6 +1706,7 @@ elf_i386_check_relocs (bfd *abfd,
h->pointer_equality_needed = 1;
}
+do_size:
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
@@ -3682,20 +3685,6 @@ elf_i386_relocate_section (bfd *output_bfd,
break;
case R_386_SIZE32:
- if (h
- && h->type == STT_TLS
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section != NULL
- && htab->elf.tls_sec == NULL)
- {
- (*_bfd_error_handler)
- (_("%B: `%s' accessed both as normal and thread local symbol"),
- input_bfd, h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
/* Set to symbol size. */
relocation = st_size;
/* Fall through. */
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 8fae5fc..c260606 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1706,6 +1706,10 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
}
goto create_got;
+ case R_X86_64_SIZE32:
+ case R_X86_64_SIZE64:
+ goto do_size;
+
case R_X86_64_32:
if (!ABI_64_P (abfd))
goto pointer;
@@ -1737,8 +1741,6 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_X86_64_PC32:
case R_X86_64_PC64:
case R_X86_64_64:
- case R_X86_64_SIZE32:
- case R_X86_64_SIZE64:
pointer:
if (h != NULL && info->executable)
{
@@ -1757,6 +1759,7 @@ pointer:
h->pointer_equality_needed = 1;
}
+do_size:
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
@@ -3678,20 +3681,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
case R_X86_64_SIZE32:
case R_X86_64_SIZE64:
- if (h
- && h->type == STT_TLS
- && (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section->output_section != NULL
- && htab->elf.tls_sec == NULL)
- {
- (*_bfd_error_handler)
- (_("%B: `%s' accessed both as normal and thread local symbol"),
- input_bfd, h->root.root.string);
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
-
/* Set to symbol size. */
relocation = st_size;
goto direct;