[Top][All Lists]

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

[Bug gas/2991] New: incbin broken on Cygwin CR/LF

From: vincent dot riviere at freesbee dot fr
Subject: [Bug gas/2991] New: incbin broken on Cygwin CR/LF
Date: 1 Aug 2006 21:39:21 -0000

On Cygwin, gas opens binary files with "r" instead of "rb".
This causes corruption when Cygwin is installed with CR/LF mode.

For example, the .incbin directive is broken :

$ cat bug.s
        .incbin "fic.bin"

$ od -t x1 fic.bin
0000000 41 0d 0a 42

$ as bug.s -o bug.o
bug.s: Assembler messages:
bug.s:1: Warning: truncated file `fic.bin', 3 of 4 bytes read

$ objdump -s bug.o

bug.o:     file format pe-i386

Contents of section .text:
 0000 410a4242 90909090 90909090 90909090  A.BB............

It can easily be fixed in gas/as.h :

#ifndef FOPEN_WB
/* #if defined GO32 || defined __MINGW32__ */
#if defined GO32 || defined __MINGW32__ || defined __CYGWIN__
#include "fopen-bin.h"
#include "fopen-same.h"

Can someone check in the above code ?

Note : It may be better to use something stronger like USE_BINARY_FOPEN like in 
the file sysdep.h in bfd and ld.


           Summary: incbin broken on Cygwin CR/LF
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gas
        AssignedTo: unassigned at sources dot redhat dot com
        ReportedBy: vincent dot riviere at freesbee dot fr
                CC: bug-binutils at gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

reply via email to

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