aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-01-31 06:28:48 +0000
committerAlan Modra <amodra@gmail.com>2013-01-31 06:28:48 +0000
commitbcaa2f8235869541dfefd7edf8494890e06f5871 (patch)
tree93ac31adbaf5ec959840d50d7329f089cbe304ee /bfd/elf64-ppc.c
parent9de83df8198ac23fbb1a43b41121815b8bb90df6 (diff)
downloadgdb-bcaa2f8235869541dfefd7edf8494890e06f5871.zip
gdb-bcaa2f8235869541dfefd7edf8494890e06f5871.tar.gz
gdb-bcaa2f8235869541dfefd7edf8494890e06f5871.tar.bz2
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 eca7bb3..6ac3bc6 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;
}