bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug binutils/6449] objdump -S and DOS-style line-endings


From: Nick Clifton
Subject: Re: [Bug binutils/6449] objdump -S and DOS-style line-endings
Date: Mon, 28 Apr 2008 09:29:51 +0100
User-agent: Thunderbird 1.5.0.12 (X11/20080213)

Hi Guys,

There are so many

#ifndef O_BINARY
#ifdef _O_BINARY
#define O_BINARY _O_BINARY
#define setmode _setmode
#else
#define O_BINARY 0
#endif
#endif

in binutils sources. It should go into sysdep.h.

H.J. is right, so I have applied the attached patch to fix the PR and move the definition of O_BINARY into sysdep.h.

Cheers
  Nick

binutils/ChangeLog
2008-04-28  M Thomas  <address@hidden>
            Nick Clifton  <address@hidden>

        PR binutils/6449
        * objdump.c (slurp_file): Open the file in binary mode.
        * ar.c: Remove conditional definition of O_BINARY.
        * bin2.c: Likewise.
        * rename.c: Likewise.
        * strings.c: Likewise.
        * sysdep.h: Add conditional definition of O_BINARY.


Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 ar.c
*** binutils/ar.c       28 Mar 2008 06:49:44 -0000      1.55
--- binutils/ar.c       28 Apr 2008 08:04:47 -0000
***************
*** 45,56 ****
  #define EXT_NAME_LEN 6                /* Ditto for *NIX.  */
  #endif
  
- /* We need to open files in binary modes on system where that makes a
-    difference.  */
- #ifndef O_BINARY
- #define O_BINARY 0
- #endif
- 
  /* Kludge declaration from BFD!  This is ugly!  FIXME!  XXX  */
  
  struct ar_hdr *
--- 45,50 ----
Index: binutils/bin2c.c
===================================================================
RCS file: /cvs/src/src/binutils/bin2c.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 bin2c.c
***************
*** 22,30 ****
  #include "bfd.h"
  #include "bucomm.h"
  
! #if !defined O_BINARY && defined _O_BINARY
    /* For MSC-compatible compilers.  */
- # define O_BINARY _O_BINARY
  # define O_TEXT _O_TEXT
  #endif
  
--- 22,29 ----
  #include "bfd.h"
  #include "bucomm.h"
  
! #if !defined O_TEXT && defined _O_TEXT
    /* For MSC-compatible compilers.  */
  # define O_TEXT _O_TEXT
  #endif
  
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.139
diff -c -3 -p -r1.139 objdump.c
*** binutils/objdump.c  1 Mar 2008 07:19:06 -0000       1.139
--- binutils/objdump.c  28 Apr 2008 08:04:47 -0000
*************** slurp_file (const char *fn, size_t *size
*** 975,981 ****
  #endif
    const char *map;
    struct stat st;
!   int fd = open (fn, O_RDONLY);
  
    if (fd < 0)
      return NULL;
--- 975,981 ----
  #endif
    const char *map;
    struct stat st;
!   int fd = open (fn, O_RDONLY | O_BINARY);
  
    if (fd < 0)
      return NULL;
Index: binutils/rename.c
===================================================================
RCS file: /cvs/src/src/binutils/rename.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 rename.c
*** binutils/rename.c   5 Jul 2007 16:54:45 -0000       1.12
--- binutils/rename.c   28 Apr 2008 08:04:47 -0000
***************
*** 32,43 ****
  #endif /* HAVE_UTIMES */
  #endif /* ! HAVE_GOOD_UTIME_H */
  
- /* We need to open the file in binary modes on system where that makes
-    a difference.  */
- #ifndef O_BINARY
- #define O_BINARY 0
- #endif
- 
  #if ! defined (_WIN32) || defined (__CYGWIN32__)
  static int simple_copy (const char *, const char *);
  
--- 32,37 ----
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 strings.c
*** binutils/strings.c  15 Feb 2008 10:20:09 -0000      1.40
--- binutils/strings.c  28 Apr 2008 08:04:48 -0000
***************
*** 69,85 ****
  /* Some platforms need to put stdin into binary mode, to read
      binary files.  */
  #ifdef HAVE_SETMODE
- #ifndef O_BINARY
  #ifdef _O_BINARY
- #define O_BINARY _O_BINARY
  #define setmode _setmode
- #else
- #define O_BINARY 0
- #endif
  #endif
  #if O_BINARY
  #include <io.h>
! #define SET_BINARY(f) do { if (!isatty (f)) setmode (f,O_BINARY); } while (0)
  #endif
  #endif
  
--- 69,80 ----
  /* Some platforms need to put stdin into binary mode, to read
      binary files.  */
  #ifdef HAVE_SETMODE
  #ifdef _O_BINARY
  #define setmode _setmode
  #endif
  #if O_BINARY
  #include <io.h>
! #define SET_BINARY(f) do { if (!isatty (f)) setmode (f, O_BINARY); } while (0)
  #endif
  #endif
  
Index: binutils/sysdep.h
===================================================================
RCS file: /cvs/src/src/binutils/sysdep.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 sysdep.h
*** binutils/sysdep.h   31 Aug 2007 15:06:11 -0000      1.3
--- binutils/sysdep.h   28 Apr 2008 08:04:48 -0000
***************
*** 36,41 ****
--- 36,49 ----
  #include "fopen-same.h"
  #endif
  
+ #ifndef O_BINARY
+ #ifdef  _O_BINARY
+ #define O_BINARY _O_BINARY
+ #else
+ #define O_BINARY 0
+ #endif
+ #endif
+ 
  #include <errno.h>
  #ifndef errno
  extern int errno;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]