aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-x86_64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-12-18 08:15:27 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-12-18 08:15:27 -0800
commitc9f203207d418f72217f4bc0997acd809a0479ce (patch)
tree88e71b62d93ed6ac3a594b2b4ef6e645c367287b /bfd/coff-x86_64.c
parentec70be9f6162aca5fb14876e232e68c64b1faa7f (diff)
downloadgdb-c9f203207d418f72217f4bc0997acd809a0479ce.zip
gdb-c9f203207d418f72217f4bc0997acd809a0479ce.tar.gz
gdb-c9f203207d418f72217f4bc0997acd809a0479ce.tar.bz2
Fix formatting in coff-x86_64.c
* coff-x86_64.c (coff_amd64_reloc): Fix formatting.
Diffstat (limited to 'bfd/coff-x86_64.c')
-rw-r--r--bfd/coff-x86_64.c98
1 files changed, 50 insertions, 48 deletions
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index 4e6420a..9d7c845 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -138,59 +138,61 @@ coff_amd64_reloc (bfd *abfd,
#define DOIT(x) \
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
- if (diff != 0)
- {
- reloc_howto_type *howto = reloc_entry->howto;
- unsigned char *addr = (unsigned char *) data + reloc_entry->address;
-
- /* FIXME: We do not have an end address for data, so we cannot
- accurately range check any addresses computed against it.
- cf: PR binutils/17512: file: 1085-1761-0.004.
- For now we do the best that we can. */
- if (addr < (unsigned char *) data || addr > ((unsigned char *) data) + input_section->size)
+ if (diff != 0)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+ /* FIXME: We do not have an end address for data, so we cannot
+ accurately range check any addresses computed against it.
+ cf: PR binutils/17512: file: 1085-1761-0.004.
+ For now we do the best that we can. */
+ if (addr < (unsigned char *) data
+ || addr > ((unsigned char *) data) + input_section->size)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, addr);
+ }
+ break;
+
+ case 1:
+ {
+ short x = bfd_get_16 (abfd, addr);
+ DOIT (x);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ case 2:
{
- bfd_set_error (bfd_error_bad_value);
- return bfd_reloc_notsupported;
+ long x = bfd_get_32 (abfd, addr);
+ DOIT (x);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
}
+ break;
- switch (howto->size)
+ case 4:
{
- case 0:
- {
- char x = bfd_get_8 (abfd, addr);
- DOIT (x);
- bfd_put_8 (abfd, x, addr);
- }
- break;
-
- case 1:
- {
- short x = bfd_get_16 (abfd, addr);
- DOIT (x);
- bfd_put_16 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- case 2:
- {
- long x = bfd_get_32 (abfd, addr);
- DOIT (x);
- bfd_put_32 (abfd, (bfd_vma) x, addr);
- }
- break;
- case 4:
- {
- long long x = bfd_get_64 (abfd, addr);
- DOIT (x);
- bfd_put_64 (abfd, (bfd_vma) x, addr);
- }
- break;
-
- default:
- bfd_set_error (bfd_error_bad_value);
- return bfd_reloc_notsupported;
+ long long x = bfd_get_64 (abfd, addr);
+ DOIT (x);
+ bfd_put_64 (abfd, (bfd_vma) x, addr);
}
- }
+ break;
+
+ default:
+ bfd_set_error (bfd_error_bad_value);
+ return bfd_reloc_notsupported;
+ }
+ }
/* Now let bfd_perform_relocation finish everything up. */
return bfd_reloc_continue;