[patch] Fix compilation on the recent glibc CVS snapshot

Jan Kratochvil jan.kratochvil@redhat.com
Wed Aug 8 19:19:00 GMT 2007


Hi,

recent glibc change:

2007-05-24  Ulrich Drepper  <drepper@redhat.com>

	* io/fcntl.h: When compiling with fortification, include bits/fcntl2.h.
	* io/bits/fcntl2.h: New file.

started to sanity check the parameters of the open(2) syscall by providing

	#define open(fname, flags, ...)

which errors out the BFD CVS snapshot compilation by:

	libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.././bfd -I. -I. -I.././bfd -I.././bfd/../include -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -O2 -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -c opncls.c -o opncls.o
	opncls.c: In function 'bfd_openr_iovec':
	opncls.c:548: error: invalid operands to binary &
	opncls.c:548: error: invalid operands to binary &
	opncls.c:548: error: invalid operands to binary &
	cc1: warnings being treated as errors
	opncls.c:548: warning: assignment makes integer from pointer without a cast
	opncls.c:548: warning: passing argument 1 of '__open_2' from incompatible pointer type
	opncls.c:548: warning: passing argument 2 of '__open_2' makes integer from pointer without a cast
	opncls.c:548: error: too many arguments to function 'open'
	opncls.c:548: warning: assignment makes integer from pointer without a cast
	opncls.c:548: warning: assignment makes pointer from integer without a cast
	make[4]: *** [opncls.lo] Error 1
	make[4]: Leaving directory `/root/redhat/sources/bfd'

GCC needs these options to make the problem reproducible:
	-O -pedantic -Wp,-D_FORTIFY_SOURCE=2 



Regards,
Jan
-------------- next part --------------
2007-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* bfd/opncls.c (bfd_openr_iovec): Fix OPEN parameter macro expansion.

--- bfd/opncls.c	24 Jul 2007 19:58:06 -0000	1.48
+++ bfd/opncls.c	8 Aug 2007 19:12:15 -0000
@@ -545,7 +545,8 @@ bfd_openr_iovec (const char *filename, c
   nbfd->filename = filename;
   nbfd->direction = read_direction;
 
-  stream = open (nbfd, open_closure);
+  /* `open (...)' would get expanded by an the open(2) syscall macro.  */
+  stream = (*open) (nbfd, open_closure);
   if (stream == NULL)
     {
       _bfd_delete_bfd (nbfd);


More information about the Binutils mailing list