This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 6449
  objdump -S and DOS-style line-endings Last modified: 2008-04-24 15:47:28
     Query page      Enter new bug
Bug#: 6449   Hardware:   Reporter: Martin Thomas <mthomas@rhrk.uni-kl.de>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: NEW   Priority:  
Resolution:   Severity:  
Assigned To: unassigned@sources.redhat.com   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 6449 depends on: Show dependency tree
Show dependency graph
Bug 6449 blocks:

Additional Comments:


Leave as NEW 
Mark bug as waiting for feedback
Mark bug as suspended
Accept bug (change status to ASSIGNED)
Resolve bug, changing resolution to
Resolve bug, mark it as duplicate of bug #
Reassign bug to
Reassign bug to owner of selected component

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2008-04-23 16:47
When using objdump to create intermixed source/disassembly (-S) with build/host
mingw/minsys a size-check fails for source-files with DOS-line endings (\r\n)
since this gets translated "internally" to a single char. When opening the file
in binary mode the sizes match. Proposed fix/patch:

--- binutils-2.18.50_org/binutils/objdump.c	Sat Mar  1 07:19:06 2008
+++ binutils-2.18.50/binutils/objdump.c	Thu Mar 13 12:29:47 2008
@@ -70,6 +70,14 @@
 
 #include <sys/stat.h>
 
+#ifndef O_BINARY
+#ifdef _O_BINARY
+#define O_BINARY _O_BINARY
+#else
+#define O_BINARY 0
+#endif
+#endif
+
 /* Internal headers for the ELF .stab-dump code - sorry.  */
 #define	BYTES_IN_WORD	32
 #include "aout/aout64.h"
@@ -975,7 +983,7 @@
 #endif
   const char *map;
   struct stat st;
-  int fd = open (fn, O_RDONLY);
+  int fd = open (fn, O_RDONLY | O_BINARY);
 
   if (fd < 0)
     return NULL;

------- Additional Comment #1 From H.J. Lu 2008-04-24 12:57 -------
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.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In