This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
AW: Cygwin crashes using own linker scripts
- To: "'Mumit Khan'" <khan@xraylith.wisc.EDU>, "'binutils@sourceware.cygnus.com'" <binutils@sourceware.cygnus.com>
- Subject: AW: Cygwin crashes using own linker scripts
- From: Rotter Klaus <Klaus.Rotter@erl9.siemens.de>
- Date: Wed, 25 Aug 1999 10:08:26 +0200
- Cc: Rotter Klaus <Klaus.Rotter@erl9.siemens.de>
[ld configurated for pe-i386 (cygwin) breaks if producing binary output]
Mumit Khan wrote:
> If you send me the offending linker script (along with instructions on
> how to run and cause it to crash), I'll see if I can help.
It really does not depend on using a linker script. It seems that binary
output "-oformat binary" is broken when configuring ld with pe-i386 as target.
An example: Take the following program (but the problem is not
source code depended):
/*
** This is a small test for absolute linking
** Don't optimize the code
*/
#define LED *((char *) 0xFF056)
typedef struct {
const char header[16];
void *ptr;
} START_T;
extern void Testfunc(void);
const START_T mystart = {
"@(#)UserProgr00",
(void *) Testfunc
};
void Delay(void)
{
int i, k;
for (i=0; i<0xFFFFFFF; i++) {
for (k=0; k<0xFFFFFFF; i++);
}
}
void Testfunc(void)
{
int k,j;
for(;;) {
LED = 0;
Delay();
LED = 1;
Delay();
}
}
Then do the following:
> gcc -c abstest.c -o abstest.o
> ld -oformat binary -Ttext 0x30000 -Tdata 0x31000 -Tbss 0x32000 abstest.o -o abstest.abs
Output on my NT SP 3 Ws:
[main] D:\users\rku65670\cygnus\CYGWIN~1\H-I586~1\bin\ld.exe 1067 (0) handle_exceptions:
Exception: STATUS_ACCESS_VIOLATION
[main] ld 1067 (0) handle_exceptions: Dumping stack trace to ld.exe.core
10:05:18://h/c-src>
If I link with ld-new (target=i386-linux-coff)
> ld-new -oformat binary -Ttext 0x30000 -Tdata 0x31000 -Tbss 0x32000 abstest.o -o abstest.abs
It works.
The broken ld says:
ld: supported targets: pe-i386 pei-i386 srec symbolsrec tekhex binary ihex
ld: supported emulations: i386pe
The runnning ld says:
ld-new: supported targets: coff-i386 srec symbolsrec tekhex binary ihex
ld-new: supported emulations: i386coff
Thanks for any help.
--
Klaus Rotter, Siemens AG, ATD TD 6 EPG, Postfach 3249, 91020 Erlangen
Frauenauracherstraße 98, 91056 Erlangen
Tel.: +49 9131 18-84637, Fax: +49 9131 18-84648
mailto:Klaus.Rotter@erl9.siemens.de