<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://sourceware.org/bugzilla/bugzilla.dtd">

<bugzilla version="4.0.10"
          urlbase="http://sourceware.org/bugzilla/"
          
          maintainer="overseers@sourceware.org"
>

    <bug>
          <bug_id>6449</bug_id>
          
          <creation_ts>2008-04-23 16:47:00 +0000</creation_ts>
          <short_desc>objdump -S and DOS-style line-endings</short_desc>
          <delta_ts>2012-02-15 12:13:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>binutils</product>
          <component>binutils</component>
          <version>2.19</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Thomas">mthomas</reporter>
          <assigned_to>unassigned</assigned_to>
          <cc>bug-binutils</cc>
    
    <cc>eric.weddington</cc>
    
    <cc>hjl.tools</cc>
    
    <cc>ktietz</cc>
          <cf_gcchost></cf_gcchost>
          <cf_gcctarget></cf_gcctarget>
          <cf_gccbuild></cf_gccbuild>
          

      

      

      

          <long_desc isprivate="0">
            <commentid>23283</commentid>
            <who name="Martin Thomas">mthomas</who>
            <bug_when>2008-04-23 16:47:10 +0000</bug_when>
            <thetext>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 &quot;internally&quot; 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 &lt;sys/stat.h&gt;
 
+#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 &quot;aout/aout64.h&quot;
@@ -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 &lt; 0)
     return NULL;</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>23295</commentid>
            <who name="H.J. Lu">hjl.tools</who>
            <bug_when>2008-04-24 12:57:56 +0000</bug_when>
            <thetext>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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53130</commentid>
            <who name="Kai Tietz">ktietz</who>
            <bug_when>2012-02-15 12:13:13 +0000</bug_when>
            <thetext>It was added to sysdep.h (via including include/binary-io.h) and objdump.c in binutils also specifies O_BINARY for open.  So bug is fixed.</thetext>
          </long_desc>
      
      

    </bug>

</bugzilla>