This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: FW: Re: Why is my executabel in DOS file format?
- From: David Daney <ddaney at avtrex dot com>
- To: Meg Abyte <fitter20 at hotmail dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 03 Mar 2004 14:36:34 -0800
- Subject: Re: FW: Re: Why is my executabel in DOS file format?
- References: <BAY7-F80ulXx5TjamJr00010213@hotmail.com>
Meg Abyte wrote:
I have compile the GNU GCC tools for the Motorola MCORE
microprocessor on a RH
linux system. However, when I make the executabel (.s19) using the
GNU linker, it
produces it in a DOS file format. Meaning the file has carriage
return and line feed. I then have to go and strip this out to ONLY
contain just the line feed.
Is there an option or way to get the linker to not create this
file in a DOS format?
How about this patch?
I don't have CVS write access, but my copyright assignments are on file,
so feel free to commit it yourselves if you like.
David Daney.
2004-03-03 David Daney <ddaney@avtrex.com>
* bfd/srec.c (S3LFOnly) New global boolean.
(srec_write_record) Use it to control record terminators.
* binutils/objcopy.c (copy_main) Set S3LFOnly if --srec-lfonly.
(copy_usage) Document it.
(command_line_switch) Add OPTION_SREC_LFONLY.
(copy_options) Add --srec-lfonly.
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.27
diff -3 -c -r1.27 srec.c
*** bfd/srec.c 30 Nov 2003 18:40:41 -0000 1.27
--- bfd/srec.c 3 Mar 2004 22:25:50 -0000
***************
*** 182,187 ****
--- 182,193 ----
parameter. */
bfd_boolean S3Forced = FALSE;
+ /* Terminate records with '\n' only.
+ This variable can be modified by objcopy's --srec-lfonly
+ parameter. */
+ bfd_boolean S3LFOnly = FALSE;
+
+
/* When writing an S-record file, the S-records can not be output as
they are seen. This structure is used to hold them in memory. */
***************
*** 995,1001 ****
TOHEX (dst, check_sum, check_sum);
dst += 2;
! *dst++ = '\r';
*dst++ = '\n';
wrlen = dst - buffer;
if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
--- 1001,1008 ----
TOHEX (dst, check_sum, check_sum);
dst += 2;
! if(!S3LFOnly)
! *dst++ = '\r';
*dst++ = '\n';
wrlen = dst - buffer;
if (bfd_bwrite ((PTR) buffer, wrlen, abfd) != wrlen)
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.65
diff -3 -c -r1.65 objcopy.c
*** binutils/objcopy.c 13 Jan 2004 15:41:00 -0000 1.65
--- binutils/objcopy.c 3 Mar 2004 22:25:51 -0000
***************
*** 230,235 ****
--- 230,236 ----
OPTION_REDEFINE_SYMS,
OPTION_SREC_LEN,
OPTION_SREC_FORCES3,
+ OPTION_SREC_LFONLY,
OPTION_STRIP_SYMBOLS,
OPTION_KEEP_SYMBOLS,
OPTION_LOCALIZE_SYMBOLS,
***************
*** 337,342 ****
--- 338,344 ----
{"set-start", required_argument, 0, OPTION_SET_START},
{"srec-len", required_argument, 0, OPTION_SREC_LEN},
{"srec-forceS3", no_argument, 0, OPTION_SREC_FORCES3},
+ {"srec-lfonly", no_argument, 0, OPTION_SREC_LFONLY},
{"strip-all", no_argument, 0, 'S'},
{"strip-debug", no_argument, 0, 'g'},
{"strip-unneeded", no_argument, 0, OPTION_STRIP_UNNEEDED},
***************
*** 370,375 ****
--- 372,382 ----
on by the --srec-forceS3 command line switch. */
extern bfd_boolean S3Forced;
+ /* Terminate records with '\n' only.
+ This variable is declare in bfd/srec.c and can be toggled
+ on by the --srec-lfonly command line switch. */
+ extern bfd_boolean S3LFOnly;
+
/* Defined in bfd/binary.c. Used to set architecture and machine of input
binary files. */
extern enum bfd_architecture bfd_external_binary_architecture;
***************
*** 441,446 ****
--- 448,454 ----
listed in <file>\n\
--srec-len <number> Restrict the length of generated Srecords\n\
--srec-forceS3 Restrict the type of generated Srecords to S3\n\
+ --srec-lfonly Terminate Srecords with \"\\n\" instead of \"\\r\\n\"\n\
--strip-symbols <file> -N for all symbols listed in <file>\n\
--keep-symbols <file> -K for all symbols listed in <file>\n\
--localize-symbols <file> -L for all symbols listed in <file>\n\
***************
*** 2827,2832 ****
--- 2835,2844 ----
case OPTION_SREC_FORCES3:
S3Forced = TRUE;
break;
+
+ case OPTION_SREC_LFONLY:
+ S3LFOnly = TRUE;
+ break;
case OPTION_STRIP_SYMBOLS:
add_specific_symbols (optarg, &strip_specific_list);