public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Richard Earnshaw <Richard.Earnshaw@foss.arm.com>,
	 Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>
Subject: [PATCH, ARM, v2] PR target/68059 libgcc should not use __write for printing fatal error
Date: Fri, 06 Nov 2015 13:33:00 -0000	[thread overview]
Message-ID: <563CAC08.7050109@arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

libgcc/config/arm/linux-atomic-64bit.c uses __write to print an error
message if the 64bit cmpxchg method is not available in the kernel.

__write is not part of the public libc abi, so use write instead.
(user code may define write in iso c conforming mode and then the
error message may not be visible before the crash.)

The return type in the declaration of write is fixed too.

OK for trunk and backporting?

libgcc/ChangeLog:

2015-11-06  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	PR target/68059
	* config/arm/linux-atomic-64bit.c (__write): Rename to...
	(write): ...this and fix the return type.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arm_write.diff --]
[-- Type: text/x-patch; name=arm_write.diff, Size: 997 bytes --]

diff --git a/libgcc/config/arm/linux-atomic-64bit.c b/libgcc/config/arm/linux-atomic-64bit.c
index cdf713c..894450e 100644
--- a/libgcc/config/arm/linux-atomic-64bit.c
+++ b/libgcc/config/arm/linux-atomic-64bit.c
@@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    kernels; we check for that in an init section and bail out rather
    unceremoneously.  */
 
-extern unsigned int __write (int fd, const void *buf, unsigned int count);
+extern int write (int fd, const void *buf, unsigned int count);
 extern void abort (void);
 
 /* Kernel helper for compare-and-exchange.  */
@@ -56,7 +56,7 @@ static void __check_for_sync8_kernelhelper (void)
 	 for the user - I'm not sure I can rely on much else being
 	 available at this point, so do the same as generic-morestack.c
 	 write () and abort ().  */
-      __write (2 /* stderr.  */, err, sizeof (err));
+      write (2 /* stderr.  */, err, sizeof (err));
       abort ();
     }
 };

             reply	other threads:[~2015-11-06 13:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 13:33 Szabolcs Nagy [this message]
2015-11-23 14:58 ` Szabolcs Nagy
2015-11-23 15:01 ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563CAC08.7050109@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Richard.Earnshaw@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).