GNU C extension introduced in common code
Robert Lipe
robertl@sco.com
Sun Jan 23 14:11:00 GMT 2000
Ian Lance Taylor wrote:
> Date: Sun, 23 Jan 2000 15:20:03 -0600
> From: Robert Lipe <robertl@sco.com>
>
> http://sourceware.cygnus.com/ml/binutils/2000-01/msg00079.html
>
> 2000-01-13 Timothy Wall (twall@tiac.net>
>
> * coffcode.h: Use bfd_coff_xxx instead of the macro XXX (where xxx
> = scnhsz, filhsz, relsz, aoutsz, etc)
>
> makes use of a GNU C extension and therefore breaks compilation on other
>
> This needs to be fixed to call bfd_malloc.
OK. Here you go.
2000-01-23 Robert Lipe (robertl@sco.com)
* coffcode.h (coff_write_object_contents): Get buff via bfd_malloc
instead of using GNU C extension.
ChangeLogs are supposed to call out the function that was changed,
right? Does binutils use a different convention for ChangeLogs than
GCC?
I'm leaving for the airport, so if this isn't what you want, please feel
free to let Timothy and Nick DTRT with it. :-)
Index: coffcode.h
===================================================================
RCS file: /cvs/gdb/gdb/bfd/coffcode.h,v
retrieving revision 1.1.1.14
diff -u -p -c -r1.1.1.14 coffcode.h
*** coffcode.h 2000/01/18 00:54:50 1.1.1.14
--- coffcode.h 2000/01/23 22:01:04
*************** coff_write_object_contents (abfd)
*** 3340,3358 ****
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
{
! char buff[bfd_coff_filhsz (abfd)];
coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
! if (bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd) != bfd_coff_filhsz (abfd))
return false;
}
if (abfd->flags & EXEC_P)
{
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */
! char buff[bfd_coff_aoutsz (abfd)];
coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
! if (bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd) != bfd_coff_aoutsz (abfd))
return false;
}
#ifdef RS6000COFF_C
else
--- 3340,3368 ----
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return false;
{
! char *buff = bfd_malloc(bfd_coff_filhsz (abfd));
! if (buff == NULL)
! return false;
coff_swap_filehdr_out (abfd, (PTR) & internal_f, (PTR) buff);
! if (bfd_write ((PTR) buff, 1, bfd_coff_filhsz (abfd), abfd) != bfd_coff_filhsz (abfd)) {
! free (buff)
return false;
+ }
+ free (buff)
}
if (abfd->flags & EXEC_P)
{
/* Note that peicode.h fills in a PEAOUTHDR, not an AOUTHDR.
include/coff/pe.h sets AOUTSZ == sizeof(PEAOUTHDR)) */
! char *buff = bfd_malloc(bfd_coff_aoutsz (abfd));
! if (buff == NULL)
! return false;
coff_swap_aouthdr_out (abfd, (PTR) & internal_a, (PTR) buff);
! if (bfd_write ((PTR) buff, 1, bfd_coff_aoutsz (abfd), abfd) != bfd_coff_aoutsz (abfd)) {
! free (buff);
return false;
+ }
+ free (buff);
}
#ifdef RS6000COFF_C
else
More information about the Binutils
mailing list