summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/sgs/libld/common/outfile.c37
-rw-r--r--usr/src/cmd/sgs/packages/common/SUNWonld-README22
2 files changed, 46 insertions, 13 deletions
diff --git a/usr/src/cmd/sgs/libld/common/outfile.c b/usr/src/cmd/sgs/libld/common/outfile.c
index 2c78ffbbb1..901dae481b 100644
--- a/usr/src/cmd/sgs/libld/common/outfile.c
+++ b/usr/src/cmd/sgs/libld/common/outfile.c
@@ -80,6 +80,13 @@ ld_open_outfile(Ofl_desc * ofl)
mode_t mode;
struct stat status;
+ /*
+ * Determine the required file mode from the type of output file we
+ * are creating.
+ */
+ mode = (ofl->ofl_flags & (FLG_OF_EXEC | FLG_OF_SHAROBJ))
+ ? 0777 : 0666;
+
/* Determine if the output file already exists */
if (stat(ofl->ofl_name, &status) == 0) {
if ((status.st_mode & S_IFMT) != S_IFREG) {
@@ -106,7 +113,30 @@ ld_open_outfile(Ofl_desc * ofl)
* file has a (link_count > 1), the other names will
* continue to reference the old inode, thus
* breaking the link.
+ *
+ * A subtlety here is that POSIX says we are not
+ * supposed to replace a non-writable file, which
+ * is something that unlink() is happy to do. The
+ * only 100% reliable test against this is to open
+ * the file for non-destructive write access. If the
+ * open succeeds, we are clear to unlink it, and if
+ * not, then the error generated is the error we
+ * need to report.
*/
+ if ((ofl->ofl_fd = open(ofl->ofl_name, O_RDWR,
+ mode)) < 0) {
+ int err = errno;
+
+ if (err != ENOENT) {
+ eprintf(ofl->ofl_lml, ERR_FATAL,
+ MSG_INTL(MSG_SYS_OPEN),
+ ofl->ofl_name, strerror(err));
+ return (S_ERROR);
+ }
+ } else {
+ (void) close(ofl->ofl_fd);
+ }
+
if ((unlink(ofl->ofl_name) == -1) &&
(errno != ENOENT)) {
int err = errno;
@@ -120,13 +150,6 @@ ld_open_outfile(Ofl_desc * ofl)
}
/*
- * Determine the required file mode from the type of output file we
- * are creating.
- */
- mode = (ofl->ofl_flags & (FLG_OF_EXEC | FLG_OF_SHAROBJ))
- ? 0777 : 0666;
-
- /*
* Open (or create) the output file name (ofl_fd acts as a global
* flag to ldexit() signifying whether the output file should be
* removed or not on error).
diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README
index 335408ea5a..95891f1c82 100644
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README
+++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README
@@ -77,9 +77,13 @@ SUNWonld - link-editors development package.
History:
- Note, starting after Solaris 10, a (D) following the bug synopsis indicates
- that a documentation change accompanies the implementation change. See the
- implementation bug report for details.
+ Note, starting after Solaris 10, letter codes in parenthesis may
+ be found following the bug synopsis. Their meanings are as follows:
+
+ (D) A documentation change accompanies the implementation change.
+ (P) A packaging change accompanies the implementation change.
+
+ In all cases, see the implementation bug report for details.
The following bug fixes exist in the OSNET consolidation workspace
from which this package is created:
@@ -1090,7 +1094,7 @@ Bugid Risk Synopsis
6391407 Insufficient alignment of 32-bit object in archive makes ld segfault
(libelf component only) (D)
6316708 LD_DEBUG should provide a means of identifying/isolating individual
- link-map lists
+ link-map lists (P)
6280209 elfdump cores on memory model 0x3
6197234 elfdump and dump don't handle 64-bit symbols correctly
6398893 Extended section processing needs some work
@@ -1100,7 +1104,7 @@ Bugid Risk Synopsis
6382945 AMD64-GCC: dbx: internal error: dwarf reference attribute out of bounds
6262333 init section of .so dlopened from audit interface not being called
6409613 elf_outsync() should fsync()
-6174390 crle configuration files are inconsistent across platforms (D)
+6174390 crle configuration files are inconsistent across platforms (D, P)
6426048 C++ exceptions broken in Nevada for amd64
6429418 ld.so.1: need work-around for Nvidia drivers use of static TLS
6429504 crle(1) shows wrong defaults for non-existent 64-bit config file
@@ -1113,10 +1117,16 @@ Bugid Risk Synopsis
instead
6229145 ld: initarray/finiarray processing occurs after got size is determined
6324924 the linker should warn if there's a .init section but not _init
-6421380 elfdump inserts extra whitespace in bitmap value display
+6424132 elfdump inserts extra whitespace in bitmap value display
6449485 ld(1) creates misaligned TLS in binary compiled with -xpg
6424550 Write to unallocated (wua) errors when libraries are built with
-z lazyload
6464235 executing the 64-bit ld(1) should be easy (D)
6465623 need a way of building unix without an interpreter
6467925 ld: section deletion (-z ignore) requires improvement
+6357230 specfiles should be nuked (link-editor components only)
+6409350 BrandZ project integration into Solaris (link-editor components only)
+6459189 UNIX03: *VSC* c99 compiler overwrites non-writable file
+6423746 add an option to relax the resolution of COMDAT relocs (D)
+4934427 runtime linker should load up static symbol names visible to
+ dladdr() (D)