PATCH: Include <errno.h> in stdio-common/psiginfo.c

H.J. Lu hjl.tools@gmail.com
Fri Apr 24 17:03:00 GMT 2009


On Fri, Apr 24, 2009 at 8:30 AM, Carlos O'Donell
<carlos@systemhalted.org> wrote:
> On Fri, Apr 24, 2009 at 1:00 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> ia64 build failed with
>>
>> /export/build/gnu/glibc/build-ia64-linux/libc_pic.os: In function
>> `psiginfo':
>> /net/gnu-6/export/gnu/src/glibc/glibc/stdio-common/psiginfo.c:182:
>> undefined reference to `__set_errno'
>> collect2: ld returned 1 exit status
>> make[3]: *** [/export/build/gnu/glibc/build-ia64-linux/libc.so] Error 1
>> make[3]: Leaving directory `/net/gnu-6/export/gnu/src/glibc/glibc'
>>
>> stdio-common/psiginfo.c has
>>
>> write_not_cancel (STDERR_FILENO, buf, strlen (buf));
>>
>> which may use __set_errno. But <errno.h> may not be included. This
>> patch fixes it.
>
> This is the wrong patch, write_not_cancel expands to INLINE_SYSCALL,
> which is defined in sysdep.h. If you get this build error it means
> your targets sysdep.h file forgot to include errno.h and used
> __set_errno in the INLINE_SYSCALL.
>
> The correct patch is to add #include <errno.h> to your target sysdep.h

Good idea. Here is the updated patch.

-- 
H.J.
---
2009-04-24  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Include <errno.h>.
-------------- next part --------------
2009-04-24  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/unix/sysv/linux/ia64/sysdep.h: Include <errno.h>.

Index: sysdeps/unix/sysv/linux/ia64/sysdep.h
===================================================================
--- sysdeps/unix/sysv/linux/ia64/sysdep.h	(revision 5746)
+++ sysdeps/unix/sysv/linux/ia64/sysdep.h	(working copy)
@@ -27,6 +27,11 @@
 #include <dl-sysdep.h>
 #include <tls.h>
 
+/* Define __set_errno() for INLINE_SYSCALL macro below.  */
+#ifndef __ASSEMBLER__
+#include <errno.h>
+#endif
+
 /* As of GAS v2.4.90.0.7, including a ".align" directive inside a
    function will cause bad unwind info to be emitted (GAS doesn't know
    how to account for the padding introduced by the .align directive).


More information about the Libc-alpha mailing list