summaryrefslogtreecommitdiff
path: root/lto-plugin/lto-plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'lto-plugin/lto-plugin.c')
-rw-r--r--lto-plugin/lto-plugin.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c
index f713c5dab0d..27fcfbeca09 100644
--- a/lto-plugin/lto-plugin.c
+++ b/lto-plugin/lto-plugin.c
@@ -975,17 +975,16 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
if (file->offset != 0)
{
- char *objname;
/* We pass the offset of the actual file, not the archive header.
Can't use PRIx64, because that's C99, so we have to print the
- 64-bit hex int as two 32-bit ones. */
- int lo, hi, t;
+ 64-bit hex int as two 32-bit ones. Use xasprintf instead of
+ asprintf because asprintf doesn't work as expected on some older
+ mingw32 hosts. */
+ int lo, hi;
lo = file->offset & 0xffffffff;
hi = ((int64_t)file->offset >> 32) & 0xffffffff;
- t = hi ? asprintf (&objname, "%s@0x%x%08x", file->name, lo, hi)
- : asprintf (&objname, "%s@0x%x", file->name, lo);
- check (t >= 0, LDPL_FATAL, "asprintf failed");
- lto_file.name = objname;
+ lto_file.name = hi ? xasprintf ("%s@0x%x%08x", file->name, hi, lo)
+ : xasprintf ("%s@0x%x", file->name, lo);
}
else
{