diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2017-07-21 15:58:14 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2017-07-21 15:58:14 +0000 |
commit | 5c2dee6fc9c52bf0cb0ddbd95333ab3d0745df3b (patch) | |
tree | d1134db703e4671f7f7e534eb7182e34c8888747 /lto-plugin | |
parent | d629ab44961886947b9ba07b8f26240868904457 (diff) | |
download | gcc-5c2dee6fc9c52bf0cb0ddbd95333ab3d0745df3b.zip gcc-5c2dee6fc9c52bf0cb0ddbd95333ab3d0745df3b.tar.gz gcc-5c2dee6fc9c52bf0cb0ddbd95333ab3d0745df3b.tar.bz2 |
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
Diffstat (limited to 'lto-plugin')
-rw-r--r-- | lto-plugin/ChangeLog | 7 | ||||
-rw-r--r-- | lto-plugin/lto-plugin.c | 13 |
2 files changed, 13 insertions, 7 deletions
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog index c1859e2..d3617a1 100644 --- a/lto-plugin/ChangeLog +++ b/lto-plugin/ChangeLog @@ -1,3 +1,10 @@ +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> PR other/79046 diff --git a/lto-plugin/lto-plugin.c b/lto-plugin/lto-plugin.c index f713c5d..27fcfbe 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 { |