components/binutils/patches/output.cc.patch
changeset 7310 88d40c6177a1
parent 7309 2655ef11c386
child 7312 6b323adaf9e7
--- a/components/binutils/patches/output.cc.patch	Wed Nov 02 08:17:06 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Solaris posix_fallocate(3C) will fail if len == 0. Try using
-# posix_fallocate(3C) first, and if it fails, fallback to
-# ftruncate(3C).
-# We aren't building the Gold Linker anyway. This is just for
-# those of us who are building and working on the Gold Linker.
-# This patch has been submitted to the community.
---- gold/output.cc	2014-10-14 00:32:04.000000000 -0700
-+++ gold/output.cc	2015-08-04 11:57:17.805271241 -0700
-@@ -22,6 +22,7 @@
- 
- #include "gold.h"
- 
-+#include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <cerrno>
-@@ -127,9 +128,15 @@
- static int
- gold_fallocate(int o, off_t offset, off_t len)
- {
--#ifdef HAVE_POSIX_FALLOCATE
--  if (parameters->options().posix_fallocate())
--    return ::posix_fallocate(o, offset, len);
-+#if defined(HAVE_POSIX_FALLOCATE)
-+  if (parameters->options().posix_fallocate()) {
-+    // posix_fallocate on Solaris will fail if len == 0
-+    int ret = ::posix_fallocate(o, offset, len);
-+    // try ::ftruncate(3C) is posix_fallocate(3C) failed.
-+    if (ret != 0)
-+      ret = ::ftruncate(o, offset + len);
-+    return ret;
-+  }
- #endif // defined(HAVE_POSIX_FALLOCATE)
- #ifdef HAVE_FALLOCATE
-   if (::fallocate(o, 0, offset, len) == 0)