Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Fix compilation on the recent glibc CVS snapshot
@ 2007-08-08 20:55 Jan Kratochvil
  2007-08-08 22:04 ` Jim Blandy
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2007-08-08 20:55 UTC (permalink / raw)
  To: gdb-patches

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

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 GDB CVS snapshot compilation by:

	gcc -c -O2 -m64 -ggdb2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4    -I. -I.././gdb -I.././gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I.././gdb/../include/opcode -I.././gdb/../readline/.. -I../bfd -I.././gdb/../bfd -I.././gdb/../include   -DMI_OUT=1 -DTUI=1  -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts -Werror serial.c
	serial.c: In function ‘serial_open’:
	serial.c:216: error: expected identifier before ‘(’ token
	make[2]: *** [serial.o] Error 1
	make[2]: Leaving directory `/root/redhat/sources/gdb'

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

Successful compilation requirs also the BFD patch posted as:
	http://sourceware.org/ml/binutils/2007-08/msg00114.html



Regards,
Jan

[-- Attachment #2: gdb-cvs-glibc-open-fcntl2-compat.patch --]
[-- Type: text/plain, Size: 523 bytes --]

2007-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* serial.c (serial_open): Fix OPEN parameter macro expansion.

--- gdb/serial.c	8 Apr 2007 15:20:07 -0000	1.29
+++ gdb/serial.c	8 Aug 2007 20:32:10 -0000
@@ -213,7 +213,8 @@ serial_open (const char *name)
   scb->bufp = scb->buf;
   scb->error_fd = -1;
 
-  if (scb->ops->open (scb, open_name))
+  /* `...->open (...)' would get expanded by an the open(2) syscall macro.  */
+  if ((*scb->ops->open) (scb, open_name))
     {
       xfree (scb);
       return NULL;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Fix compilation on the recent glibc CVS snapshot
  2007-08-08 20:55 [patch] Fix compilation on the recent glibc CVS snapshot Jan Kratochvil
@ 2007-08-08 22:04 ` Jim Blandy
  2007-08-08 22:15   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Blandy @ 2007-08-08 22:04 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb-patches

Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> 2007-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
> 	* serial.c (serial_open): Fix OPEN parameter macro expansion.
>

POSIX System Interfaces section 2.1 says, "Any function declared in a
header may also be implemented as a macro defined in the header."  I
gather this means that GLIBC is within its rights to make that change
to 'open'.  I've learned something new today.

So, this change is approved.

> --- gdb/serial.c	8 Apr 2007 15:20:07 -0000	1.29
> +++ gdb/serial.c	8 Aug 2007 20:32:10 -0000
> @@ -213,7 +213,8 @@ serial_open (const char *name)
>    scb->bufp = scb->buf;
>    scb->error_fd = -1;
>  
> -  if (scb->ops->open (scb, open_name))
> +  /* `...->open (...)' would get expanded by an the open(2) syscall macro.  */
> +  if ((*scb->ops->open) (scb, open_name))
>      {
>        xfree (scb);
>        return NULL;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Fix compilation on the recent glibc CVS snapshot
  2007-08-08 22:04 ` Jim Blandy
@ 2007-08-08 22:15   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2007-08-08 22:15 UTC (permalink / raw)
  To: Jim Blandy; +Cc: gdb-patches

On Thu, 09 Aug 2007 00:04:24 +0200, Jim Blandy wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> > 2007-08-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
> >
> > 	* serial.c (serial_open): Fix OPEN parameter macro expansion.
> 
> POSIX System Interfaces section 2.1 says, "Any function declared in a
> header may also be implemented as a macro defined in the header."  I
> gather this means that GLIBC is within its rights to make that change
> to 'open'.  I've learned something new today.

Thanks, me too.


> So, this change is approved.

Committed.


Regards,
Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-08 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-08 20:55 [patch] Fix compilation on the recent glibc CVS snapshot Jan Kratochvil
2007-08-08 22:04 ` Jim Blandy
2007-08-08 22:15   ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox