This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/2] Fix attributes for fortify functions


On Fri, Apr 27, 2012 at 11:00:19PM +0200, Marek Polacek wrote:
> On Tue, Apr 24, 2012 at 01:05:39PM -0700, Roland McGrath wrote:
> > The first patch without the second regresses the state of all the
> > _FORTIFY_SOURCE functions.  So just make it all one patch/commit instead.
> 
> Hopefully done this time around.  Regtested on x86_64, ok for trunk?

This commit glibc-2.15-685-g5ac3ea1 introduced a regression:

$ echo '#include <stdlib.h>' |gcc-4.1 -O2 -D_FORTIFY_SOURCE=2 -S -xc++ - -o /dev/null
/usr/include/bits/stdlib.h:36: error: expected constructor, destructor, or type conversion before 'char'
/usr/include/stdlib.h:972: error: expected `}' at end of input

$ echo '#include <stdlib.h>' |gcc-4.1 -O2 -D_FORTIFY_SOURCE=2 -E -xc++ - |grep -A1 __extern_always_inline
__extern_always_inline __attribute__ ((__warn_unused_result__)) char *
 realpath (const char *__restrict __name, char *__restrict __resolved) throw ()
--
__extern_always_inline int
 ptsname_r (int __fd, char *__buf, size_t __buflen) throw ()
--
__extern_always_inline __attribute__ ((__warn_unused_result__)) int
 wctomb (char *__s, wchar_t __wchar) throw ()
--
__extern_always_inline size_t
 mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len) throw ()
--
__extern_always_inline size_t
 wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len) throw ()

That is, g++-4.1 in fortify mode no longer compiles stdlib.h;
Due to __GNUC_PREREQ (4,3) the minimal supported g++ version seems to be 4.3.

> 2012-04-27  Marek Polacek  <polacek@redhat.com>
> 
> 	* misc/sys/cdefs.h (__attribute_artificial__): New macro.
> 	(__fortify_function): New macro.
> 	(__extern_always_inline): Don't use __attribute__ ((__artificial__)).
> 	* libio/bits/stdio-ldbl.h: Use __fortify_function in place of
> 	__extern_always_inline.
> 	* libio/bits/stdio2.h: Likewise.
> 	* libio/bits/stdio.h: Likewise.
> 	* string/string.h: Likewise.
> 	* string/bits/string3.h: Likewise.
> 	* include/stdio.h: Likewise.
> 	* stdlib/bits/stdlib.h: Likewise.
> 	* stdlib/stdlib.h: Likewise.
> 	* rt/bits/mqueue2.h: Likewise.
> 	* rt/mqueue.h: Likewise.
> 	* posix/bits/unistd.h: Likewise.
> 	* posix/unistd.h: Likewise.
> 	* io/bits/poll2.h: Likewise.
> 	* io/bits/fcntl2.h: Likewise.
> 	* io/fcntl.h: Likewise.
> 	* io/sys/poll.h: Likewise.
> 	* misc/bits/syslog.h: Likewise.
> 	* misc/bits/syslog-ldbl.h: Likewise.
> 	* misc/sys/syslog.h: Likewise.
> 	* socket/bits/socket2.h: Likewise.
> 	* socket/sys/socket.h: Likewise.
> 	* debug/tst-chk1.c: Likewise.
> 	* wcsmbs/bits/wchar2.h: Likewise.
> 	* wcsmbs/bits/wchar-ldbl.h: Likewise.
> 	* wcsmbs/wchar.h: Likewise.


-- 
ldv

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]