summaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2013-01-31 06:28:45 +0000
committerAlan Modra <amodra@bigpond.net.au>2013-01-31 06:28:45 +0000
commit7b3b2f0134db39759ce35ca4945cc4a006fd9ef1 (patch)
tree3bf9fad769ad7bc4c8d05caad1fde75ac5c69808 /bfd/elf64-ppc.c
parentf17b70beb620c971c246682e8934703a4c7f8f35 (diff)
downloadbinutils-redhat-7b3b2f0134db39759ce35ca4945cc4a006fd9ef1.tar.gz
bfd/
* elf64-ppc.c (ppc_stub_name): Trim off trailing "+0". ld/testsuite/ * ld-powerpc/tlsexe.d: Update for changed stub names. * ld-powerpc/tlsexe.r: Likewise. * ld-powerpc/tlsexetoc.d: Likewise. * ld-powerpc/tlsexetoc.r: Likewise. * ld-powerpc/tlsso.d: Likewise. * ld-powerpc/tlsso.r: Likewise. * ld-powerpc/tlstocso.d: Likewise. * ld-powerpc/tlstocso.r: Likewise.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index eca7bb3a68..6ac3bc6f2f 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4074,7 +4074,7 @@ ppc_stub_name (const asection *input_section,
const Elf_Internal_Rela *rel)
{
char *stub_name;
- bfd_size_type len;
+ ssize_t len;
/* rel->r_addend is actually 64 bit, but who uses more than +/- 2^31
offsets from a sym as a branch target? In fact, we could
@@ -4088,10 +4088,10 @@ ppc_stub_name (const asection *input_section,
if (stub_name == NULL)
return stub_name;
- sprintf (stub_name, "%08x.%s+%x",
- input_section->id & 0xffffffff,
- h->elf.root.root.string,
- (int) rel->r_addend & 0xffffffff);
+ len = sprintf (stub_name, "%08x.%s+%x",
+ input_section->id & 0xffffffff,
+ h->elf.root.root.string,
+ (int) rel->r_addend & 0xffffffff);
}
else
{
@@ -4100,13 +4100,13 @@ ppc_stub_name (const asection *input_section,
if (stub_name == NULL)
return stub_name;
- sprintf (stub_name, "%08x.%x:%x+%x",
- input_section->id & 0xffffffff,
- sym_sec->id & 0xffffffff,
- (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
- (int) rel->r_addend & 0xffffffff);
+ len = sprintf (stub_name, "%08x.%x:%x+%x",
+ input_section->id & 0xffffffff,
+ sym_sec->id & 0xffffffff,
+ (int) ELF64_R_SYM (rel->r_info) & 0xffffffff,
+ (int) rel->r_addend & 0xffffffff);
}
- if (stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
+ if (len > 2 && stub_name[len - 2] == '+' && stub_name[len - 1] == '0')
stub_name[len - 2] = 0;
return stub_name;
}