author | Norm Jacobs <Norm.Jacobs@Oracle.COM> |
Fri, 08 Mar 2013 12:36:34 -0800 | |
changeset 1201 | de71257be89e |
parent 1123 | cb43164c5dd1 |
child 5057 | ab1b43bf588f |
permissions | -rw-r--r-- |
1123
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
1 |
--- binutils-2.23.1/gold/output.cc 2012-11-09 01:21:28.000000000 -0700 |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
2 |
+++ binutils-2.23.1/gold/output.cc 2013-01-01 01:45:50.721203685 -0700 |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
3 |
@@ -22,6 +22,7 @@ |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
4 |
|
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
5 |
#include "gold.h" |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
6 |
|
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
7 |
+#include <cstdio> |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
8 |
#include <cstdlib> |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
9 |
#include <cstring> |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
10 |
#include <cerrno> |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
11 |
@@ -127,9 +128,15 @@ |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
12 |
static int |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
13 |
gold_fallocate(int o, off_t offset, off_t len) |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
14 |
{ |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
15 |
-#ifdef HAVE_POSIX_FALLOCATE |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
16 |
- if (parameters->options().posix_fallocate()) |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
17 |
- return ::posix_fallocate(o, offset, len); |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
18 |
+#if defined(HAVE_POSIX_FALLOCATE) |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
19 |
+ if (parameters->options().posix_fallocate()) { |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
20 |
+ // posix_fallocate on Solaris will fail if len == 0 |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
21 |
+ int ret = ::posix_fallocate(o, offset, len); |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
22 |
+ // try ::ftruncate(3C) is posix_fallocate(3C) failed. |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
23 |
+ if (ret != 0) |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
24 |
+ ret = ::ftruncate(o, offset + len); |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
25 |
+ return ret; |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
26 |
+ } |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
27 |
#endif // defined(HAVE_POSIX_FALLOCATE) |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
28 |
#ifdef HAVE_FALLOCATE |
cb43164c5dd1
15824357 SUNBT7205968 Upgrade binutils to 2.22
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff
changeset
|
29 |
if (::fallocate(o, 0, offset, len) == 0) |