Commit 5c2dee6f by Georg-Johann Lay Committed by Georg-Johann Lay

re PR lto/81487 ([mingw32] ld.exe: error: asprintf failed)

lto-plugin/
	PR lto/81487
	* lto-plugin.c (claim_file_handler): Use xasprintf instead of
	asprintf.
	[hi!=0]: Swap hi and lo arguments supplied to xasprintf.

From-SVN: r250428
parent d629ab44
2017-07-21 Georg-Johann Lay <avr@gjlay.de>
PR lto/81487
* lto-plugin.c (claim_file_handler): Use xasprintf instead of
asprintf.
[hi!=0]: Swap hi and lo arguments supplied to xasprintf.
2017-01-17 Jakub Jelinek <jakub@redhat.com> 2017-01-17 Jakub Jelinek <jakub@redhat.com>
PR other/79046 PR other/79046
......
...@@ -975,17 +975,16 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed) ...@@ -975,17 +975,16 @@ claim_file_handler (const struct ld_plugin_input_file *file, int *claimed)
if (file->offset != 0) if (file->offset != 0)
{ {
char *objname;
/* We pass the offset of the actual file, not the archive header. /* 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 Can't use PRIx64, because that's C99, so we have to print the
64-bit hex int as two 32-bit ones. */ 64-bit hex int as two 32-bit ones. Use xasprintf instead of
int lo, hi, t; asprintf because asprintf doesn't work as expected on some older
mingw32 hosts. */
int lo, hi;
lo = file->offset & 0xffffffff; lo = file->offset & 0xffffffff;
hi = ((int64_t)file->offset >> 32) & 0xffffffff; hi = ((int64_t)file->offset >> 32) & 0xffffffff;
t = hi ? asprintf (&objname, "%s@0x%x%08x", file->name, lo, hi) lto_file.name = hi ? xasprintf ("%s@0x%x%08x", file->name, hi, lo)
: asprintf (&objname, "%s@0x%x", file->name, lo); : xasprintf ("%s@0x%x", file->name, lo);
check (t >= 0, LDPL_FATAL, "asprintf failed");
lto_file.name = objname;
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment