This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: [patch] to gas: portability fix


Nick Clifton <nickc@redhat.com> wrote:

> Approved and applied.

Thanks.

> There seems to be one problem though - if limits.h is not included
> then INT_MAX will not be defined, which will prevent dwarf2dbg.c from
> being compiled.

Yup, that didn't hit me originally because I caught the limits.h breakage in
gas while building binutils for m68k-coff, which is !BFD_ASSEMBLER and hence
ifdefs out most of dwarf2dbg.c, including the bit that uses INT_MAX.

> I added the following lines to your patch as a
> workaround for this potential problem, although I am not sure if this
> is the best way to solve the problem:
>
> [concotting INT_MAX manually]

Yes, this extra ifdef you added would help systems that don't have INT_MAX at
all. However, some systems, such as 4.3BSD, do have INT_MAX, but being opposed
to ANSI, define it in the traditional UNIX header <sys/param.h>, rather than
the ANSI <limits.h>. Therefore, I think the patch below would be in order.
binutils built with this patch on 4.3BSD for m68k-coff and m68k-elf.

--
Michael Sokolov
Public Service Agent
International Engineering and Science Task Force

1351 VINE AVE APT 27		Phone: +1-714-738-5409
FULLERTON CA 92833-4291 USA	(home office)

E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP)

Wed Dec 13 18:06:18 PST 2000  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	* dwarf2dbg.c: If we don't have <limits.h>, try including <sys/param.h>
	if we have it.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.28
diff -p -r1.28 dwarf2dbg.c
*** dwarf2dbg.c	2000/12/14 01:12:43	1.28
--- dwarf2dbg.c	2000/12/14 02:07:29
***************
*** 33,38 ****
--- 33,41 ----
  #ifdef HAVE_LIMITS_H
  #include <limits.h>
  #else
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
  #ifndef INT_MAX
  #define INT_MAX (int) (((unsigned) (-1)) >> 1)
  #endif

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